Shift Operations
By controlling IR and IL with multiplexers it is straightforward to adapt this circuit to perform arithmetic shifts, constructive and destructive shifts, Rotates and rotate-then- carry operation
CSU22022, 7th Lecture, Dr. M. Manzke, Page: 1
4-Bit Barrel Shifter
CSU22022, 7th Lecture, Dr. M. Manzke, Page: 2
S1 S2 0 0
Y3 Y2 Y1 Y0 D3 D2 D1 D0
Micro-ops
0 1 1 0 1 1
D2 D1 D0 D3 D1 D0 D3 D2 D0 D3 D2 D1
NoRotate RotateOne RotateTwo Rotate Three
Multiple Shifts
If multiple shifts are required we wire them into multiplexers that have an input for every bit on the bus to obtain a Barrel shifter (Previous slide).
CSU22022, 7th Lecture, Dr. M. Manzke, Page: 3
Controlling a Datapath
The Control Word
The figure on the next slide is an updated version of our introductory datapath (4th Lecture, Page 12) where the register file has been expanded to a more realistic eight n-bit registers.
Consequently the destination decoder and A and B bus MUX require three-bit select input.
The Function Unit still requires five bits to select ALU/Shift micro-ops.
Three more bits are required to control: Writing to the registers (RW)
MUX B (MB)
MUX D (MD)
CSU22022, 7th Lecture, Dr. M. Manzke, Page: 4
4th Lecture – Page 12
CSU22022, 7th Lecture, Dr. M. Manzke, Page: 5
Updated Datapath
m = 5, n = 32
CSU22022, 7th Lecture, Dr. M. Manzke, Page: 6
Control Word
The schematic on the next slide identifies all these control inputs and arranges them in a 23-bit vector called the Control Word.
CSU22022, 7th Lecture, Dr. M. Manzke, Page: 7
Datapath and the Control Word
We have 5 bits for DA, AA, and BA. Also n = 32 bits
CSU22022, 7th Lecture, Dr. M. Manzke, Page: 8
The Control Word Specifies One Micro-ops
22 1817 1312 876 210
DA AA BA MB FS MDRW
Note that for the function select FS we need to make explicit the relationship between its value and the micro-ops.
See next slide for details.
CSU22022, 7th Lecture, Dr. M. Manzke, Page: 9
00000 0
00001 0
0000 XX G=A 0001 XX G=A+1
TRANSFER INCREMENT
00010 0
00011 0
00100 0
00101 0
00110 0
00111 0
01000 0 01010 0 01100 0 01110 0 10000 1 10100 1 11000 1
0010 XX G=A+B 0011 XX G=A+B+1 0100 XX G=A+B 0101 XX G=A+B+1 0110 XX G=A-1 0111 XX G=A
1000 XX G=AB 1010 XX G=AB 1100 XX G=AB 1110 XX G=A
XXXX 00 G=B
XXXX 01 G=srB XXXX 10 G=slB
ADD
ADD WITH C A plus 1’s C.B SUBTRACT DECREMENT TRANSFER AND
OR
XOR
NOT TRANSFER SHIFT RIGTH SHIFT LEFT
G Select, H Select and MF Select determine the FS code
FS MF G H Output Select Select Select
CSU22022, 7th Lecture, Dr. M. Manzke, Page: 10
FS[2]= Cin
CSU22022, 7th Lecture, Dr. M. Manzke, Page: 11
FS[34]=S0S1
CSU22022, 7th Lecture, Dr. M. Manzke, Page: 12
FS[5]=S2
CSU22022, 7th Lecture, Dr. M. Manzke, Page: 13
FS[6]=MF select
CSU22022, 7th Lecture, Dr. M. Manzke, Page: 14