Topic 3b Computer Arithmetic: ALU Design

Slides:



Advertisements
Similar presentations
Kuliah Rangkaian Digital Kuliah 7: Unit Aritmatika
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.
Chapter 4 -- Modular Combinational Logic. Decoders.
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.
Comparator.
©UCB CPSC 161 Lecture 6 Prof. L.N. Bhuyan
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.
Lecture 8 Arithmetic Logic Circuits
Arithmetic-Logic Units CPSC 321 Computer Architecture Andreas Klappenecker.
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.
Lecture # 12 University of Tehran
Digital Arithmetic and Arithmetic Circuits
Chapter # 5: Arithmetic Circuits
Chapter 6-1 ALU, Adder and Subtractor
Csci 136 Computer Architecture II – Constructing An Arithmetic Logic Unit Xiuzhen Cheng
EEL-4713C Computer Architecture Introduction: the Logic Design Process
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.
درس مدارهای منطقی دانشگاه قم مدارهای منطقی محاسباتی تهیه شده توسط حسین امیرخانی مبتنی بر اسلایدهای درس مدارهای منطقی دانشگاه.
CDA 3101 Fall 2013 Introduction to Computer Organization The Arithmetic Logic Unit (ALU) and MIPS ALU Support 20 September 2013.
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.
Ch3b- 2 EE/CS/CPE Computer Organization  Seattle Pacific University There is logic to it andRd, Rs, RtRd
A four function ALU A 00 ADD B MUX SUB 11 Result AND OR
1 Modified from  Modified from 1998 Morgan Kaufmann Publishers Chapter Three: Arithmetic for Computers Section 2 citation and following credit line is.
CPE 232 MIPS Arithmetic1 CPE 232 Computer Organization MIPS Arithmetic – Part I Dr. Gheith Abandah [Adapted from the slides of Professor Mary Irwin (
Addition, Subtraction, Logic Operations and ALU Design
Cpu control.1 2/14 Datapath Components for Lab The Processor! ( th ed)
Arithmetic-Logic Units. Logic Gates AND gate OR gate NOT gate.
Gates AND, OR, NOT NAND, NOR Combinational logic No memory A set of inputs uniquely and unambiguously specifies.
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.
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 Arithmetic Building Blocks Today: Signed ArithmeticFirst Hour: Signed Arithmetic –Section 5.1 of Katz’s Textbook –In-class Activity #1 Second Hour: Adder.
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
Somet things you should know about digital arithmetic:
Lecture 12 Logistics Last lecture Today HW4 due today Timing diagrams
Lecture Adders Half adder.
Single Bit ALU 3 R e s u l t O p r a i o n 1 C y I B v b 2 L S f w d O
Addition and multiplication
Computer Organization and Design Arithmetic & Logic Circuits
CS352H: Computer Systems Architecture
Computer Organization and Design Arithmetic & Logic Circuits
Combinational Circuits
Computer Organization and Design Arithmetic & Logic Circuits
5. Combinational circuits
CSE Winter 2001 – Arithmetic Unit - 1
Topic 3b Computer Arithmetic: ALU Design
Lecture 14 Logistics Last lecture Today
King Fahd University of Petroleum and Minerals
Computer Organization and Design Arithmetic & Logic Circuits
MIPS ALU.
Arithmetic Circuits (Part I) Randy H
Systems Architecture I
Computer Architecture EECS 361 Lecture 5: The Design Process & ALU Design Just like lat time, I like to start today’s lecture with a recap of our last.
Overview Part 1 – Design Procedure Part 2 – Combinational Logic
Part III The Arithmetic/Logic Unit
COMS 361 Computer Organization
Instructor: Mozafar Bag-Mohammadi University of Ilam
A 1-Bit Arithmetic Logic Unit
Lecture 14 Logistics Last lecture Today
ECE 352 Digital System Fundamentals
Combinational Circuits
Number Representation
Arithmetic and Logic Circuits
Presentation transcript:

Topic 3b Computer Arithmetic: ALU Design Introduction to Computer Systems Engineering (CPEG 323) 2019/1/2 cpeg323-05F\Topic3b

Design Process Design Top Down decomposition of complex functions components how they are put together Top Down decomposition of complex functions Bottom-up composition of primitive 2019/1/2 cpeg323-05F\Topic3b

Problem: Design an ALU Operations Total number of operations = 10 add, addu, sub, subu, addi, addiu 2’s complement adder/sub with overflow detection and, or, andi, ori bitwise operations Total number of operations = 10 2019/1/2 cpeg323-05F\Topic3b

Design: divide & conquer method Break the problem into simpler parts Work on the parts Put pieces together Verify solution works as a whole Example: Separate immediate instructions from the rest. Process immediates before ALU ALU inputs now uniform 6 non-immediate operations remain Need 3 bits to specify the ALU mode 2019/1/2 cpeg323-05F\Topic3b

Design – First Steps Complete functional specification first inputs: 2 x 32-bit operands A, B, 3-bit operation code outputs: 32-bit result R, 1-bit carry, 1 bit overflow operations: add, addu, sub, subu, and, or High-level block diagram completed next 2019/1/2 cpeg323-05F\Topic3b

Design – Reducing the problem to something simpler For our ALU, reduce 32-bit problem into simpler 1-bit slices. Changes big combinational problem to a small combinational problem Put the pieces together to solve the big problem. 2019/1/2 cpeg323-05F\Topic3b

Designing with lower-level block diagrams 1-Bit ALU block Replicate 32 times for a 32-bit ALU Replicate 32 times for a 32-bit ALU 2019/1/2 cpeg323-05F\Topic3b

The 1-Bit ALU Block Partition into separate/independent blocks logic arithmetic Complete each block at this level or further refine. Complete logic block Complete function select Decompose arithmetic block into simpler parts 2019/1/2 cpeg323-05F\Topic3b

1-bit Add Computing A + B Sum= Co = (a* Ci) + (b * Ci) + (a * b) This is called full adder. A half adder assumes no Ci. Can you draw the 1-bit adder according to the above logic? # of gate delays for Sum = 3 # of gate delays for Carry = 2 (a *b*Ci) + (a *b* Ci) + (a * b*Ci) +(a *b*Ci) 2019/1/2 cpeg323-05F\Topic3b

1-bit Subtraction Convert subtraction to addition XOR complements the input B Setting CarryIn adds 1 (if least significant bit) 2019/1/2 cpeg323-05F\Topic3b

Completing the ALU Overflow detection & opcode decoder 2019/1/2 cpeg323-05F\Topic3b

Overflow Overflow can be detected decoding the Carry into MSB and the Carry out of MSB 2019/1/2 cpeg323-05F\Topic3b

Overflow Detection Logic Carry into MSB XOR Carry out of MSB For a N-bit ALU: Overflow = CarryIn[N - 1] XOR CarryOut[N - 1] 2019/1/2 cpeg323-05F\Topic3b

Evaluating Performance Logic path has three gate delays XOR + AND/OR + MUX Add/sub 1 gate delay for XOR 3 gate delays for SUM and 2 for CarryOut Each bit slice depends on Ci: the output of the previous slice. For an N-bit Adder the worst case delay is then 2 *N gate delays This worst case delay describes a ripple adder 2019/1/2 cpeg323-05F\Topic3b

Evaluating Performance – ALU Block The ALU speed is limited by its slowest block. The logic block has 2 gate delays The add/subtract has 2*N + 1 gate delays, where N >> 1 The arithmetic block is significantly limiting performance Consider ways to reduce gate delays in adder 2019/1/2 cpeg323-05F\Topic3b

Speeding up the ripple carry adder Eliminating the ripple c1 = b0*c0 + a0*c0 + a0*b0 c2 = b1*c1 + a1*c1 + a1*b1 c3 = b2*c2 + a2*c2 + a2*b2 c4 = b3*c3 + a3*c3 + a3*b3 2019/1/2 cpeg323-05F\Topic3b

Carry Look Ahead When both inputs 0, no carry When one is 0, the other is 1, propagate carry input When both are 1, then generate a carry 2019/1/2 cpeg323-05F\Topic3b

Carry-lookahead adder Generate gi = ai * bi Propagate pi = ai + bi Write carry out as function of preceding g, p, & co c1 = g0 + p0*c0 c2 = g1 + p1*c1 c3 = g2 + p2*c2 c4 = g3 + p3*c3 2019/1/2 cpeg323-05F\Topic3b

Reducing the complexity C1 = g0 + (p0 * C0) C2 = g1 + (p1 * [g0 + p0 * C0]) = g1 + (p1 * g0) + (p1 * p0 * C0) C3 = g2 + (p2 * g1) + (p2 * p1 * g0) + (p2 * p1 * p0 * c0) C4=? Increase speed at what cost ? Can you illustrate how to build a 32-bit adder with carry look ahead? 2019/1/2 cpeg323-05F\Topic3b

Limitations The number of inputs of the gates drastically increases Technology permits only a certain maximal number of inputs (fan-in) Realization of a gate with high fan-in by a chain of gates with low fan-in. From Prof.Michal G. Wahl 2019/1/2 cpeg323-05F\Topic3b

Use principle to build a 16-bit adders Let us add a second-level abstractions! Using a 4-bit adder as a first-level abstraction 2019/1/2 cpeg323-05F\Topic3b

4-bit wide carry-lookahead P0 = p3 * p2 * p1 * p0 P1 = p7 * p6 * p5 * p4 P2 = p11 * p10 * p9 * p8 P3 = p15 * p14 * p13 * p12 G0 = g3 + (p3 * g2) + (p3 * p2 * g1) + (p3 * p2 * p1 * g0) G1 = G2 = G3 = 2019/1/2 cpeg323-05F\Topic3b