10-29-2011, 05:04 AM
A= (B+C)*(D+E)
3 address instructions involve three operands i.e. two source and one destination. Op-code specifies the operation to be carried out.add x, b, c
add y, d, e
mul a, x, y
In case of 2 address instructions, there are two operands. One of them is used as source whereas the other one is used both as source and destination.
load y, b
add y, c
load r, d
add r, e
mul y, r
store a, y
In case of 0 address instruction only op code field has to be specified. Stack is used to hold both the operands and result.
push d
push e
add
push b
push c
add
mul
pop a
Download the attachment for the solution
