COMP541 Arithmetic Circuits

Slides:



Advertisements
Similar presentations
Kuliah Rangkaian Digital Kuliah 7: Unit Aritmatika
Advertisements

Combinational Circuits
Introduction So far, we have studied the basic skills of designing combinational and sequential logic using schematic and Verilog-HDL Now, we are going.
Combinational Circuits. Analysis Diagram Designing Combinational Circuits In general we have to do following steps: 1. Problem description 2. Input/output.
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.
Lab 10 : Arithmetic Systems : Adder System Layout: Slide #2 Slide #3 Slide #4 Slide #5 Arithmetic Overflow: 2’s Complement Conversions: 8 Bit Adder/Subtractor.
Mohamed Younis CMCS 411, Computer Architecture 1 CMCS Computer Architecture Lecture 7 Arithmetic Logic Unit February 19,
Lecture Adders Half adder.
DPSD This PPT Credits to : Ms. Elakya - AP / ECE.
Parallel Adder Recap To add two n-bit numbers together, n full-adders should be cascaded. Each full-adder represents a column in the long addition. The.
Henry Hexmoor1 Chapter 5 Arithmetic Functions Arithmetic functions –Operate on binary vectors –Use the same subfunction in each bit position Can design.
ECE 331 – Digital System Design
1 CS 140 Lecture 14 Standard Combinational Modules Professor CK Cheng CSE Dept. UC San Diego Some slides from Harris and Harris.
Arithmetic II CPSC 321 E. J. Kim. Today’s Menu Arithmetic-Logic Units Logic Design Revisited Faster Addition Multiplication (if time permits)
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.
Lecture 8 Arithmetic Logic Circuits
1 COMP541 Arithmetic Circuits Montek Singh Mar 20, 2007.
Arithmetic-Logic Units CPSC 321 Computer Architecture Andreas Klappenecker.
Fall 2008EE VLSI Design I - © Kia Bazargan 1 EE 5323 – VLSI Design I Kia Bazargan University of Minnesota Adders.
ECE 301 – Digital Electronics
ECE 301 – Digital Electronics
1  1998 Morgan Kaufmann Publishers Chapter Four Arithmetic for Computers.
ENGIN112 L14: Binary Adder Subtractor October 3, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 14 Binary Adders and Subtractors.
Chapter 3 Arithmetic for Computers. Arithmetic Where we've been: Abstractions: Instruction Set Architecture Assembly Language and Machine Language What's.
4-bit adder, multiplexer, timing diagrams, propagation delays
Charles Kime & Thomas Kaminski © 2008 Pearson Education, Inc. (Hyperlinks are active in View Show mode) Chapter 4 – Arithmetic Functions Logic and Computer.
CS 105 Digital Logic Design
Binary Arithmetic Stephen Boyd March 14, Two's Complement Most significant bit represents sign. 0 = positive 1 = negative Positive numbers behave.
3-1 Chapter 3 - Arithmetic Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Principles of Computer Architecture.
Basic Arithmetic (adding and subtracting)
Digital Arithmetic and Arithmetic Circuits
ECE2030 Introduction to Computer Engineering Lecture 12: Building Blocks for Combinational Logic (3) Adders/Subtractors, Parity Checkers Prof. Hsien-Hsin.
IKI a-Combinatorial Components Bobby Nazief Semester-I The materials on these slides are adopted from those in CS231’s Lecture Notes.
Chapter 6-1 ALU, Adder and Subtractor
Basic Arithmetic (adding and subtracting)
Csci 136 Computer Architecture II – Constructing An Arithmetic Logic Unit Xiuzhen Cheng
Important Components, Blocks and Methodologies. To remember 1.EXORS 2.Counters and Generalized Counters 3.State Machines (Moore, Mealy, Rabin-Scott) 4.Controllers.
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.
1 Arithmetic I Instructor: Mozafar Bag-Mohammadi Ilam University.
Lecture 4. Adder & Subtractor Prof. Taeweon Suh Computer Science Education Korea University 2010 R&E Computer System Education & Research.
Computer Architecture Lecture 3 Combinational Circuits Ralph Grishman September 2015 NYU.
N, Z, C, V in CPSR with Adder & Subtractor Prof. Taeweon Suh Computer Science Education Korea University.
COMP541 Arithmetic Circuits
ECE 331 – Digital System Design Multi-bit Adder Circuits, Adder/Subtractor Circuit, and Multiplier Circuit (Lecture #12)
1 IKI20210 Pengantar Organisasi Komputer Kuliah No. 23: Aritmatika 18 Desember 2002 Bobby Nazief Johny Moningka
C-H1 Lecture Adders Half adder. C-H2 Full Adder si is the modulo- 2 sum of ci, xi, yi.
CPEN Digital System Design
Addition, Subtraction, Logic Operations and ALU Design
1 Fundamentals of Computer Science Combinational Circuits.
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.
Number Representation (Part 2) Computer Architecture (Fall 2006)
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.
ECE DIGITAL LOGIC LECTURE 15: COMBINATIONAL CIRCUITS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2015, 10/20/2015.
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.
Arithmetic Circuits I. 2 Iterative Combinational Circuits Like a hierachy, except functional blocks per bit.
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.
Combinational Circuits
Computer Organization and Design Arithmetic & Logic Circuits
Computer Organization and Design Arithmetic & Logic Circuits
ECE 352 Digital System Fundamentals
Combinational Circuits
ECE 352 Digital System Fundamentals
Presentation transcript:

COMP541 Arithmetic Circuits Montek Singh Oct 21, 2015

Today’s Topics Adder circuits Subtraction Overflow ripple-carry adder (revisited) more advanced: carry-lookahead adder Subtraction by adding the negative Overflow

Iterative Circuit Like a hierarchy, except functional blocks per bit

Adders Great example of this type of design Design 1-bit circuit, then expand Let’s look at Half adder – 2-bit adder, no carry in Inputs are bits to be added Outputs: result and possible carry Full adder – includes carry in, really a 3-bit adder We have already studied adder in Lab 3/Comp411 here we look at it from a different angle modify it to be faster

Half Adder Produces carry out does not handle carry in

Full Adder Three inputs Two outputs third is carry in sum and carry out

Two Half Adders (and an OR)

Ripple-Carry Adder Straightforward – connect full adders 32-bit ripple-carry adder Straightforward – connect full adders Carry-out to carry-in chain Cin in case this is part of larger chain, or just ‘0’

Lab 3: Hierarchical 4-Bit Adder We used hierarchy in Lab 3 Design full adder Used 4 of them to make a 4-bit adder Used two 4-bit adders to make an 8-bit adder …

Specifying Addition in Behavioral Verilog // 4-bit Adder: Behavioral Verilog module adder_4_behav(A, B, C0, S, C4); input wire[3:0] A, B; input wire C0; output logic[3:0] S; output logic C4; assign {C4, S} = A + B + C0; endmodule Addition (unsigned) Concatenation operation

What’s the problem with this design? Delay Approx how much? Imagine a 64-bit adder Look at carry chain

Delays (after assigning delays to gates) Delays are generally higher for more significant bits

Multibit Adders Several types of carry propagate adders (CPAs) are: Ripple-carry adders (slow) Carry-lookahead adders (fast) Prefix adders (faster) Carry-lookahead and prefix adders are faster for large adders but require more hardware. Adder symbol (right)

Carry Lookahead Adder Note that add itself just 2 level sum is produced with a delay of only two XOR gates carry takes three gates, though Idea is to separate carry from adder function then make carry faster actually, we will make carry have a 2-gate delay total, for all the bits of the adder! these two gates might be huge though

Four-bit Ripple Carry Reference Adder function separated from carry Notice adder has A, B, C in and S out, as well as G,P out.

Propagate The P signal is called propagate P = A  B Means to propagate incoming carry

Generate The G is generate So it’s ORed with incoming carry G = AB, so new carry created So it’s ORed with incoming carry

Said Differently If A  B and there’s incoming carry, carry will be propagated And S will be 0, of course If AB, then will create carry Incoming will determine whether S is 0 or 1

Ripple Carry Delay: 8 Gates Key observation: G and P are produced by each adder stage without needing carry from the right! need only 2 gate delays for all G’s and P’s to be generated! critical path is the carry logic at the bottom the G’s and P’s are “off the critical path”

Turn Into Two Gate Delays Refactor the logic changed from deep (in delay) to wide for each stage, gather and squish together all the logic to the right

C1 Just Like Ripple Carry

C2 Circuit Two Levels G from before and P to pass on This checks two propagates and a carry in

C3 Circuit Two Levels Generate from level 0 and two propagates G from before and P to pass on This checks three propagates and a carry in

What happens as scaled up? Can I realistically make 64-bit adder like this? Have to AND 63 propagates and Cin! Compromise Hierarchical design More levels of gates use a tree of AND’s delay grows only logarithmically

Making 4-Bit Adder Module Create propagate and generate signals for whole module

Group Propagate Make propagate of whole 4-bit block P0-3 = P3P2P1P0

Group Generate Indicates carry generated within this block

Hierarchical Carry Left lookahead block is exercise for you 4-bit adder A B S G P Cin C0 Look Ahead C8 C4 Left lookahead block is exercise for you

Practical Matters FPGAs like ours have limited inputs per gate Instead they have special circuits to make adders So don’t expect to see same results as theory would suggest

Other Adder Circuits What if hierarchical lookahead too slow Other styles exist Prefix adder (explained in text) had a tree to computer generate and propagate Pipelined arithmetic units – multicycle but enable faster clock speed These are for self-study

Adder-Subtractor Need only adder and complementer for input to subtract Need selective complementer to make negative output back from 2’s complement

Design of Adder/Subtractor S low for add, high for subtract Inverts each bit of B if S is 1 Adds 1 to make 2’s complement Output is 2’s complement if B > A

Overflow Two cases of overflow for addition of signed numbers Two large positive numbers overflow into sign bit Not enough room for result Two large negative numbers added Same – not enough bits Carry out by itself doesn’t indicate overflow

Overflow Examples 4-bit signed numbers: Sometimes a leftmost carry is generated without overflow: -7 + 7 5 + (-3) Sometimes a leftmost carry is not generated, but overflow occurs: 4 + 4

Overflow Detection Basic condition: if two +ve numbers are added and sum is –ve if two -ve numbers are added and sum is +ve Can be simplified to the following check: either Cn-1 or Cn is high, but not both

Summary Today Next class: adders and subtractors overflow full processor datapath