Arithmetic Circuits. (Part I) Randy H. Katz University of California, Berkeley. Spring Time vs. Space Trade-offs. Arithmetic Logic Units

Similar documents
Arithmetic Circuits. (Part I) Randy H. Katz University of California, Berkeley. Spring 2007

Overview EECS Components and Design Techniques for Digital Systems. Lec 15 Addition, Subtraction, and Negative Numbers. Positional Notation

EE260: Digital Design, Spring n Binary Addition. n Complement forms. n Subtraction. n Multiplication. n Inputs: A 0, B 0. n Boolean equations:

EECS150. Arithmetic Circuits

Chapter 9 Computer Design Basics

Chapter 9 Computer Design Basics

Overview. Arithmetic circuits. Binary half adder. Binary full adder. Last lecture PLDs ROMs Tristates Design examples

Egyptian Numerals. Mesopotamia Civilization. Babylonian numerals

CHAPTER XI DATAPATH ELEMENTS

Applications of Distributed Arithmetic to Digital Signal Processing: A Tutorial Review

EE260: Digital Design, Spring n MUX Gate n Rudimentary functions n Binary Decoders. n Binary Encoders n Priority Encoders

CMPUT 329. Circuits for binary addition

Load. Load. Load 1 0 MUX B. MB select. Bus A. A B n H select S 2:0 C S. G select 4 V C N Z. unit (ALU) G. Zero Detect.

Number Representation

Annotations to the assignments and the solution sheet. Note the following points

Fig. 7-6 Single Bus versus Dedicated Multiplexers

Problem 01 X Y. Logic Testbank. Problem. Problems. Problem 1:

14:332:231 DIGITAL LOGIC DESIGN

FIR Filters. Lecture #7 Chapter 5. BME 310 Biomedical Computing - J.Schesser

DESIGN AND IMPLEMENTATION OF IMPROVED AREA EFFICIENT WEIGHTED MODULO 2N+1 ADDER DESIGN

6.003: Signals and Systems. Feedback, Poles, and Fundamental Modes

Applications of Distributed Arithmetic to Digital Signal Processing: A Tutorial Review

Computing the output response of LTI Systems.

1 Hash tables. 1.1 Implementation

Efficient Reverse Converter Design for Five Moduli

Physics 310 Lecture 9a DAC and ADC

A One-Step Modulo 2 n +1 Adder Based on Double-lsb Representation of Residues

ADVANCED DIGITAL SIGNAL PROCESSING

Introduction to Distributed Arithmetic. K. Sridharan, IIT Madras

Mini Lecture 10.1 Radical Expressions and Functions. 81x d. x 4x 4

CS537. Numerical Analysis and Computing

3. Z Transform. Recall that the Fourier transform (FT) of a DT signal xn [ ] is ( ) [ ] = In order for the FT to exist in the finite magnitude sense,

Complex Number Theory without Imaginary Number (i)

Solutions. Number of Problems: 4. None. Use only the prepared sheets for your solutions. Additional paper is available from the supervisors.

EE260: Digital Design, Spring n Binary logic and Gates n Boolean Algebra. n Basic Properties n Algebraic Manipulation

Lecture 2 Linear and Time Invariant Systems

Module 2. Basic Digital Building Blocks. Binary Arithmetic & Arithmetic Circuits Comparators, Decoders, Encoders, Multiplexors Flip-Flops

Kinetics of Complex Reactions

Chapter Vectors

6.111 Lecture 6 Today: 1.Blocking vs. non-blocking assignments 2.Single clock synchronous circuits 3.Finite State Machines

CS 332: Algorithms. Linear-Time Sorting. Order statistics. Slide credit: David Luebke (Virginia)

CMSC 313 Lecture 18 Midterm Exam returned Assign Homework 3 Circuits for Addition Digital Logic Components Programmable Logic Arrays

CS161 Design and Analysis of Algorithms. Administrative

Design and Analysis of ALGORITHM (Topic 2)

Sequences A sequence of numbers is a function whose domain is the positive integers. We can see that the sequence

4.3 Growth Rates of Solutions to Recurrences

MCT242: Electronic Instrumentation Lecture 2: Instrumentation Definitions

Lecture 7: Polar representation of complex numbers

Digital Logic and Design (Course Code: EE222) Lecture 0 3: Digital Electronics Fundamentals

Signal Processing in Mechatronics. Lecture 3, Convolution, Fourier Series and Fourier Transform

Problem Set # 5 Solutions

ISSN: ISO 9001:2008 Certified International Journal of Engineering and Innovative Technology (IJEIT) Volume 2, Issue 5, November 2012

6.003 Homework #3 Solutions

Arithmetic Circuits How to add and subtract using combinational logic Setting flags Adding faster

Discrete-Time Signals and Systems. Discrete-Time Signals and Systems. Signal Symmetry. Elementary Discrete-Time Signals.

Chapter 9: Numerical Differentiation

Generating Functions. 1 Operations on generating functions

Difference Equation Construction (1) ENGG 1203 Tutorial. Difference Equation Construction (2) Grow, baby, grow (1)

Signals & Systems Chapter3

Solutions - Homework # 1

ECE-S352 Introduction to Digital Signal Processing Lecture 3A Direct Solution of Difference Equations

SNAP Centre Workshop. Basic Algebraic Manipulation

Sums, products and sequences

Chapter 5 Arithmetic Circuits

ECE 2300 Digital Logic & Computer Organization

1 Generating functions for balls in boxes

Chapter 9 - CD companion 1. A Generic Implementation; The Common-Merge Amplifier. 1 τ is. ω ch. τ io

Review of Discrete-time Signals. ELEC 635 Prof. Siripong Potisuk

Recursive Algorithms. Recurrences. Recursive Algorithms Analysis

COMPARISON OF FPGA IMPLEMENTATION OF THE MOD M REDUCTION

Midterm Exam Two is scheduled on April 8 in class. On March 27 I will help you prepare Midterm Exam Two.

MATH 262A LECTURE 1: AN INTRODUCTION TO BOOLEAN CIRCUITS AND FORMULAE

Advanced Course of Algorithm Design and Analysis

6.3 Testing Series With Positive Terms

CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION

DESCRIPTION OF THE SYSTEM

Signal Processing. Lecture 02: Discrete Time Signals and Systems. Ahmet Taha Koru, Ph. D. Yildiz Technical University.

We start by describing a one bit memory circuit built of a couple of two inputs NAND gates.

Oblivious Transfer using Elliptic Curves

ECE4270 Fundamentals of DSP. Lecture 2 Discrete-Time Signals and Systems & Difference Equations. Overview of Lecture 2. More Discrete-Time Systems

EE422G Homework #13 (12 points)

Analysis of Algorithms. Introduction. Contents

Lecture 8: Solving the Heat, Laplace and Wave equations using finite difference methods

Lecture 3. Digital Signal Processing. Chapter 3. z-transforms. Mikael Swartling Nedelko Grbic Bengt Mandersson. rev. 2016

10-701/ Machine Learning Mid-term Exam Solution

ELEC1200: A System View of Communications: from Signals to Packets Lecture 3

Polynomials. Computer Programming for Engineers (2014 Spring)

Lesson 10: Limits and Continuity

Topic 1 2: Sequences and Series. A sequence is an ordered list of numbers, e.g. 1, 2, 4, 8, 16, or

P.3 Polynomials and Special products

Test One (Answer Key)

Beurling Integers: Part 2

Arithmetic Circuits Didn t I learn how to do addition in the second grade? UNC courses aren t what they used to be...

Math 5311 Problem Set #5 Solutions

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Electrical Engineering and Computer Science. BACKGROUND EXAM September 30, 2004.

ICS141: Discrete Mathematics for Computer Science I

CS321. Numerical Analysis and Computing

A sequence of numbers is a function whose domain is the positive integers. We can see that the sequence

Round-off Errors and Computer Arithmetic - (1.2)

CS 330 Discussion - Probability

Transcription:

rithmetic rcuits (art I) Rady H. Katz Uiversity of Califoria, erkeley otivatio rithmetic circuits are excellet examples of comb. logic desig Time vs. pace Trade-offs Doig thigs fast requires more logic ad thus more space Example: carry lookahead logic rithmetic Logic Uits Critical compoet of processor datapath Ier-most "loop" of most computer istructios prig Lecture #: rithmetic rcuits- Lecture #: rithmetic rcuits- Overview iary Number Represetatio ig & agitude, Oes Complemet, Twos Complemet iary dditio Full dder Revisted LU Desig CD rcuits Combiatioal ultiplier rcuit Desig Case tudy: it ultiplier equetial ultiplier rcuit Number ystems Represetatio of Negative Numbers Represetatio of positive umbers same i most systems ajor differeces are i how egative umbers are represeted Three major schemes: sig ad magitude oes complemet twos complemet ssumptios: we'll assume a bit machie word 6 differet values ca be represeted roughly half are positive, half are egative Lecture #: rithmetic rcuits Lecture #: rithmetic rcuits- Number ystems ig ad agitude Represetatio - -6 - - - - 5 6 = = - High order bit is sig: = positive (or zero), = egative Three low order bits is the magitude: () thru () Number rage for bits = /- - - Represetatios for - Lecture #: rithmetic rcuits Number ystems ig ad agitude Cumbersome additio/subtractio ust compare magitudes to determie sig of result Oes Complemet N is positive umber, the N is its egative 's complemet N = ( - ) - N Example: 's complemet of hortcut method: simply compute bit wise complemet -> = - = - = = - i 's comp. Lecture #: rithmetic rcuits-6

Number ystems Oes Complemet Number Represetatios Twos Complemet - - - - -6-5 6 = = - - like 's comp except shifted oe positio clockwise - - - -6-5 6 = = - - ubtractio implemeted by additio & 's complemet Oly oe represetatio for till two represetatios of! This causes some problems Oe more egative umber tha positive umber ome complexities i additio Lecture #: rithmetic rcuits- Lecture #: rithmetic rcuits Number ystems Twos Complemet Numbers N* = - N Example: Twos complemet of = sub = = repr. of - Number Represetatios dditio ad ubtractio of Numbers ig ad agitude result sig bit is the same as the operads' sig - () - Example: Twos complemet of - = sub hortcut method: Twos complemet = bitwise complemet - = = repr. of whe sigs differ, operatio is subtract, sig of result depeds o sig of umber with the larger magitude - - - -> -> (represetatio of -) -> -> (represetatio of ) Lecture #: rithmetic rcuits- Lecture #: rithmetic rcuits- Number ystems dditio ad ubtractio of Numbers Oes Complemet Calculatios Number ystems dditio ad ubtractio of iary Numbers Oes Complemet Calculatios - () - Ed aroud carry Why does ed-aroud carry work? Its equivalet to subtractig ad addig - N = N = ( - - N) = ( - N) - - (-N) = N = ( - - ) ( - N - ) = [ - - ( N)] - ( > N) N < - - Ed aroud carry - - after ed aroud carry: = - - ( N) this is the correct form for represetig -( N) i 's comp! Lecture #: rithmetic rcuits- Lecture #: rithmetic rcuits-

Number ystems dditio ad ubtractio of iary Numbers Twos Complemet Calculatios If carry-i to sig = carry-out the igore carry if carry-i differs from carry-out the overflow - - () - - - impler additio scheme makes twos complemet the most commo choice for iteger umber systems withi digital systems Number ystems dditio ad ubtractio of iary Numbers Twos Complemet Calculatios Why ca the carry-out be igored? - N whe N > : * N = ( - ) N = (N - ) Igorig carry-out is just like subtractig - -N where N < or = - - (-N) = * N* = ( - ) ( - N) = - ( N) fter igorig the carry, this is just the right twos compl. represetatio for -( N)! Lecture #: rithmetic rcuits Lecture #: rithmetic rcuits- Number ystems Overflow Coditios dd two positive umbers to get a egative umber or two egative umbers to get a positive umber - - - -6 5-6 - -6 - - - 6 5 Number ystems Overflow Coditios 5 Overflow 5 No overflow - - Overflow No overflow 5 =! - - =! Overflow whe carry i to sig does ot equal carry out Lecture #: rithmetic rcuits Lecture #: rithmetic rcuits-6 Networks for iary dditio Half dder With twos complemet umbers, additio is sufficiet Networks for iary dditio Full dder i i um Carry i i um = i i i i = i i i i Carry = i i Cascaded ulti-bit dder C usually iterested i addig more tha two bits C C i um this motivates the eed for the full adder i Half-adder chematic Carry Lecture #: rithmetic rcuits- Lecture #: rithmetic rcuits

Networks for iary dditio Full dder = xor xor = = ( ) Networks for iary dditio Full dder/half dder tadard pproach: 6 ates lterative Implemetatio: 5 ates Half dder Half dder ( ) ( xor ) = Lecture #: rithmetic rcuits- Lecture #: rithmetic rcuits- Networks for iary dditio dder/ubtractor Networks for iary dditio Carry Lookahead rcuits Critical delay: the propagatio of carry from low to high order stages el el el el late arrivig sigal @ @ @N @ @ @ @N @ @N two gate delays to compute dd/ubtract C stage adder @ C @ @ C @ Overflow - = (-) = Lecture #: rithmetic rcuits- C @6 @ C @ fial sum ad carry Lecture #: rithmetic rcuits- Networks for iary dditio Carry Lookahead rcuits Critical delay: the propagatio of carry from low to high order stages, C Valid, C Valid, C Valid, C Valid Networks for iary dditio Carry eerate i = i i must geerate carry whe = = Carry ropagate i = i xor i carry i will equal carry out here worst case additio T T T T6 T T: Iputs to the adder are valid T: tage carry out (C) T: tage carry out (C) T6: tage carry out (C) T: tage carry out (C) delays to compute sum but last carry ot ready util 6 delays later Lecture #: rithmetic rcuits um ad Carry ca be reexpressed i terms of geerate/propagate: i = i xor i xor = i xor = i i i i = i i (i i) = i i (i xor i) = i i Lecture #: rithmetic rcuits-

Networks for iary dditio Reexpress the carry logic as follows: C = C C = C = C C = C = C C = C = C i i Networks for iary dditio Carry Lookahead Implemetatio i @ gate delay i @ gate delays i @ gate delay dder with ropagate ad eerate Outputs Icreasigly complex logic Each of the carry equatios ca be implemeted i a two-level logic etwork Variables are the adder iputs ad carry i to stage! C C C C C C C C Lecture #: rithmetic rcuits Lecture #: rithmetic rcuits-6 Networks for iary dditio Cascaded Carry Lookahead C Networks for iary dditio Cascaded Carry Lookahead Carry lookahead logic geerates idividual carries sums computed much faster @ C @ @ C @ @ C 6 [5-] [5-] C -bit dder @ C 6 [5-] @ @ C [] [] C -bit dder @ [] @ @ [-] [-] C -bit dder @ [-] @ @ [-] [-] C -bit dder @ [-] @ @ @ C C C Lookahead Carry Uit C - - @ @ C @ C @ bit adders with iteral carry lookahead @ secod level carry lookahead uit, exteds lookahead to 6 bits C @ roup = roup = Lecture #: rithmetic rcuits- Lecture #: rithmetic rcuits Networks for iary dditio Carry elect dder Redudat hardware to make carry calculatio go faster C C C : ux -it dder [:] -it dder [:] compute the high order sums i parallel oe additio assumes carry i = the other assumes carry i = C dder Low dder High -it dder [:] C 6 5 C rithmetic Logic Uit Desig ample LU =, Logical itwise Operatios Fuctio Fi = i Fi = ot i Fi = i xor i Fi = i xor i =, C =, rithmetic Operatios F = F = ot F = plus F = (ot ) plus =, C =, rithmetic Operatios F = plus F = (ot ) plus F = plus plus F = (ot ) plus plus Logical ad rithmetic Operatios Commet Iput i trasferred to output Complemet of i trasferred to output Compute XOR of i, i Compute XNOR of i, i Iput passed to output Complemet of passed to output um of ad um of ad complemet of Icremet Twos complemet of Icremet sum of ad mius Not all operatios appear useful, but "fall out" of iteral logic Lecture #: rithmetic rcuits- Lecture #: rithmetic rcuits

rithmetic Logic Uit Desig ample LU product terms! Equivalet to 5 gates Traditioal Desig pproach Truth Table & Espresso.i 6.o.ilb m s s ci ai bi.ob fi co.p - - - - - - - - -- -- -- -- -- -- -- -- --- --- --- --- ---.e i i Fi X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X Lecture #: rithmetic rcuits rithmetic Logic Uit Desig ample LU ultilevel Implemetatio.model alu.espresso.iputs m s s ci ai bi.outputs fi co.ames m ci co [] [] [5] fi --- --- --- --- \.ames m ci [] [] co \i -- -- - i.ames s ai [] i.ames m s bi [].ames s bi [5] - -.ed [5] [] [] [] [] [] [] ates \Co Co [] [] Fi \Co [] [5] \Co \[] \[5] Lecture #: rithmetic rcuits rithmetic Logic Uit Desig ample LU Clever ulti-level Logic Implemetatio O i X i X X Fi ates (but are XOR) = blocks i Happes whe operatios ivolve i oly ame is true for whe = dditio happes whe = i, to Xor gates X, X =, X passes =, X passes rithmetic ode: Or gate iputs are i ad i (i xor ) Logic ode: Cascaded XORs form output from i ad i Lecture #: rithmetic rcuits rithmetic Logic Uit Desig TTL LU electio = =, rithmetic Fuctios Logic Fuctio C = F = ot F = ad F = (ot ) F = F = or F = ot F = xor F = ot F = (ot ) F = xor F = F = F = F = (ot ) F = F = F = mius F = mius F = (ot ) mius F = mius F = plus ( ot ) F = plus ( ot ) F = mius mius F = ot F = plus ( ) F = plus F = (ot ) plus ( ) F = ( ) F = F = plus F= (ot ) plus F = C = F = F = F = (ot ) F = zero F = plus ( ot ) plus F = plus ( ot ) plus F = ( ot ) plus F = mius F = ( ot ) plus F = plus ( ) plus F = (ot ) plus ( ) plus F = ( ) plus F = plus plus F = plus plus F = (ot ) plus plus F = plus Lecture #: rithmetic rcuits rithmetic Logic Uit Desig TTL LU Note that the sese of the carry i ad out are OOITE from the iput bits C F F F = C 6 5 5 6 6 5 5 C Cz Cy Cx Fortuately, carry lookahead geerator maitais the correct sese of the sigals rithmetic Logic Uit Desig 6-bit LU with Carry Lookahead C C C C F F F = C 5 6 F F F = C 5 6 F F F = C 5 6 C F F F = C 5 6 6 5 6 5 6 5 6 5 C6 5 6 5 C Cz Cy Cx Lecture #: rithmetic rcuits5 Lecture #: rithmetic rcuits6

Lecture Review We have covered: iary Number Represetatio positive umbers the same differece is i how egative umbers are represeted twos complemet easiest to hadle: oe represetatio for zero, slightly complicated complemetatio, simple additio iary Networks for dditios basic H, F carry lookahead logic LU Desig specificatio ad implemetatio Lecture #: rithmetic rcuits