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.

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

Arithmetic for Computers
Combinational Circuits. Analysis Diagram Designing Combinational Circuits In general we have to do following steps: 1. Problem description 2. Input/output.
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.
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.
1 Representing Numbers Using Bases Numbers in base 10 are called decimal numbers, they are composed of 10 numerals ( ספרות ) = 9* * *10.
Chap 3.3~3.5 Construction an Arithmetic Logic Unit (ALU) Jen-Chang Liu, Spring 2006.
Lecture 8 Arithmetic Logic Circuits
Arithmetic-Logic Units CPSC 321 Computer Architecture Andreas Klappenecker.
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 7 Arithmetic Operations and Circuits Hexadecimal Arithmetic 4 binary bits represent a single hexadecimal digit Addition –Add the digits.
Computer Science 210 Computer Organization The Arithmetic Logic Unit.
1 Bits are just bits (no inherent meaning) — conventions define relationship between bits and numbers Binary numbers (base 2)
Binary Arithmetic Stephen Boyd March 14, Two's Complement Most significant bit represents sign. 0 = positive 1 = negative Positive numbers behave.
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
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.
Ch3b- 2 EE/CS/CPE Computer Organization  Seattle Pacific University There is logic to it andRd, Rs, RtRd
1 Arithmetic I Instructor: Mozafar Bag-Mohammadi Ilam University.
COMP541 Arithmetic Circuits
Combinational Circuits
Topics covered: Arithmetic CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
MIPS ALU. Building from the adder to ALU ALU – Arithmetic Logic Unit, does the major calculations in the computer, including – Add – And – Or – Sub –
CPE 232 MIPS Arithmetic1 CPE 232 Computer Organization MIPS Arithmetic – Part I Dr. Gheith Abandah [Adapted from the slides of Professor Mary Irwin (
1  2004 Morgan Kaufmann Publishers Performance is specific to a particular program/s –Total execution time is a consistent summary of performance For.
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
Cpu control.1 2/14 Datapath Components for Lab The Processor! ( th ed)
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.
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.
1 Arithmetic Where we've been: –Abstractions: Instruction Set Architecture Assembly Language and Machine Language What's up ahead: –Implementing the Architecture.
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.
MIPS ALU. Exercise – Design a selector? I need a circuit that takes two input bits, a and b, and a selector bit s. The function is that if s=0, f=a. if.
Csci136 Computer Architecture II Lab#5 Arithmetic Review ALU Design Ripple Carry Adder & Carry lookahead HW #4: Due on Feb 22, before class Feb.16, 2005.
9/23/2004Comp 120 Fall September Chapter 4 – Arithmetic and its implementation Assignments 5,6 and 7 posted to the class web page.
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.
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
5. Combinational circuits
MIPS ALU.
Lecture 11: Hardware for Arithmetic
COMS 361 Computer Organization
A 1-Bit Arithmetic Logic Unit
Combinational Circuits
MIPS ALU.
MIPS ALU.
Presentation transcript:

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 computer.  We will build it out of 4 basic building blocks.  AND gate: performs the AND operation on 2 signals.  OR gate: performs the OR operation on 2 signals.  Inverter: inverts the incoming signal (o to 1, 1 to 0).  Multiplexor: chooses between one out of several incoming signals. 1/13

The Basic Building Blocks 2/13

1-bit Full Adder  1-bit addition has 3 inputs (a, b, CarryIn) and 2 outputs (Sum, CarryOut).  The CarryOut is set if at least 2 out of a, b, and CarryIn are 1.  The Sum is set when exactly one input is 1 or all three are 1. 3/13

Computer Structure - The ALU 1-bit ALU  We now have a 1-bit ALU that can perform AND, OR and addition.  All 3 operations are performed in parallel.  The MUX (Multiplexor), dependent on the operation, chooses the result. 4/13

Computer Structure - The ALU Subtraction  Subtraction is performed by adding the negative value.  Thus we have to add an inverter.  A MUX has to be added to choose between addition and subtraction. 5/13

Computer Structure - The ALU 32-bit ALU  With 32 of these 1-bit ALUs we can build a 32- bit ALU.  The CarryOut of the Nth 1-bit ALU is connected to the CarryIn of the N+1 1-bit ALU.  This adder is called a ripple carry or ripple adder.  A single carry out in the least significant bit (LSB) can cause a carry out of the MSB. 6/13

Computer Structure - The ALU Adding the slt instruction  slt produces 1 if rs = rt.  Thus slt will set all but the LSB to 0 with the LSB being dependent on the result.  We add a new input to the multiplexor called Less, this will be the output of slt.  To set the LSB we perform rs - rt.  If the result is negative we must set the output. Thus the sign bit is the correct output.  But it isn't the output of slt (Less is) so a new output is added to the 1-bit ALU of the MSB, Set.  The input of the last 31 Less lines is 0, the input of the 1st Less line is Set of the 32nd ALU. 7/13

ALU with slt  The Less line is added to all ALUs.  The 32nd ALU has a Set line.  The 32nd ALU also has overflow detection circuitry. 8/13

Computer Structure - The ALU The New ALU  All the Less inputs are hardwired to zero.  Except the LSB Less input which is wired to the Set output of the MSB 1-bit ALU. 9/13

Computer Structure - The ALU Comparison in the ALU  bne and beq compare 2 numbers.  a is equal to b if a - b=0.  The output line Zero is set to 1 if all the Result lines are 0.  This happens if a == b. 10/13

Computer Structure - The ALU ALU Summary  Our ALU can perform AND, OR, Addition, Subtraction, Set on less then (slt), and Equality tests. The universal symbol of the ALU is shown here: 11/13

Computer Structure - The ALU Fast Addition  The addition we have just described is to slow. We have to wait until carry values ripple through the ALU.  Do we have to wait? c1 = (b0*c0)+(a0*c0)+(a0*b0) c2 = (b1*c1)+(a1*c1)+(a1*b1)  Thus we can compute c2 without waiting for the carry c1: c2=(a1*a0*b0)+(a1*a0*c0)+(a1*b0*c0)+(b1*a0*b0)+(b1*a0*c0)+(b1*b0*c 0)+(a1*b1)  We can in fact compute c32 with only a,b and c0. However the size of the adder will be very large. This is called a Fast-Adder. 12/13

Computer Structure - The ALU Carry Lookahead Addition  Each 4 bit Fast-Adder outputs a Propagate (תעביר) and Generate (תייצר) bit.  Generate means there is a CarryOut, independent of the CarryIn..  Propagate means the CarryOut is dependent on the CarryIn.  This is called Carry Lookahead Addition. 13/13