0% found this document useful (0 votes)
140 views

Shift Microoperation Arithmetic Logic Shift Unit

1) There are three types of shifts - logical, circular, and arithmetic. Logical shifts input a 0, circular shifts input the bit shifted out, and arithmetic shifts must maintain the number's sign. 2) Arithmetic shifts are for signed integers and an arithmetic left shift multiplies by 2 while maintaining the sign bit. 3) Hardware implements shifts using multiplexers, full adders, and other logic gates to perform the appropriate shift operation. An arithmetic left shift checks for overflow using the leftmost two

Uploaded by

Uma k
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
140 views

Shift Microoperation Arithmetic Logic Shift Unit

1) There are three types of shifts - logical, circular, and arithmetic. Logical shifts input a 0, circular shifts input the bit shifted out, and arithmetic shifts must maintain the number's sign. 2) Arithmetic shifts are for signed integers and an arithmetic left shift multiplies by 2 while maintaining the sign bit. 3) Hardware implements shifts using multiplexers, full adders, and other logic gates to perform the appropriate shift operation. An arithmetic left shift checks for overflow using the leftmost two

Uploaded by

Uma k
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Register Transfer and Micro-operations 1

Shift Microoperations
• There are three types of shifts
– Logical shift
– Circular shift
– Arithmetic shift
• What differentiates them is the information that goes into the serial input

• A right shift operation

Serial
input

• A left shift operation


Serial
input

CSE 211
Register Transfer and Micro-operations 2

Logical Shift
• In a logical shift the serial input to the shift is a 0.

• A right logical shift operation:


0

• A left logical shift operation:


0

• In a Register Transfer Language, the following notation is used


– shl for a logical shift left
– shr for a logical shift right
– Examples:
• R2  shr R2
• R3  shl R3
CSE 211
Register Transfer and Micro-operations 3

Circular Shift
• In a circular shift the serial input is the bit that is shifted out of the other
end of the register.

• A right circular shift operation:

• A left circular shift operation:

• In a RTL, the following notation is used


– cil for a circular shift left
– cir for a circular shift right
– Examples:
• R2  cir R2
• R3  cil R3

CSE 211
Register Transfer and Micro-operations 4

Arithmetic Shift
• An arithmetic shift is meant for signed binary numbers (integer)
• An arithmetic left shift multiplies a signed number by two
• An arithmetic right shift divides a signed number by two
• Sign bit : 0 for positive and 1 for negative
• The main distinction of an arithmetic shift is that it must keep the sign of
the number the same as it performs the multiplication or division

• A right arithmetic shift operation:

sign
bit

• A left arithmetic shift operation: 0


sign
bit

CSE 211
Register Transfer and Micro-operations 5

Arithmetic Shift
• An left arithmetic shift operation must be checked for the overflow

0
sign
bit

Before the shift, if the leftmost two


V bits differ, the shift will result in an
overflow

• In a RTL, the following notation is used


– ashl for an arithmetic shift left
– ashr for an arithmetic shift right
– Examples:
» R2  ashr R2
» R3  ashl R3

CSE 211
• An arithmetic left shift multiplies a signed
number by
A) 4
B) 8
C) 2
D) 16
Register Transfer and Micro-operations 7

Hardware Implementation of Shift Microoperation

CSE 211
Register Transfer and Micro-operations 8

Arithmetic Circuits
Cin
S1
S0

A0 X0 C0

S1 D0
S0
Y0
FAC1
B0 0
1 4x1
2
3
MUX
A1 X1 C1

S1 D1
S0 FA
B1 0 Y1 C2
1 4x1
2
3
MUX
A2 X2 C2

S1 D2
S0 FA
B2 0 Y2 C3
1 4x1
2
3
MUX
A3 X3 C3

S1 D3
S0 FA
B3 0 Y3 C4
1 4x1
2
3
MUX Cout
0 1

CSE 211
Register Transfer and Micro-operations 9

Hardware Implementation
Ai
0
Bi

1
4X1 Fi
MUX
2

3 Select

S1
S0

Function table
S1 S0 Output -operation
0 0 F=AB AND
0 1 F = AB OR
1 0 F=AB XOR
1 1 F = A’ Complement

CSE 211
Register Transfer and Micro-operations 10

Arithmetic Logic and Shift Unit


S3
S2 C
i
S1
S0

D
Arithmetic i

Circuit
Select

0 4x1
C i+1 F
1 i
MUX S3 S2 S1 S0 Cin Operation
2 0 0 0 0 0 F=A
3 0 0 0 0 1 F=A+1
0 0 0 1 0 F=A+B
E 0 0 0 1 1 F=A+B+1
Logic i 0 0 1 0 0 F = A + B’
Bi 0 0 1 0 1 F = A + B’+ 1
Circuit 0 0 1 1 0 F=A-1
A 0 0 1 1 1 F=A
i
0 1 0 0 X F=AB
shr
A 0 1 0 1 X F = A B
i-1 0 1 1 0 X F=AB
shl
A 0 1 1 1 X F = A’
i+1
1 0 X X X F = shr A
1 1 X X X F = shl A

CSE 211
• In context of arithmetic shift left operation,
which of the following Gate is used to check
the overflow?
A) OR
B) XOR
C) XNOR
D) NOR

You might also like