
Homework 10: Shifters, Microcode, Instruction Encoding
ECE 2030 A, B (Schimmel)
1. Shift the following 8-bit value by the instructions given below and answer in hex: 0xA2
a. Logical shift left by 3 bits. 0x10
b. Arithmetic shift right by 3 bits. 0xF4 โ remember sign bit is shifted in
c. Arithmetic shift left by 2 bits. 0x88
d. Rotate shift right by 2 bits. 0xA8
2. The datapath below contains an adder/subtractor and a 3-type shift unit similar to the one
seen in lecture. Subtraction is (X-Y). Shift type 0 = logical, shift type 1 = arithmetic, shift
type 2 = rotate. The 32 bit value A to the shift unit will be shifted according to distance with
signed number B. The signals +/- en and shift en enable their respective modules when =1.
Fill in the table with only binary values (so to pick register 3 for X, fill in โ11โ).
INITIAL VALUES OF THE REGISTER FILE ARE:
R0 = 0x0
R1 = 0xFFFFFFF8
R2 = 0xF000000A
R3 = 0x7
a. Write microcode that performs an 8-bit logical, left shift on R2 and stores the value in
R2.
b. Write microcode that adds R3 and R0, then stores the result in R0.
Problem
X Y Z WE +/- en add/sub shift en shift type
2a.
01 10 10 1 0 X 1 00
2b.
11 00 00 1 1 1 0 XX