Assignment 22 (Assigned October 25)


  1. Consider a data path that has been enhanced by adding a memory and a register file unit for storage of information and an M-register and a shift unit after the ALU. The shift unit can shift left or right with and without M-register. Without M-register, it take n-bit output of the ALU and shifts it left or right (control code 00 and 01). Shifted-out bit is lost and shifted-in bit is 0. With M register, the shift unit treats n-bit ALU output and n-bit M-register contents as a 2n-bit value and shifts left or right (control code 10 and 11). The ALU perform the following eight functions:

ALU Function Code

Function

ALU Function Code 

Function

000

Output is A

100

Output is A+B

001

Output is B

101

Output is A-B

010

Output is 0000

110

Output is A and B

011

Output is 1111

 

111

Output is A or B

Suppose we want to multiply two values. Write a sequence of instructions to load multiplicand in B register and multiplier in A register from input. Next transfer the multiplier in M-register and make A register zero to hold initial result. In each step of multiplication, we will replace A register by A or A+B depending on the least significant bit of M-register, shifted by one bit position right with M-register. Notice that as part of shift, the least significant bit of M-register is always containing the bit by which we want to multiply next. We need to repeat the step n times. Using the data path below and the above algorithm, show the contents of the registers A, B, and M after if each step. Also show the control signals you need to apply in each step.
(See slide 3 of lecture notes of October 25.)