Learning Outcomes. Spiral 2 2. Digital System Design DATAPATH COMPONENTS

Similar documents
Learning Outcomes. Spiral 2-2. Digital System Design DATAPATH COMPONENTS

Learning Outcomes. Spiral 2 2. Digital System Design DATAPATH COMPONENTS

MULTIPLICATION TECHNIQUES

11.1. Unit 11. Adders & Arithmetic Circuits

Overview. EECS Components and Design Techniques for Digital Systems. Lec 16 Arithmetic II (Multiplication) Computer Number Systems.

Mark Redekopp, All rights reserved. EE 352 Unit 8. HW Constructs

Arithmetic Logic Unit. Digital Computer Design

EE 101 Lab 5 Fast Adders

EE 109 Unit 6 Binary Arithmetic

Week 7: Assignment Solutions

T insn-mem T regfile T ALU T data-mem T regfile

Computer Architecture and Organization

Semester Transition Point. EE 109 Unit 11 Binary Arithmetic. Binary Arithmetic ARITHMETIC

Department of Electrical and Computer Engineering University of Wisconsin - Madison. ECE/CS 352 Digital System Fundamentals.

ECE 341 Midterm Exam

Binary Arithmetic. Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T.

DIGITAL TECHNICS. Dr. Bálint Pődör. Óbuda University, Microelectronics and Technology Institute

Arithmetic Circuits. Nurul Hazlina Adder 2. Multiplier 3. Arithmetic Logic Unit (ALU) 4. HDL for Arithmetic Circuit

ECE 30 Introduction to Computer Engineering

Addition and multiplication

VTU NOTES QUESTION PAPERS NEWS RESULTS FORUMS Arithmetic (a) The four possible cases Carry (b) Truth table x y

Chapter 3 Arithmetic for Computers

Timing for Ripple Carry Adder

Chapter 5. Digital Design and Computer Architecture, 2 nd Edition. David Money Harris and Sarah L. Harris. Chapter 5 <1>

ECE 341 Midterm Exam

Chapter 3 Part 2 Combinational Logic Design

Digital Circuit Design and Language. Datapath Design. Chang, Ik Joon Kyunghee University

This Unit: Arithmetic. CIS 371 Computer Organization and Design. Readings. Pre Class Exercise

ECE 341 Final Exam Solution

Jan Rabaey Homework # 7 Solutions EECS141

Principles of Computer Architecture. Chapter 3: Arithmetic

Digital Logic & Computer Design CS Professor Dan Moldovan Spring 2010

Binary Adders: Half Adders and Full Adders

Lecture 5. Other Adder Issues

CS/COE0447: Computer Organization

CS/COE0447: Computer Organization

Real Digital Problem Set #6

Writing Circuit Descriptions 8

*Instruction Matters: Purdue Academic Course Transformation. Introduction to Digital System Design. Module 4 Arithmetic and Computer Logic Circuits

Outline. Introduction to Structured VLSI Design. Signed and Unsigned Integers. 8 bit Signed/Unsigned Integers

UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering. Digital Computer Arithmetic ECE 666

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Electrical Engineering and Computer Sciences

Chapter 3: part 3 Binary Subtraction

Tailoring the 32-Bit ALU to MIPS

Chapter 4. Combinational Logic

EE878 Special Topics in VLSI. Computer Arithmetic for Digital Signal Processing

Microcomputers. Outline. Number Systems and Digital Logic Review

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 3. Arithmetic for Computers Implementation

Number Systems. Readings: , Problem: Implement simple pocket calculator Need: Display, adders & subtractors, inputs

Binary Adders. Ripple-Carry Adder

Arithmetic Circuits. Design of Digital Circuits 2014 Srdjan Capkun Frank K. Gürkaynak.

ECE331: Hardware Organization and Design

CS 5803 Introduction to High Performance Computer Architecture: Arithmetic Logic Unit. A.R. Hurson 323 CS Building, Missouri S&T

An FPGA based Implementation of Floating-point Multiplier

Chapter 3 Part 2 Combinational Logic Design

An Efficient Fused Add Multiplier With MWT Multiplier And Spanning Tree Adder

At the ith stage: Input: ci is the carry-in Output: si is the sum ci+1 carry-out to (i+1)st state

Revision: August 31, E Main Suite D Pullman, WA (509) Voice and Fax

EKT 422/4 COMPUTER ARCHITECTURE. MINI PROJECT : Design of an Arithmetic Logic Unit

Computer Architecture Set Four. Arithmetic

Binary Multiplication

DIGITAL ARITHMETIC: OPERATIONS AND CIRCUITS

1. Prove that if you have tri-state buffers and inverters, you can build any combinational logic circuit. [4]

CAD4 The ALU Fall 2009 Assignment. Description

Fundamentals of Computer Systems

L11: Major/Minor FSMs

PESIT Bangalore South Campus


Parallel logic circuits

Chapter 3. ALU Design

Hardware Design Environments. Dr. Mahdi Abbasi Computer Engineering Department Bu-Ali Sina University

ECE 645: Lecture 1. Basic Adders and Counters. Implementation of Adders in FPGAs

CPE300: Digital System Architecture and Design

Each DSP includes: 3-input, 48-bit adder/subtractor

Arithmetic and Logical Operations

Number Systems and Computer Arithmetic

9/6/2011. Multiplication. Binary Multipliers The key trick of multiplication is memorizing a digit-to-digit table Everything else was just adding

COMP 303 Computer Architecture Lecture 6

Combinational Circuit Design

CS/COE 0447 Example Problems for Exam 2 Spring 2011

Fast Arithmetic. Philipp Koehn. 19 October 2016

University of California at Berkeley College of Engineering Department of Electrical Engineering and Computer Sciences. Spring 2010 May 10, 2010

CPE 335 Computer Organization. MIPS Arithmetic Part I. Content from Chapter 3 and Appendix B

ECE 341 Midterm Exam

Introduction to Digital Logic Missouri S&T University CPE 2210 Multipliers/Dividers

University of Illinois at Chicago. Lecture Notes # 10

Computer Arithmetic Multiplication & Shift Chapter 3.4 EEC170 FQ 2005

ECE 341. Lecture # 6

Control Unit: Binary Multiplier. Arturo Díaz-Pérez Departamento de Computación Laboratorio de Tecnologías de Información CINVESTAV-IPN

8/27/2016. ECE 120: Introduction to Computing. Graphical Illustration of Modular Arithmetic. Representations Must be Unambiguous

CS Computer Architecture. 1. Explain Carry Look Ahead adders in detail

4DM4 Lab. #1 A: Introduction to VHDL and FPGAs B: An Unbuffered Crossbar Switch (posted Thursday, Sept 19, 2013)

Laboratory Exercise 6

By, Ajinkya Karande Adarsh Yoga

Chapter 4 Arithmetic Functions

ECE468 Computer Organization & Architecture. The Design Process & ALU Design

Due: Instructor: G. Puvvada

Binary Addition. Add the binary numbers and and show the equivalent decimal addition.

Data Representation Type of Data Representation Integers Bits Unsigned 2 s Comp Excess 7 Excess 8

Integer Multiplication and Division

Transcription:

2-2. 2-2.2 Learning Outcomes piral 2 2 Arithmetic Components and Their Efficient Implementations I know how to combine overflow and subtraction results to determine comparison results of both signed and unsigned numbers I understand how combination multipliers can be built I understand how hierarchical carry lookahead logic can be used to produce logarithmic time delay for an adder Mark Redekopp 2-2.3 2-2.4 Digital ystem Design Control (CU) and Datapath Unit (DPU) paradigm eparate logic into datapath elements that operate on data and control elements that generate control signals for datapath elements Datapath: s, muxes, comparators, counters, registers (shift, with enables, etc.), memories, FIFO s Control Unit: tate machines/sequencers DATAPATH COMPONENT clk reset Control ignals Control Condition ignals Data Inputs Datapath Data Outputs

2-2.5 2-2.6 Overflow Detecting Overflow Helps Us Perform Comparison OVERFLOW & COMPARION Overflow occurs when the result of an arithmetic operation is to be represented with the given number of bits Unsigned overflow occurs when adding or subtracting unsigned numbers igned (2 s complement overflow) overflow occurs when adding or subtracting 2 s complement numbers 2-2.7 2-2.8 Unsigned Overflow 2 s Complement Overflow + 7 = 7 With 4-bit unsigned numbers we can only represent 5. Thus, we say overflow has occurred. Overflow occurs when you cross this discontinuity +5 +4 +3 Plus 7 +2 + + +9 +8 + +2 +3 +4 +5 +6 +7 5 + 7 = +2-6 + -4 = - With 4-bit 2 s complement numbers we can only represent -8 to +7. Thus, we say overflow has occurred. -4-3 -5-2 -6 - -7-8 + +2 +6 +7 +3 +5 +4 Overflow occurs when you cross this discontinuity

Testing for Overflow Most fundamental test Check if answer is (i.e. Positive + Positive yields a negative) Unsigned overflow test [Different for add or sub] Addition: If carry out of final position equals ubtraction: If carry out of final addition equals igned (2 s complement) overflow test [ame for add or sub] Only occurs if Alternate test: if of final column are different 2-2.9 Testing for Unsigned Overflow Unsigned Overflow has occurred if Unsigned Addition: If final carry out = Unsigned ubtraction: If final carry out = + - + - 2-2. 2-2. 2-2.2 Testing for 2 s Comp. Overflow Checking for Overflow 2 s Complement Overflow Occurs If Test : If pos. + pos. = neg. or neg. + neg. = pos. Test 2: If carry in to MB position and carry out of MB position are different Produce additional outputs to indicate if unsigned (UOV) or signed (OV) overflow has occurred + (5) (6) (-4) + (-7) + (3) (2) (-2) + (-6)

2-2.3 2-2.4 Comparison Via ubtraction COMPARION uppose we want to compare two numbers: A & B uppose we let DIFF = A B what could the result tell us If DIFF <, then If DIFF =, then IF DIFF >, then How would we know DIFF ==? If all bits of our answer. How would we know DIFF < (i.e. negative)? igned:! (but what about overflow) Unsigned: Huh? In unsigned there are no negative results 2-2.5 2-2.6 Computing A<B from "Negative" Result Unsigned Comparator Unsigned Perform A B If A B would yield a negative result, this will appear as in an unsigned subtraction And we know unsigned subtraction overflow occurs if o just check if igned Perform A B If there is no overflow (V=), simply check if But if there is overflow?? Recall overflow has the effect of flipping the sign of the result to the opposite of what it should be. o if there is overflow (V=) check is (i.e. positive) ummary: A B is "truly" negative if: A comparator can be built by using a subtractor A=B A A[3:] A>B DIFF[3:] Res[3:] ubtractor B B[3:] C4 A<B

igned Comparator 2-2.7 2-2.8 A comparator can be built by using a subtractor A=B A A[3:] Res[3:] DIFF[3:] A>B ADDER TIMING B ubtractor B[3:] C4 A<B 2-2.9 2-2.2 Addition s Timing Be sure to connect first to = + = A chain of full adders presents an interesting timing analysis problem To correctly compute its own um and Carry out, each full adder requires the carry out bit from the full adder Because hardware works in parallel, the full adders further down the chain may produce the outputs because the carry has not had time to to them C out

2-2.2 2-2.22 Timing Example Assume that we were adding one set of inputs and then change to a new set of inputs: Old inputs: Old inputs: + = = New inputs: + = = Timing At the time just before we enter the new input values, all carries are s New inputs: Old inputs: + = = Time - C out 2-2.23 2-2.24 Timing Now we enter the new inputs and all the s starting adding their respective inputs + = = Time Timing Each adder computes from the current inputs (notice the sum of is incorrect at this point) + = = Time New inputs: Due to propagation delay, the carries are still from the old inputs Now the carries are all based off the new inputs

2-2.25 2-2.26 Timing Timing The carry is rippling through each adder + = = Time 2 The carry is rippling through each adder + = = Time 3 2-2.27 2-2.28 Timing Ripple Carry Only after the carry propagates through all the adders is the sum valid and correct + = = Time 4 The longest path through a chain of full adders is the carry path We say that the carry through the adder time C C C C C C out out in out in out C 4 C 3 C 2 C C

2-2.29 2-2.3 Ripple Carry Delay Glitches An n bit ripple carry adder has a worst case delay proportional to, output values due to arrival times of gate inputs 2-2.3 2-2.32 Output Glitches Critical Path Delay of the carry causes glitches on the sum bits Glitch = momentarily, incorrect output value early late C C out out Critical Path = possible delay path Assume t sum = 5 ns, t carry = 4 ns 6 ns Co Ci 2 ns Co Ci 8 ns Co Ci 4 ns Co Ci 7 ns 3 ns 9 ns 5 ns Critical Path 3

2-2.33 Unsigned Multiplication Review 2-2.34 ame rules as decimal multiplication Multiply each bit of Q by M shifting as you go An m bit * n bit mult. produces an bit result (i.e. n bit * n bit produces bit result) Notice each partial product is a shifted copy of M or (zero) MULTIPLIER * M (Multiplicand) Q (Multiplier) 2-2.35 2-2.36 igned Multiplication Techniques igned Multiplication Techniques When adding signed (2 s comp.) numbers, some new issues arise Must Also, must worry about negative multiplier MB of multiplier has negative weight If MB=, * = = -7 +6 * = = -7 +6 * = = -4-6 * = = -4-6

2-2.37 2-2.38 Combinational Multiplier Partial Product (PP i ) Generation Multiply Q[i] * M if Q[i]= => PP i = if Q[i]= => PP i = Combinational Multiplier Partial Product (PP i ) Generation Multiply Q[i] * M if Q[i]= => PP i = if Q[i]= => PP i = gates can be used to generate each partial product M[3] M[2] M[] M[] M[3] M[2] M[] M[] if Q[ i]= if Q[ i]= 2-2.39 2-2.4 Multiplication Overview Combinational Multiplier Multiplication approaches: equential: hift and Add produces one product bit per clock cycle time (usually slow) Combinational: Array multiplier uses an array of adders Can be as simple as N ripple carry adders for an NxN multiplication m3 m2 m m x q3 q2 q q m3q m2q mq mq m3q m2q mq mq - m3q2 m2q2 mq2 mq2 - - + m3q3 m2q3 mq3 mq3 - - - p7 p6 p5 p4 p3 p2 p p Partial Products must be added together Combinational multipliers require long propagation delay through the adders propagation delay is proportional to the number of partial products (i.e. number of bits of input) and the width of each adder AND Gate Array produces partial product terms

Array Multiplier 2-2.4 Combinational Multiplier 2-2.42 Can this be a HA? Maximum delay = Do you look for the longest path or the shortest path between any input and output? Compare with the delay of a shift and add method Critical Paths 2-2.43 Combinational Multiplier Analysis 2-2.44 Large Area due to bit adders n because the first adder adds the first two partial products and then each adder afterwards adds one more partial product Propagation delay is in two dimensions proportional to Critical Path Critical Path 2

2-2.45 2-2.46 Pipelined Multiplier Carry ave Multiplier Now try to pipeline the previous design m3q2 m2q2 mq2 mq2 m2q3 mq3 mq3 m3q3 m3q m2q mq mq m3q m2q mq mq Instead of propagating the carries to the left in the same row, carries are now sent down to the next stage to reduce stage delay and facilitate pipelining Co HA Co Ci Co Ci Co HA CA s m3q m3q m2q mq mq m2q mq mq Co Ci Co Ci Co Ci Co Ci Co Ci Co Ci Co HA m3q2 m2q2 mq2 mq2 Co Ci Co Ci Co Ci P[7] Co Ci P[6] Co Ci P[5] Co Ci P[4] Co HA Determine the maximum stage delay to decide the pipeline clock rate. Assume zero delay for stage latches. How does the latency of the pipeline compare with the simple combinational array of the previous stage? P[3] P[2] P[] P[] The upper three stages are 3 bit Carry ave s (CA s) each with 2 gate delays. The last stage is a Ripple Carry (RCA) which requires longer delay. It can be replaced by a CLA for larger multipliers. RCA m3q3 Co Ci P[7] P[6] m2q3 mq3 mq3 Co Ci Co Ci Co Ci Co Ci Co Ci P[5] P[4] P[3] P[2] P[] P[] 2-2.47 2-2.48 Carry ave s Carry ave (3,2) s Consider the decimal addition of 47 + 96 + 58 = 2 One way is to add to get and Here the column cannot be added is produced In the carry save style, we add the column and column simultaneous 4 7 + 9 6 2 4 3 + 5 8 2 3 6 5 4 4 7 9 6 + 5 8 2 2 + 8 _ 2 4 3 A carry save adder is also called a (3,2) adder or a (3,2) counter (refer to Computer Arithmetic Algorithms by Israel Koren) as it takes three vectors, adds them up, and reduces them to two vectors, namely a sum vector and a carry vector CA s are based on the principle that carries do not have to be added, but can be combined An n bit CA consist of n disjoint full adders + _ Carry vector um vector A[3] B[3] C[3] A[2] B[2] C[2] A[] B[] C[] A[] B[] C[] Co Z Co Z Co Z Co C[4] [3] C[3] [2] C[2] [] C[] [] Z

2-2.49 2-2.5 Ripple Carry s Ripple carry adders (RCA) are slow due to carry propagation At least 2 levels of logic per full adder Carry Lookahead s T ADDER 6 5 4 3 2 2-2.5 2-2.52 Fast s Carry Lookahead Logic Rather than calculating one carry at a time and passing it down the chain, can we compute a group of carries at the same time To do this, let us define some new signals for each column of addition: p i = : This column will propagate a carry in (if there is one) to the carry out. p i is true when A i or B i is => p i = g i = : This column will generate a carry out whether or not the carry in is g i is true when A i and B i is => g i = Using these signals, we can define the carry out (c i+ ) as: c i+ = Define each carry in terms of p i, g i and the initial carry in (c ) and not in terms of carry chain (intermediate carries: c,c2,c3, ) c = c2 = c3 = c4 =

Carry Lookahead Analogy 2-2.53 2-2.54 Consider the carry chain like a long tube broken into segments. Each segment is controlled by a valve (propagate signal) and can insert a fluid into that segment (generate signal) The carry out of the diagram below will be true if g is true or p is true and g is true, or p, p and c is true Carry Lookahead Use carry lookahead logic to generate all the carries in one shot and then create the sum Example 4 bit CLA shown below How many levels of logic is the adder? 2-2.55 4 bit s 74L283 chip implements a 4 bit adder using CLA methodology A 3 A 2 A A = A + B 3 B 2 B B = B 4 3 2 = A 3 B 3 A 2 B 2 A B A B 74L283 3 2 2-2.56

6 Bit CLA But how would we make a 6 bit adder? hould we really just chain these fast 4 bit adders together? Or can we do better? 2-2.57 2-2.58 A[5:2] B[5:2] A[:8] B[:8] A[7:4] B[7:4] A[3:] B[3:] C C6 _ C2 PG PG PG PG _ [5:2] [:8] [7:4] [3:] C8 _ C4 _ 6-bit RCA Delay = = gate delays Delay of the above adder design = = gates Let us improve by looking ahead at a higher level to produce C6, C2, C8, C4 in parallel What s the difference between the equation for G here and C4 on the previous slides Define P and G as the overall Propagate and Generate signals for a set of 4 bits P = p3 p2 p p G = g3 + p3 g2 + p3 p2 g + p3 p2 p g REVIEW ON OUR OWN FOR CLA LAB 2-2.59 2-2.6 6 bit CLA Closer Look 6 Bit CLA Each 4 bit CLA only propagates its overall carry in if each of the 4 columns propagates: P = p3 p2 p p P = p7 p6 p5 p4 P2 = p p p9 p8 P3 = p5 p4 p3 p2 Each 4 bit CLA generates a carry if any column generates and the more significant columns propagate G = g3 + (p3 g2) + (p3 p2 g)+(p3 p2 p g) G3 = g5 + (p5 g4) + (p5 p4 g3)+(p5 p4 p3 g2) The higher order CLL logic (producing C4,C8,C2,C6) then is realized as: (C4) =>C = G + (P c) (C6) => C4 = G3 + (P3 G2) + (P3 P2 G) +(P3 P2 P G)+ (P3 P2 P P c) These equations are exactly the same CLL logic we derived earlier C6 Understanding 6 bit CLA hierarchy PG G c5 p3 g3 c4 P* G* CLL PG CLL PG CLL P G CLL C2 c3 p2 g2 C8 CLL p g Delay = = = Delay in producing pi,gi = = Delay in producing Pi*,Gi* = = Delay in producing C4,C8,C2,C6 = = Delay in producing c5 = = Delay in producing 5 c2 C4 c p g c C

64 Bit CLA 2-2.6 We can reuse the same CLL logic to build a 64 bit CLA C c63 s35 C6 PG G C56 C52 C44 C4 C36 C28 C24 C2 C2 C8 CLL PG CLL PG CLL P G CLL C4 C48 C32 C6 p3 g3 c4 P* G* c3 p2 g2 c2 CLL p g c p g c = = Delay in producing 63 Is the delay in producing s63 the same as in s35? = = Delay in producing 2 = = Delay in producing = = Delay in producing pi*,gi* = = Delay in producing Pj**,Gj** = = Delay in producing C48 = = Delay in producing C6 = = Delay in producing C63 = = Delay in producing 63 = Total Delay