Design Example: 4-bit Multiplier

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

Week 6: Processor Components

COMP 303 Computer Architecture Lecture 6

CS 2630 Computer Organization. Meeting 13: Faster arithmetic and more operations Brandon Myers University of Iowa

ECE 341 Midterm Exam

Clocked Sequential System Design. Multiply Example

Tailoring the 32-Bit ALU to MIPS

ECE 341 Midterm Exam

The Need of Datapath or Register Transfer Logic. Number 1 Number 2 Number 3 Number 4. Numbers from 1 to million. Register

Cpr E 281 FINAL PROJECT ELECTRICAL AND COMPUTER ENGINEERING IOWA STATE UNIVERSITY. FINAL Project. Objectives. Project Selection

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

Register Transfer Level

EECE 353: Digital Systems Design Lecture 10: Datapath Circuits

Digital Design Using Digilent FPGA Boards -- Verilog / Active-HDL Edition

Binary Adders. Ripple-Carry Adder

Digital Design Review

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

2.1 Transforming Linear Functions

CS/COE0447: Computer Organization

CS/COE0447: Computer Organization

Two-Level CLA for 4-bit Adder. Two-Level CLA for 4-bit Adder. Two-Level CLA for 16-bit Adder. A Closer Look at CLA Delay

3 Designing Digital Systems with Algorithmic State Machine Charts

CS/COE 0447 Example Problems for Exam 2 Spring 2011

Announcements. This week: no lab, no quiz, just midterm

ECE260: Fundamentals of Computer Engineering

Integer Multiplication and Division

ECE 30 Introduction to Computer Engineering

REGISTER TRANSFER LANGUAGE

ECE 341 Midterm Exam

Timing for Ripple Carry Adder

Computer Arithmetic Multiplication & Shift Chapter 3.4 EEC170 FQ 2005

TABLE 8-1. Control Signals for Binary Multiplier. Load. MUL0 Q 0 CAQ sr CAQ. Shift_dec. C out. Load LOADQ. CAQ sr CAQ. Shift_dec P P 1.

UNIT-III REGISTER TRANSFER LANGUAGE AND DESIGN OF CONTROL UNIT

Building Bigger Systems: Hardware Threads

CS 151 Midterm. (Last Name) (First Name)

CS 151 Final. (Last Name) (First Name)

EE 109L Review. Name: Solutions

EECS150 - Digital Design Lecture 13 - Combinational Logic & Arithmetic Circuits Part 3

Continuing with whatever we saw in the previous lectures, we are going to discuss or continue to discuss the hardwired logic design.

LECTURE 4. Logic Design

CMPT 250 : Week 3 (Sept 19 to Sept 26)

Midterm Exam ECE 448 Spring 2019 Wednesday, March 6 15 points

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

8-1. Fig. 8-1 ASM Chart Elements 2001 Prentice Hall, Inc. M. Morris Mano & Charles R. Kime LOGIC AND COMPUTER DESIGN FUNDAMENTALS, 2e, Updated.

Overview. Ram vs Register. Register File. Introduction to Structured VLSI Design. Recap Operator Sharing FSMD Counters.

RTL Design (Using ASM/SM Chart)

ELCT 501: Digital System Design

Midterm Exam ECE 448 Spring 2014 Monday, March 3 (15 points)

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

Register Transfer Level in Verilog: Part I

Computer Architecture: Part V. First Semester 2013 Department of Computer Science Faculty of Science Chiang Mai University

CS61C : Machine Structures

DIGITAL ARITHMETIC: OPERATIONS AND CIRCUITS

Architecture and Partitioning - Architecture

EECS150: Components and Design Techniques for Digital Systems

An instruction set processor consist of two important units: Data Processing Unit (DataPath) Program Control Unit

University of Toronto Mississauga. Flip to the back cover and write down your name and student number.

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

EE 109L Final Review

Microcomputers. Outline. Number Systems and Digital Logic Review

Jan Rabaey Homework # 7 Solutions EECS141

Boolean Unit (The obvious way)

Chapter 3 Arithmetic for Computers

FPGA Design Challenge :Techkriti 14 Digital Design using Verilog Part 1

structure syntax different levels of abstraction

Here is a list of lecture objectives. They are provided for you to reflect on what you are supposed to learn, rather than an introduction to this

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

Outline. CPE/EE 422/522 Advanced Logic Design L15. Files. Files

University of Toronto Faculty of Applied Science and Engineering Edward S. Rogers Sr. Department of Electrical and Computer Engineering

Structure of Computer Systems

Contents. Chapter 9 Datapaths Page 1 of 28

Number Systems and Computer Arithmetic

Floating Point Arithmetic

EECS150 - Digital Design Lecture 5 - Verilog Logic Synthesis

Chapter 5 Registers & Counters

LABORATORY # 6 * L A B M A N U A L. Datapath Components - Adders

Many ways to build logic out of MOSFETs

Binary Arithmetic Intro to Assembly Language CS 64: Computer Organization and Design Logic Lecture #3

Arithmetic Logic Unit

(Refer Slide Time 3:31)

CS 31: Intro to Systems Digital Logic. Kevin Webb Swarthmore College February 2, 2016

register:a group of binary cells suitable for holding binary information flip-flops + gates

Week 7: Assignment Solutions

DC57 COMPUTER ORGANIZATION JUNE 2013

Recommended Design Techniques for ECE241 Project Franjo Plavec Department of Electrical and Computer Engineering University of Toronto

Chapter 3: Arithmetic for Computers

Kinds Of Data CHAPTER 3 DATA REPRESENTATION. Numbers Are Different! Positional Number Systems. Text. Numbers. Other

Binary Multiplication

10/21/2016. ECE 120: Introduction to Computing. Let s Extend Our Keyless Entry FSM. FSM Designs Also Allow Use of Abstraction

Multiplication Simple Gradeschool Algorithm for 16 Bits (32 Bit Result)

Engin 100 (section 250), Winter 2015, Technical Lecture 3 Page 1 of 5. Use pencil!

COMPUTER ARCHITECTURE AND ORGANIZATION. Operation Add Magnitudes Subtract Magnitudes (+A) + ( B) + (A B) (B A) + (A B)

BINARY SYSTEM. Binary system is used in digital systems because it is:

1. What is y-chart? ans: The y- chart consists of three domains:- behavioral, structural and geometrical.

Review of Last lecture. Review ALU Design. Designing a Multiplier Shifter Design Review. Booth s algorithm. Today s Outline

Outline. Combinational Circuit Design: Practice. Sharing. 2. Operator sharing. An example 0.55 um standard-cell CMOS implementation

Combinational Circuit Design: Practice

Chapter 5: Computer Arithmetic. In this chapter you will learn about:

Exp#8: Designing a Programmable Sequence Detector

Multicycle conclusion

Transcription:

Design Example: 4-bit Multiplier Consider how we normally multiply numbers: 123 x 264 492 7380 24600 32472 Binary multiplication is similar. (Note that the product of two 4-bit numbers is potentially an 8- bit number). Multiplicand 1011 Multiplier x 0110 0000 Note that each of these lines 10110 here is either zero or just a 101100 shifted venison of the 0000000 multiplicand. Product 1000010 Note that in binary multiplication, the processes involves shifting the multiplicand, and adding the shifted multiplicand or zero. Each bit of the multiplier determines whether a 0 is added or a shifter version of the multiplicand (0 implies zero added, 1 implies shifted multiplicand added). Thus, we can infer a basic shift-and-add algorithm to implement unsigned binary multiplication. Can we design a circuit to implement this? We must start with the datapath. Datapath Well, because of the way the multiplication works, the algorithm involves shifting and adding. This tells us that we ll probably need shift registers and an adder. We also need somewhere to store the product. We can use registers or flip-flops. Registers will allow us to hold the value as long as we like. Sometimes, we add zero, sometimes we add a shifted version of the multiplicand. this suggests AND gates will be needed Copyright 2003 by Andrew W. H. House Page 1 of 7

So, say we consider the expression we want as P = A x B, where P is the 8-bit product, A is the 4-bit multiplicand, and B is the 4-bit multiplier. We define the system to work as follows. A and B are input into the system. The system waits for a user to assert a START signal. At that point, the system begins multiplication, and when finished, asserts a FINISHED signal. When the FINISHED signal is asserted, the final value of the product is available on the outputs. The START signal must go low before and then high again before a new multiplication can be started. Our basic approach, from our understanding of how multiplication works, is that it is just the sum of shifted versions of the multiplicand or zeros. If, instead of adding all the terms at the same time, we use one adder over and over again, we can save on a lot of hardware. So, we do one addition each clock cycle. We initialize the product register to zero. Then, we add the first term. (In the above binary multiplication example, we add zero). On the next clock cycle, we add the second term (10110 in the example above), and so on. Thus, we complete the multiplication in four clock cycles. Let s think about the multiplicand first. We ve repeatedly said that we add shifted versions of the multiplicand to generate the product. This leads us to think that the multiplicand should be loaded into a shift register at the beginning of our multiplication. How big should the shift register be? Well, it needs to be at least 7 bits, since if the most significant bit of the multiplier is a 1, a version of the multiplicand shifted left 3 places must be added. However, we might as well use an 8-bit shift register, since 7-bits is not likely a standard part. Each clock cycle will shift the register one place left. Copyright 2003 by Andrew W. H. House Page 2 of 7

Also, since the product is up to 8-bits long, the adder used to generate the product must be 8-bits in size. Likewise, the register to hold the product must be 8-bits. What about the multiplier? We use it to determine whether we add zero or a version of the multiplicand into the product. In each clock cycle of the multiplication, we check one bit, and use that to determine whether the output of the multiplicand shift register is passed into the adder, or zeroed. We can load the multiplier into a shift register, too. But this one only need be 4 bits long, and shifts to the right. That way, we only need to look at the least significant bit, and use that to AND the output of the multiplicand shift register. (Note that we assume a general or universal shift register exists, something like the 74194. This shift register we assume has activelow clear, parallel inputs and outputs, and shiftin-left and shiftin-right inputs, and two control inputs S0 and S1. If S0S1 is 00, the shift register holds; if 01, the register shifts right; 10 shifts left; and 11 causes parallel load.) So we have our datapath architecture as depicted here. Copyright 2003 by Andrew W. H. House Page 3 of 7

Controller Now that we have a defined datapath architecture, we can do an ASM chart for the control. The controller has several responsibilities: must iterate four times must load A and B into their shift registers must wait for START input must assert the FINISHED signal well done must generate the outputs to control the two shift registers: S0_8, S1_8, S0_4, S1_4 must generate the WRITE_ENABLE signal to the product register when needed must clear the product register when starting a new multiplication (CLEAR_D) must still allow global clear from a switch See the following ASM chart for one implementation. Copyright 2003 by Andrew W. H. House Page 4 of 7

Now we can derive the equations. State sequences: Current state C k B k A k Next state C k+1 B k+1 A k+1 Conditions IDLE 0 0 0 IDLE 0 0 0 START ONE 0 0 1 START ONE 0 0 1 TWO 0 1 0 TWO 0 1 0 THREE 0 1 1 THREE 0 1 1 FOUR 1 0 0 FOUR 1 0 0 DONE 1 0 1 DONE 1 0 1 DONE 1 0 1 START IDLE 0 0 0 START C k+1 = THREE + FOUR + DONE@START = C k @B k @A k + C k @B k @A k + C k @B k @A k @START B k+1 = ONE + TWO = C k @B k @A k + C k @B k @A k A k+1 = IDLE@START + TWO + FOUR + DONE@START = C k @B k @A k @START + C k @B k @A k + C k @B k @A k + C k @B k @A k @START The outputs are mostly generated from the states and the inputs. Most of these can likely be minimized to some extent. WRITE_ENABLE = ONE + TWO + THREE + FOUR = C k @B k @A k + C k @B k @A k + C k @B k @A k + C k @B k @A k S1_8 = S0_4 = CLEAR_D = IDLE@START = C k @B k @A k @START S0_8 = S1_4 = IDLE@START + ONE + TWO + THREE + FOUR = C k @B k @A k @START + C k @B k @A k + C k @B k @A k + C k @B k @A k + C k @B k @A k FINISHED = DONE = C k @B k @A k Copyright 2003 by Andrew W. H. House Page 5 of 7

It is possible to have a smaller implementation by utilizing a 2-bit counter and staying in a single multiplying state until all 4 iterations have been done. Try working out this alternate on your own, then see the following ASM chart and solution. Copyright 2003 by Andrew W. H. House Page 6 of 7

State sequences for alternate implementation: Current state B k A k Next state B k+1 A k+1 Conditions IDLE 0 0 IDLE 0 0 START WORKING 0 1 START WORKING 0 1 WORKING 0 1 CNT_DONE DONE 1 0 CNT_DONE DONE 1 0 DONE 1 0 START IDLE 0 0 START The state equations are easier, since there are fewer states. B k+1 = WORKING@CNT_DONE + DONE@START = B k @A k @CNT_DONE + B k @A k @START A k+1 = IDLE@START + WORKING@CNT_DONE = B k @A k @START + B k @A k @CNT_DONE The outputs in this case are also easier to generate. WRITE_ENABLE = WORKING = B k @A k S1_8 = S0_4 = CLEAR_D = IDLE@START = B k @A k @START S0_8 = S1_4 = IDLE@START + WORKING = B k @A k @START + B k @A k FINISHED = DONE = B k @A k Copyright 2003 by Andrew W. H. House Page 7 of 7