CS355 Syllabus & Progress

# Shifter circuits

• The ALU can perform arithmetic (+, -, *, /), logic operations (AND, OR, Negate (NOT)), and shift and rotate operation.

• Shifting is moving a bit pattern to the left or right. The following figures show a left and a right shift operation:

• We can construct a shifter circuit by "re-arranging" the inputs and outputs as shown in the following figure:

• The shifter circuit above will shift the input bits to the left when control = 0 and to the right when control = 1

• The best way to see how the shifter circuit "re-arranges" the input and output is to follow the input signals for different value of the control signal.

The following figure shows the data flow through the circuit when the control signal control = 0:

• Notice that the red and gates will cut off their data inputs while the blue and gates will let their data inputs pass
• If you follow the blue lines, you can clearly see that the circuit "re-arranges" the inputs and move them to the left. (I have made the blue line thicker to highlight the effect.)

• The following figure shows the data flow through the circuit when the control signal control = 1:

• Notice that now, the blue and gates will cut off their data inputs while the red and gates will let their data inputs pass
• If you follow the red lines, you can clearly see that the circuit "re-arranges" the inputs and move them to the right. (Again, I have made the red line thicker to highlight the effect.)

• An easier (but more costly) way to make a shifter circuit

• We can use a number of multiplexor circuits to create a shifter circuit.

Recall the functionality of a 2×1 multiplexor:

• A shifter circuit using 2×1 multiplexors (the mux is drawn rotated 90 degrees)

The multiplexors select the left inputs to shift left:

The multiplexors select the right inputs to shift right:

(We must connect the correct data signals di to the inputs of the multiplexors !)