Full Adder Display. Topics A 1 bit adder with LED display Ripple Adder Signed/Unsigned Subtraction Hardware Implementation of 4-bit adder.

Slides:



Advertisements
Similar presentations
ADDER, HALF ADDER & FULL ADDER
Advertisements

L10 – Transistors Logic Math 1 Comp 411 – Spring /22/07 Arithmetic Circuits Didn’t I learn how to do addition in the second grade?
Lecture Adders Half adder.
7-Segment LED Display DD: Section Mano: Section 3.10.
Parallel Adder Recap To add two n-bit numbers together, n full-adders should be cascaded. Each full-adder represents a column in the long addition. The.
ECE 331 – Digital System Design
CSE-221 Digital Logic Design (DLD)
Arithmetic II CPSC 321 E. J. Kim. Today’s Menu Arithmetic-Logic Units Logic Design Revisited Faster Addition Multiplication (if time permits)
1 COMP541 Arithmetic Circuits Montek Singh Mar 20, 2007.
Arithmetic-Logic Units CPSC 321 Computer Architecture Andreas Klappenecker.
Homework Reading Machine Projects Labs
ECE 301 – Digital Electronics
ECE 301 – Digital Electronics
ECE 301 – Digital Electronics
ENGIN112 L14: Binary Adder Subtractor October 3, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 14 Binary Adders and Subtractors.
4-bit adder, multiplexer, timing diagrams, propagation delays
Part 2: DESIGN CIRCUIT. LOGIC CIRCUIT DESIGN x y z F F = x + y’z x y z F Truth Table Boolean Function.
Binary Addition Binary Multiplication Section 4.5 and 4.7.
Adders, subtractors, ALUs
 Arithmetic circuit  Addition  Subtraction  Division  Multiplication.
Chapter 3 Digital Logic Structures. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 3-2 Building Functions.
Calculator Lab Overview Note: Slides Updated 10/8/12
Logic Design CS221 1 st Term combinational circuits Cairo University Faculty of Computers and Information.
Outline Analysis of Combinational Circuits Signed Number Arithmetic
Dr. Ahmed El-Bialy, Dr. Sahar Fawzy Combinational Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy.
Binary Addition Section 4.5. Binary Addition Example.
ECE 3130 – Digital Electronics and Design
Functions of Combinational Logic
Chapter 6-1 ALU, Adder and Subtractor
ECE 3110: Introduction to Digital Systems Chapter 6 Combinational Logic Design Practices Adders, subtractors, ALUs.
ECEN 248 Lab 4: Multiplexer Based Arithmetic Logic Unit
درس مدارهای منطقی دانشگاه قم مدارهای منطقی محاسباتی تهیه شده توسط حسین امیرخانی مبتنی بر اسلایدهای درس مدارهای منطقی دانشگاه.
DIGITAL CIRCUITS David Kauchak CS52 – Fall 2015.
Lecture 18: Hardware for Arithmetic Today’s topic –Intro to Boolean functions (Continued) –Designing an ALU 1.
Half Adder & Full Adder Patrick Marshall. Intro Adding binary digits Half adder Full adder Parallel adder (ripple carry) Arithmetic overflow.
Binary Adder DesignSpring Binary Adders. Binary Adder DesignSpring n-bit Addition –Ripple Carry Adder –Conditional Sum Adder –(Carry Lookahead.
Logic and computers 2/6/12. Binary Arithmetic /6/ Only two digits: the bits 0 and 1 (Think: 0 = F, 1.
1 Arithmetic I Instructor: Mozafar Bag-Mohammadi Ilam University.
COMP541 Arithmetic Circuits
Combinational Circuits
Computer Architecture Lecture 16 Fasih ur Rehman.
ECE 331 – Digital System Design Multi-bit Adder Circuits, Adder/Subtractor Circuit, and Multiplier Circuit (Lecture #12)
1 Chapter 4 Combinational Logic Logic circuits for digital systems may be combinational or sequential. A combinational circuit consists of input variables,
Logic Design CS221 1 st Term combinational circuits Cairo University Faculty of Computers and Information.
Addition, Subtraction, Logic Operations and ALU Design
ECE 320 Homework #4 1. Using 8 data input selector logic (MUX), implement the following two functions: a) F(A,B,C)=S 0 S 2 S 3 S 5 b) F(A,B,C,D)=P 0 +P.
1 Fundamentals of Computer Science Combinational Circuits.
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.
Arithmetic-Logic Units. Logic Gates AND gate OR gate NOT gate.
ECE 3110: Introduction to Digital Systems Chapter 5 Combinational Logic Design Practices Adders,subtractors, ALUs.
President UniversityErwin SitompulDigital Systems 7/1 Lecture 7 Digital Systems Dr.-Ing. Erwin Sitompul President University
1 The ALU l ALU includes combinational logic. –Combinational logic  a change in inputs directly causes a change in output, after a characteristic delay.
ETE 204 – Digital Electronics Combinational Logic Design Single-bit and Multiple-bit Adder Circuits [Lecture: 9] Instructor: Sajib Roy Lecturer, ETE,ULAB.
Lecture No. 14 Combinational Functional Devices. Digital Logic &Design Dr. Waseem Ikram Lecture 14.
Gunjeet Kaur Dronacharya Group of Institutions. Binary Adder-Subtractor A combinational circuit that performs the addition of two bits is called a half.
Combinational Circuits
ECE 3130 Digital Electronics and Design
ECE 3130 Digital Electronics and Design
Homework Reading Machine Projects Labs
Digital Systems Section 8 Multiplexers. Digital Systems Section 8 Multiplexers.
Reference: Moris Mano 4th Edition Chapter 4
CSE Winter 2001 – Arithmetic Unit - 1
FIGURE 4.1 Block diagram of combinational circuit
HALF ADDER FULL ADDER Half Subtractor.
Number Systems and Circuits for Addition
Homework Reading Machine Projects Labs
Overview Part 1 – Design Procedure Part 2 – Combinational Logic
Combinational Circuits
Carryout bit? Carryout bit is ‘1’ also on four cases. When a, b and carryin are 110, 101, 011, 111. Does it mean that we need a similar circuit as sum?
Lecture 2 Adders Half adder.
Presentation transcript:

Full Adder Display

Topics A 1 bit adder with LED display Ripple Adder Signed/Unsigned Subtraction Hardware Implementation of 4-bit adder

Implementation of a Full Adder (carry-in)

Verilog Implementation Use switches to input binary numbers—x, y, and z. z is the carry-in. Display the output on the LED. Press a button to determine which bit will be displayed. s represents the sum bit. c represents the carry-out bit. A mux is used to determine Whether s or c should be displayed.

Multiplexing 7-Segment Displays (Last Week) Get values for an[3:0] from btn[3:0] so that only one LED is displayed. If s[1:0]=00, then x[3:0]. If s[1:0]=01, then x[7:4]. If s[1:0]=10, then x[11:8]. If s[1:0]=11, then x[15:12]. Use Quad 4-to-1 mux

Explanation of the Code If btn[0] is pushed, t[0] is 0. If btn[1] is pusehd, t[0] is 1. So we can use t[0] as a selector bit for the MUX. t[ ] =s[] If the output of the MUX is a 0, a 0 Is displayed. If the output of the MUX is a 1, a 1 is displayed.

Implementation of a Full Adder (carry-in)

Four-Bit Adder C 4 is calculated last because it takes C 0 8 gates to reach C 4. Each FA uses 2 XOR, 2 AND and 1 OR gate. A four-bit adder uses 8 XOR, 8 AND and 4 OR gate.

Alternative Naming Convention for the Full Adder

Hardware Simplification 2 gate delays for C 3 !

Four-bit adder with Carry Lookahead Ripple adder uses 8 XOR, 8 AND and 4 OR gate. Lookahead implementation: 8 XOR, (4+6) AND, 1 2-input OR, 2 3-input OR.

Advantages C1, C2 and C3 do not have to wait for C1 and C2 to progate. C3 is propagated at the same time as C1 and C2.

carry_lookahead.v

four_bit_adder_carry_lookahead.v

four_adder_carry_lookahead_top.v

Topics Calculations Examples – Signed Binary Number – Unsigned Binary Number Hardware Implementation Overflow Condition

Unsigned Number Decimalb1b (2-bit example)

Unsigned Addition 1+2= Decimalb1b Decimalb1b1 b0b

Unsigned Addition 1+3= Decimalb1b Decimalb1b1 b0b (Carry Out) (Indicates Overflow) Overflow can be an issue in unsigned addition.

Unsigned Subtraction (1) 1-2= Decimalb1b Decimalb1b1 b0b (1’s complement) (2’s complement)

Unsigned Subtraction (2) 2-1= Decimalb1b Decimalb1b Discarded

Summary for Unsigned Addition/Subtraction Overflow can be an issue in unsigned addition Unsigned Subtraction (M-N) – If M≥N, and end carry will be produced. The end carry is discarded. – If M<N, Take the 2’s complement of the sum Place a negative sign in front

Signed Binary Numbers 4-bit binary number – 1 bit is used as a signed bit – -8 to +7 – 2’s complement

Signed Addition (70+80) b7b7 b6b6 b5b5 b4b4 b3b3 b2b2 b1b1 b0b = = = = → → = = ↔-106 (Indicates a negative number) ↔ = =150 Conclusion: There is a problem of overflow Fix: Use the end carry as the sign bit, and let b7 be the extra bit.

Signed Subtraction (70-80) b7b7 b6b6 b5b5 b4b4 b3b3 b2b2 b1b1 b0b = = = =16+64= → → → → = ↔-10 (Indicates a negative number) (No Problem)

Signed Subtraction (-70-80) b7b7 b6b6 b5b5 b4b4 b3b3 b2b2 b1b1 b0b = = = =16+64 (Indicates a positive number! A negative number expected.) → → ↔ = = ↔-150 Conclusion: There is a problem of overflow Fix: Use the end carry as the sign bit, and let b7 be the extra bit.

Observations Given the similarity between addition and subtraction, same hardware can be used. Overflow is an issue that needs to be addressed in the hardware implementation A signed number is not processed any different from an unsigned number. The programmer must interpret the results of addition and subtraction appropriately.

Four-Bit Adder-Subtractor

The Mode Input (1)

The Mode Input (2)

M=0 (Addition) 0 B3B3 B2B2 B1B1 B0B0

M=1 (Subtraction) 1 2’s complement is generated of B is generated!

Unsigned Addition When two unsigned numbers are added, an overflow is detected from the end carry.

Detect Overflow in Signed Addition Observe 1.The cary into the sign bit 2.The carry out of the sign bit If they are not equal, they indicate an overflow.

FPGA Demo: 12+15

FPGA: 15-12

FPGA: 12-15