Question: 0-address machine uses a stack, where all operations are done using values stored on the stack. For example, PUSH addr - pushes the value stored

0-address machine uses a stack, where all operations are done using values stored on the stack. For example,

PUSH addr - pushes the value stored at memory location addr onto the stack.

POP addr - pops the stack and stores the value into memory location addr

BOP addr - pops two values off the stack, performs the binary operation BOP on the two values, and pushes the result back onto the stack

For example, to compute A + B with 0-address machine, the following sequence of operations are necessary: PUSH A, PUSH B, ADD. After execution of ADD, A and B would no longer be on the stack, but the value A+B would be at the top of the stack.

Make the following assumptions for the next questions and the following code snippet.

The opcode size is 1 byte (8 bits).

All register operands are 1 byte (8 bits).

All memory addresses are 2 bytes (16 bits).

All data values are 4 bytes (32 bits).

All instructions are an integral number of bytes in length.

X = Y + Z;

Y = X + Z;

T = X - Y;

For (a), (b), (c), use the provided table. I-bytes refers to instruction bytes, D-bytes refers to data bytes.

(a) What is the assembly code for the above code for 0-address machine? Assume initially the variables X, Y, Z and T are in memory. Be sure to store the contents of variables back into memory. Do not modify any other values in memory.

(b) What is the assembly code for the above code for MIPS?

(c) Calculate the instruction bytes fetched and the memory-data bytes transferred (read or written) for 0-address machine and for MIPS.

(d) Which ISA is most efficient as measured by code size? Why?

(e) Which ISA is most efficient as measured by total memory traffic (code + data)? Why?

0-address machine uses a stack, where all operations are done using values

Instruction Set Opcode (e.g.Operands (e.g. Architecture Load, Store)X, Y, Z, T) Total O-addres:s Machine Total MIPS Total

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!