Beruflich Dokumente
Kultur Dokumente
Shift Microoperations
Introduction
Shift microoperations are used for serial transfer of data. There are three types of shifts: logical, circular, and arithmetic. o A logical shift is one that transfers 0 through the serial input. e.g., R1 shl R1, R2 shr R2 o The register symbol must be the same on both sides of the arrow. The circular shift (rotate operation) circulates the bits of the register around the two ends without loss of information. e.g., cil, cir The symbolic notation for the shift microoperations is shown in Table
Shift Microoperations
Symbolic designation R shl R R shr R R cil R R cir R R ashl R R ashrR Description Shift-left register R Shift-right register R Circular shift-left register R Circular shift-right register R Arithmetic shift-left R Arithmetic shift-right R
Arithmetic Shift
An arithmetic shift is a microoperation that shifts a signed binary number to the left or right. Arithmetic shifts must leave the sign bit unchanged because the sign of the number remains the same when it is multiplied or divided by 2. Figure shows a typical register of n bits.
o o o
Arithmetic shift right Arithmetic shift left, an overflow flip-flop Vs is used Vs = (Rn-1) XOR (Rn-2
If Vs=0, there is no overflow If Vs=1, there is an overflow and a sign reversal after the shift.
Rn-1
Rn-2
R1
R0
Rn-1
Rn-2
R1
R0
Hardware Implementation
A possible choice for a shift unit would be a bidirectional shift register with parallel load.
o
This requires only one clock pulse for loading the shifted value into the register.
A combinational circuit shift can be constructed with multiplexers as shown in the figure next. The function table shows which input goes to each output after the shift.
MUX
H0 Function table
A0 A1 A2
S 0 1 S 0 1 S 0 1
MUX
H1
Select S 0 H0 IR H1 A0
Output
H2 A1
H3 A2
A3
MUX
H2
A1
A2
A3
IL
MUX
H3
Introduction
Computer systems employ a number of storage registers connected to a common operational unit called an arithmetic logic unit, abbreviated ALU. The ALU is a combinational circuit so that the entire register transfer operation from the source registers through the ALU and into the destination register can be performed during one clock pulse period. One stage of an arithmetic logic shift unit is shown in the figure. Table lists the 14 operations of the ALU.
Ci
Di
Select
Ci+1
0 1 2 3
Fi
BI Ai Ai-1 Ai+1
Ei shr
shl