SlideShare a Scribd company logo
1 of 30
ECE2030
Introduction to Computer Engineering
Lecture 13: Building Blocks for Combinational
Logic (4) Shifters, Multipliers
Prof. Hsien-Hsin Sean LeeProf. Hsien-Hsin Sean Lee
School of Electrical and Computer EngineeringSchool of Electrical and Computer Engineering
Georgia TechGeorgia Tech
Basic Shifting
• Shift directions
– Left (multiply by 2)
– Right (divide by 2)
•Take floor value if the result is not an integer
•Floor value of XX (or X) is the greatest integer number
less than or equal to X,X, E.g.
5/2 = 2
-3/2 = -2
• Shift types
– Logical (or unsigned)
– Arithmetic (or signed)
Logical Shift
• Shift Left
– MSB: Shifted out
– LSB: Shifted in with a “0”
– Examples:
• (11001011 << 1) = 10010110
• (11001011 << 3) = 01011000
• Shift right
– MSB: Shifted in with a “0”
– LSB: Shifted out
– Examples: (Some ISA use triple “>” for logical right shift)
• (11001011 >>> 1) = 01100101
• (11001011 >>> 3) = 00011001
Arithmetic Shift
• Shift left
– MSB: Shifted out, however, be aware of
overflow/underflow
– LSB: Shifted in with a “0”
– Examples:
• (1100 << 1) = 1000
• (1100 << 3) = 0000 (Incorrect!) ⇒ Underflow
• Shift right
– MSB: Retain “sign bit”
– LSB: Shifted out
– Examples:
• (1100 >> 1) = 1110 (Retain sign bit)
• (1100 >> 3) = 1111 ( -4/8 = -1 ) ⇒ Floor value of -0.5
Examples of Arithmetic Shift
1111 1011 Arithmetic shift right by 1
→ 1111 1101
1111 1011 Arithmetic shift left by 1
→ 1111 0110
1011 1111 (= -65) Arithmetic shift left by 1 (i.e. x2)
→ 0111 1110 (= +126 ≠ -130) ⇒ Underflow !
0100 0010 (= +66) Arithmetic shift left by 1 (i.e. x2)
→ 1000 0100 (= -124 ≠ +132) ⇒ Overflow !
Overflow/Underflow
4-bit Logical Shifter
S1 S0 D3 D2 D1 D0
0 X A3 A2 A1 A0
1 0 0 A3 A2 A1
1 1 A2 A1 A0 0
A3 A2 A1 A0
D3 D2 D1 D0
S/NS
S0
S1
L/R
101010
001201111
101301212
201313
ASSASD
ASSASSASD
ASSASSASD
ASSASD
+=
++=
++=
+=
4-bit Logical Shifter using 4-to-1 Mux
4-to-1 Mux
00 01 10 11
s1
s0
S1 S0 D3 D2 D1 D0
0 X A3 A2 A1 A0
1 0 0 A3 A2 A1
1 1 A2 A1 A0 0
D3
A2A3
4-to-1 Mux
00 01 10 11
s1
s0
D2
A1
4-to-1 Mux
00 01 10 11
s1
s0
D1
A0
4-to-1 Mux
00 01 10 11
s1
s0
D0
S1
S0
Right Shift
Left Shift
4-bit Arithmetic Shifter w/ 4-to-1 Mux
4-to-1 Mux
00 01 10 11
s1
s0
S1 S0 D3 D2 D1 D0
0 X A3 A2 A1 A0
1 0 A3A3 A3 A2 A1
1 1 A2 A1 A0 0
D3
A2A3
4-to-1 Mux
00 01 10 11
s1
s0
D2
A1
4-to-1 Mux
00 01 10 11
s1
s0
D1
A0
4-to-1 Mux
00 01 10 11
s1
s0
D0
S1
S0
Right Shift
Left Shift
4-bit Arithmetic Shifter w/ 4-to-1 Mux
4-to-1 Mux
00 01 10 11
s1
s0
S1 S0 D3 D2 D1 D0
0 X A3 A2 A1 A0
1 0 A3A3 A3 A2 A1
1 1 A2 A1 A0 0
D3
A2A3
4-to-1 Mux
00 01 10 11
s1
s0
D2
A1
4-to-1 Mux
00 01 10 11
s1
s0
D1
A0
4-to-1 Mux
00 01 10 11
s1
s0
D0
S1
S0
Right Shift
Left Shift
Overflow/Overflow/
UnderflowUnderflow
4-bit Arithmetic Shifter w/ 4-to-1 Mux
4-to-1 Mux
00 01 10 11
s1
s0
S1 S0 D3 D2 D1 D0
0 X A3 A2 A1 A0
1 0 A3A3 A3 A2 A1
1 1 A2 A1 A0 0
D3
A2A3
4-to-1 Mux
00 01 10 11
s1
s0
D2
A1
4-to-1 Mux
00 01 10 11
s1
s0
D1
A0
4-to-1 Mux
00 01 10 11
s1
s0
D0
S1
S0
Right Shift
Left Shift
Overflow/Overflow/
UnderflowUnderflow
Overflow
Underflow Detection
Rotator
S1 S0 D3 D2 D1 D0
0 0 A3 A2 A1 A0
0 1 A0 A3 A2 A1
1 0 A1 A0 A3 A2
1 1 A2 A1 A0 A3
4-to-1 Mux
00 01 10 11
s1
s0
D3
A2A3
4-to-1 Mux
00 01 10 11
s1
s0
D2
A1
4-to-1 Mux
00 01 10 11
s1
s0
D1
A0
4-to-1 Mux
00 01 10 11
s1
s0
D0
S1
S0
Barrel Shifter
S2 S1 S0 D3 D2 D1 D0
0 0 0 A3 A2 A1 A0
0 0 1 A3 A3 A2 A1
0 1 0 A3 A3 A3 A2
0 1 1 A3 A3 A3 A3
1 0 0 A3 A2 A1 A0
1 0 1 A2 A1 A0 0
1 1 0 A1 A0 0 0
1 1 1 A0 0 0 0
Shift multiple bitsmultiple bits at a time
Left Shift
Right Shift
Barrel Shifter Design w/ Mux (D3)
S2 S1 S0 D3 D2 D1 D0
0 0 0 A3 A2 A1 A0
0 0 1 A3 A3 A2 A1
0 1 0 A3 A3 A3 A2
0 1 1 A3 A3 A3 A3
1 0 0 A3 A2 A1 A0
1 0 1 A2 A1 A0 0
1 1 0 A1 A0 0 0
1 1 1 A0 0 0 0
4-to-1 Mux
00 01 10 11
s1
s0
00 01 10 11
s1
s0
4-to-1 Mux
2-to-1Mux2-to-1Mux1
0 D3
A3
A3 A2 A1 A0
S0
S1
S2
Replicate and change wiring of the two 4-to-1 Muxes for D2, D1 and D0
Barrel Shifter Design Alternative (16-bit)
23
Shifter
22
Shifter
21
Shifter
20
Shifter
Left/Right
S3
S2
S1
S0
16
16
16
16
(S3 S2 S1 S0) specifies the “shift amount” in binary(S3 S2 S1 S0) specifies the “shift amount” in binary
16
Output NumberOutput Number
Input NumberInput Number
Barrel Shifter Design w/ nMOSFET
D3
D2
D1
D0
A3
S=0
(No Shift)
S=1 S=2 S=3
A2
A1
A0
S=3
S=2
S=1
A3A3A3
Barrel Shifter Design w/ nMOSFET
D3
D2
D1
D0
A3
S=0
(No Shift)
S=1 S=2S=2 S=3
A2
A1
A0
S=3
S=2S=2
S=1
A3
A2
Barrel Shifter Design w/ nMOSFET
D3
D2
D1
D0
A3
S=0
(No Shift)
S=1S=1 S=2 S=3
A2
A1
A0
S=3
S=2
S=1S=1
= A3
= A3
= A2
= A1
Unsigned Binary Multiply
101 (5)
X 111 (7)
----------
101
101
101
----------
100011 (35)
Unsigned Integer Multiplier (2-bit)
s
00100111
1011
0001
01
01
babababa
baba
baba
bbx
aa
+
2-bit by 2-bit
carrycarry out
p0
a0b0
H.A.
p1
c
s
a1b0a0b1
H.A.c
s
p2p3
a1b1
Unsigned Integer Multiplier (3-bit)
bababa
bababa
bababa
bbbx
aaa
202122
101112
000102
012
012
3-bit by 3-bit
p0
a0b0
s
F.A.
p1
a1b0a0b1
0
co
s
ci
c
F.A.
p2
s
a2b0a1b1
co
s
ci
c
F.A.
s
co
s
ci
a0b2
00
c
F.A.
p3
a2b1
co
s
ci
c
F.A.co
s
ci
a1b2
0
s
s
s
c
p4
c
F.A.co
s
ci
a2b2
p5
4-bit Unsigned Integer Multiplier
a0 b0
P0
a1 b0
a0 b1
++
0
P1
a2 b0
a1 b1
++
a0 b2
++
0
P2
a3 b0
a2 b1
++
a1 b2
++
a0 b3
++
0
P3
a3 b1
++
a2 b2
++
a1 b3
++
0
P4
a3 b2
++
a2 b3
++
P5
a3 b3
++
P6P7
a0 b0
++
CinCout
Sum
A B
Full AdderFull Adder
a0b0
≡≡
Propagation Delay
a0 b0
P0
a1 b0
a0 b1
++
0
P1
a2 b0
a1 b1
++
a0 b2
++
0
P2
a3 b0
a2 b1
++
a1 b2
++
a0 b3
++
0
P3
a3 b1
++
a2 b2
++
a1 b3
++
0
P4
a3 b2
++
a2 b3
++
P5
a3 b3
++
P6P7
1122
33
33
44
44
55
55
66
667788
4x4
Delay = 8 adders
8x8
Delay = 20 adders
a3 b3
++
P7 P6
Carry-Save Multiplier
a0 b0
P0
a1 b0
a0 b1
++
0
P1
a2 b0
a1 b1
++
a0 b2
++
0
P2
a3 b0
a2 b1
++
a1 b2
++
a0 b3
++
0
P3
a3 b2
++
a2 b3
++
P5
a3 b1
++
a2 b2
a1 b3
++
++
0
P4
Propagation Delay of Carry-Save Multiplier
a0 b0
P0
a3 b1
++
a2 b2
a1 b3
++
a3 b2
++
a2 b3
++
P5
a3 b3
++
P7
a1 b0
a0 b1
++
0
P1
11
22
33 33
5566
4x4
Delay
= 6 adders
8x8
Delay
= 14 adders
a2 b0
a1 b1
++
a0 b2
++
0
P2
11
22
a3 b0
a2 b1
++
a1 b2
++
a0 b3
++
0
P3
11
22
33
++44
0
P6 P4
Signed Binary Multiply
When the Multiplicand is negativeWhen the Multiplicand is negative
11101 (-3)
01001 (+9)
--------------------
11111101
00
11101
--------------------
11100101
Maintain the sign bits of the
partial product
Signed Binary Multiply
When the Multiplier is negativeWhen the Multiplier is negative
01001 (+9)
11101 (-3)
--------------------
01001
01001
--------------------
0101101
01001
--------------------
01110101
10111
--------------------
111100101 (-27)
At the last step, 2’s complement
the multiplicand before adding
Signed Binary Multiply
When both the Multiplicand and Multiplier are negativeWhen both the Multiplicand and Multiplier are negative
10111 (-9)
11101 (-3)
--------------------
1110111
10111
--------------------
11010011
10111
--------------------
110001011
01001
--------------------
000011011(+27)
At the last step, 2’s complement
the multiplicand before adding
Maintain the sign bits of the
partial product
More Examples (1)
1111 1010 (-6)
0000 0101 (+5)
--------------------
111111 1010
111110 10
--------------------
1110 0010 (-30)
Assume 8-bit numbers
More Examples (2)
0011 (+3)
1110 (-2)
--------------------
0 0110
00 11
--------------------
01 0010
110 1
--------------------
1010 (-6)
Assume 4-bit numbers
More Examples (3)
1111 1100 (-4)
1110 0000 (-32)
--------------------
11 1111 1000 0000
11 1111 00
--------------------
111 1110 1000 0000
000 0010 0
--------------------
000 0000 1000 0000 (+128)
Assume 8-bit numbers

More Related Content

What's hot

What's hot (20)

Logic gates
Logic gatesLogic gates
Logic gates
 
Ceng232 Decoder Multiplexer Adder
Ceng232 Decoder Multiplexer AdderCeng232 Decoder Multiplexer Adder
Ceng232 Decoder Multiplexer Adder
 
04 comb ex
04 comb ex04 comb ex
04 comb ex
 
Lab 4 Three-Bit Binary Adder
Lab 4 Three-Bit Binary AdderLab 4 Three-Bit Binary Adder
Lab 4 Three-Bit Binary Adder
 
Chapter 2
Chapter 2Chapter 2
Chapter 2
 
Mba admission in india
Mba admission in indiaMba admission in india
Mba admission in india
 
Basic electronics
Basic electronicsBasic electronics
Basic electronics
 
Free video lectures for mca
Free video lectures for mcaFree video lectures for mca
Free video lectures for mca
 
Dpsd lecture-notes
Dpsd lecture-notesDpsd lecture-notes
Dpsd lecture-notes
 
Vlsi presentation final
Vlsi presentation finalVlsi presentation final
Vlsi presentation final
 
Admissions in india 2015
Admissions in india 2015Admissions in india 2015
Admissions in india 2015
 
Digital Logic Rcs
Digital Logic RcsDigital Logic Rcs
Digital Logic Rcs
 
Chapter 07 Digital Alrithmetic and Arithmetic Circuits
Chapter 07 Digital Alrithmetic and Arithmetic CircuitsChapter 07 Digital Alrithmetic and Arithmetic Circuits
Chapter 07 Digital Alrithmetic and Arithmetic Circuits
 
Arithmetic by aniket bhute
Arithmetic by aniket bhuteArithmetic by aniket bhute
Arithmetic by aniket bhute
 
Digital logic
Digital logicDigital logic
Digital logic
 
Understand data representation on CPU 1
Understand data representation on CPU 1Understand data representation on CPU 1
Understand data representation on CPU 1
 
Register transfer and microoperations part 2
Register transfer and microoperations part 2Register transfer and microoperations part 2
Register transfer and microoperations part 2
 
Unit 4 dica
Unit 4 dicaUnit 4 dica
Unit 4 dica
 
Make your data dance: PIVOT and GROUP BY in Oracle SQL
Make your data dance: PIVOT and GROUP BY in Oracle SQLMake your data dance: PIVOT and GROUP BY in Oracle SQL
Make your data dance: PIVOT and GROUP BY in Oracle SQL
 
Digi qestions
Digi qestionsDigi qestions
Digi qestions
 

Viewers also liked

Lec18 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- In...
Lec18 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- In...Lec18 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- In...
Lec18 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- In...
Hsien-Hsin Sean Lee, Ph.D.
 
Lec3 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- CMO...
Lec3 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- CMO...Lec3 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- CMO...
Lec3 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- CMO...
Hsien-Hsin Sean Lee, Ph.D.
 

Viewers also liked (20)

Shifters
ShiftersShifters
Shifters
 
Lec6 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Can...
Lec6 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Can...Lec6 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Can...
Lec6 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Can...
 
Lec20 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Da...
Lec20 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Da...Lec20 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Da...
Lec20 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Da...
 
Lec6 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Instruction...
Lec6 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Instruction...Lec6 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Instruction...
Lec6 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Instruction...
 
Lec1 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Intro
Lec1 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- IntroLec1 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Intro
Lec1 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Intro
 
Lec5 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Branch Pred...
Lec5 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Branch Pred...Lec5 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Branch Pred...
Lec5 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Branch Pred...
 
Lec14 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Se...
Lec14 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Se...Lec14 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Se...
Lec14 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Se...
 
Lec4 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- ISA
Lec4 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- ISALec4 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- ISA
Lec4 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- ISA
 
Lec3 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Performance
Lec3 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- PerformanceLec3 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Performance
Lec3 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Performance
 
Lec18 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- In...
Lec18 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- In...Lec18 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- In...
Lec18 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- In...
 
Lec19 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Pr...
Lec19 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Pr...Lec19 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Pr...
Lec19 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Pr...
 
Lec8 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Qui...
Lec8 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Qui...Lec8 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Qui...
Lec8 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Qui...
 
Lec3 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- CMO...
Lec3 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- CMO...Lec3 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- CMO...
Lec3 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- CMO...
 
Lec9 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Com...
Lec9 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Com...Lec9 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Com...
Lec9 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Com...
 
Lec1 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Pipelining
Lec1 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- PipeliningLec1 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Pipelining
Lec1 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Pipelining
 
Lec17 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Me...
Lec17 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Me...Lec17 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Me...
Lec17 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Me...
 
Lec4 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- CMOS
Lec4 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- CMOSLec4 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- CMOS
Lec4 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- CMOS
 
Lec2 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- ILP
Lec2 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- ILPLec2 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- ILP
Lec2 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- ILP
 
Lec7 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Dynamic Sch...
Lec7 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Dynamic Sch...Lec7 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Dynamic Sch...
Lec7 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Dynamic Sch...
 
Lec15 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Re...
Lec15 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Re...Lec15 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Re...
Lec15 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Re...
 

Similar to Lec13 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Shifter and Multiplier

Decimal arithematic operation
Decimal arithematic operationDecimal arithematic operation
Decimal arithematic operation
PadmapriyaG
 
dd_sampleslides.ppt
dd_sampleslides.pptdd_sampleslides.ppt
dd_sampleslides.ppt
wafawafa52
 
Binary Mathematics Classwork and Hw
Binary Mathematics Classwork and HwBinary Mathematics Classwork and Hw
Binary Mathematics Classwork and Hw
Joji Thompson
 

Similar to Lec13 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Shifter and Multiplier (20)

Data representation and Arithmetic Algorithms
Data representation and Arithmetic AlgorithmsData representation and Arithmetic Algorithms
Data representation and Arithmetic Algorithms
 
Decimal arithematic operation
Decimal arithematic operationDecimal arithematic operation
Decimal arithematic operation
 
4 b3t wikipedia
4 b3t   wikipedia4 b3t   wikipedia
4 b3t wikipedia
 
dd_sampleslides.ppt
dd_sampleslides.pptdd_sampleslides.ppt
dd_sampleslides.ppt
 
Shift micro operations & 4 bit combinational circuit shifter
Shift micro operations &  4 bit combinational circuit shifterShift micro operations &  4 bit combinational circuit shifter
Shift micro operations & 4 bit combinational circuit shifter
 
Week 5 - Number Systems.pdf
Week 5 - Number Systems.pdfWeek 5 - Number Systems.pdf
Week 5 - Number Systems.pdf
 
Computer Architecture
Computer ArchitectureComputer Architecture
Computer Architecture
 
Computer Architecture
Computer ArchitectureComputer Architecture
Computer Architecture
 
Digital logic design lecture 03
Digital logic design   lecture 03 Digital logic design   lecture 03
Digital logic design lecture 03
 
Bolum1cozumler
Bolum1cozumlerBolum1cozumler
Bolum1cozumler
 
Chapter 4
Chapter 4Chapter 4
Chapter 4
 
digital-electronics.pptx
digital-electronics.pptxdigital-electronics.pptx
digital-electronics.pptx
 
Ch_10.pptx.pdf
Ch_10.pptx.pdfCh_10.pptx.pdf
Ch_10.pptx.pdf
 
ARITHMETIC FOR COMPUTERS
ARITHMETIC FOR COMPUTERS	  ARITHMETIC FOR COMPUTERS
ARITHMETIC FOR COMPUTERS
 
Digital_Electronics_Basics.pdf
Digital_Electronics_Basics.pdfDigital_Electronics_Basics.pdf
Digital_Electronics_Basics.pdf
 
elec2200-6.pdf
elec2200-6.pdfelec2200-6.pdf
elec2200-6.pdf
 
Reliable multimedia transmission under noisy condition
Reliable multimedia transmission under noisy conditionReliable multimedia transmission under noisy condition
Reliable multimedia transmission under noisy condition
 
Binary Mathematics Classwork and Hw
Binary Mathematics Classwork and HwBinary Mathematics Classwork and Hw
Binary Mathematics Classwork and Hw
 
Top schools in faridabad
Top schools in faridabadTop schools in faridabad
Top schools in faridabad
 
1
11
1
 

More from Hsien-Hsin Sean Lee, Ph.D.

Lec7 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Kar...
Lec7 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Kar...Lec7 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Kar...
Lec7 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Kar...
Hsien-Hsin Sean Lee, Ph.D.
 
Lec5 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Boo...
Lec5 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Boo...Lec5 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Boo...
Lec5 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Boo...
Hsien-Hsin Sean Lee, Ph.D.
 

More from Hsien-Hsin Sean Lee, Ph.D. (11)

Lec7 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Kar...
Lec7 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Kar...Lec7 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Kar...
Lec7 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Kar...
 
Lec5 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Boo...
Lec5 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Boo...Lec5 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Boo...
Lec5 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Boo...
 
Lec15 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- EPIC VLIW
Lec15 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- EPIC VLIWLec15 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- EPIC VLIW
Lec15 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- EPIC VLIW
 
Lec14 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech --- Coherence
Lec14 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech --- CoherenceLec14 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech --- Coherence
Lec14 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech --- Coherence
 
Lec13 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- SMP
Lec13 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- SMPLec13 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- SMP
Lec13 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- SMP
 
Lec13 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Multicore
Lec13 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- MulticoreLec13 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Multicore
Lec13 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Multicore
 
Lec12 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- P6, Netbur...
Lec12 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- P6, Netbur...Lec12 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- P6, Netbur...
Lec12 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- P6, Netbur...
 
Lec11 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Memory part3
Lec11 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Memory part3Lec11 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Memory part3
Lec11 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Memory part3
 
Lec10 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Memory part2
Lec10 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Memory part2Lec10 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Memory part2
Lec10 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Memory part2
 
Lec9 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Memory part 1
Lec9 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Memory part 1Lec9 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Memory part 1
Lec9 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Memory part 1
 
Lec8 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Dynamic Sch...
Lec8 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Dynamic Sch...Lec8 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Dynamic Sch...
Lec8 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Dynamic Sch...
 

Recently uploaded

Vip Mumbai Call Girls Kalyan Call On 9920725232 With Body to body massage wit...
Vip Mumbai Call Girls Kalyan Call On 9920725232 With Body to body massage wit...Vip Mumbai Call Girls Kalyan Call On 9920725232 With Body to body massage wit...
Vip Mumbai Call Girls Kalyan Call On 9920725232 With Body to body massage wit...
amitlee9823
 
一比一定(购)新西兰林肯大学毕业证(Lincoln毕业证)成绩单学位证
一比一定(购)新西兰林肯大学毕业证(Lincoln毕业证)成绩单学位证一比一定(购)新西兰林肯大学毕业证(Lincoln毕业证)成绩单学位证
一比一定(购)新西兰林肯大学毕业证(Lincoln毕业证)成绩单学位证
wpkuukw
 
Call Girls In RT Nagar ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In RT Nagar ☎ 7737669865 🥵 Book Your One night StandCall Girls In RT Nagar ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In RT Nagar ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
➥🔝 7737669865 🔝▻ Vijayawada Call-girls in Women Seeking Men 🔝Vijayawada🔝 E...
➥🔝 7737669865 🔝▻ Vijayawada Call-girls in Women Seeking Men  🔝Vijayawada🔝   E...➥🔝 7737669865 🔝▻ Vijayawada Call-girls in Women Seeking Men  🔝Vijayawada🔝   E...
➥🔝 7737669865 🔝▻ Vijayawada Call-girls in Women Seeking Men 🔝Vijayawada🔝 E...
amitlee9823
 
Escorts Service Arekere ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Arekere ☎ 7737669865☎ Book Your One night Stand (Bangalore)Escorts Service Arekere ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Arekere ☎ 7737669865☎ Book Your One night Stand (Bangalore)
amitlee9823
 
Abort pregnancy in research centre+966_505195917 abortion pills in Kuwait cyt...
Abort pregnancy in research centre+966_505195917 abortion pills in Kuwait cyt...Abort pregnancy in research centre+966_505195917 abortion pills in Kuwait cyt...
Abort pregnancy in research centre+966_505195917 abortion pills in Kuwait cyt...
drmarathore
 
➥🔝 7737669865 🔝▻ kakinada Call-girls in Women Seeking Men 🔝kakinada🔝 Escor...
➥🔝 7737669865 🔝▻ kakinada Call-girls in Women Seeking Men  🔝kakinada🔝   Escor...➥🔝 7737669865 🔝▻ kakinada Call-girls in Women Seeking Men  🔝kakinada🔝   Escor...
➥🔝 7737669865 🔝▻ kakinada Call-girls in Women Seeking Men 🔝kakinada🔝 Escor...
amitlee9823
 
CHEAP Call Girls in Vinay Nagar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Vinay Nagar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Vinay Nagar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Vinay Nagar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Call Girls Chickpet ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Call Girls Chickpet ☎ 7737669865☎ Book Your One night Stand (Bangalore)Call Girls Chickpet ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Call Girls Chickpet ☎ 7737669865☎ Book Your One night Stand (Bangalore)
amitlee9823
 

Recently uploaded (20)

Top Rated Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated  Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Top Rated  Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
 
Call Girls in Vashi Escorts Services - 7738631006
Call Girls in Vashi Escorts Services - 7738631006Call Girls in Vashi Escorts Services - 7738631006
Call Girls in Vashi Escorts Services - 7738631006
 
Book Sex Workers Available Pune Call Girls Yerwada 6297143586 Call Hot India...
Book Sex Workers Available Pune Call Girls Yerwada  6297143586 Call Hot India...Book Sex Workers Available Pune Call Girls Yerwada  6297143586 Call Hot India...
Book Sex Workers Available Pune Call Girls Yerwada 6297143586 Call Hot India...
 
Call Girls Pimple Saudagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Pimple Saudagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Pimple Saudagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Pimple Saudagar Call Me 7737669865 Budget Friendly No Advance Booking
 
Shikrapur Call Girls Most Awaited Fun 6297143586 High Profiles young Beautie...
Shikrapur Call Girls Most Awaited Fun  6297143586 High Profiles young Beautie...Shikrapur Call Girls Most Awaited Fun  6297143586 High Profiles young Beautie...
Shikrapur Call Girls Most Awaited Fun 6297143586 High Profiles young Beautie...
 
Book Paid Lohegaon Call Girls Pune 8250192130Low Budget Full Independent High...
Book Paid Lohegaon Call Girls Pune 8250192130Low Budget Full Independent High...Book Paid Lohegaon Call Girls Pune 8250192130Low Budget Full Independent High...
Book Paid Lohegaon Call Girls Pune 8250192130Low Budget Full Independent High...
 
Vip Mumbai Call Girls Kalyan Call On 9920725232 With Body to body massage wit...
Vip Mumbai Call Girls Kalyan Call On 9920725232 With Body to body massage wit...Vip Mumbai Call Girls Kalyan Call On 9920725232 With Body to body massage wit...
Vip Mumbai Call Girls Kalyan Call On 9920725232 With Body to body massage wit...
 
一比一定(购)新西兰林肯大学毕业证(Lincoln毕业证)成绩单学位证
一比一定(购)新西兰林肯大学毕业证(Lincoln毕业证)成绩单学位证一比一定(购)新西兰林肯大学毕业证(Lincoln毕业证)成绩单学位证
一比一定(购)新西兰林肯大学毕业证(Lincoln毕业证)成绩单学位证
 
(ISHITA) Call Girls Service Aurangabad Call Now 8617697112 Aurangabad Escorts...
(ISHITA) Call Girls Service Aurangabad Call Now 8617697112 Aurangabad Escorts...(ISHITA) Call Girls Service Aurangabad Call Now 8617697112 Aurangabad Escorts...
(ISHITA) Call Girls Service Aurangabad Call Now 8617697112 Aurangabad Escorts...
 
Call Girls In RT Nagar ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In RT Nagar ☎ 7737669865 🥵 Book Your One night StandCall Girls In RT Nagar ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In RT Nagar ☎ 7737669865 🥵 Book Your One night Stand
 
➥🔝 7737669865 🔝▻ Vijayawada Call-girls in Women Seeking Men 🔝Vijayawada🔝 E...
➥🔝 7737669865 🔝▻ Vijayawada Call-girls in Women Seeking Men  🔝Vijayawada🔝   E...➥🔝 7737669865 🔝▻ Vijayawada Call-girls in Women Seeking Men  🔝Vijayawada🔝   E...
➥🔝 7737669865 🔝▻ Vijayawada Call-girls in Women Seeking Men 🔝Vijayawada🔝 E...
 
(INDIRA) Call Girl Napur Call Now 8617697112 Napur Escorts 24x7
(INDIRA) Call Girl Napur Call Now 8617697112 Napur Escorts 24x7(INDIRA) Call Girl Napur Call Now 8617697112 Napur Escorts 24x7
(INDIRA) Call Girl Napur Call Now 8617697112 Napur Escorts 24x7
 
Escorts Service Arekere ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Arekere ☎ 7737669865☎ Book Your One night Stand (Bangalore)Escorts Service Arekere ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Arekere ☎ 7737669865☎ Book Your One night Stand (Bangalore)
 
Abort pregnancy in research centre+966_505195917 abortion pills in Kuwait cyt...
Abort pregnancy in research centre+966_505195917 abortion pills in Kuwait cyt...Abort pregnancy in research centre+966_505195917 abortion pills in Kuwait cyt...
Abort pregnancy in research centre+966_505195917 abortion pills in Kuwait cyt...
 
HLH PPT.ppt very important topic to discuss
HLH PPT.ppt very important topic to discussHLH PPT.ppt very important topic to discuss
HLH PPT.ppt very important topic to discuss
 
Call Girls Chikhali Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Chikhali Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Chikhali Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Chikhali Call Me 7737669865 Budget Friendly No Advance Booking
 
➥🔝 7737669865 🔝▻ kakinada Call-girls in Women Seeking Men 🔝kakinada🔝 Escor...
➥🔝 7737669865 🔝▻ kakinada Call-girls in Women Seeking Men  🔝kakinada🔝   Escor...➥🔝 7737669865 🔝▻ kakinada Call-girls in Women Seeking Men  🔝kakinada🔝   Escor...
➥🔝 7737669865 🔝▻ kakinada Call-girls in Women Seeking Men 🔝kakinada🔝 Escor...
 
CHEAP Call Girls in Vinay Nagar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Vinay Nagar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Vinay Nagar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Vinay Nagar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Introduction-to-4x4-SRAM-Memory-Block.pptx
Introduction-to-4x4-SRAM-Memory-Block.pptxIntroduction-to-4x4-SRAM-Memory-Block.pptx
Introduction-to-4x4-SRAM-Memory-Block.pptx
 
Call Girls Chickpet ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Call Girls Chickpet ☎ 7737669865☎ Book Your One night Stand (Bangalore)Call Girls Chickpet ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Call Girls Chickpet ☎ 7737669865☎ Book Your One night Stand (Bangalore)
 

Lec13 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Shifter and Multiplier

  • 1. ECE2030 Introduction to Computer Engineering Lecture 13: Building Blocks for Combinational Logic (4) Shifters, Multipliers Prof. Hsien-Hsin Sean LeeProf. Hsien-Hsin Sean Lee School of Electrical and Computer EngineeringSchool of Electrical and Computer Engineering Georgia TechGeorgia Tech
  • 2. Basic Shifting • Shift directions – Left (multiply by 2) – Right (divide by 2) •Take floor value if the result is not an integer •Floor value of XX (or X) is the greatest integer number less than or equal to X,X, E.g. 5/2 = 2 -3/2 = -2 • Shift types – Logical (or unsigned) – Arithmetic (or signed)
  • 3. Logical Shift • Shift Left – MSB: Shifted out – LSB: Shifted in with a “0” – Examples: • (11001011 << 1) = 10010110 • (11001011 << 3) = 01011000 • Shift right – MSB: Shifted in with a “0” – LSB: Shifted out – Examples: (Some ISA use triple “>” for logical right shift) • (11001011 >>> 1) = 01100101 • (11001011 >>> 3) = 00011001
  • 4. Arithmetic Shift • Shift left – MSB: Shifted out, however, be aware of overflow/underflow – LSB: Shifted in with a “0” – Examples: • (1100 << 1) = 1000 • (1100 << 3) = 0000 (Incorrect!) ⇒ Underflow • Shift right – MSB: Retain “sign bit” – LSB: Shifted out – Examples: • (1100 >> 1) = 1110 (Retain sign bit) • (1100 >> 3) = 1111 ( -4/8 = -1 ) ⇒ Floor value of -0.5
  • 5. Examples of Arithmetic Shift 1111 1011 Arithmetic shift right by 1 → 1111 1101 1111 1011 Arithmetic shift left by 1 → 1111 0110 1011 1111 (= -65) Arithmetic shift left by 1 (i.e. x2) → 0111 1110 (= +126 ≠ -130) ⇒ Underflow ! 0100 0010 (= +66) Arithmetic shift left by 1 (i.e. x2) → 1000 0100 (= -124 ≠ +132) ⇒ Overflow ! Overflow/Underflow
  • 6. 4-bit Logical Shifter S1 S0 D3 D2 D1 D0 0 X A3 A2 A1 A0 1 0 0 A3 A2 A1 1 1 A2 A1 A0 0 A3 A2 A1 A0 D3 D2 D1 D0 S/NS S0 S1 L/R 101010 001201111 101301212 201313 ASSASD ASSASSASD ASSASSASD ASSASD += ++= ++= +=
  • 7. 4-bit Logical Shifter using 4-to-1 Mux 4-to-1 Mux 00 01 10 11 s1 s0 S1 S0 D3 D2 D1 D0 0 X A3 A2 A1 A0 1 0 0 A3 A2 A1 1 1 A2 A1 A0 0 D3 A2A3 4-to-1 Mux 00 01 10 11 s1 s0 D2 A1 4-to-1 Mux 00 01 10 11 s1 s0 D1 A0 4-to-1 Mux 00 01 10 11 s1 s0 D0 S1 S0 Right Shift Left Shift
  • 8. 4-bit Arithmetic Shifter w/ 4-to-1 Mux 4-to-1 Mux 00 01 10 11 s1 s0 S1 S0 D3 D2 D1 D0 0 X A3 A2 A1 A0 1 0 A3A3 A3 A2 A1 1 1 A2 A1 A0 0 D3 A2A3 4-to-1 Mux 00 01 10 11 s1 s0 D2 A1 4-to-1 Mux 00 01 10 11 s1 s0 D1 A0 4-to-1 Mux 00 01 10 11 s1 s0 D0 S1 S0 Right Shift Left Shift
  • 9. 4-bit Arithmetic Shifter w/ 4-to-1 Mux 4-to-1 Mux 00 01 10 11 s1 s0 S1 S0 D3 D2 D1 D0 0 X A3 A2 A1 A0 1 0 A3A3 A3 A2 A1 1 1 A2 A1 A0 0 D3 A2A3 4-to-1 Mux 00 01 10 11 s1 s0 D2 A1 4-to-1 Mux 00 01 10 11 s1 s0 D1 A0 4-to-1 Mux 00 01 10 11 s1 s0 D0 S1 S0 Right Shift Left Shift Overflow/Overflow/ UnderflowUnderflow
  • 10. 4-bit Arithmetic Shifter w/ 4-to-1 Mux 4-to-1 Mux 00 01 10 11 s1 s0 S1 S0 D3 D2 D1 D0 0 X A3 A2 A1 A0 1 0 A3A3 A3 A2 A1 1 1 A2 A1 A0 0 D3 A2A3 4-to-1 Mux 00 01 10 11 s1 s0 D2 A1 4-to-1 Mux 00 01 10 11 s1 s0 D1 A0 4-to-1 Mux 00 01 10 11 s1 s0 D0 S1 S0 Right Shift Left Shift Overflow/Overflow/ UnderflowUnderflow Overflow Underflow Detection
  • 11. Rotator S1 S0 D3 D2 D1 D0 0 0 A3 A2 A1 A0 0 1 A0 A3 A2 A1 1 0 A1 A0 A3 A2 1 1 A2 A1 A0 A3 4-to-1 Mux 00 01 10 11 s1 s0 D3 A2A3 4-to-1 Mux 00 01 10 11 s1 s0 D2 A1 4-to-1 Mux 00 01 10 11 s1 s0 D1 A0 4-to-1 Mux 00 01 10 11 s1 s0 D0 S1 S0
  • 12. Barrel Shifter S2 S1 S0 D3 D2 D1 D0 0 0 0 A3 A2 A1 A0 0 0 1 A3 A3 A2 A1 0 1 0 A3 A3 A3 A2 0 1 1 A3 A3 A3 A3 1 0 0 A3 A2 A1 A0 1 0 1 A2 A1 A0 0 1 1 0 A1 A0 0 0 1 1 1 A0 0 0 0 Shift multiple bitsmultiple bits at a time Left Shift Right Shift
  • 13. Barrel Shifter Design w/ Mux (D3) S2 S1 S0 D3 D2 D1 D0 0 0 0 A3 A2 A1 A0 0 0 1 A3 A3 A2 A1 0 1 0 A3 A3 A3 A2 0 1 1 A3 A3 A3 A3 1 0 0 A3 A2 A1 A0 1 0 1 A2 A1 A0 0 1 1 0 A1 A0 0 0 1 1 1 A0 0 0 0 4-to-1 Mux 00 01 10 11 s1 s0 00 01 10 11 s1 s0 4-to-1 Mux 2-to-1Mux2-to-1Mux1 0 D3 A3 A3 A2 A1 A0 S0 S1 S2 Replicate and change wiring of the two 4-to-1 Muxes for D2, D1 and D0
  • 14. Barrel Shifter Design Alternative (16-bit) 23 Shifter 22 Shifter 21 Shifter 20 Shifter Left/Right S3 S2 S1 S0 16 16 16 16 (S3 S2 S1 S0) specifies the “shift amount” in binary(S3 S2 S1 S0) specifies the “shift amount” in binary 16 Output NumberOutput Number Input NumberInput Number
  • 15. Barrel Shifter Design w/ nMOSFET D3 D2 D1 D0 A3 S=0 (No Shift) S=1 S=2 S=3 A2 A1 A0 S=3 S=2 S=1
  • 16. A3A3A3 Barrel Shifter Design w/ nMOSFET D3 D2 D1 D0 A3 S=0 (No Shift) S=1 S=2S=2 S=3 A2 A1 A0 S=3 S=2S=2 S=1 A3 A2
  • 17. Barrel Shifter Design w/ nMOSFET D3 D2 D1 D0 A3 S=0 (No Shift) S=1S=1 S=2 S=3 A2 A1 A0 S=3 S=2 S=1S=1 = A3 = A3 = A2 = A1
  • 18. Unsigned Binary Multiply 101 (5) X 111 (7) ---------- 101 101 101 ---------- 100011 (35)
  • 19. Unsigned Integer Multiplier (2-bit) s 00100111 1011 0001 01 01 babababa baba baba bbx aa + 2-bit by 2-bit carrycarry out p0 a0b0 H.A. p1 c s a1b0a0b1 H.A.c s p2p3 a1b1
  • 20. Unsigned Integer Multiplier (3-bit) bababa bababa bababa bbbx aaa 202122 101112 000102 012 012 3-bit by 3-bit p0 a0b0 s F.A. p1 a1b0a0b1 0 co s ci c F.A. p2 s a2b0a1b1 co s ci c F.A. s co s ci a0b2 00 c F.A. p3 a2b1 co s ci c F.A.co s ci a1b2 0 s s s c p4 c F.A.co s ci a2b2 p5
  • 21. 4-bit Unsigned Integer Multiplier a0 b0 P0 a1 b0 a0 b1 ++ 0 P1 a2 b0 a1 b1 ++ a0 b2 ++ 0 P2 a3 b0 a2 b1 ++ a1 b2 ++ a0 b3 ++ 0 P3 a3 b1 ++ a2 b2 ++ a1 b3 ++ 0 P4 a3 b2 ++ a2 b3 ++ P5 a3 b3 ++ P6P7 a0 b0 ++ CinCout Sum A B Full AdderFull Adder a0b0 ≡≡
  • 22. Propagation Delay a0 b0 P0 a1 b0 a0 b1 ++ 0 P1 a2 b0 a1 b1 ++ a0 b2 ++ 0 P2 a3 b0 a2 b1 ++ a1 b2 ++ a0 b3 ++ 0 P3 a3 b1 ++ a2 b2 ++ a1 b3 ++ 0 P4 a3 b2 ++ a2 b3 ++ P5 a3 b3 ++ P6P7 1122 33 33 44 44 55 55 66 667788 4x4 Delay = 8 adders 8x8 Delay = 20 adders
  • 23. a3 b3 ++ P7 P6 Carry-Save Multiplier a0 b0 P0 a1 b0 a0 b1 ++ 0 P1 a2 b0 a1 b1 ++ a0 b2 ++ 0 P2 a3 b0 a2 b1 ++ a1 b2 ++ a0 b3 ++ 0 P3 a3 b2 ++ a2 b3 ++ P5 a3 b1 ++ a2 b2 a1 b3 ++ ++ 0 P4
  • 24. Propagation Delay of Carry-Save Multiplier a0 b0 P0 a3 b1 ++ a2 b2 a1 b3 ++ a3 b2 ++ a2 b3 ++ P5 a3 b3 ++ P7 a1 b0 a0 b1 ++ 0 P1 11 22 33 33 5566 4x4 Delay = 6 adders 8x8 Delay = 14 adders a2 b0 a1 b1 ++ a0 b2 ++ 0 P2 11 22 a3 b0 a2 b1 ++ a1 b2 ++ a0 b3 ++ 0 P3 11 22 33 ++44 0 P6 P4
  • 25. Signed Binary Multiply When the Multiplicand is negativeWhen the Multiplicand is negative 11101 (-3) 01001 (+9) -------------------- 11111101 00 11101 -------------------- 11100101 Maintain the sign bits of the partial product
  • 26. Signed Binary Multiply When the Multiplier is negativeWhen the Multiplier is negative 01001 (+9) 11101 (-3) -------------------- 01001 01001 -------------------- 0101101 01001 -------------------- 01110101 10111 -------------------- 111100101 (-27) At the last step, 2’s complement the multiplicand before adding
  • 27. Signed Binary Multiply When both the Multiplicand and Multiplier are negativeWhen both the Multiplicand and Multiplier are negative 10111 (-9) 11101 (-3) -------------------- 1110111 10111 -------------------- 11010011 10111 -------------------- 110001011 01001 -------------------- 000011011(+27) At the last step, 2’s complement the multiplicand before adding Maintain the sign bits of the partial product
  • 28. More Examples (1) 1111 1010 (-6) 0000 0101 (+5) -------------------- 111111 1010 111110 10 -------------------- 1110 0010 (-30) Assume 8-bit numbers
  • 29. More Examples (2) 0011 (+3) 1110 (-2) -------------------- 0 0110 00 11 -------------------- 01 0010 110 1 -------------------- 1010 (-6) Assume 4-bit numbers
  • 30. More Examples (3) 1111 1100 (-4) 1110 0000 (-32) -------------------- 11 1111 1000 0000 11 1111 00 -------------------- 111 1110 1000 0000 000 0010 0 -------------------- 000 0000 1000 0000 (+128) Assume 8-bit numbers