Arithmetic II CPSC 321 E. J. Kim. Today’s Menu Arithmetic-Logic Units Logic Design Revisited Faster Addition Multiplication (if time permits)

Slides:



Advertisements
Similar presentations
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.
Advertisements

Lecture 19: Hardware for Arithmetic Today’s topic –Designing an ALU –Carry Look-Ahead Adder 1.
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.
Mohamed Younis CMCS 411, Computer Architecture 1 CMCS Computer Architecture Lecture 7 Arithmetic Logic Unit February 19,
1 CONSTRUCTING AN ARITHMETIC LOGIC UNIT CHAPTER 4: PART II.
Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Arithmetic See: P&H Chapter 3.1-3, C.5-6.
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.
Our ultimate goal: building the datapath
Arithmetic II CPSC 321 Andreas Klappenecker. Any Questions?
Lecture 8 Arithmetic Logic Circuits
1 Chapter 4: Arithmetic Where we've been: –Performance (seconds, cycles, instructions) –Abstractions: Instruction Set Architecture Assembly Language and.
Arithmetic-Logic Units CPSC 321 Computer Architecture Andreas Klappenecker.
Arithmetic III CPSC 321 Andreas Klappenecker. Any Questions?
1 ECE369 Chapter 3. 2 ECE369 Multiplication More complicated than addition –Accomplished via shifting and addition More time and more area.
ECE 301 – Digital Electronics
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,
 Arithmetic circuit  Addition  Subtraction  Division  Multiplication.
1 Bits are just bits (no inherent meaning) — conventions define relationship between bits and numbers Binary numbers (base 2)
1 CHAPTER 4: PART I ARITHMETIC FOR COMPUTERS. 2 The MIPS ALU We’ll be working with the MIPS instruction set architecture –similar to other architectures.
EGRE 426 Fall 09 Chapter Three
ADDERS Half Adders Recall that the basic rules of binary addition are as indicated below in Table 2-9. A circuit known as the half-adder carries out these.
WEEK #10 FUNCTIONS OF COMBINATIONAL LOGIC (ADDERS)
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ć.
1 EGRE 426 Fall 08 Chapter Three. 2 Arithmetic What's up ahead: –Implementing the Architecture 32 operation result a b ALU.
1  1998 Morgan Kaufmann Publishers Arithmetic Where we've been: –Performance (seconds, cycles, instructions) –Abstractions: Instruction Set Architecture.
Csci 136 Computer Architecture II – Constructing An Arithmetic Logic Unit Xiuzhen Cheng
1 CPSC3850 Adders and Simple ALUs Simple Adders Figures 10.1/10.2 Binary half-adder (HA) and full-adder (FA). Digit-set interpretation: {0, 1}
Lecture 9 Topics: –Combinational circuits Basic concepts Examples of typical combinational circuits –Half-adder –Full-adder –Ripple-Carry adder –Decoder.
Computing Systems Designing a basic ALU.
CHAPTER 4 Combinational Logic Design- Arithmetic Operation (Section 4.6&4.9)
IT253: Computer Organization Lecture 7: Logic and Gates: Digital Design Tonga Institute of Higher Education.
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.
Half Adder & Full Adder Patrick Marshall. Intro Adding binary digits Half adder Full adder Parallel adder (ripple carry) Arithmetic overflow.
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 Arithmetic I Instructor: Mozafar Bag-Mohammadi Ilam University.
COMP541 Arithmetic Circuits
1  2004 Morgan Kaufmann Publishers Performance is specific to a particular program/s –Total execution time is a consistent summary of performance For.
1 ELEN 033 Lecture 4 Chapter 4 of Text (COD2E) Chapters 3 and 4 of Goodman and Miller book.
Orange Coast College Business Division Computer Science Department CS 116- Computer Architecture Arithmetic: Part II.
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
Prof. Hsien-Hsin Sean Lee
ECE/CS 552: Arithmetic I Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes partially based on set created by Mark Hill.
Arithmetic-Logic Units. Logic Gates AND gate OR gate NOT gate.
Addition and multiplication Arithmetic is the most basic thing you can do with a computer, but it’s not as easy as you might expect! These next few lectures.
1 Lecture 14 Binary Adders and Subtractors. 2 Overview °Addition and subtraction of binary data is fundamental Need to determine hardware implementation.
1 Lecture 11: Hardware for Arithmetic Today’s topics:  Logic for common operations  Designing an ALU  Carry-lookahead adder.
1 Arithmetic Where we've been: –Abstractions: Instruction Set Architecture Assembly Language and Machine Language What's up ahead: –Implementing the Architecture.
1 Ethics of Computing MONT 113G, Spring 2012 Session 4 Binary Addition.
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.
Simple ALU  Half adder  Full adder  Constructing 4 bits adder  ALU does several operations  General ALU structure  Timing diagram of adder  Overflow.
9/23/2004Comp 120 Fall September Chapter 4 – Arithmetic and its implementation Assignments 5,6 and 7 posted to the class web page.
1 CPTR 220 Computer Organization Computer Architecture Assembly Programming.
1 The ALU l ALU includes combinational logic. –Combinational logic  a change in inputs directly causes a change in output, after a characteristic delay.
Addition and multiplication1 Arithmetic is the most basic thing you can do with a computer, but it’s not as easy as you might expect! These next few lectures.
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.
Lecture 11: Hardware for Arithmetic
Arithmetic Where we've been:
Lecture 11: Hardware for Arithmetic
COSC 2021: Computer Organization Instructor: Dr. Amir Asif
COMS 361 Computer Organization
October 8 Rules for Programming Assignments ASK QUESTIONS!
XOR Function Logic Symbol  Description  Truth Table 
Presentation transcript:

Arithmetic II CPSC 321 E. J. Kim

Today’s Menu Arithmetic-Logic Units Logic Design Revisited Faster Addition Multiplication (if time permits)

Goals We recall some basic logic gates Determine the truth tables for the Boolean functions We recall half-adders and full-adders Ripple-carry adders Discuss faster adders

Logic Gates AND gate OR gate NOT gate What are the truth tables?

Logic Gates NOR gate NAND gate XOR gate What are the truth tables?

Half Adder s c a b a b c s

Full Adder c in a b c out s Give a Boolean formula for s s=cin xor a xor b Give a Boolean formula for c out c out =ab+c in (a xor b) Design now a circuit using and, or, xor.

Full Adder c in a b c out s s=c in xor a xor b c out = ab+c in (a xor b)

Ripple Carry Adder

Critical Path c in a b c out s Suppose that each gate has a unit delay. What is the critical path (= path with the longest delay)?

Ripple Carry Adders Each gates causes a delay our example: 3 gates for carry generation book has example with 2 gates Carry might ripple through all n adders O(n) gates causing delay intolerable delay if n is large Carry lookahead adders

Faster Adders c in a b c out s c out =ab+c in (a xor b) =ab+ac in +bc in =ab+(a+b)c in = g + p c in Generate g = ab Propagate p = a+b Why are they called like that?

Fast Adders Iterate the idea, generate and propagate c i+1 = g i + p i c i = g i + p i (g i-1 + p i-1 c i-1 ) = g i + p i g i-1 + p i p i-1 c i-1 = g i + p i g i-1 + p i p i-1 g i-2 +…+ p i p i-1 …p 1 g 0 +p i p i-1 …p 1 p 0 c 0 Two level AND-OR circuit Carry is known early!

Carry Lookahead Adders Based on the previous identity Fast because critical path is shorter O(log n) gate delays [assuming 2-input gates]  More complex to implement  Design is less regular  Layout of one bit adder cells depend on i Compromise  couple blocks of carry lookahead adders

Building an ALU Addition Subtraction AND OR What is missing?

Need to support the set-on-less-than instruction (slt) remember: slt is an arithmetic instruction produces 1 if rs < rt and 0 otherwise use subtraction: (a-b) < 0 implies a < b Need to support test for equality (beq $t5, $t6, $t7) use subtraction: (a-b) = 0 implies a = b Tailoring the ALU to the MIPS

SLT Determine a<b Calculate b-a If MSB equals 1, then a<b 0, then a>=b Changes? Operation less than Output of subtraction Overflow

SLT 4 operations subtraction output available Connect MSB set output w/ LSB less

LSB indicates whether a<b 0 if false 1 if true

Test for equality Notice control lines: 000 = and 001 = or 010 = add 110 = subtract 111 = slt Note: zero is a 1 when the result is zero!

Summary We can build an ALU to support the MIPS instruction set key idea: use multiplexor to select the output we want we can efficiently perform subtraction using two’s complement we can replicate a 1-bit ALU to produce a 32-bit ALU Important points about hardware all of the gates are always working the speed of a gate is affected by the number of inputs to the gate the speed of a circuit is affected by the number of gates in series (on the “critical path” or the “deepest level of logic”) We focused on basic principles. We noted that clever changes to organization can improve performance (similar to using better algorithms in software) faster addition, next time: faster multiplication