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

Similar documents
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.

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.

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.

Sequential Logic - Module 5

Contents. Chapter 9 Datapaths Page 1 of 28

Control and Datapath 8

EECE 353: Digital Systems Design Lecture 10: Datapath Circuits

ELCT 501: Digital System Design

3 Designing Digital Systems with Algorithmic State Machine Charts

[VARIABLE declaration] BEGIN. sequential statements

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

CSE 260 Introduction to Digital Logic and Computer Design. Exam 1. Your name 2/13/2014

Lecture 12 VHDL Synthesis

CS/EE Homework 7 Solutions

Timing in synchronous systems

The University of Alabama in Huntsville Electrical and Computer Engineering CPE/EE 422/522 Spring 2005 Homework #6 Solution

VHDL in 1h. Martin Schöberl

Digital Design with SystemVerilog

Hardware Description Language VHDL (1) Introduction

Abi Farsoni, Department of Nuclear Engineering and Radiation Health Physics, Oregon State University

DIGITAL LOGIC DESIGN VHDL Coding for FPGAs Unit 6

Design Example: 4-bit Multiplier

The University of Alabama in Huntsville ECE Department CPE Final Exam Solution Spring 2004

CprE 583 Reconfigurable Computing

ECE 545 Lecture 12. Datapath vs. Controller. Structure of a Typical Digital System Data Inputs. Required reading. Design of Controllers

VHDL. VHDL History. Why VHDL? Introduction to Structured VLSI Design. Very High Speed Integrated Circuit (VHSIC) Hardware Description Language

IT T35 Digital system desigm y - ii /s - iii

DESCRIPTION OF DIGITAL CIRCUITS USING VHDL

Modeling Complex Behavior

ECE 545 Lecture 12. FPGA Resources. George Mason University

VHDL Examples Mohamed Zaky

Two HDLs used today VHDL. Why VHDL? Introduction to Structured VLSI Design

COVER SHEET: Total: Regrade Info: 5 (14 points) 7 (15 points) Midterm 1 Spring 2012 VERSION 1 UFID:

Addition and multiplication

Tailoring the 32-Bit ALU to MIPS

Summary of FPGA & VHDL

Lab 3: Standard Combinational Components

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

ECE 545 Lecture 8. Data Flow Description of Combinational-Circuit Building Blocks. George Mason University

EEL 4712 Digital Design Test 1 Spring Semester 2007

Lecture 7. Standard ICs FPGA (Field Programmable Gate Array) VHDL (Very-high-speed integrated circuits. Hardware Description Language)

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

VHDL simulation and synthesis

EL 310 Hardware Description Languages Midterm

ECE 448 Lecture 3. Combinational-Circuit Building Blocks. Data Flow Modeling of Combinational Logic

ECE 448 Lecture 3. Combinational-Circuit Building Blocks. Data Flow Modeling of Combinational Logic

Chapter 6 Combinational-Circuit Building Blocks

ECE260: Fundamentals of Computer Engineering

ECOM 4311 Digital Systems Design

Lecture 5: State Machines, Arrays, Loops. EE 3610 Digital Systems

Sign here to give permission for your test to be returned in class, where others might see your score:

Introduction to VHDL #3

VHDL Modeling Behavior from Synthesis Perspective -Part B - EL 310 Erkay Savaş Sabancı University

EE 109L Review. Name: Solutions

ECEU530. Schedule. ECE U530 Digital Hardware Synthesis. Datapath for the Calculator (HW 5) HW 5 Datapath Entity

Concurrent & Sequential Stmts. (Review)

The VHDL Hardware Description Language

ACS College of Engineering. Department of Biomedical Engineering. Logic Design Lab pre lab questions ( ) Cycle-1

VHDL 2 Combinational Logic Circuits. Reference: Roth/John Text: Chapter 2

Problem Set 10 Solutions

Field Programmable Gate Array

VHDL And Synthesis Review

Sequential Statement

COVER SHEET: Total: Regrade Info: Problem#: Points. 7 (14 points) 6 (7 points) 9 (6 points) 10 (21 points) 11 (4 points)

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

VHDL: RTL Synthesis Basics. 1 of 59

EE 459/500 HDL Based Digital Design with Programmable Logic. Lecture 6 Combinational and sequential circuits

Multi-valued Logic. Standard Logic IEEE 1164 Type std_ulogic is ( U, uninitialized

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 6

CMPT 250: Computer Architecture. Using LogicWorks 5. Tutorial Part 1. Somsubhra Sharangi

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

Part 4: VHDL for sequential circuits. Introduction to Modeling and Verification of Digital Systems. Memory elements. Sequential circuits

Writing VHDL for RTL Synthesis

COMP 303 Computer Architecture Lecture 6

REGISTER TRANSFER LANGUAGE

EE 459/500 HDL Based Digital Design with Programmable Logic. Lecture 13 Control and Sequencing: Hardwired and Microprogrammed Control

Hardware Description Languages. Modeling Complex Systems

Computer Architecture Programming the Basic Computer

Lab 3. Advanced VHDL

CprE 583 Reconfigurable Computing

EITF35: Introduction to Structured VLSI Design

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

Inferring Storage Elements

The University of Alabama in Huntsville ECE Department CPE Midterm Exam Solution Spring 2016

CSE 260 Introduction to Digital Logic and Computer Design. Exam 1 Solutions

Digital System Design Using Verilog. - Processing Unit Design

6.1 Combinational Circuits. George Boole ( ) Claude Shannon ( )

RTL Design (Using ASM/SM Chart)

Luleå University of Technology Kurskod SMD152 Datum Skrivtid

Design Examples. ELEC 418 Advanced Digital Systems Dr. Ron Hayne. Images Courtesy of Cengage Learning

VHDL Testbench. Test Bench Syntax. VHDL Testbench Tutorial 1. Contents

Using Library Modules in VHDL Designs

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 3

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

Outline. CPE/EE 422/522 Advanced Logic Design L05. Review: General Model of Moore Sequential Machine. Review: Mealy Sequential Networks.

Spiral 1 / Unit 6. Flip-flops and Registers

Using Library Modules in VHDL Designs

Schedule. ECE U530 Digital Hardware Synthesis. Rest of Semester. Midterm Question 1a

EEL 4712 Digital Design Test 1 Spring Semester 2008

Outcomes. Spiral 1 / Unit 6. Flip Flops FLIP FLOPS AND REGISTERS. Flip flops and Registers. Outputs only change once per clock period

Transcription:

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

Example: Binary Multiplier Two versions Hardwired control Microprogrammed Multiplies two unsigned binary numbers 2

Multiplication Algorithm Either select multiplicand or zero Shift left one every time Sum all to get product Result size 2n 3

Multiplication Multiplication can t be that hard! It s just repeated addition. If we have adders, we can do multiplication also. Remember that the AND operation is equivalent to multiplication on two bits: a b ab 0 0 0 0 1 0 1 0 0 1 1 1 a b a b 0 0 0 0 1 0 1 0 0 1 1 1 4

Binary multiplication example 1 1 0 1 Multiplicand x 0 1 1 0 Multiplier 0 0 0 0 Partial products 1 1 0 1 1 1 0 1 + 0 0 0 0 1 0 0 1 1 1 0 Product Since we always multiply by either 0 or 1, the partial products are always either 0000 or the multiplicand (1101 in this example). There are four partial products which are added to form the result. We can add them in pairs, using three adders. Even though the product has up to 8 bits, we can use 4-bit adders if we stagger them leftwards, like the partial products themselves. 5

A 2x2 binary multiplier The AND gates produce the partial products. For a 2-bit by 2-bit multiplier, we can just use two half adders to sum the partial products. In general, though, we ll need full adders. Here C 3 -C 0 are the product, not carries! B 1 B 0 x A 1 A 0 A 0 B 1 A 0 B 0 + A 1 B 1 A 1 B 0 C 3 C 2 C 1 C 0 6

A 4x4 multiplier circuit 7

More on multipliers Notice that this 4-bit multiplier produces an 8-bit result. We could just keep all 8 bits. Or, if we needed a 4-bit result, we could ignore C4-C7, and consider it an overflow condition if the result is longer than 4 bits. Multipliers are very complex circuits. In general, when multiplying an m-bit number by an n-bit number: There are n partial products, one for each bit of the multiplier. This requires n-1 adders, each of which can add m bits (the size of the multiplicand). The circuit for 32-bit or 64-bit multiplication would be huge! 8

Multiplication: a special case In decimal, an easy way to multiply by 10 is to shift all the digits to the left, and tack a 0 to the right end. 128 x 10 = 1280 We can do the same thing in binary. Shifting left is equivalent to multiplying by 2: 11 x 10 = 110 (in decimal, 3 x 2 = 6) Shifting left twice is equivalent to multiplying by 4: 11 x 100 = 1100 (in decimal, 3 x 4 = 12) As an aside, shifting to the right is equivalent to dividing by 2. 110 10 = 11 (in decimal, 6 2 = 3) 9

Hardware-Friendly Variation Partial product Right shift Only n bit adder instead of 2n Each step either add/shift or just shift 10

ASM Chart Look at it in parts 11

Idle Wait until G asserted Then clear C and A, and set P to n-1 Then multiplication begins 12

Multiplication Test Q 0 If 1, add B Recall that MUL1 done all at same time What happens to C? Test counter zero To IDLE 13

Create Control Signals from ASM Can look at it one set at a time 14

Datapath Counter size ceiling of log n Holds multiplier as well as shifted result. How? 15

More Counter preset to n-1. Counts down. Signals when it hits zero. 16

Hardwired Control Two aspects to control 1. Control of the microoperations Generating signals, such as those for the ALU operations, register numbers, etc. 2. Sequencing What happens next? The order of any microoperations Like states of our locks 17

Register A All microoperations on Reg A Last column is combinational expression that controls microoperation Name is just assigned by designer 18

Register B LOADB is not listed on ASM chart It s an external signal that commands reg to load 19

Flip-Flop C Why is Load repeated? 20

Register Q Similar External load Shift same as for Reg A 21

Counter P Both of counter s Ops happen with others, so no new signals 22

Sequencing Now can look purely at sequencing Only decisions affecting next state are left Q 0 did not affect state 23

Recall: Multiplier 24

ASM 25

Control Signals 26

What We Need to Do Have decided how to generate control signals Have separated control of timing Now: implement in logic 27

Sequence Register and Decoder Make register with enough bits to represent states Add decoder to generate signal for each state For our example (3 states) need 2-bit register 2-to-4 decoder (only need 3 lines of it) 28

State Table Let s recall how this works by stepping through 29

Generate Signals Using Tables 30

Circuit 31

Another Approach One Flip-Flop per state Only one of the FFs has value 1 The single 1 propagates, controlled by combinational logic Seems wasteful at first glance Need n FFs instead of log n However, it s easy to design 32

Design from ASM Just use transformation rules to convert ASM to logic Here s state box 33

Decision Box Represents both possibilities 34

Junction Junction just an OR gate 35

Conditional Output The action is triggered by the generated control line 36

Circuit from Chart FFs labeled 1, decisions 2, junctions 3, control 4 37

VHDL Description of a Binary Multiplier (1) library ieee;use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity binary_multiplier is port( CLK, RESET, G, LOADB, LOADQ: in std_logic; MULT_IN: in std_logic_vector(3 downto 0); MULT_OUT: out std_logic_vector(7 downto 0) ); end binary_multiplier; architecture behavior_4 of binary_multiplier is type state_type is (IDLE, MUL0, MUL1); signal state, next_state : state_type; signal A, B, Q: std_logic_vector(3 downto 0); signal P: std_logic_vector(1 downto 0); signal C, Z: std_logic; begin Z <= P(1) NOR P(0); MULT_OUT <= A & Q; state_register: process (CLK, RESET) begin if (RESET = '1') then state <= IDLE; elsif (CLK event and CLK = '1') then state <= next_state; end if; end process; 38

VHDL Description of a Binary Multiplier (2) next_state_func: process (G, Z, state) begin case state is when IDLE => if G = '1' then next_state <= MUL0; else next_state <= IDLE; end if; when MUL0 => next_state <= MUL1; when MUL1 => if Z = '1' then next_state <= IDLE; else next_state <= MUL0; end if; end case; end process; 39

VHDL Description of a Binary Multiplier (3) datapath_func: process (CLK) variable CA: std_logic_vector(4 downto 0); begin if (CLK event and CLK = '1') then if LOADB = '1' then B <= MULT_IN; end if; if LOADQ = '1' then Q <= MULT_IN; end if; case state is when IDLE => if G = '1' then C <= '0';A <= "0000"; P <= "11"; end if; when MUL0 => if Q(0) = '1' then CA := ('0' & A) + ('0' & B); else CA := C & A; end if; C <= CA(4); A <= CA(3 downto 0); when MUL1 => C <= '0'; A <= C & A(3 downto 1); Q <= A(0) & Q(3 downto 1); P <= P - "01"; end case; end if; end process; 40 end behavior 4;

Microprogrammed Approach Control values stored in a memory Job of instructions is to generate control signals to datapath and output 41

Nomenclature and Characteristics Word of memory called microinstruction The set of instructions called microprogram Sometimes in ROM, sometimes loadable Often wide word 42

Microprogrammed Control Unit Control Address Register (CAR) equivalent to PC Sequencer Part of instruction sent to next-address generator to determine next instruction addr 43

Control Data Register Pipelining approach to break up the delay in the addr gen and ROM Not used in example 44

Status Bits Notice that they go only to sequencer Can only affect next control word So, conditional output boxes not allowed in this architecture 45

ASM old vs. new 46

Microinstruction Word format Addresses of potential next instructions Fields for next instruction selection Fields for datapath control 47

Datapath Control Signals Doesn t include load reg inst. Look at ASM to see where they are asserted 48

Mapping to Microinstruction Have only 4 signals Could encode (2 bits) Would cost a decoder Just a design tradeoff This design has tiny ROM anyway 49

Sequencer Design Probably most important part of this process This design provides 2 addrs SEL field and control logic choose one Other possibility is one addr field Choice is to go to next sequential addr (like PC), or Using control signals go to addr specified 50

SEL Field 51

Result 5 words in ROM ROM is 12 bits wide Design next 52

Microprog Design for Mult MUX1 chooses addr1 or addr2 MUX2 control from datapath status and external signals. Next slide 53

Detail of Control NXTADD1 NXTADD0 54

Microprogram 55