Assignment 30 (Assigned November 17)


  1. This homework is similar to Assignment 29. We will do the problems again on the modified data path given below that includes instruction memory, a PC (program counter) and mechanisms to modify PC. Assume that PC value has been initially loaded with a value 0. Consider computing the value of D in expression

D = A AND B + C OR D

where A, B, C, and D are four memory locations storing four numbers.

Use machine M2 of homework 29 to realize this computation. Recall that machine M2 is a load/store kind of architecture. The program fpr computing D on this machine is given below.

LD R1, A /* Load contents of memory location A into register R1 */

LD R2, B /* Load contents of memory location B into register R2 */

AND R3, R1, R2 /* AND contents of registers R1 and R2 and store it into register R3 */

LD R1, C /* Load contents of memory location C into register R1 */

LD R2, D /* Load contents of memory location D into register R2 */

OR R1, R1, R2 /* OR contents of registers R1 and R2 and store it into register R1 */

ADD R1, R1, R3 /* Add contents of registers R1 and R3 and store it into register R1 */

ST R1, D /* Store contents of register R1 into memory location D */

 

LD and ST instructions need two memory locations. Opcode for LD and ST and register addresses are stored in the first word and the address of memory location is stored in the second word. Other instructions are stored in exactly one word. When an instruction is fetched, the first word of an instruction is stored into register I0 and the address of an operand is stored into register I1.

Write micro-sequences using register-transfer level description for LD (1st instruction), ST (last instruction), and an instruction that operates on only registers (say ADD instruction) for the data path shown below. For each micro instruction, indicate the signal values for each control signal. Do not forget to fetch an instruction. Based on these micro-sequences, estimate how many memory locations will be read to fetch instructions, to fetch data, and write results for this program.