Contemporary Logic Design Arithmetic Circuits © R.H. Katz Lecture #24: Arithmetic Circuits -1 Arithmetic Circuits (Part II) Randy H. Katz University of.

Slides:



Advertisements
Similar presentations
1 Counter with Parallel Load Up-counter that can be loaded with external value –Designed using 2x1 mux – ld input selects incremented value or external.
Advertisements

Comparator.
Datorteknik IntegerMulDiv bild 1 MIPS mul/div instructions Multiply: mult $2,$3Hi, Lo = $2 x $3;64-bit signed product Multiply unsigned: multu$2,$3Hi,
Computer Architecture ECE 361 Lecture 6: ALU Design
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE VLSI Circuit Design Lecture 24 - Subsystem.
1 COMP541 Sequencing and Control Montek Singh Mar 29, 2007.
EECS Components and Design Techniques for Digital Systems Lec 18 – Arithmetic II (Multiplication) David Culler Electrical Engineering and Computer.
Contemporary Logic Design Sequential Case Studies © R.H. Katz Transparency No Chapter #7: Sequential Logic Case Studies 7.1, 7.2 Counters.
Chapter 6 Arithmetic. Addition Carry in Carry out
L10 – Multiplication Division 1 Comp 411 – Fall /19/2009 Binary Multipliers ×
ECE C03 Lecture 61 Lecture 6 Arithmetic Logic Circuits Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
Chapter # 5: Arithmetic Circuits Contemporary Logic Design Randy H
Lecture 8 Arithmetic Logic Circuits
Computer ArchitectureFall 2008 © August 25, CS 447 – Computer Architecture Lecture 3 Computer Arithmetic (1)
Chapter Four Arithmetic and Logic Unit
ECE 301 – Digital Electronics
Copyright 2008 Koren ECE666/Koren Part.6a.1 Israel Koren Spring 2008 UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering Digital Computer.
ENGIN112 L26: Shift Registers November 3, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 26 Shift Registers.
ECE 232 L9.Mult.1 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers ECE 232 Hardware Organization and Design Lecture 9 Computer Arithmetic.
Computer ArchitectureFall 2007 © August 29, 2007 Karem Sakallah CS 447 – Computer Architecture.
Chapter 5 Arithmetic Logic Functions. Page 2 This Chapter..  We will be looking at multi-valued arithmetic and logic functions  Bitwise AND, OR, EXOR,
KU College of Engineering Elec 204: Digital Systems Design
Multiplication.
Chapter 6-2 Multiplier Multiplier Next Lecture Divider
Adders and Multipliers Review. ARITHMETIC CIRCUITS Is a combinational circuit that performs arithmetic operations, e.g. –Addition –Subtraction –Multiplication.
Logical Circuit Design Week 8: Arithmetic Circuits Mentor Hamiti, MSc Office ,
Basic Arithmetic (adding and subtracting)
Conversion and Coding (12) 10. Conversion and Coding (12) Conversion.
Copyright 1995 by Coherence LTD., all rights reserved (Revised: Oct 97 by Rafi Lohev, Oct 99 by Yair Wiseman, Sep 04 Oren Kapah) IBM י ב מ 10-1 The ALU.
Chapter # 5: Arithmetic Circuits
Topic: Arithmetic Circuits Course: Digital Systems Slide no. 1 Chapter # 5: Arithmetic Circuits.
5-1 Programmable and Steering Logic Chapter # 5: Arithmetic Circuits.
07/19/2005 Arithmetic / Logic Unit – ALU Design Presentation F CSE : Introduction to Computer Architecture Slides by Gojko Babić.
CSE 241 Computer Organization Lecture # 9 Ch. 4 Computer Arithmetic Dr. Tamer Samy Gaafar Dept. of Computer & Systems Engineering.
Reconfigurable Computing - Multipliers: Options in Circuit Design John Morris Chung-Ang University The University of Auckland ‘Iolanthe’ at 13 knots on.
1 KU College of Engineering Elec 204: Digital Systems Design Lecture 21 Multiplier Example Example: (101 x 011) Base 2 Note that the partial product summation.
Lecture 6: Multiply, Shift, and Divide
ENG241 Digital Design Week #8 Registers and Counters.
1 Arithmetic Logic Unit ALU. 2 The Bus Concept 3 CPU Building Blocks  Registers (IR, PC, ACC)  Control Unit (CU)  Arithmetic Logic Unit (ALU)
درس مدارهای منطقی دانشگاه قم مدارهای منطقی محاسباتی تهیه شده توسط حسین امیرخانی مبتنی بر اسلایدهای درس مدارهای منطقی دانشگاه.
CHAPTER 4 Combinational Logic Design- Arithmetic Operation (Section 4.6&4.9)
Cs 152 l6 Multiply 1 DAP Fa 97 © U.C.B. ECE Computer Architecture Lecture Notes Multiply, Shift, Divide Shantanu Dutt Univ. of Illinois at.
05/03/2009CA&O Lecture 8,9,10 By Engr. Umbreen sabir1 Computer Arithmetic Computer Engineering Department.
Abdullah Said Alkalbani University of Buraimi
CDA 3101 Fall 2013 Introduction to Computer Organization The Arithmetic Logic Unit (ALU) and MIPS ALU Support 20 September 2013.
EE2174: Digital Logic and Lab Professor Shiyan Hu Department of Electrical and Computer Engineering Michigan Technological University CHAPTER 8 Arithmetic.
Topics covered: Arithmetic CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
EKT 221 : Chapter 4 Computer Design Basics
ECE 331 – Digital System Design Multi-bit Adder Circuits, Adder/Subtractor Circuit, and Multiplier Circuit (Lecture #12)
Digital Electronics Tutorial: Number System & Arithmetic Circuits Solutions.
Lecture #23: Arithmetic Circuits-1 Arithmetic Circuits (Part I) Randy H. Katz University of California, Berkeley Fall 2005.
ECE DIGITAL LOGIC LECTURE 15: COMBINATIONAL CIRCUITS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2015, 10/20/2015.
ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Dr. Shi Dept. of Electrical and Computer Engineering.
Reconfigurable Computing - Options in Circuit Design John Morris Chung-Ang University The University of Auckland ‘Iolanthe’ at 13 knots on Cockburn Sound,
Reconfigurable Computing - Options in Circuit Design John Morris Chung-Ang University The University of Auckland ‘Iolanthe’ at 13 knots on Cockburn Sound,
Logic Design (CE1111 ) Lecture 4 (Chapter 4) Combinational Logic Prepared by Dr. Lamiaa Elshenawy 1.
EKT 221 : DIGITAL 2.
Registers and Counters
Multiplier Design [Adapted from Rabaey’s Digital Integrated Circuits, Second Edition, ©2003 J. Rabaey, A. Chandrakasan, B. Nikolic]
MIPS mul/div instructions
Morgan Kaufmann Publishers
Multipliers Multipliers play an important role in today’s digital signal processing and various other applications. The common multiplication method is.
Digital System Design Review.
Topic 3c Integer Multiply and Divide
CSE Winter 2001 – Arithmetic Unit - 1
Unsigned Multiplication
Arithmetic Circuits (Part I) Randy H
ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN
Number Representation
Instruction execution and ALU
Presentation transcript:

Contemporary Logic Design Arithmetic Circuits © R.H. Katz Lecture #24: Arithmetic Circuits -1 Arithmetic Circuits (Part II) Randy H. Katz University of California, Berkeley Fall 2005

Contemporary Logic Design Arithmetic Circuits © R.H. Katz Lecture #24: Arithmetic Circuits -2 Overview BCD Circuits Combinational Multiplier Circuit Design Case Study: 8 Bit Multiplier Sequential Multiplier Circuit

Contemporary Logic Design Arithmetic Circuits © R.H. Katz Lecture #24: Arithmetic Circuits -3 BCD Addition BCD Number Representation Decimal digits 0 thru 9 represented as 0000 thru 1001 in binary Addition: 5 = = = 8 5 = = = 13! Problem when digit sum exceeds 9 Solution: add 6 (0110) if sum exceeds 9! 5 = = = = 1 3 in BCD 9 = = = 16 in binary 6 = = 1 6 in BCD

Contemporary Logic Design Arithmetic Circuits © R.H. Katz Lecture #24: Arithmetic Circuits -4 BCD Addition Adder Design Add 0110 to sum whenever it exceeds 1001 (11XX or 1X1X) FAFAFAFA FAFA Cin A 3 A 2 A 1 A 0 B 3 B 2 B 1 B 0 CoutS 3 S 2 S 1 S 0 0 COCI S COCI S COCI S COCI S COCI S COCI S 11XX A1 A2 1X1X

Contemporary Logic Design Arithmetic Circuits © R.H. Katz Lecture #24: Arithmetic Circuits -5 Combinational Multiplier Basic Concept multiplicand multiplier 1101 (13) 1011 (11) * (143) Partial products product of 2 4-bit numbers is an 8-bit number

Contemporary Logic Design Arithmetic Circuits © R.H. Katz Lecture #24: Arithmetic Circuits -6 Combinational Multiplier Partial Product Accumulation A0 B0 A0 B0 A1 B1 A1 B0 A0 B1 A2 B2 A2 B0 A1 B1 A0 B2 A3 B3 A3 B0 A2 B1 A1 B2 A0 B3 A3 B1 A2 B2 A1 B3 A3 B2 A2 B3 A3 B3 S6 S5 S4 S3S2 S1S0 S7

Contemporary Logic Design Arithmetic Circuits © R.H. Katz Lecture #24: Arithmetic Circuits -7 Combinational Multiplier Partial Product Accumulation Note use of parallel carry-outs to form higher order sums 12 Adders, if full adders, this is 6 gates each = 72 gates 16 gates form the partial products total = 88 gates! A 0 B 0 A 1 B 0 A 0 B 1 A 0 B 2 A 1 B 1 A 2 B 0 A 0 B 3 A 1 B 2 A 2 B 1 A 3 B 0 A 1 B 3 A 2 B 2 A 3 B 1 A 2 B 3 A 3 B 2 A 3 B 3 HA S 0 S 1 FA FA S 3 FA FA S 4 FA S 2 FA FA S 5 FA S 6 S 7

Contemporary Logic Design Arithmetic Circuits © R.H. Katz Lecture #24: Arithmetic Circuits -8 C CCCC CCCC CCC Combinational Multiplier Another Representation of the Circuit SSSS C SSSS SSSS SSSS B0 B1 B2 P7P6P5P4P3P2P1P0 A3A2 A1 A0 Building block: full adder + and 4 x 4 array of building blocks FA X Y AB S CICO Cin Sum In Sum Out Cout A3 B0A2 B0A1 B0A0 B0 A3 B1A2 B1A1 B1A0 B1 A3 B2A2 B2A1 B2A0 B2 A3 B3A2 B3A1 B3A0 B3 B

Contemporary Logic Design Arithmetic Circuits © R.H. Katz Lecture #24: Arithmetic Circuits -9 Case Study: 8 x 8 Multiplier TTL Multipliers Two chip implementation of 4 x 4 multipler

Contemporary Logic Design Arithmetic Circuits © R.H. Katz Lecture #24: Arithmetic Circuits -10 Case Study: 8 x 8 Multiplier Problem Decomposition How to implement 8 x 8 multiply in terms of 4 x 4 multiplies? A7-4 B7-4 A3-0 B3-0 * A3-0 * B3-0 A7-4 * B3-0 A3-0 * B7-4 A7-4 * B7-4 = PP0 = PP1 = PP2 = PP3 P15-12 P11-8 P7-4 P3-0 8 bit products P3-0 = PP0 P7-4 = PP0 + PP1 + PP2 P11-8 = PP1 + PP2 + PP3 P15-12 = PP Carry-in

Contemporary Logic Design Arithmetic Circuits © R.H. Katz Lecture #24: Arithmetic Circuits -11 Case Study: 8 x 8 Multiplier Calculation of Partial Products Use 4 4x4 multipliers to create the 4 partial products

Contemporary Logic Design Arithmetic Circuits © R.H. Katz Lecture #24: Arithmetic Circuits -12 Case Study: 8 x 8 Multiplier Three-At-A-Time Adder Clever use of the Carry Inputs Sum A[3-0], B[3-0], C[3-0]: Two Level Full Adder Circuit Note: Carry lookahead schemes also possible!

Contemporary Logic Design Arithmetic Circuits © R.H. Katz Lecture #24: Arithmetic Circuits -13 Case Study: 8 x 8 Multiplier Three-At-A-Time Adder with TTL Components Full Adders (2 per package) Standard ALU configured as 4-bit cascaded adder (with internal carry lookahead) Note the off-set in the outputs Full Adder Full Adder Full Adder Full Adder 4-bit ALU/Adder

Contemporary Logic Design Arithmetic Circuits © R.H. Katz Lecture #24: Arithmetic Circuits -14 Case Study: 8 x 8 Multiplier Accumulation of Partial Products Just a case of cascaded three-at-a-time adders! 4-bit ALU/Adder FA

Contemporary Logic Design Arithmetic Circuits © R.H. Katz Lecture #24: Arithmetic Circuits -15 Case Study: 8 x 8 Multiplier The Complete System (Actual TTL packages)

Contemporary Logic Design Arithmetic Circuits © R.H. Katz Lecture #24: Arithmetic Circuits -16 Case Study: 8 x 8 Multiplier Package Count and Performance /74285 pairs = 8 packages , , = 8 packages 16 packages total Partial product calculation (74284/285) = 40 ns typ, 60 ns max Intermediate sums (74183) = 9 ns/20ns = 15 ns average, 33 ns max Second stage sums w/carry lookahead 74LS181: carry G and P = 20 ns typ, 30 ns max 74182: second level carries = 13 ns typ, 22 ns max 74LS181: formations of sums = 15 ns typ, 26 ns max 103 ns typ, 171 ns max

Contemporary Logic Design Arithmetic Circuits © R.H. Katz Lecture #24: Arithmetic Circuits -17 Sequential Multiplier 4-Bit Multiplier Example: 3 x 4 = 12 –Four cycles to completion CycleMultiplierMultiplicandProduct Initialize Cycle 0, Multiplier[0]= Cycle 1, Multiplier[0]= Cycle 2, Multiplier[0]= Cycle 3, Multiplier[0]= Product = 0 For i = 0 to 3 do If Multiplier[0] = 1 then Product = Product + Multiplicand Shift right the Multiplier Shift left the Multiplicand

Contemporary Logic Design Arithmetic Circuits © R.H. Katz Lecture #24: Arithmetic Circuits -18 Sequential Multiplier Datapath and Control Block Diagram –External load signals for Multiplier and Multiplicand –Low order bit of multiplier: if 0, shift; if 1, shift and add Multiplicand Multiplier Product ‘0’ Accumulator 16 Shift Load3 Control Start Digit ShiftLoad3 Clock Clear ‘0’ 88 8 Load1 Load2

Contemporary Logic Design Arithmetic Circuits © R.H. Katz Lecture #24: Arithmetic Circuits -19 Sequential Multiplier State Diagram –One state for each bit Start/Clear Idle Reset S0 S1 S2 S3 S4 S5 S6 S7 Digit/Load3,Shift Digit’/Shift Start’ Digit/Load3,Shift Digit’/Shift

Contemporary Logic Design Arithmetic Circuits © R.H. Katz Lecture #24: Arithmetic Circuits -20 Sequential Multiplier Control Timing Behavior IdleS0 Clk State Start Clear Load Shift S1S2S3S4S5S6S7Idle Digit0Digit1Digit2Digit3Digit4Digit5Digit6Digit7

Contemporary Logic Design Arithmetic Circuits © R.H. Katz Lecture #24: Arithmetic Circuits -21 Sequential Multiplier Slightly Revised Block Diagram –If multiplier low order bit is 0 than assert 0 into accumulator –Else pass multiplicand through to accumulator –Simplifies the control! Pass or Zero Pass/Zero’ Multiplicand Multiplier Product ‘0’ Accumulator 16 Load3-Shift Digit Clear ‘0’ 88 8 Load1 Load2 16 Control Start Load3-Shift Clock Clear

Contemporary Logic Design Arithmetic Circuits © R.H. Katz Lecture #24: Arithmetic Circuits -22 Sequential Multiplier Revised State Diagram –Fewer control outputs! Start/Clear Idle Reset S0 S1 S2 S3 S4 S5 S6 S7 Load3-Shift Start’ Load3-Shift

Contemporary Logic Design Arithmetic Circuits © R.H. Katz Lecture #24: Arithmetic Circuits -23 Sequential Multiplier Symbolic/Encoded State Transition Table –State assignment chosen as follows: »Idle state set to 0000, i.e., START resets the state FFs »States S0 to S7 set to 1000 to 1111, easy to implement as a counter Current State Start Next State Clear Load3-Shift Idle Idle 0 0 Idle S0 1 0 S S1 0 1 S S2 0 1 S S3 0 1 S S4 0 1 S S5 0 1 S S6 0 1 S S7 0 1 S Idle 0 1

Contemporary Logic Design Arithmetic Circuits © R.H. Katz Lecture #24: Arithmetic Circuits -24 Booth Multiplier Tricky encoding scheme to reduce the number of stages in a binary multiplier Considers two bits at a time rather than one—this cuts the number of multiplier steps in half Each step is slightly more complex compared to the simple multiplier, but is almost as fast as the basic multiplier stage that it replaces Searching for ways to speed up the basic multiply step

Contemporary Logic Design Arithmetic Circuits © R.H. Katz Lecture #24: Arithmetic Circuits -25 Alternative Multiply Hardware 32-bit Multiplicand reg, 32 -bit ALU, 64-bit Product reg, (0-bit Multiplier reg) Rather than shift multiplier right and multiplicand left, we can shift BOTH the product and the multiplier to the right … Product (Multiplier) Multiplicand 32-bit ALU Write Control 32 bits 64 bits Shift Right

Contemporary Logic Design Arithmetic Circuits © R.H. Katz Lecture #24: Arithmetic Circuits -26 Multiply Control MultiplicandProduct Done Yes: 32 repetitions 2. Shift the Product register right 1 bit. No: < 32 repetitions 1.Test Product0 Product0 = 0 Product0 = 1 1a. Add multiplicand to the left half of product & place the result in the left half of Product register 32nd repetition? Start

Contemporary Logic Design Arithmetic Circuits © R.H. Katz Lecture #24: Arithmetic Circuits -27 Motivation for Booth’s Algorithm Example 2 x 6 = 0010 x 0110: 0010 x shift (0 in multiplier) add (1 in multiplier) add (1 in multiplier) shift (0 in multiplier) If ALU can subtract as well as add, get same result as follows: 6= – = – = For example 0010 x shift (0 in multiplier) – 0010 sub(first 1 in multiplier) 0000 shift (mid string of 1s) add (prior step had last 1) Just add (twos complement of 2)

Contemporary Logic Design Arithmetic Circuits © R.H. Katz Lecture #24: Arithmetic Circuits -28 Booth Multiplier: an Introduction Recode each 1 in multiplier as “+2-1” –Converts sequences of 1 to 10…0(-1) –Might reduce the number of 1’s

Contemporary Logic Design Arithmetic Circuits © R.H. Katz Lecture #24: Arithmetic Circuits -29 Recoding (Encoding) Example If you use the last row in multiplication, you should get exactly the same result as using the first row (after all, they represent the same number!) (+1 -1) (+1 -1) (+1 -1) (+1 -1) (+1 -1) (+1 -1)

Contemporary Logic Design Arithmetic Circuits © R.H. Katz Lecture #24: Arithmetic Circuits x (-6) Booth Multiplication Example Sign extension

Contemporary Logic Design Arithmetic Circuits © R.H. Katz Lecture #24: Arithmetic Circuits -31 Booth’s Algorithm: Implementation Approach Current BitBit to the RightExplanationExampleOp 10Begins run of 1s sub 11Middle of run of 1s none 01End of run of 1s add 00Middle of run of 0s none Originally for Speed (when shift is faster than add, it is advantageous to replace adds and subs with shifts) Basic idea: replace a string of 1s in multiplier with an initial subtract for rightmost 1 in a run of 1’s, then later add back a 1 for the bit to the left of the last 1 in the run beginning of run end of run middle of run –

Contemporary Logic Design Arithmetic Circuits © R.H. Katz Lecture #24: Arithmetic Circuits -32 Booth’s Example (2 x 7) 1a. P = P - m shift P (sign ext) 1b > nop, shift > nop, shift > add 4a shift 4b done OperationMultiplicandProductnext? 0. initial value > sub

Contemporary Logic Design Arithmetic Circuits © R.H. Katz Lecture #24: Arithmetic Circuits -33 Booth’s Example (2 x -3) 1a. P = P - m shift P (sign ext) 1b > add a shift P 2b > sub a shift 3b > nop 4a shift 4b done OperationMultiplicandProductnext? 0. initial value > sub

Contemporary Logic Design Arithmetic Circuits © R.H. Katz Lecture #24: Arithmetic Circuits -34 Lecture Review We have covered: BCD Adders Simple extension of binary adders Multipliers 4 x 4 multiplier: partial product accumulation extension to 8 x 8 case Sequential Multipliers Booth Multiply Step Recoding to speed up the calculation