|
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.)
