Docsity

Microcode and Shift Operations for ECE 2030 A, B - Prof. David Schimmel, Assignments of Electrical and Electronics Engineering

Toggle sidebar
bg1
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
pf3

Partial preview of the text

Download Microcode and Shift Operations for ECE 2030 A, B - Prof. David Schimmel and more Assignments Electrical and Electronics Engineering in PDF only on Docsity!

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: 0xA a. Logical shift left by 3 bits. 0x b. Arithmetic shift right by 3 bits. 0xF4 โ€“ remember sign bit is shifted in c. Arithmetic shift left by 2 bits. 0x 88 d. Rotate shift right by 2 bits. 0xA
  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 = 0x R1 = 0xFFFFFFF R2 = 0xF000000A R3 = 0x 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
  1. The datapath found below operates exactly as shown in lecture. The asl signal is 00 for the AU, 01 for the SU, and 10 for the LU. Port Z is the register fileโ€™s write port (Zwa=Z write address, Zdi = Z data in) and ports X and Y are read ports (Xra = X read address, X data out.) Write the microcode to compute the average of R 16 , R 20 , R21, and R23 and store the value in R 25. Do NOT alter the contents of any other register besides R 25. Do not assume you know the value of R25. You may assume R0 has the value 0 in it, R2 has the value 0x 1 in it. Fill in the table below using decimal values (ex. to read R9 on X, put โ€œ9โ€ in Xra). You do not HAVE to use all lines given to you. In cycle 1, for LF, 0 is also an acceptable answer (null function). Cycle 1 could also be left out completely if you added 2 of the 4 registers you had to add (16/20/21/23) or one of (16/20/21/23) and R0, and stored the result in R25. Cycle Zwa Xra Yra rwe asl alu en LF ST a /s 1

25 25 0 1 2 1 1 X X

25 25 16 1 0 1 X X 0

25 25 20 1 0 1 X X 0

25 25 21 1 0 1 X X 0

25 25 23 1 0 1 X X 0

25 25 2 1 1 1 X 1 X

25 25 2 1 1 1 X 1 X