Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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?

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Principles Programming And Performance

Authors: Patrick O'Neil, Elizabeth O'Neil

2nd Edition

1558605800, 978-1558605800

More Books

Students also viewed these Databases questions