ECE2030 Introduction to Computer Engineering Lecture 13: Building Blocks for Combinational Logic (4) Shifters, Multipliers Prof. Hsien-Hsin Sean Lee School.

Slides:



Advertisements
Similar presentations
Kuliah Rangkaian Digital Kuliah 7: Unit Aritmatika
Advertisements

Arithmetic for Computers
L10 – Transistors Logic Math 1 Comp 411 – Spring /22/07 Arithmetic Circuits Didn’t I learn how to do addition in the second grade?
Speical purpose Encoders/Comparators
Comparator.
Datapath Functional Units. Outline  Comparators  Shifters  Multi-input Adders  Multipliers.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 3:
Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Arithmetic See: P&H Chapter 3.1-3, C.5-6.
1 CS 140 Lecture 14 Standard Combinational Modules Professor CK Cheng CSE Dept. UC San Diego Some slides from Harris and Harris.
EECS Components and Design Techniques for Digital Systems Lec 18 – Arithmetic II (Multiplication) David Culler Electrical Engineering and Computer.
Fixed-Point Arithmetics: Part I
Computer Structure - The ALU Goal: Build an ALU  The Arithmetic Logic Unit or ALU is the device that performs arithmetic and logical operations in the.
ECE C03 Lecture 61 Lecture 6 Arithmetic Logic Circuits Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
Lecture 8 Arithmetic Logic Circuits
Arithmetic and Logical Operations
Combinational Comparators
EE466: VLSI Design Lecture 14: Datapath Functional Units.
Introduction to CMOS VLSI Design Datapath Functional Units
ECE 301 – Digital Electronics
DIGITAL SYSTEMS TCE1111 Representation and Arithmetic Operations with Signed Numbers Week 6 and 7 (Lecture 1 of 2)
Datapath Functional Units Adapted from David Harris of Harvey Mudd College.
1 Arithmetic and Logical Operations - Part II. Unsigned Numbers Addition in unsigned numbers is the same regardless of the base. Given a pair of bit sequences.
Lecture 18: Datapath Functional Units
ECE 4110– Sequential Logic Design
Computer Architecture Lecture 3: Logical circuits, computer arithmetics Piotr Bilski.
ECE2030 Introduction to Computer Engineering Lecture 12: Building Blocks for Combinational Logic (3) Adders/Subtractors, Parity Checkers Prof. Hsien-Hsin.
Copyright 1995 by Coherence LTD., all rights reserved (Revised: Oct 97 by Rafi Lohev, Oct 99 by Yair Wiseman, Sep 04 Oren Kapah) IBM י ב מ 10-1 The ALU.
Chapter 6-1 ALU, Adder and Subtractor
Introduction to Computer Organization and Architecture Lecture 10 By Juthawut Chantharamalee wut_cha/home.htm.
07/19/2005 Arithmetic / Logic Unit – ALU Design Presentation F CSE : Introduction to Computer Architecture Slides by Gojko Babić.
CSE 241 Computer Organization Lecture # 9 Ch. 4 Computer Arithmetic Dr. Tamer Samy Gaafar Dept. of Computer & Systems Engineering.
Spring 2002EECS150 - Lec12-cl3 Page 1 EECS150 - Digital Design Lecture 12 - Combinational Logic Circuits Part 3 March 4, 2002 John Wawrzynek.
Multiplication of signed-operands
55:035 Computer Architecture and Organization Lecture 5.
Advanced VLSI Design Unit 05: Datapath Units. Slide 2 Outline  Adders  Comparators  Shifters  Multi-input Adders  Multipliers.
ECEN 248 Lab 4: Multiplexer Based Arithmetic Logic Unit
درس مدارهای منطقی دانشگاه قم مدارهای منطقی محاسباتی تهیه شده توسط حسین امیرخانی مبتنی بر اسلایدهای درس مدارهای منطقی دانشگاه.
Arithmetic Functions BIL- 223 Logic Circuit Design Ege University Department of Computer Engineering.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 3:
1 Arithmetic and Logic Operations Patt and Patel Ch. 2 & 3.
1 Arithmetic I Instructor: Mozafar Bag-Mohammadi Ilam University.
N, Z, C, V in CPSR with Adder & Subtractor Prof. Taeweon Suh Computer Science Education Korea University.
Combinational Circuits
Topics covered: Arithmetic CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
ECE 331 – Digital System Design Multi-bit Adder Circuits, Adder/Subtractor Circuit, and Multiplier Circuit (Lecture #12)
COE 308: Computer Architecture (T032) Dr. Marwan Abu-Amara Integer & Floating-Point Arithmetic (Appendix A, Computer Architecture: A Quantitative Approach,
Arithmetic Operations
ECE/CS 552: Arithmetic I Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes partially based on set created by Mark Hill.
ECE DIGITAL LOGIC LECTURE 15: COMBINATIONAL CIRCUITS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2015, 10/20/2015.
Computer Organization and Design Arithmetic & Logic Circuits Montek Singh Nov 2, 2015 Lecture 11.
By Wannarat Computer System Design Lecture 3 Wannarat Suntiamorntut.
Lecture 8. ALU, Shifter, Counter,
Lecture 7. Subtractor Prof. Taeweon Suh Computer Science & Engineering Korea University COSE221, COMP211 Logic Design.
B0110 ALU ENGR xD52 Eric VanWyk Fall Today Back to Gates! Review Timing with Adders Compare Growth Characteristics Construct Adder/Subtractor Construct.
Computer System Design Lecture 3
Combinational Circuits
Multiplication
Prof. Hsien-Hsin Sean Lee
Multiplication
Arithmetic Circuits Didn’t I learn how
CSE Winter 2001 – Arithmetic Unit - 1
Unsigned Multiplication
CS 140 Lecture 14 Standard Combinational Modules
By: A. H. Abdul Hafez CAO, by Dr. A.H. Abdul Hafez, CE Dept. HKU
CSE 140 Lecture 14 Standard Combinational Modules
Instructor: Mozafar Bag-Mohammadi University of Ilam
ECE 352 Digital System Fundamentals
Combinational Circuits
Number Representation
Lecture 9: Shift, Mult, Div Fixed & Floating Point
Presentation transcript:

ECE2030 Introduction to Computer Engineering Lecture 13: Building Blocks for Combinational Logic (4) Shifters, Multipliers Prof. Hsien-Hsin Sean Lee School of Electrical and Computer Engineering Georgia Tech

2 Basic Shifting Shift directions –Left (multiply by 2) –Right (divide by 2) Take floor value if the result is not an integer X X,Floor value of X (or  X  ) is the greatest integer number less than or equal to 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: ( << 1) = ( << 3) = Shift right –MSB: Shifted in with a “0” –LSB: Shifted out –Examples: (Some ISA use triple “>” for logical right shift) ( >>> 1) = ( >>> 3) =

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 Arithmetic shift right by 1  Arithmetic shift left by 1  (= -65) Arithmetic shift left by 1 (i.e. x2)  (= +126  -130)  Underflow ! (= +66) Arithmetic shift left by 1 (i.e. x2)  (= -124  +132)  Overflow ! Overflow/Underflow

6 4-bit Logical Shifter S1S0D3D2D1D0 0XA3A2A1A0 100A3A2A1 11A2A1A00 A3 A2A1A0 D3 D2D1D0 S/NS S0 S1 L/R

7 4-bit Logical Shifter using 4-to-1 Mux 4-to-1 Mux s1 s0 S1S0D3D2D1D0 0XA3A2A1A0 100A3A2A1 11A2A1A00 D3 A2A3 4-to-1 Mux s1 s0 D2 A1 4-to-1 Mux s1 s0 D1 A0 4-to-1 Mux s1 s0 D0 S1 S0 Right Shift Left Shift

8 4-bit Arithmetic Shifter w/ 4-to-1 Mux 4-to-1 Mux s1 s0 S1S0D3D2D1D0 0XA3A2A1A0 10A3A3A2A1 11A2A1A00 D3 A2A3 4-to-1 Mux s1 s0 D2 A1 4-to-1 Mux s1 s0 D1 A0 4-to-1 Mux s1 s0 D0 S1 S0 Right Shift Left Shift

9 4-bit Arithmetic Shifter w/ 4-to-1 Mux 4-to-1 Mux s1 s0 S1S0D3D2D1D0 0XA3A2A1A0 10A3A3A2A1 11A2A1A00 D3 A2A3 4-to-1 Mux s1 s0 D2 A1 4-to-1 Mux s1 s0 D1 A0 4-to-1 Mux s1 s0 D0 S1 S0 Right Shift Left Shift Overflow/Underflow

10 4-bit Arithmetic Shifter w/ 4-to-1 Mux 4-to-1 Mux s1 s0 S1S0D3D2D1D0 0XA3A2A1A0 10A3A3A2A1 11A2A1A00 D3 A2A3 4-to-1 Mux s1 s0 D2 A1 4-to-1 Mux s1 s0 D1 A0 4-to-1 Mux s1 s0 D0 S1 S0 Right Shift Left Shift Overflow/Underflow Overflow Underflow Detection

11 Rotator S1S0D3D2D1D0 00A3A2A1A0 01 A3A2A1 10 A0A3A2 11 A1A0A3 4-to-1 Mux s1 s0 D3 A2A3 4-to-1 Mux s1 s0 D2 A1 4-to-1 Mux s1 s0 D1 A0 4-to-1 Mux s1 s0 D0 S1 S0

12 Barrel Shifter S2S1S0D3D2D1D0 000A3A2A1A0 001A3 A2A1 010A3 A2 011A3 100 A2A1A0 101A2A1A00 110A1A multiple bits Shift multiple bits at a time Left Shift Right Shift

13 Barrel Shifter Design w/ Mux (D3) S2S1S0D3D2D1D0 000A3A2A1A0 001A3 A2A1 010A3 A2 011A3 100 A2A1A0 101A2A1A00 110A1A to-1 Mux s1 s s1 s0 4-to-1 Mux 2-to-1 Mux 1 0 D3 A3 A2A1A0 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) 2 3 Shifter 2 2 Shifter 2 1 Shifter 2 0 Shifter Left/Right S3 S2 S1 S0 16 (S3 S2 S1 S0) specifies the “shift amount” in binary 16 Output Number Input Number

15 Barrel Shifter Design w/ nMOSFET D3 D2 D1 D0 A3 S=0 (No Shift) S=1S=2S=3 A2 A1 A0 S=3 S=2 S=1

16 A3 Barrel Shifter Design w/ nMOSFET D3 D2 D1 D0 A3 S=0 (No Shift) S=1S=2S=3 A2 A1 A0 S=3 S=2 S=1 A3 A2

17 Barrel Shifter Design w/ nMOSFET D3 D2 D1 D0 A3 S=0 (No Shift)S=1S=2S=3 A2 A1 A0 S=3 S=2 S=1 = A3 = A2 = A1

18 Unsigned Binary Multiply 101 (5) X 111 (7) (35)

19 Unsigned Integer Multiplier (2-bit) s 2-bit by 2-bit carry carry out p0 a0b0 H.A. p1 c s a1b0a0b1 H.A. c s p2p3 a1b1

20 Unsigned Integer Multiplier (3-bit) 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 + P6 P7 a0 b0 + Cin Cout Sum AB Full 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 + P6 P x4 Delay = 8 adders 8x8 Delay = 20 adders

23 a3 b3 + P7P6 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 b 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 P x4 Delay = 6 adders 8x8 Delay = 14 adders a2 b0 a1 b1 + a0 b2 + 0 P2 1 2 a3 b0 a2 b1 + a1 b2 + a0 b3 + 0 P P6P4

25 Signed Binary Multiply When the Multiplicand is negative (-3) (+9) Maintain the sign bits of the partial product

26 Signed Binary Multiply When the Multiplier is negative (+9) (-3) (-27) At the last step, 2’s complement the multiplicand before adding

27 Signed Binary Multiply When both the Multiplicand and Multiplier are negative (-9) (-3) (+27) At the last step, 2’s complement the multiplicand before adding Maintain the sign bits of the partial product

28 More Examples (1) (-6) (+5) (-30) Assume 8-bit numbers

29 More Examples (2) 0011 (+3) 1110 (-2) (-6) Assume 4-bit numbers

30 More Examples (3) (-4) (-32) (+128) Assume 8-bit numbers