Lecture 14 Logistics Last lecture Today

Slides:



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

Comparator.
1 CONSTRUCTING AN ARITHMETIC LOGIC UNIT CHAPTER 4: PART II.
Lecture 20: Hardware for Arithmetic Today’s topic –Carry Look-Ahead Adder 1.
EECS Components and Design Techniques for Digital Systems Lec 17 – Addition, Subtraction, and Negative Numbers David Culler Electrical Engineering.
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.
Csci 136 Computer Architecture II – Constructing An Arithmetic Logic Unit Xiuzhen Cheng
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.
Building a Faster Adder
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.
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 12 Logistics Last lecture Today HW4 due today Timing diagrams
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.
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
Topic 3b Computer Arithmetic: ALU Design
Lecture 14 Logistics Last lecture Today
Arithmetic Functions & Circuits
Instructor: Alexander Stoytchev
Arithmetic Circuits (Part I) Randy H
Instructor: Alexander Stoytchev
Lecture 15 Logistics Last lecture Today HW4 is due today
Instructor: Alexander Stoytchev
Combinational logic design case studies
Topic 3b Computer Arithmetic: ALU Design
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
CSE 140 Lecture 14 Standard Combinational Modules
Instructor: Alexander Stoytchev
Addition and multiplication
Instructor: Mozafar Bag-Mohammadi University of Ilam
Instructor: Alexander Stoytchev
Addition and multiplication
Instructor: Alexander Stoytchev
Instructor: Alexander Stoytchev
Combinational Circuits
Lecture 4 Logistics Last lecture --- Boolean algebra Today’s lecture
Arithmetic Circuits.
Lecture 2 Adders Half adder.
Presentation transcript:

Lecture 14 Logistics Last lecture Today Midterm 1: ave 88, median 89, std 9. good job! HW4 due on Wednesday Lab5 is going on this week Last lecture Multi-level logic Timing diagrams Today Time/space trade offs: Parallel prefix trees Adders The conclusion of combinational logic!!! 14

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 it works, how it scales, and how it may be optimized for time/space. 14

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 14

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

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 14 11

The tree version of the prefix circuit Gates: 12 Max delay: 3 The gates highlighted in blue are the original tree 14 11

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 14 11

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 14 11

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

2-bit ripple-carry adder Cout Cin B 1-Bit Adder A1 B1 A2 B2 Cin Cout Cin Cout Sum1 Sum2 Overflow pp. 526, Appendix A 11 Sum

4-bit ripple-carry adder Cout Sum Cin 1 0  Add 1  Subtract A0 B0 B0' Sel Overflow A1 B1 B1' A2 B2 B2' A3 B3 B3' S3 S2 S1 S0 Turns out it is easy to convert to subtractor 2s complement: A – B = A + (–B) = A + B' + 1 14 11

Let’s talk about speed optimization Back to 2-level structure for speed Carry propagation limits adder speed A0 B0 Cin S0 @2 A1 B1 C1 @2 S1 @3 A2 B2 C2 @4 S2 @5 A3 B3 C3 @6 S3 @7 Cout @8 @0 @2N @2N+1 @0 @2N @2N+2 @0 @2N @0 Cout takes two gate delays Cin arrives late 14 11

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 11

Solution: Create a carry lookahead logic Step 1: Getting Pi an Gi B A xor B Cin A xor B xor Cin Cout Cin(A xor B) AB Sum Half Adder 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 14 11

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 14 11

Solution: Carry-lookahead logic Step 3: Express all carry 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 14 11

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 C1 C0 P0 G0 P1 G1 C2 C0 P0 G0 P1 G1 P2 G2 C3 14 11

With Carry lookahead logic B0 Cin = C0 S0 @2 A1 B1 C1 @2 S1 @3 A2 B2 C2 @4 S2 @5 A3 B3 C3 @6 S3 @7 C4@8 @1 @2 P0 G0 @3 @4 C1 = G0 + P0C0 C2 = G1 + P1C1 = G1 + P1G0 + P1P0C0 P1 G1 C3 = G2 + P2C2 @3 = G2 + P2G1 + P2P1G0 + P2P1P0C0 C4 = G3 + P3C3 P2 G2 @4 = G3 + P3G2 + P3P2G1 + P3P2P1G0 + P3P2P1P0C0 @3 @4 P3 G3 @3 14 12 11

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 11