ECE 331 – Digital System Design

Slides:



Advertisements
Similar presentations
L23 – Adder Architectures. Adders  Carry Lookahead adder  Carry select adder (staged)  Carry Multiplexed Adder  Ref: text Unit 15 9/2/2012 – ECE 3561.
Advertisements

Combinational Circuits. Analysis Diagram Designing Combinational Circuits In general we have to do following steps: 1. Problem description 2. Input/output.
Comparator.
Lecture Adders Half adder.
DPSD This PPT Credits to : Ms. Elakya - AP / ECE.
Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Arithmetic See: P&H Chapter 3.1-3, C.5-6.
ECE 331 – Digital System Design
EECS Components and Design Techniques for Digital Systems Lec 18 – Arithmetic II (Multiplication) David Culler Electrical Engineering and Computer.
ECE C03 Lecture 61 Lecture 6 Arithmetic Logic Circuits Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
Chapter # 5: Arithmetic Circuits Contemporary Logic Design Randy H
Lecture 8 Arithmetic Logic Circuits
Computer ArchitectureFall 2008 © August 25, CS 447 – Computer Architecture Lecture 3 Computer Arithmetic (1)
Design of Arithmetic Circuits – Adders, Subtractors, BCD adders
1 COMP541 Arithmetic Circuits Montek Singh Mar 20, 2007.
ECE 301 – Digital Electronics
ECE 331 – Digital System Design Single-bit Adder Circuits and Adder Circuits in VHDL (Lecture #12) The slides included herein were taken from the materials.
ECE 301 – Digital Electronics
ECE 301 – Digital Electronics
ECE 331 – Digital System Design
ENGIN112 L14: Binary Adder Subtractor October 3, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 14 Binary Adders and Subtractors.
Chapter 5 Arithmetic Logic Functions. Page 2 This Chapter..  We will be looking at multi-valued arithmetic and logic functions  Bitwise AND, OR, EXOR,
Charles Kime & Thomas Kaminski © 2008 Pearson Education, Inc. (Hyperlinks are active in View Show mode) Chapter 4 – Arithmetic Functions Logic and Computer.
Part 2: DESIGN CIRCUIT. LOGIC CIRCUIT DESIGN x y z F F = x + y’z x y z F Truth Table Boolean Function.
CS 105 Digital Logic Design
Logic Design CS221 1 st Term combinational circuits Cairo University Faculty of Computers and Information.
Outline Analysis of Combinational Circuits Signed Number Arithmetic
Logical Circuit Design Week 8: Arithmetic Circuits Mentor Hamiti, MSc Office ,
+ CS 325: CS Hardware and Software Organization and Architecture Combinational Circuits 1.
Digital Arithmetic and Arithmetic Circuits
ECE2030 Introduction to Computer Engineering Lecture 12: Building Blocks for Combinational Logic (3) Adders/Subtractors, Parity Checkers Prof. Hsien-Hsin.
Chapter 4 – Arithmetic Functions and HDLs Logic and Computer Design Fundamentals.
Fall 2004EE 3563 Digital Systems Design EE 3563 Comparators  Comparators determine if two binary inputs are equal  Some will signal greater than/less.
Chapter # 5: Arithmetic Circuits
Chapter 6-1 ALU, Adder and Subtractor
5-1 Programmable and Steering Logic Chapter # 5: Arithmetic Circuits.
CSE 241 Computer Organization Lecture # 9 Ch. 4 Computer Arithmetic Dr. Tamer Samy Gaafar Dept. of Computer & Systems Engineering.
Logic Gates Logic gates are electronic digital circuit perform logic functions. Commonly expected logic functions are already having the corresponding.
درس مدارهای منطقی دانشگاه قم مدارهای منطقی محاسباتی تهیه شده توسط حسین امیرخانی مبتنی بر اسلایدهای درس مدارهای منطقی دانشگاه.
CHAPTER 4 Combinational Logic Design- Arithmetic Operation (Section 4.6&4.9)
1 Lecture 6 BOOLEAN ALGEBRA and GATES Building a 32 bit processor PH 3: B.1-B.5.
ECE 331 – Digital System Design Representation and Binary Arithmetic of Negative Numbers and Binary Codes (Lecture #10) The slides included herein were.
Half Adder & Full Adder Patrick Marshall. Intro Adding binary digits Half adder Full adder Parallel adder (ripple carry) Arithmetic overflow.
ECE 331 – Digital System Design Single-bit Adder Circuits and Adder Circuits in VHDL (Lecture #11) The slides included herein were taken from the materials.
1 Lecture 12 Time/space trade offs Adders. 2 Time vs. speed: Linear chain 8-input OR function with 2-input gates Gates: 7 Max delay: 7.
Lecture 4. Adder & Subtractor Prof. Taeweon Suh Computer Science Education Korea University 2010 R&E Computer System Education & Research.
Combinational Circuits
ECE 301 – Digital Electronics Representation of Negative Numbers, Binary Arithmetic of Negative Numbers, and Binary Codes (Lecture #11) The slides included.
Topics covered: Arithmetic CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
Kavita Bala CS 3410, Spring 2014 Computer Science Cornell University.
ECE 331 – Digital System Design Multi-bit Adder Circuits, Adder/Subtractor Circuit, and Multiplier Circuit (Lecture #12)
CS/EE 3700 : Fundamentals of Digital System Design Chris J. Myers Lecture 5: Arithmetic Circuits Chapter 5 (minus 5.3.4)
Computer Architecture
1 Chapter 4 Combinational Logic Logic circuits for digital systems may be combinational or sequential. A combinational circuit consists of input variables,
C-H1 Lecture Adders Half adder. C-H2 Full Adder si is the modulo- 2 sum of ci, xi, yi.
Addition, Subtraction, Logic Operations and ALU Design
CEC 220 Digital Circuit Design
CHAPTER 2 Digital Combinational Logic/Arithmetic Circuits
1 Fundamentals of Computer Science Combinational Circuits.
Addition and multiplication Arithmetic is the most basic thing you can do with a computer, but it’s not as easy as you might expect! These next few lectures.
1 Lecture 14 Binary Adders and Subtractors. 2 Overview °Addition and subtraction of binary data is fundamental Need to determine hardware implementation.
Number Representation (Part 2) Computer Architecture (Fall 2006)
Lecture #23: Arithmetic Circuits-1 Arithmetic Circuits (Part I) Randy H. Katz University of California, Berkeley Fall 2005.
ECE DIGITAL LOGIC LECTURE 15: COMBINATIONAL CIRCUITS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2015, 10/20/2015.
ETE 204 – Digital Electronics Combinational Logic Design Single-bit and Multiple-bit Adder Circuits [Lecture: 9] Instructor: Sajib Roy Lecturer, ETE,ULAB.
Arithmetic Circuits I. 2 Iterative Combinational Circuits Like a hierachy, except functional blocks per bit.
Addition and multiplication1 Arithmetic is the most basic thing you can do with a computer, but it’s not as easy as you might expect! These next few lectures.
Gunjeet Kaur Dronacharya Group of Institutions. Binary Adder-Subtractor A combinational circuit that performs the addition of two bits is called a half.
ECE 331 – Digital System Design
CSE Winter 2001 – Arithmetic Unit - 1
ECE 301 – Digital Electronics
Presentation transcript:

ECE 331 – Digital System Design Multiple-bit Adder Circuits and Adder Circuits in VHDL (Lecture #13) The slides included herein were taken from the materials accompanying Fundamentals of Logic Design, 6th Edition, by Roth and Kinney, and were used with permission from Cengage Learning.

Multiple-bit Adder Circuits How do you design a combinational logic circuit to add two 4-bit binary numbers? Spring 2011 ECE 331 - Digital System Design

ECE 331 - Digital System Design A 4-bit Adder Circuit Spring 2011 ECE 331 - Digital System Design

ECE 331 - Digital System Design A 4-bit Adder Circuit Design a two-level logic circuit Construct a truth table 9 inputs (A3..A0, B3..B0, Cin) 5 outputs (S3..S0, Cout) Derive minimized Boolean expressions What is the problem with this design approach? What happens when n gets large? Spring 2011 ECE 331 - Digital System Design

ECE 331 - Digital System Design A 4-bit Adder Circuit Use a hierarchical design approach. Design a logic circuit (i.e. module) to add two 1-bit numbers and a carry-in. 3 inputs (A, B, Cin) 2 outputs (S, Cout) Connect 4 modules to form a 4-bit adder. This design approach can easily be extended to n bits. Spring 2011 ECE 331 - Digital System Design

Multiple-bit Adder Circuits Two designs for multiple-bit adders: 1. Ripple Carry Adder 2. Carry Lookahead Adder Spring 2011 ECE 331 - Digital System Design

ECE 331 - Digital System Design Ripple Carry Adder Spring 2011 ECE 331 - Digital System Design

ECE 331 - Digital System Design Ripple Carry Adder 1 + Carry-in Carry-out Carry ripples from one column to the next Spring 2011 ECE 331 - Digital System Design

ECE 331 - Digital System Design Ripple Carry Adder An n-bit RCA consists of n Full Adders. The carry-out from bit i is connected to the carry-in of bit (i+1). Simple design Relatively slow Each sum bit can be calculated only after the previous carry-out bit has been calculated. Delay ~ (n) * (delay of FA) Spring 2011 ECE 331 - Digital System Design

ECE 331 - Digital System Design Ripple Carry Adder C0 C1 C2 … C3 Cn-1 Cn S0 A0 B0 Carry-out Carry ripples from one stage to the next Carry-in LSB position MSB position A1 B1 A2 B2 An-1 Bn-1 S1 S2 Sn-1 FAn-1 FA2 FA1 FA0 Spring 2011 ECE 331 - Digital System Design

Multiple-bit Adder Circuits The Ripple Carry Adder (RCA) may become prohibitively slow as the number of bits to add becomes large. The Carry Lookahead Adder (CLA) provides a significant increase in speed at the cost of additional hardware (i.e. logic gates). Spring 2011 ECE 331 - Digital System Design

ECE 331 - Digital System Design Carry Lookahead Adder Spring 2011 ECE 331 - Digital System Design

ECE 331 - Digital System Design Carry Lookahead Adder 1 + Carry Generate Carry End Carry Propagate A B Spring 2011 ECE 331 - Digital System Design

ECE 331 - Digital System Design Carry Lookahead Adder A CLA uses the carry generate and carry propagate concepts to produce the carry bits. A carry is generated iff both A and B are 1. Generate: G(A,B) = A.B A carry is propagated if either A or B is 1. If Cin = 1 and (A or B) = 1 then Cout = 1 Propagate: P(A,B) = A + B Alternate Propagate: P*(A,B) = A xor B Spring 2011 ECE 331 - Digital System Design

ECE 331 - Digital System Design The Full Adder Circuit A xor B = P*(A,B) A.B = G(A,B) Source: Wikipedia – Adder (Electronics) (http://en.wikipedia.org/wiki/Adder_electronics) Spring 2011 ECE 331 - Digital System Design

ECE 331 - Digital System Design Carry Lookahead Adder Source: Wikipedia – Adder (Electronics) (http://en.wikipedia.org/wiki/Adder_electronics) Spring 2011 ECE 331 - Digital System Design

ECE 331 - Digital System Design Carry Lookahead Adder For each bit (or stage) of the multiple-bit adder, the carry-out can be defined in terms of the generate and propagate functions, and the carry-in: Ci+1 = Gi + (Pi . Ci) Ai+Bi Ai.Bi carry-in carry-out Pi* can also be used. Spring 2011 ECE 331 - Digital System Design

ECE 331 - Digital System Design Carry Lookahead Adder For bit 0 (LSB): C1 = G0 + (P0 . C0) C1 = (A0 . B0) + ((A0 + B0) . C0) C1 = (A0 . B0) + ((A0 xor B0) . C0) C1 is a function of primary inputs Three-level circuit, therefore 3-gate delay Not a function of previous carries (except C0), therefore no ripple carry. using Pi* Spring 2011 ECE 331 - Digital System Design

ECE 331 - Digital System Design Carry Lookahead Adder For bit 1: C2 = G1 + (P1 . C1) C2 = (A1 . B1) + ((A1 + B1) . C1) C2 = (A1 . B1) + ((A1 + B1) . ((A0 . B0) + ((A0 + B0) . C0)) C2 is a function of primary inputs Three-level circuit, therefore 3-gate delay Not a function of previous carries (except C0), therefore no ripple carry. Spring 2011 ECE 331 - Digital System Design

ECE 331 - Digital System Design Carry Lookahead Adder For bit 2: C3 = G2 + (P2 . C2) C3 = G2 + (P2 . (G1 + (P1 . C1)) C3 = G2 + (P2 . (G1 + (P1 . (G0 + (P0 . C0))) C3 is a function of primary inputs Three-level circuit, therefore 3-gate delay Not a function of previous carries (except C0), therefore no ripple carry. Spring 2011 ECE 331 - Digital System Design

ECE 331 - Digital System Design Carry Lookahead Adder For bit i: Ci+1 = F(G0..Gi, P0..Pi, C0) For i > 4, the silicon area required for the carry circuits becomes prohibitively large. Tradeoff: speed vs. area. How, then, do you build a bigger adder? Spring 2011 ECE 331 - Digital System Design

ECE 331 - Digital System Design A 16-bit Adder Circuit C0 C4 C8 C12 C16 S3-0 A3-0 B3-0 A7-4 B7-4 S7-4 A11-8 B11-8 S11-8 A15-12 B15-12 S15-12 Ripple carry (between CLAs) CLA3 CLA2 CLA1 CLA0 Spring 2011 ECE 331 - Digital System Design

ECE 331 - Digital System Design A 4-bit CLA (Standard Component) Spring 2011 ECE 331 - Digital System Design

Multiple-bit Adder/Subtractor Circuit Spring 2011 ECE 331 - Digital System Design

Multiple-bit Adder/Subtractor Build separate binary adder and subtractor Not common. Use 2's Complement representation Addition uses binary adder Subtraction uses binary adder with 2's Complement representation for subtrahend Issues Cannot represent a positive number with the same magnitude as the most negative n-bit number Must detect overflow Spring 2011 ECE 331 - Digital System Design

ECE 331 - Digital System Design A 4-bit Subtractor A – B = A + (-B) represent with 2's complement Spring 2011 ECE 331 - Digital System Design

Multiple-bit Adder/Subtractor 1 n – x c -bit adder y Add  Sub control Spring 2011 ECE 331 - Digital System Design

ECE 331 - Digital System Design Detecting Overflow Spring 2011 ECE 331 - Digital System Design

Detecting Overflow for Addition Overflow occurs if the result is out of range. Overflow cannot occur when adding a positive number and a negative number. Overflow occurs when adding two numbers with the same sign. Two positive numbers → negative number Two negative numbers → positive number Can you write a Boolean expression to detect overflow? Spring 2011 ECE 331 - Digital System Design

Detecting Overflow for Subtraction Overflow occurs if the result is out of range. Overflow cannot occur when subtracting two numbers with the same sign. Overflow occurs when subtracting a positive number from a negative number or a negative number from a positive number. positive # - negative # → negative # negative # - positive # → positive # Can you write a Boolean expression to detect overflow? Spring 2011 ECE 331 - Digital System Design

ECE 331 - Digital System Design VHDL Spring 2011 ECE 331 - Digital System Design

The For-Generate Statement The for-generate statement uses a for loop to instantiate multiple copies of the same component. The loop variable is used as the index in the port and signal names in the component instantiation. The ports and signals must be defined using composite types (i.e. vectors) Format for the for-generate statement generate_label: for <loop_index> in 0 to n-1 generate <instance_name>: <component_name> port map ( signal mapping ); end generate <generate_label>; Spring 2011 ECE 331 - Digital System Design

ECE 331 - Digital System Design Adder Circuits in VHDL Spring 2011 ECE 331 - Digital System Design

ECE 331 - Digital System Design A 4-bit RCA in VHDL C0 C1 C2 C3 C4 S0 A0 B0 A1 B1 A2 B2 A3 B3 S1 S2 S3 FA3 FA2 FA1 FA0 Spring 2011 ECE 331 - Digital System Design

ECE 331 - Digital System Design A 4-bit RCA in VHDL Cin Cout A[3..0] B[3..0] S[3..0] 4-bit RCA Spring 2011 ECE 331 - Digital System Design

ECE 331 - Digital System Design A 4-bit RCA in VHDL Spring 2011 ECE 331 - Digital System Design

ECE 331 - Digital System Design A 4-bit RCA in VHDL Spring 2011 ECE 331 - Digital System Design

ECE 331 - Digital System Design A 4-bit RCA in VHDL Cin Cout Spring 2011 ECE 331 - Digital System Design

ECE 331 - Digital System Design A 4-bit RCA in VHDL Cin Cout Spring 2011 ECE 331 - Digital System Design

ECE 331 - Digital System Design A 4-bit RCA in VHDL Cin Cout Spring 2011 ECE 331 - Digital System Design

ECE 331 - Digital System Design Questions? Spring 2011 ECE 331 - Digital System Design