Академический Документы
Профессиональный Документы
Культура Документы
Lecture 12
+A * B C A+B*C ABC*+
• Initially the Stack is empty and our Postfix string has no characters.
Now, the first character scanned is 'a'. 'a' is added to the Postfix
string. The next character scanned is '+'. It being an operator, it is
pushed to the stack.
Post-fix String
Stack
End result :
Infix String : a+b*c-d
Post-fix String
Postfix String : abc*+d-
COA by Athar Mohsin
Stack
Instruction Formats
• The principal advantage of postfix • In a stack ISA, the postfix
notation is that parentheses are expression,
not used.
Z = X Y × W U × +
• For example, the infix expression, might look like this:
Z = (X × Y) + (W × U),
PUSH X
becomes: PUSH Y
MULT
Z = X Y × W U × + PUSH W
in postfix notation. PUSH U
MULT
ADD
PUSH Z
– see that the opcode is 1 and the address from which to load the
data is 3.
• This is a bit pattern for a SKIPCOND instruction as it would
appear in the IR:
– See that the opcode is 8 and bits ’11’ and ’10’ are 10b, meaning that
the next instruction will be skipped if the value in the AC is greater
than zero.
COA by Athar Mohsin
Microoperations
• Each instruction actually consists of a sequence
of smaller instructions called
– microoperations.
• The exact sequence of microoperations that are
carried out by an instruction can be specified
using register transfer language (RTL)
– the notation M[X] to indicate the actual data value
stored in memory location X, and ← to indicate the
transfer of bytes to a register or memory location