Lecture 12 Logistics Last lecture Today HW4 due today Timing diagrams

Slides:



Advertisements
Similar presentations
Chapter 4 -- Modular Combinational Logic. Decoders.
Advertisements

Comparator.
Lecture 20: Hardware for Arithmetic Today’s topic –Carry Look-Ahead Adder 1.
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
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
Chapter # 5: Arithmetic Circuits
5-1 Programmable and Steering Logic Chapter # 5: Arithmetic Circuits.
ECE 3110: Introduction to Digital Systems Chapter 6 Combinational Logic Design Practices Adders, subtractors, ALUs.
Computing Systems Designing a basic ALU.
درس مدارهای منطقی دانشگاه قم مدارهای منطقی محاسباتی تهیه شده توسط حسین امیرخانی مبتنی بر اسلایدهای درس مدارهای منطقی دانشگاه.
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.
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.
1 Lecture 11: Hardware for Arithmetic Today’s topics:  Logic for common operations  Designing an ALU  Carry-lookahead adder.
Lecture #23: Arithmetic Circuits-1 Arithmetic Circuits (Part I) Randy H. Katz University of California, Berkeley Fall 2005.
ECE 3110: Introduction to Digital Systems Chapter 5 Combinational Logic Design Practices Adders,subtractors, ALUs.
ETE 204 – Digital Electronics Combinational Logic Design Single-bit and Multiple-bit Adder Circuits [Lecture: 9] Instructor: Sajib Roy Lecturer, ETE,ULAB.
Presented by A. Maleki Fall Semester, 2010
CDA3101 Recitation Section 5
Computer Arthmetic Chapter Four P&H.
Combinational Circuits
Somet things you should know about digital arithmetic:
Lecture 4 Logistics Last lecture --- Boolean algebra Today’s lecture
Lecture Adders Half adder.
ECE 4110– Sequential Logic Design
Addition and multiplication
Space vs. Speed: Binary Adders
Digital Systems Section 8 Multiplexers. Digital Systems Section 8 Multiplexers.
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.
XOR, XNOR, and Binary Adders
ECE/CS 552: Carry Lookahead
Combinational Circuits
ECE 331 – Digital System Design
CSE Winter 2001 – Arithmetic Unit - 1
Lecture 12: Adders, Sequential Circuits
Lecture 12: Adders, Sequential Circuits
Lecture 14 Logistics Last lecture Today
Arithmetic Functions & Circuits
Instructor: Alexander Stoytchev
Arithmetic Circuits (Part I) Randy H
CSE 370 – Winter 2002 – Comb. Logic building blocks - 1
Instructor: Alexander Stoytchev
Lecture 15 Logistics Last lecture Today HW4 is due today
Instructor: Alexander Stoytchev
Combinational logic design case studies
Digital Systems Section 12 Binary Adders. Digital Systems Section 12 Binary Adders.
CS 140 Lecture 14 Standard Combinational Modules
Chapter 5 – Number Representation and Arithmetic Circuits
Digital System Design Combinational Logic
COMS 361 Computer Organization
CSE 140 Lecture 14 Standard Combinational Modules
Instructor: Alexander Stoytchev
Addition and multiplication
Instructor: Mozafar Bag-Mohammadi University of Ilam
Instructor: Alexander Stoytchev
Lecture 14 Logistics Last lecture Today
XOR, XNOR, and Binary Adders
Addition and multiplication
Instructor: Alexander Stoytchev
Instructor: Alexander Stoytchev
Combinational Circuits
Lecture 4 Logistics Last lecture --- Boolean algebra Today’s lecture
Special Gates Combinational Logic Gates
Arithmetic Circuits.
Lecture 2 Adders Half adder.
Presentation transcript:

Lecture 12 Logistics Last lecture Today HW4 due today Timing diagrams Hazards Today Time/space trade offs: Parallel prefix trees Adders The conclusion of combinational logic!!!

The “WHY” slide Timing/space trade offs Adders In real life, complex logic circuits you will work on will not have one minimum circuit. You will have to learn to understand what parameters to optimize your design on, and be able to come up with “trade offs” suitable for your application or customer’s needs. Adders Arithmetic logic units (ALUs) such as adders and multipliers perform most computer instructions. Therefore, it is critical to know how they works, how they scale, and how they may be optimized for time/space.

What do we mean by time/speed tradeoff?: Linear chains vs. trees Lets say we want to implement an 8-input OR function with only 2-input gates Gates: 7 Max delay: 7

Linear chains vs. trees Now consider the tree version Gates: 7 Max delay: 3

And now we change the problem slightly Build a circuit that takes 8 single bit inputs and calculates the OR of the first 2, the OR of the first 3, the OR of the first 4, and so on, up to the OR of all 8 Gates: 7 Max delay: 7

A parallel version of the prefix circuit Gates: 12 Max delay: 3 0-6 0-7 0-3 0-5 The gates highlighted in blue are the original tree 0-1 0-2 0-4

The parallel prefix OR circuit n inputs n/2 OR gates per level log2n levels in-1 Parallel Prefix n/2 inputs on-1 in/2 on/2 in/2-1 on/2-1 Parallel Prefix n/2 inputs The gates highlighted in blue are the original tree i0 o0

Binary half adder 1-bit half adder Computes sum, carry-out No carry-in Sum = A'B + AB' = A xor B Cout = AB A B S Cout 0 0 0 0 0 1 1 0 1 0 1 0 1 1 0 1 A B Cout Sum Half Adder

Binary full adder 1-bit full adder Computes sum, carry-out Carry-in allows cascaded adders Sum = Cin xor A xor B Cout = ACin + BCin + AB A B Cin S Cout 0 0 0 0 0 0 0 1 1 0 0 1 0 1 0 0 1 1 0 1 1 0 0 1 0 1 0 1 0 1 1 1 0 0 1 1 1 1 1 1 A B Cin Cout Sum Full Adder

Full adder: using 2 half adders A B Cin S Cout Cout 0 0 0 0 0 0 0 0 1 1 0 0 0 1 0 1 0 0 0 1 1 0 1 1 1 0 0 1 0 0 1 0 1 0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 Multilevel logic Slower Fewer gates 2 XORs, 2 ANDs, 1 OR Sum = (A  B)  Cin Cout = ACin + BCin + AB = (A  B)Cin + AB

4-bit ripple-carry adder (also subtracts) Sel 1 Sel 1 Sel Sel 1 1 A B A B A B A B 0  Add 1  Subtract Cout Cin Cout Cin Cout Cin Cout Cin Sum Sum Sum Sum S3 S2 S1 S0 Overflow Easy to convert to subtractor using twos complement Twos complement: A – B = A + (–B) = A + B' + 1

Problem: Ripple-carry delay Carry propagation limits adder speed 111 0111 A + 0001 B -------------- ???? . @0 A0 B0 C0 S0 @2 A1 B1 C1 @2 S1 @3 A2 B2 C2 @4 S2 @5 A3 B3 C3 @6 S3 @7 Cout @8 @2N 1000 0000 0100 @2N+1 Except when N=0 0110 @0 @2N @2N+2 @0 @2N @0 Cout takes two gate delays Cin arrives late

Can we be clever and speed this up? Let’s compute all the carries in parallel Derive carries from the data inputs Not from intermediate carries Use two-level logic Compute all sums in parallel How do we do that??? A0 B0 Cin S0 A1 B1 C1 S1 A2 B2 C2 S2 A3 B3 C3 S3 C4

Speeding up the adder Need to find a way to “predict” Cout for all bits Without knowing what Cin is + 0 -------- Predict Cout Cout is always 0 Call this PROPAGATE Cout is 0 if Cin is 0 Cout is 1 if Cin is 1 + 1 -------- Predict Cout Let’s try all cases: A = 0, B = 0 but not sure of Cin A = 0, B = 1 but not sure of Cin A = 1, B = 0 but not sure of Cin A = 1, B = 1 but not sure of Cin Cout is 0 if Cin is 0 Cout is 1 if Cin is 1 1 + 0 -------- Predict Cout Call this GENERATE 1 + 1 -------- Predict Cout Cout is always 1

Solution: Create a carry lookahead logic Step 1: Getting Pi an Gi Half Adder Half Adder A xor B A xor B xor Cin A Sum Sum Sum AB Cin(A xor B) B Cout Cout Cin Cout Gi Pi Ci+1 Ci Ai Bi Si 40 OR2 37 AND2 39 36 XOR 38 Carry generate: Gi = AiBi Generate carry when A = B = 1 Carry propagate: Pi = Ai xor Bi Propagate carry-in to carry-out when (A xor B) = 1

Solution: Carry-lookahead logic Step 2: Calculate Sum and Cout Sum and Cout in terms of generate/propagate: Si = Ai xor Bi xor Ci = Pi xor Ci Ci+1= AiBi + Ci(Ai xor Bi) = Gi + CiPi

Solution: Carry-lookahead logic Step 3: Express all carries in terms of C0 Re-express the carry logic in terms of G and P C1 = G0 + P0C0 C2 = G1 + P1C1 = G1 + P1G0 + P1P0C0 C3 = G2 + P2C2 = G2 + P2G1 + P2P1G0 + P2P1P0C0 C4 = G3 + P3C3 = G3 + P3G2 + P3P2G1 + P3P2P1G0 + P3P2P1P0C0 Implement each carry equation with two-level logic Derive intermediate results directly from inputs Rather than from carries Allows "sum" computations to proceed in parallel

Solution: carry-lookahead logic Step 4: implement with 2-level logic Pi @ 1 gate delay Ci Si @ 2 gate delays Bi Ai Gi @ 1 gate delay Logic complexity increases with adder size G3 C0 P0 G0 P1 G1 P2 G2 P3 C4 C0 P0 C1 C0 P0 G0 P1 G1 P2 G2 C3 G0 C0 P0 P1 G0 P1 C2 G1

Solution: Carry lookahead logic Get Pi (propagate) and Gi (generate) @0 A0 B0 C0 S0 @2 A1 B1 C1 @2 S1 @3 A2 B2 C2 @4 S2 @5 A3 B3 C3 @6 S3 @7 C4@8 Pi @1 @2 P0 G0 @3 @4 P1 G1 @3 P2 G2 @4 @3 C2 = G1 + P1C1 Gi = G1 + P1G0 + P1P0C0 @4 C3 = G2 + P2C2 P3 G3 = G2 + P2G1 + P2P1G0 + P2P1P0C0 C1 = G0 + P0C0 C4 = G3 + P3C3 @3 = G3 + P3G2 + P3P2G1 + P3P2P1G0 + P3P2P1P0C0

Carry lookahead logic summary Compute all the carries in parallel Derive carries from the data inputs Not from intermediate carries Use two-level logic Compute all sums in parallel Cascade simple adders to make large adders Speed improvement Complex combinational logic A0 B0 Cin S0 @2 A1 B1 C1 @3 S1 @4 A2 B2 C2 @3 S2 @4 A3 B3 C3 @3 S3 @4 C4 @3

We've finished combinational logic... Negative numbers in binary Truth tables Basic logic gates Schematic diagrams Minterm and maxterm expansions (canonical, minimized) de Morgan's theorem AND/OR to NAND/NOR logic conversion K-maps, logic minimization, don't cares Multiplexers/demultiplexers PLAs/PALs ROMs Multi-level logics Timing diagrams Hazards Adders