CSE115: Digital Design Lecture 20: Comparators, Adders and Subtractors Faculty of Engineering.

Slides:



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

Comparator.
EE141 © Digital Integrated Circuits 2nd Arithmetic Circuits 1 Digital Integrated Circuits A Design Perspective Arithmetic Circuits Jan M. Rabaey Anantha.
EE141 Adder Circuits S. Sundar Kumar Iyer.
Mohamed Younis CMCS 411, Computer Architecture 1 CMCS Computer Architecture Lecture 7 Arithmetic Logic Unit February 19,
Lecture Adders Half adder.
Henry Hexmoor1 Chapter 5 Arithmetic Functions Arithmetic functions –Operate on binary vectors –Use the same subfunction in each bit position Can design.
DATAPATHS 3) Shifters. 4) Comparators 5) Counters.
1 CS 140 Lecture 14 Standard Combinational Modules Professor CK Cheng CSE Dept. UC San Diego Some slides from Harris and Harris.
Arithmetic-Logic Units CPSC 321 Computer Architecture Andreas Klappenecker.
Digital Integrated Circuits© Prentice Hall 1995 Arithmetic Arithmetic Building Blocks.
ECE 301 – Digital Electronics
ECE 301 – Digital Electronics
1 EE 365 Adders Multipliers Read-Only Memories 2 Equality Comparators 1-bit comparator 4-bit comparator EQ_L.
Chapter 5 Arithmetic Logic Functions. Page 2 This Chapter..  We will be looking at multi-valued arithmetic and logic functions  Bitwise AND, OR, EXOR,
Adders, subtractors, ALUs
 Arithmetic circuit  Addition  Subtraction  Division  Multiplication.
CS 105 Digital Logic Design
Logical Circuit Design Week 8: Arithmetic Circuits Mentor Hamiti, MSc Office ,
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Logic Circuits I.
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.
IKI a-Combinatorial Components Bobby Nazief Semester-I The materials on these slides are adopted from those in CS231’s Lecture Notes.
Fall 2004EE 3563 Digital Systems Design EE 3563 Comparators  Comparators determine if two binary inputs are equal  Some will signal greater than/less.
Chapter 6-1 ALU, Adder and Subtractor
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Logic Circuits I.
Arithmetic Building Blocks
ECE 3110: Introduction to Digital Systems Chapter 6 Combinational Logic Design Practices Adders, subtractors, ALUs.
EE141 © Digital Integrated Circuits 2nd Arithmetic Circuits 1 Digital Integrated Circuits A Design Perspective Arithmetic Circuits Reference: Digital Integrated.
Arithmetic Building Blocks
1/8/ L3 Data Path DesignCopyright Joanne DeGroat, ECE, OSU1 ALUs and Data Paths Subtitle: How to design the data path of a processor.
Chapter 14 Arithmetic Circuits (I): Adder Designs Rev /12/2003
Chapter
درس مدارهای منطقی دانشگاه قم مدارهای منطقی محاسباتی تهیه شده توسط حسین امیرخانی مبتنی بر اسلایدهای درس مدارهای منطقی دانشگاه.
Arithmetic Functions BIL- 223 Logic Circuit Design Ege University Department of Computer Engineering.
CHAPTER 4 Combinational Logic Design- Arithmetic Operation (Section 4.6&4.9)
COE 202: Digital Logic Design Combinational Circuits Part 2 KFUPM Courtesy of Dr. Ahmad Almulhem.
ECE 3110: Introduction to Digital Systems Chapter 5 Combinational Logic Design Practices X-OR gates and Parity circuits Comparators Adders, subtractors,
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.
EE365 Adv. Digital Circuit Design Clarkson University Lecture #9 Math Units ROMs.
EE 466/586 VLSI Design Partha Pande School of EECS Washington State University
EE141 © Digital Integrated Circuits 2nd Arithmetic Circuits 1 Digital Integrated Circuits A Design Perspective Arithmetic Circuits Jan M. Rabaey Anantha.
EE121 John Wakerly Lecture #6
Digital Integrated Circuits© Prentice Hall 1995 Arithmetic Arithmetic Building Blocks.
ECE 331 – Digital System Design Multi-bit Adder Circuits, Adder/Subtractor Circuit, and Multiplier Circuit (Lecture #12)
1 Carry Lookahead Logic Carry Generate Gi = Ai Bi must generate carry when A = B = 1 Carry Propagate Pi = Ai xor Bi carry in will equal carry out here.
C-H1 Lecture Adders Half adder. C-H2 Full Adder si is the modulo- 2 sum of ci, xi, yi.
CHAPTER 2 Digital Combinational Logic/Arithmetic Circuits
Cpu control.1 2/14 Datapath Components for Lab The Processor! ( th ed)
Arithmetic-Logic Units. Logic Gates AND gate OR gate NOT gate.
EE141 Arithmetic Circuits 1 Chapter 14 Arithmetic Circuits Rev /12/2003 Rev /05/2003.
ECE 3110: Introduction to Digital Systems Chapter 5 Combinational Logic Design Practices Adders,subtractors, ALUs.
Electrical Engineering Engineering the Future Digital Circuits Fundamentals Hands-on Full-Adder Simulation (afternoon)
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.
EE141 Arithmetic Circuits 1 Chapter 14 Arithmetic Circuits Rev /12/2003.
Combinational Circuits
ECE 4110– Sequential Logic Design
Digital Building Blocks
CSE Winter 2001 – Arithmetic Unit - 1
Lecture 14 Logistics Last lecture Today
CS 140 Lecture 14 Standard Combinational Modules
CSE 140 Lecture 14 Standard Combinational Modules
Logic Circuits I Lecture 3.
Lecture 14 Logistics Last lecture Today
Combinational Circuits
Arithmetic Circuits.
Arithmetic Building Blocks
Lecture 2 Adders Half adder.
Unit IV Adders Subtractors Flip Flops Counters Multiplexes and De multiplexes. Integrated circuits-Op. amp – Characteristics Inverting amplifier - Non-inverting.
Presentation transcript:

CSE115: Digital Design Lecture 20: Comparators, Adders and Subtractors Faculty of Engineering

Suggested Reading – Sections

MEMORY DATAPATH CONTROL INPUT - OUTPUT RAM, ROM, Registers, … Finite state machine: PLA, Counters, Flip- flops, Latches, … Interconnect: Switches, Arbiters, Bus, … Arithmetic Unit: Adder, Multiplier, Shifter, Comparator, … Building Blocks for Digital Architectures CPU A Generic Digital Processor

Bit-Sliced Design Bit 3 Bit 2 Bit 1 Bit 0 Control Tile identical processing elements Register Adder Shifter Multiplexer DATA-IN DATA-OUT

Comparators Compares Two binary words and indicate if they are equal A Comparator ComparatorA=B B A>B A>B A<B A<B A B F Advanced Comparators: 1-bit Comparator: XOR gate, the Output is 1 if A  B A Comparator Comparator B A=B

Equality Comparators 4-bit comparator EQ_L 1-bit comparator

Iterative Comparator EQIXYEQO 0XX XY EQI EQI EQO EQO 1 bit comparator:

Multibit Iterative Comparator EQ0 =1 X0 X0 Y0 Y0 X1 X1 Y1 Y1 X(N-1) X(N-1) Y(N-1) Y(N-1)EQN X Y EQI EQI EQO EQO EQ1 EQ1 X Y EQI EQI EQO EQO EQ1 EQ1 X Y EQI EQI EQO EQO EQ1(N-1) Iterative Comparator: cascaded 1 bit comparators

MSI Comparator: 74x85B0 A1 B1 A2 B2 A3 A0 B3 74x85 74x85A<BIN A=BIN A>BIN A<BOUT A=B OUT A>BOUT 4 bit comparator (A<B)+(A=B).(A<B IN) (A>B)+(A=B).(A>B IN) (A=B).(A=B IN) 3 Cascading inputs Cascading inputs initial values: (A=B IN) = 1 (A>B IN) = 0 (A<B IN) = 0

8 bit ComparatorB0 A1 B1 A2 B2 A3 A0 B3 74x85 74x85A<BIN A=BIN A>BIN A<BOUT A=B OUT A>BOUT B0 A1 B1 A2 B2 A3 A0 B3 74x85 74x85A<BIN A=BIN A>BIN A<BOUT A=B OUT A>BOUT B0 A1 B1 A2 B2 A3A0B3 B4 A5 B5 A6 B6 A7A4B7 +5V A<BA=B A>B Most Significant bits Least Significant bits

Half Adder XYSUMC OUT SUM = X  Y C OUT = X.Y Y X S C OUT

Full Adder 1-bit-wide adder, produces sum and carry outputs XYCinSCout S = X’Y’C IN +X’YC IN ’+XY’C IN ’+XYC IN S = X  Y  C IN C OUT = XY + XC IN + YC IN

Full-Adder Circuit S = X  Y  C IN C OUT = XY + XC IN + YC IN

Ripple Adder Speed limited by carry chain: t adder  (n-1)t carry + t sum Goal: Make the fastest possible carry path circuit Faster adders eliminate or limit carry chain  2-level AND-OR logic  2 n product terms  3 or 4 levels of logic, carry lookahead Cascade n Full Adders to get n-bit binary Adder

Subtraction is the same as addition of the two’s complement. The two’s complement is the bit-by-bit complement plus 1. X – Y = X + Y’ + 1 Complement Y inputs to adder, set C in to 1. For a borrow, set C in to 0. XY’ 1 Subtraction

Full Subtractor ≈ Full adder

M = 0: Ripple Adder M = 1: Ripple Subtractor X0 X0 Y0 Y0 X1 X1 Y1 Y1 X(n-1) X(n-1) Y(n-1) Y(n-1) COUT/ BOUT S0/D0 S0/D0 S(n-1) / D(n-1) S(n-1) / D(n-1) S1/D1 S1/D1 X Y COUT COUT CIN CIN S X Y COUT COUT CIN CIN S X Y COUT COUT CIN CIN S M Adder/Subtractor Circuit

CLL: Carry Lookahead Logic X Y CLL CLL S X Y S S0 S0 S1 S1S(n-1) X0 X0 Y0 Y0 X1 X1 Y1 Y1 X(n-1) X(n-1) Y(n-1) Y(n-1)I(n-1)I1I0 Carry Lookahead Adder Units CLL CLL X Y S COUT Carry Lookahead Adder

S Yi Yi Xi Xi Ci Ci S Ci+1 Ci+1 Yi Yi Xi XiXi-1 X0 Yi-1 Y0 C0 Ci Ci Carry Lookahead Logic hsi hsi Adder Full Adder vs. Carry Lookahead Adder

We need to provide an expression for the c i in the CLL Unit When does the Full adder produce carry? Answer: If both X i and Y i equal 1 (carry is generated) OR.. If C i =1 and either X i or Y i equal 1 (carry is propagated)  C i+1 = (X i.Y i ) + (X i +Y i ).C i {Compare to: C OUT =XY + XC IN + YC IN } C i+1 = g i + p i.C i Let g i = X i.Y i p i = X i + Y i Generate Propagate Carry Lookahead Logic

C 1 = g 0 + p 0.C 0 C 2 =g 1 + p 1.C 1 = g 1 + p 1 g 0 + p 1.p 0.C 0 C 3 = g 2 + p 2.C 2 = g 2 + p 2.g 1 + p 2.p 1.g 0 + p 2.p 1.p 0.C 0 C 4 = g 3 + p 3.C 3 = g 3 + p 3.g 2 + p 3.p 2.g 1 + p 3.p 2.p 1.g 0 + p 2.p 1.p 0.C 0 C 5 = …………………………………………………………………………………………… C i+1 = g i + p i.C i g i = X i. Y i p i = X i + Y i X0,Y0X1,Y1XN-1,YN-1... C i,0 P 0 C i,1 P 1 C i,N-1 P N-1... Almost the same amount of delay Carry Lookahead Logic

A0 B0 A1 S1 S2 B1 A2 B2 C0 S0 A374x283S3 C4 B3 Uses Carry Lookahead internally 74x283 4-bit Adder

Ripple carry between groups

Lookahead carry between groups

ALU performs Arithmetic and Logical Functions A, B: 4 bit inputs S3, S2, S1, S0: Function select M = 0: Arithmetic operations: + = Plus, – = Minus M = 1: Logical operations: + = OR,. = AND S1 S2 S3 F1 F2 M CIN A0 S0 F0 B074x181F3 COUT A1 B1 A2 B2 A3 B3 A=B A=B P G InputsFunctions S3S2S1S0M=0 (arithmetic)M=1 (logic) 0000A – 1 + CINA’ 0110A – B – 1 + CINA XOR B’ 1001A + B + CINA XOR B 1011(A OR B) + CINA + B 1100A + A + CIN A + CINA MSI Arithmetic Logic Units (ALU )