Adders Lecture L7.1 Section 6.2 Section 10.4 (pp 270-272)

Slides:



Advertisements
Similar presentations
Abdullah Said Alkalbani University of Buraimi
Advertisements

Adders and Subtractors
Adders Module M8.1 Section 6.2. Adders Half Adder Full Adder TTL Adder.
Modulo-N Counters Module M10.4 Section 7.2.
Encoders Module M9.3 Section 6.3. Encoders Priority Encoders TTL Encoders.
Demultiplexers Module M6.4 Section 6.4. Demultiplexers YIN 1 x 4 DeMUX d0d1 Y0 Y1 Y2 Y3 Y0 Y1 Y2 Y3 d1d0 0 0 YIN YIN YIN
Cs 1110 Ch 4-1 Combinational Logic. ° Introduction Logic circuits for digital systems may be: °2°2 combinational sequential OR A combinational circuit.
7-Segment Displays Lecture L6.1 Section 6.3. Turning on an LED.
Magnitude Comparator Lecture L6.4 Section 6.1.
Combinational Circuits. Analysis Diagram Designing Combinational Circuits In general we have to do following steps: 1. Problem description 2. Input/output.
Comparator.
Lab 10 : Arithmetic Systems : Adder System Layout: Slide #2 Slide #3 Slide #4 Slide #5 Arithmetic Overflow: 2’s Complement Conversions: 8 Bit Adder/Subtractor.
Number Systems Discussion D4.1 Appendix C. Number Systems Counting in Binary Positional Notation Hexadecimal Numbers Negative Numbers.
Binary-to-BCD Converter Lecture L6.2 Section 6.5 pp
ECE 331 – Digital System Design
Multiplier Lecture L7.3 Section 10.4 (p.276) Section 7.3 (Handout)
Multiplexers Lecture L6.4 Section 6.4.
Subtractors Module M8.2 Section 6.2. Subtractors Half Subtractor Full Subtractor Adder/Subtractor - 1 Adder/Subtractor - 2.
Binary Subtraction Section 3-9 Mano & Kime. Binary Subtraction Review from CSE 171 Two’s Complement Negative Numbers Binary Adder-Subtractors 4-bit Adder/Subtractor.
Equality Detector Lecture L6.1 Section 6.1. Equality Detector XNOR X Y Z Z = !(X $ Y) X Y Z
Codes and Code Converters
Code Converters Module M7.1 Section 6.5. Code Converters Binary-to-BCD Converters ABEL TRUTH_TABLE Command.
CS 140 Lecture 14 Professor CK Cheng 11/14/02. Part II. Standard Modules A.Interconnect B.Operators. Adders Multiplier Adders1. Representation of numbers.
Arithmetic Logic Unit (ALU) Lecture L7.5 Section 7.5.
Introduction to Computer Engineering by Richard E. Haskell Addition and Subtraction Instructions Module M16.3 Section 10.4.
Multiplexers Module M6.1 Section 6.4. Multiplexers A 4-to-1 MUX TTL Multiplexer A 2-to-1 MUX.
Decoders Module M9.1 Section 6.3. Decoders TTL Decoders.
Arithmetic Logic Unit (ALU) Lecture L9.3 Lab 10. ALU CB = carry_borrow flag Z = zero flag (Z = 1 if Y = 0)
Equality Detector Lecture L6.3 Section 6.1. Equality Detector XNOR X Y Z Z = !(X $ Y) X Y Z
7-Segment Displays Module M7.2 Section 6.5. Turning on an LED Common Anode.
Homework Reading Machine Projects Labs
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.
Charles Kime & Thomas Kaminski © 2008 Pearson Education, Inc. (Hyperlinks are active in View Show mode) Chapter 4 – Arithmetic Functions Logic and Computer.
©2008 The McGraw-Hill Companies, Inc. All rights reserved. Digital Electronics Principles & Applications Seventh Edition Chapter 10 Arithmetic Circuits.
1 Lecture 2: Number Systems Binary numbers Base conversion Arithmetic Number systems  Sign and magnitude  Ones-complement  Twos-complement Binary-coded.
Binary Arithmetic Adding Binary numbers Overflow conditions
Calculator Lab Overview Note: Slides Updated 10/8/12
Overview of Chapter 4 °Design digital circuit from specification °Digital inputs and outputs known Need to determine logic that can transform data °Start.
Combinational and Sequential Logic Circuits.
Basic Arithmetic (adding and subtracting)
Eng. Mohammed Timraz Electronics & Communication Engineer University of Palestine Faculty of Engineering and Urban planning Software Engineering Department.
Chapter 6-1 ALU, Adder and Subtractor
Basic Arithmetic (adding and subtracting)
Digital Electronics and Computer Interfacing
Lab 6 Module M8.3. EXPERIMENT 6: Adder/Subtractor PRE-LAB 1.Read and understand text Sec. 6.2, Adders and Subtractors, pages Using textbook.
Logic Gates Logic gates are electronic digital circuit perform logic functions. Commonly expected logic functions are already having the corresponding.
Number Systems and Circuits for Addition Lecture 5 Section 1.5 Thu, Jan 26, 2006.
1 Ethics of Computing MONT 113G, Spring 2012 Session 5 Binary Addition.
ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 7 Dr. Shi Dept. of Electrical and Computer Engineering.
Combinational Logic Design
Number Systems and Circuits for Addition – Binary Adders Lecture 6 Section 1.5 Fri, Jan 26, 2007.
CHAPTER 2 Digital Combinational Logic/Arithmetic Circuits
1 Lecture 14 Binary Adders and Subtractors. 2 Overview °Addition and subtraction of binary data is fundamental Need to determine hardware implementation.
1 Ethics of Computing MONT 113G, Spring 2012 Session 4 Binary Addition.
President UniversityErwin SitompulDigital Systems 7/1 Lecture 7 Digital Systems Dr.-Ing. Erwin Sitompul President University
ETE 204 – Digital Electronics Combinational Logic Design Single-bit and Multiple-bit Adder Circuits [Lecture: 9] Instructor: Sajib Roy Lecturer, ETE,ULAB.
1 Review of Boolean algebra Not is a horizontal bar above the number –0 = 1 –1 = 0 Or is a plus –0+0 = 0 –0+1 = 1 –1+0 = 1 –1+1 = 1 And is multiplication.
Combinational Circuits
Multiplexer.
Magnitude Comparator Module M5.2 Section 6.1.
Homework Reading Machine Projects Labs
Summary Half-Adder Basic rules of binary addition are performed by a half adder, which has two binary inputs (A and B) and two binary outputs (Carry out.
CSE Winter 2001 – Arithmetic Unit - 1
Number Systems and Circuits for Addition
Digital Systems Section 12 Binary Adders. Digital Systems Section 12 Binary Adders.
Homework Reading Machine Projects Labs
Combinational Circuits
Magnitude Comparator Lecture L6.2 Section 6.1.
Presentation transcript:

Adders Lecture L7.1 Section 6.2 Section 10.4 (pp )

Adders Half Adder Full Adder TTL Adder

Half Adder CABS 0001 A 0 B 0 S 0 C Dec Binary

Multiple-bit Addition A B A 3 A 2 A 1 A A B 3 B 2 B 1 B 0 B A i +B i +C i SiSi C i+1

Full Adder C i A i B i S i C i CiCi AiBiAiBi SiSi

Full Adder C i A i B i S i C i+1 S i = !C i & !A i & B i # !C i & A i & !B i # C i & !A i & !B i # C i & A i & B i

Full Adder S i = !C i & !A i & B i # !C i & A i & !B i # C i & !A i & !B i # C i & A i & B i S i = !C i & (!A i & B i # A i & !B i ) # C i & (!A i & !B i # A i & B i ) S i = !C i & (A i $ B i ) # C i & !(A i $ B i ) S i = C i $ (A i $ B i )

Full Adder C i A i B i S i C i CiCi AiBiAiBi C i+1

Full Adder C i A i B i S i C i+1 CiCi AiBiAiBi C i+1 C i+1 = A i & B i # C i & B i # C i & A i

Full Adder C i A i B i S i C i+1 CiCi AiBiAiBi C i+1 C i+1 = A i & B i # C i & !A i & B i # C i & A i & !B i

Full Adder C i+1 = A i & B i # C i !A i & B i # C i & A i & !B i C i+1 = A i & B i # C i & (!A i & B i # A i & !B i ) C i+1 = A i & B i # C i & (A i $ B i ) Recall: S i = C i $ (A i $ B i ) C i+1 = A i & B i # C i & (A i $ B i )

Full Adder S i = C i $ (A i $ B i ) Half-adder C i+1 = A i & B i # C i & (A i $ B i )

Full Adder A full adder can be made from two half adders (plus an OR gate).

Full Adder Block Diagram

4-Bit Adder C A B S

adder.abl MODULE adder TITLE ‘4-Bit Adder' DECLARATIONS " INPUT PINS " A3..A0 PIN 11, 7, 6, 5; " Switch S6(1..4) A = [A3..A0]; " 4-bit operand B3..B0 PIN 4, 3, 2, 1; " Switch S7(1..4) B = [B3..B0]; " 4-bit addend " OUTPUT PINS " S3..S0 PIN 40, 41, 43, 44 ISTYPE 'com'; " LED S = [S3..S0]; " 4-bit sum CF PIN 39 ISTYPE 'com'; " LED 12; carry flag OVF PIN 35 ISTYPE 'com'; " LED 9; overflow flag

adder.abl (cont’d) " INTERMEDIATE NODES " C4..C0 NODE ISTYPE 'com'; " internal carry vector Cin = [C3..C0]; " carry input vector Cout = [C4..C1]; " carry output vector Intermediate Carry bits

adder.abl (cont’d) S i = C i $ (A i $ B i ) C i+1 = A i & B i # C i & (A i $ B i ) EQUATIONS C0 = 0; " zero carry in S = A $ B $ Cin; " sum output Cout = A & B # (A $ B) & Cin; " carry output vector CF = C4; " carry flag OVF = C4 $ C3; " overflow flag END adder4 Why?

C4A3B3C3 0000Adding positive #s, result positive 0001Adding positive #s, result negative 0100Adding a negative and a positive Adding 2 negative #s, result positive 1111Adding 2 negative #s, result negative OVF Sign BitsDiscard

= = -14 discard 0010=2 Wrong => OVF = = =-7 discard 1001=-7 Correct C4C3C4C3 A3A3 B3B3

Carry and Overflow C = 0 O = E Dec Hex Binary Note no carry from bit 6 to bit 7 and no carry from bit 7 to C.

Carry and Overflow C = 0 O = B 90 Dec Hex Binary Thinking SIGNED we added two positive numbers and got a negative result. This can’t be correct! Therefore, the OVERFLOW bit, O, is set to 1. Correct answer (144) is outside the range -128 to Note carry from bit 6 to bit 7 but no carry from bit 7 to C.

Carry and Overflow C = 1 O = D3 108 Dec Hex Binary Thinking SIGNED we added a positive number to a negative number and got the correct positive answer. Therefore, the OVERFLOW bit, O, is cleared to 0. Correct answer (8) is inside the range -128 to Ignore carry Note carry from bit 6 to bit 7 and carry from bit 7 to C.

Carry and Overflow C = 1 O = E +D3 171 Dec Hex Binary Thinking SIGNED we added two negative numbers and got a positive answer. This must be wrong! Therefore, the OVERFLOW bit, O, is set to 1. Correct answer (-143) is outside the range -128 to Ignore carry Note no carry from bit 6 to bit 7 but there is a carry from bit 7 to C.

Overflow Note that the overflow bit was set whenever we had a carry from bit 6 to bit 7, but no carry from bit 7 to C. It was also set when we had a carry from bit 7 to C, but no carry from bit 6 to bit 7. Upshot: The overflow bit is the EXCLUSIVE-OR of a carry from bit 6 to bit 7 and a carry from bit 7 to C.

TTL Adder GND Vcc B3 S1 B1 C4 S4 B4 C0 A3 S3 A4 A2 B2 S2 A1 74LS283

Question Add the following 8-bit binary numbers What is the answer in hex? Was there a net carry? Was there an overflow? = =-74 = 111 =25H=