1 Lecture 12: Hardware for Arithmetic Today’s topics:  Designing an ALU  Carry-lookahead adder Reminder: Assignment 5 will be posted in a couple of days.

Slides:



Advertisements
Similar presentations
Lecture 13: Sequential Circuits
Advertisements

1 ECE 4436ECE 5367 Computer Arithmetic I-II. 2 ECE 4436ECE 5367 Addition concepts 1 bit adder –2 inputs for the operands. –Third input – carry in from.
Introduction So far, we have studied the basic skills of designing combinational and sequential logic using schematic and Verilog-HDL Now, we are going.
Arithmetic for Computers
Lecture 19: Hardware for Arithmetic Today’s topic –Designing an ALU –Carry Look-Ahead Adder 1.
Comparator.
Mohamed Younis CMCS 411, Computer Architecture 1 CMCS Computer Architecture Lecture 7 Arithmetic Logic Unit February 19,
Lecture 20: Hardware for Arithmetic Today’s topic –Carry Look-Ahead Adder 1.
Arithmetic II CPSC 321 E. J. Kim. Today’s Menu Arithmetic-Logic Units Logic Design Revisited Faster Addition Multiplication (if time permits)
1 Lecture 4: Arithmetic for Computers (Part 3) CS 447 Jason Bakos.
Computer Structure - The ALU Goal: Build an ALU  The Arithmetic Logic Unit or ALU is the device that performs arithmetic and logical operations in the.
ECE C03 Lecture 61 Lecture 6 Arithmetic Logic Circuits Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
Arithmetic II CPSC 321 Andreas Klappenecker. Any Questions?
Lecture 8 Arithmetic Logic Circuits
Arithmetic-Logic Units CPSC 321 Computer Architecture Andreas Klappenecker.
ECE 301 – Digital Electronics
COMPUTER ARCHITECTURE & OPERATIONS I Instructor: Hao Ji.
1  1998 Morgan Kaufmann Publishers Chapter Four Arithmetic for Computers.
Chapter 3 Arithmetic for Computers. Arithmetic Where we've been: Abstractions: Instruction Set Architecture Assembly Language and Machine Language What's.
Chapter 5 Arithmetic Logic Functions. Page 2 This Chapter..  We will be looking at multi-valued arithmetic and logic functions  Bitwise AND, OR, EXOR,
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
Digital Arithmetic and Arithmetic Circuits
Chapter # 5: Arithmetic Circuits
Chapter 6-1 ALU, Adder and Subtractor
07/19/2005 Arithmetic / Logic Unit – ALU Design Presentation F CSE : Introduction to Computer Architecture Slides by Gojko Babić.
Csci 136 Computer Architecture II – Constructing An Arithmetic Logic Unit Xiuzhen Cheng
CPS3340 COMPUTER ARCHITECTURE Fall Semester, /19/2013 Lecture 7: 32-bit ALU, Fast Carry Lookahead Instructor: Ashraf Yaseen DEPARTMENT OF MATH &
1 Arithmetic Logic Unit ALU. 2 The Bus Concept 3 CPU Building Blocks  Registers (IR, PC, ACC)  Control Unit (CU)  Arithmetic Logic Unit (ALU)
Computing Systems Designing a basic ALU.
درس مدارهای منطقی دانشگاه قم مدارهای منطقی محاسباتی تهیه شده توسط حسین امیرخانی مبتنی بر اسلایدهای درس مدارهای منطقی دانشگاه.
1 Lecture 6 BOOLEAN ALGEBRA and GATES Building a 32 bit processor PH 3: B.1-B.5.
CDA 3101 Fall 2013 Introduction to Computer Organization The Arithmetic Logic Unit (ALU) and MIPS ALU Support 20 September 2013.
Lecture 18: Hardware for Arithmetic Today’s topic –Intro to Boolean functions (Continued) –Designing an ALU 1.
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 Lecture 10: Floating Point, Digital Design Today’s topics:  FP arithmetic  Intro to Boolean functions.
ECE 331 – Digital System Design Multi-bit Adder Circuits, Adder/Subtractor Circuit, and Multiplier Circuit (Lecture #12)
1  2004 Morgan Kaufmann Publishers Performance is specific to a particular program/s –Total execution time is a consistent summary of performance For.
1 Lecture 12: Adders, Sequential Circuits Today’s topics:  Carry-lookahead adder  Clocks, latches, sequential circuits.
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.
Appendix C Basics of Digital Logic Part I. Florida A & M University - Department of Computer and Information Sciences Modern Computer Digital electronics.
1  2004 Morgan Kaufmann Publishers Lets Build a Processor Almost ready to move into chapter 5 and start building a processor First, let’s review Boolean.
Addition, Subtraction, Logic Operations and ALU Design
1 Fundamentals of Computer Science Combinational Circuits.
Arithmetic-Logic Units. Logic Gates AND gate OR gate NOT gate.
LECTURE 4 Logic Design. LOGIC DESIGN We already know that the language of the machine is binary – that is, sequences of 1’s and 0’s. But why is this?
Gates AND, OR, NOT NAND, NOR Combinational logic No memory A set of inputs uniquely and unambiguously specifies.
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.
Computer Arthmetic Chapter Four P&H. Data Representation Why do we not encode numbers as strings of ASCII digits inside computers? What is overflow when.
EE204 L03-ALUHina Anwar Khan EE204 Computer Architecture Lecture 03- ALU.
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.
1 (Based on text: David A. Patterson & John L. Hennessy, Computer Organization and Design: The Hardware/Software Interface, 3 rd Ed., Morgan Kaufmann,
Computer Arthmetic Chapter Four P&H.
Combinational Circuits
Lecture 11: Hardware for Arithmetic
Computer Architecture & Operations I
Combinational Circuits
ECE 331 – Digital System Design
5. Combinational circuits
Arithmetic Where we've been:
CSE Winter 2001 – Arithmetic Unit - 1
Lecture 12: Adders, Sequential Circuits
Lecture 12: Adders, Sequential Circuits
Arithmetic Circuits (Part I) Randy H
Lecture 11: Hardware for Arithmetic
COSC 2021: Computer Organization Instructor: Dr. Amir Asif
COMS 361 Computer Organization
Combinational Circuits
Presentation transcript:

1 Lecture 12: Hardware for Arithmetic Today’s topics:  Designing an ALU  Carry-lookahead adder Reminder: Assignment 5 will be posted in a couple of days (due Thursday 10/12), no class on Thursday 10/19, mid-term exam Tuesday 10/24

2 DeMorgan’s Laws A + B = A. B A. B = A + B Confirm that these are indeed true

3 Sum of Products Can represent any logic block with the AND, OR, NOT operators  Draw the truth table  For each true output, represent the corresponding inputs as a product  The final equation is a sum of these products A B C E (A. B. C) + (A. C. B) + (C. B. A) Can also use “product of sums” Any equation can be implemented with an array of ANDs, followed by an array of ORs

4 Adder Algorithm Sum Carry A B Cin Sum Cout Truth Table for the above operations:

5 Adder Algorithm Sum Carry A B Cin Sum Cout Truth Table for the above operations: Equations: Sum = Cin. A. B + B. Cin. A + A. Cin. B + A. B. Cin Cout = A. B. Cin + A. B. Cin + A. Cin. B + B. Cin. A = A. B + A. Cin + B. Cin

6 Carry Out Logic Equations: Sum = Cin. A. B + B. Cin. A + A. Cin. B + A. B. Cin Cout = A. B. Cin + A. B. Cin + A. Cin. B + B. Cin. A = A. B + A. Cin + B. Cin

7 1-Bit ALU with Add, Or, And Multiplexor selects between Add, Or, And operations

8 32-bit Ripple Carry Adder 1-bit ALUs are connected “in series” with the carry-out of 1 box going into the carry-in of the next box

9 Incorporating Subtraction

10 Incorporating Subtraction Must invert bits of B and add a 1 Include an inverter CarryIn for the first bit is 1 The CarryIn signal (for the first bit) can be the same as the Binvert signal

11 Incorporating NOR

12 Incorporating NOR

13 Incorporating slt

14 Incorporating slt Perform a – b and check the sign New signal (Less) that is zero for ALU boxes 1-31 The 31 st box has a unit to detect overflow and sign – the sign bit serves as the Less signal for the 0 th box

15 Incorporating beq Perform a – b and confirm that the result is all zero’s

16 Control Lines What are the values of the control lines and what operations do they correspond to?

17 Control Lines What are the values of the control lines and what operations do they correspond to? Ai Bn Op AND OR Add Sub SLT NOR

18 Speed of Ripple Carry The carry propagates thru every 1-bit box: each 1-bit box sequentially implements AND and OR – total delay is the time to go through 64 gates! We’ve already seen that any logic equation can be expressed as the sum of products – so it should be possible to compute the result by going through only 2 gates! Caveat: need many parallel gates and each gate may have a very large number of inputs – it is difficult to efficiently build such large gates, so we’ll find a compromise:  moderate number of gates  moderate number of inputs to each gate  moderate number of sequential gates traversed

19 Computing CarryOut CarryIn1 = b0.CarryIn0 + a0.CarryIn0 + a0.b0 CarryIn2 = b1.CarryIn1 + a1.CarryIn1 + a1.b1 = b1.b0.c0 + b1.a0.c0 + b1.a0.b0 + a1.b0.c0 + a1.a0.c0 + a1.a0.b0 + a1.b1 … CarryIn32 = a really large sum of really large products Potentially fast implementation as the result is computed by going thru just 2 levels of logic – unfortunately, each gate is enormous and slow

20 Generate and Propagate Equation re-phrased: Ci+1 = ai.bi + ai.Ci + bi.Ci = (ai.bi) + (ai + bi).Ci Stated verbally, the current pair of bits will generate a carry if they are both 1 and the current pair of bits will propagate a carry if either is 1 Generate signal = ai.bi Propagate signal = ai + bi Therefore, Ci+1 = Gi + Pi. Ci

21 Generate and Propagate c1 = g0 + p0.c0 c2 = g1 + p1.c1 = g1 + p1.g0 + p1.p0.c0 c3 = g2 + p2.g1 + p2.p1.g0 + p2.p1.p0.c0 c4 = g3 + p3.g2 + p3.p2.g1 + p3.p2.p1.g0 + p3.p2.p1.p0.c0 Either, a carry was just generated, or a carry was generated in the last step and was propagated, or a carry was generated two steps back and was propagated by both the next two stages, or a carry was generated N steps back and was propagated by every single one of the N next stages

22 Divide and Conquer The equations on the previous slide are still difficult to implement as logic functions – for the 32 nd bit, we must AND every single propagate bit to determine what becomes of c0 (among other things) Hence, the bits are broken into groups (of 4) and each group computes its group-generate and group-propagate For example, to add 32 numbers, you can partition the task as a tree

23 P and G for 4-bit Blocks Compute P0 and G0 (super-propagate and super-generate) for the first group of 4 bits (and similarly for other groups of 4 bits) P0 = p0.p1.p2.p3 G0 = g3 + g2.p3 + g1.p2.p3 + g0.p1.p2.p3 Carry out of the first group of 4 bits is C1 = G0 + P0.c0 C2 = G1 + P1.G0 + P1.P0.c0 … By having a tree of sub-computations, each AND, OR gate has few inputs and logic signals have to travel through a modest set of gates (equal to the height of the tree)

24 Example Add A and B g p P G C4 = 1

25 Carry Look-Ahead Adder 16-bit Ripple-carry takes 32 steps This design takes how many steps?

26 Title Bullet