0) Compare zero-, one-, two-, and three-address machines by writing programs to compute

X = (A + B * C) / (D - E * F)

for each of the four machines. The instructions available for use are as follows:

0 Address

(Stack machine)

1 Address

(Accumulator machine)

2 Address 3 Address
PUSH M LOAD M MOVE (X Y) MOVE (X Y)
POP M STORE M    
ADD ADD M ADD (X X + Y) ADD (X Y + Z)
SUB SUB M ADD (X X - Y) SUB (X Y - Z)
MUL MUL M MUL (X X * Y) MUL (X Y * Z)
DIV DIV M DIV (X X / Y) DIV (X Y / Z)

1) How relocatable is the code in memory if direct addressing is used?

2) How many bits are needed to represent a direct address on a 32-bit machine?

3) From your programming experience, what range of Integer values would cover 90% of the constant Integer values used in your programs?

4) How many binary bits would you need to represent this range of values?

5) What determines how many bits are needed to represent a register in a machine language instruction?

6) Which of the following programming language constructs would be good candidates for using PC-relative addressing?

a) conditional branch used when implementing loops

b) calling a subprogram

c) accessing a global variable

d) accessing a local variable

7) Assume that an automobile assembly process takes 4 hours.

If the stages take the following amounts of time, then what is the time between completions of automobiles?

Chassis 45 minutes, Motor 1 hour, Interior 1 hour and 15 minutes, Exterior 1 hour