+ All Categories
Home > Documents > ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608:...

ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608:...

Date post: 14-May-2018
Category:
Upload: vuongnguyet
View: 234 times
Download: 2 times
Share this document with a friend
50
ASM Chart: Multiplier Control COE608: Computer Organization and Architecture Dr. Gul N. Khan http://www.ee.ryerson.ca/~gnkhan Electrical and Computer Engineering Ryerson University Overview Types of Sequential Circuits Mealy and Moore Machine Models Sequence Detector Implementations Algorithmic State Machines: Introduction Realization of ASM Control Unit Design of the Multiplier Hardwired Control Sequence Register and Decoder Method One Flip-Flop per State Method Part of Chapter 8, section 8.3 - 8.5 of Text by Mano and Kime © G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 1
Transcript
Page 1: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

ASM Chart: Multiplier Control

COE608: Computer Organization and Architecture

Dr. Gul N. Khan http://www.ee.ryerson.ca/~gnkhan

Electrical and Computer Engineering

Ryerson University

Overview • Types of Sequential Circuits

♦ Mealy and Moore Machine Models ♦ Sequence Detector Implementations

• Algorithmic State Machines: Introduction • Realization of ASM • Control Unit Design of the Multiplier • Hardwired Control

♦ Sequence Register and Decoder Method ♦ One Flip-Flop per State Method

Part of Chapter 8, section 8.3 - 8.5 of Text by Mano and Kime

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 1

Page 2: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

Sequential Logic Circuits

}Output

variables (z1 ..... zm)

Nv} ext-state

ariables (Y1 ..... Yr)

Primary input variables

(x1 ..... xn ) Present state

variables (y1 ..... yr)

{ {

MemoryDevices

Clock

CombinationalLogic

Inputs Primary Inputs State variables

Outputs Output variables Next state variables.

Synchronous Sequential Circuits Clock is used to ensure occurrence of event (change of state) at a specified instant of time.

Asynchronous Sequential Circuits

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 2

Page 3: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

Sequential Machine Models Main Models of Sequential Circuits or Machines are: Mealy and Moore Model Mealy Machines: Their outputs depend on both the present state and the present inputs. Moore Machines: The outputs depend on the present state only.

PresentState

Inputs (x)

Outputs (Z)

Clock

Next State

Comb. Logic

Network

State Reg.

PresentState

Inputs (x)

Outputs(Z)Next State

Comb. Logic

Network

State Reg.

Clock

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 3

Page 4: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

Sequential Machine Models

Mealy Model Moore Model

10/0

01/0 10/0

00/0 11/1

01/010/0

00/1 11/0

01/0

00/0 11/0

AB/S

Z Y

X 10

01 10

00 11

01 10

00 11

01

00 11

AB

Z/0Y/1

X/0

PS NS PS NS Output AB

00 01

11

10

AB 00

01

11

10

S

x x/0 z/0 x/0 y/0 x x z x y 0 y x/0 y/0 x/1 y/0 y x y x y 1 z x/1 z/0 x/0 z/0 z x z x z 0

Mealy State Table Moore State Table

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 4

Page 5: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

Sequential Machine Models

Mealy Model Timing Diagram

Moore Model Timing Diagram

X Y X Z X X

CLK

Present State

Input A

Input B

Output S

CLK

PresentState

Input A

Input B

Output S

X Y X Z X X

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 5

Page 6: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

Sequential Machine Models Main Features:

• Moore machine realization is more complex than Mealy due to additional state requirements to derive the required outputs.

• Outputs of a Moore machine are generally robust and independent of external (primary) inputs.

• Mealy model is useful for applications where faster respond is needed.

• In the case of Mealy machines, all unspecified states must end up in a specified state after the next or consecutive clock cycle. Otherwise, oscillation/hang-up may occur for certain input combinations.

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 6

Page 7: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

Finite State Machine Example Problem Statement: • The occurrence of sequence of pairs of inputs

00→00→11→10 is to be detected. • The machine will output logic 1 after detecting

the sequence successfully.

The Mealy Model: • State transitions are labeled with inputs and the

output values.

10/0

01/0

11/0

00/0

01/0 10/0

10/1

11/0

01/0

11/0

00/0

00/0

01/0

10/0

11/0

4

3

2

1

00/0

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 7

Page 8: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

State Assignment

The occurrence of sequence of pairs of inputs 00→00→11→10 is to be detected.

Mealy Machine Design Approach State-Transition Table

Present Inputs X1, X2 state Next state Output z

00 01 11 10 00 01 11 101 2 3 4

2 3 3 2

1 1 1 1

1 1 4 1

1 1 1 1

0 0 0 0

0 0 0 0

0 0 0 0

0 0 0 1

State Assignment: Assign binary codes to the states. 1 = 00, 2 = 01, 3 = 11 and 4 = 10

Present Inputs x1x2 State Next State, w1w2 Output z y1y2 00 01 11 10 00 01 11 1000 01 11 10

01 11 11 01

00000000

00001000

00000000

0 0 0 0

0 0 0 0

0 0 0 0

0 0 0 1

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 8

Page 9: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

State Assignment • Any state assignment is satisfactory as long

as each state is assigned a unique binary code.

• However, one particular assignment may be optimal that requires least number of gates.

Guidelines for State Assignment

States having the same NEXT STATES for a given input condition should be given adjacent assignments.

States, which are NEXT STATES of a single-state, should be given adjacent assignments. States, which have identical output specification, should be given adjacent assignments.

Overall Minimize the number of Sate Variable changes as you move through the state diagram.

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 9

Page 10: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

Mealy Machine Design Using D-type FFs

21212211 yyxxyxxw += 212 xxw =

x1x2 00

y1y2

10

11

01

00

01 11 10

1

1

1 1

x1x2

10

00

x1x2 00

y1y2

10

11

01

00

1

1101

y1y2

10

11

01

00

1

1

1

1011 01

BY INSPECTION OUTPUT z x x y y= 1 2 1 2

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 10

Page 11: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

Mealy Machine Design

Sequential Circuit

Q

QQ z

x2

x1

x2

x1

y1 W1

y2W2

Clock Timing Diagram

1 1 2 3 4 1

CLK

PresentState

Input x1

Input x2

Output z

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 11

Page 12: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

Moore Machine Implementation The Moore Model: • Suitable for asynchronous sequential systems. • Transitions are labeled with the inputs only.

State Diagram

01,10,11

00

00

01 11

1011

00

10 01 00

011011

00

100111

5/1

4/0

3/0

2/0

1/0

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 12

Page 13: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

Moore Machine Example State-transition Table

Present State Next State xy

Output z

00 01 11 10 1 2 3 4 5

2 3 3 2 2

1 1 1 1 1

1 1 4 1 1

1 1 1 5 1

0 0 0 0 1

State Assignment

Present State Next state (A+B+C+) Output ABC XY

00

01

11

10 z

000 001 000 000 000 0 001 011 000 000 000 0 011 011 000 010 000 0 010 001 000 000 110 0 110 001 000 000 000 1

Using D-type FFs

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 13

Page 14: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

Moore Machine Design

B+

x

x C

X

0 0 0 0

x x x

x x x

x xx x

10 11 01 00 X

A = 0 A = 1

B 10

11

01

00

1

1 1

1

10 11 01 00 XY

BC

Y Y

yxCBABCxyyxCB ++=+

C+

x

x C

X

0 0 0 1

x x x

x x x

x x x x

10 11 01 00 X

A = 0 A = 1

B 10

11

01

00

1

1

1

1

10 11 01 00 XY

BC Y Y

yxC =+

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 14

Page 15: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

Moore Machine Design

Sequential Circuit clock

DB QB

QB

DC QC

QC

DA QA

QA

Z

XY

Timing Diagram

1(000) 1(000) 2(001) 3(011) 4(010) 5(110) 1(000)

CLK

PresentState ABC

Input x

Input y

Output z © G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 15

Page 16: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

Algorithmic State Machine (ASM)

• Flow Charts are mostly used for software

design. They are also useful for digital system design.

• The ASM or State Machine charts offer several advantages over state diagrams.

Main Features of ASM Charts • Operation of a digital system represented by an

ASM chart is easier to understand.

• An ASM chart can be converted into several equivalent forms and each form leads directly to a hardware realization.

• The conditions for a proper state diagram are completely satisfied by the ASM chart.

• ASM chart based digital system design is equivalent to software design.

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 16

Page 17: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

ASM Charts

A Typical ASM Chart

0

Z1 Z2

X 1

S2/Zc

X 1

S1/Zb

0

S0/Za

0 1 X

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 17

Page 18: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

ASM Charts

The state diagram/table based design approach becomes impractical for systems with large number of inputs. • The number of columns for the state table

doubles with every additional input. • All the inputs are not relevant at each clock

pulse/transition (don't care conditions). On the other hand, ASM approach only shows the active inputs on the chart.

• State diagrams are not suitable for gradual refinement of FSM.

Typical State Table

Present State Next state (A+B+C+) Output ABC XY

00

01

11

10 z

000 001 000 000 000 0 001 011 000 000 000 0 011 011 000 010 000 0 010 001 000 000 110 0 110 001 000 000 000 1

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 18

Page 19: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

ASM Charts

Basic Elements of an ASM chart are:

State Box • It represents one state of the ASM. • The sequential machine resides in a state box

for one state time (one clock cycle). • It consists of a state name, state assignment

code and state output (Moore). • State box has a single exit/entry point unlike to

a state node in state diagram.

Entry

Exit Path

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 19

Page 20: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

ASM Charts

Decision Box • The decision box takes machine inputs. • It contains Boolean variables to be tested and

gives conditions that control or qualify conditional state transition and outputs.

• Single entry path and two exit paths define the condition for true or false exit.

1

input

0

Conditional Output Box • It describes those outputs that only become

active on true conditions. • It is always connected to the exit-path of a

decision box.

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 20

Page 21: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

ASM Charts

ASM charts are equivalent to state diagrams: • Sate Box ⇔ State diagram node • Decision Box ⇔ Input values on the state

transition lines. • Outputs in the State Box ⇔ Output values in the

state nodes. (Moore Machine) • Outputs in Conditional Output Box ⇔ Output

values on the state transition lines. (Mealy Machine)

ASM Block ASM charts are constructed from ASM Blocks An ASM block consists of: • Exactly one state box. • Decision and conditional output boxes

associated with the state. • One entry path and one or more exit paths.

A pure combinational circuit can be described by one ASM block.

An ASM block describes the machine operation during the time that the machine is in that state.

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 21

Page 22: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

ASM Block

When a digital system enters the state associated with an ASM block: • Outputs on the output list of the state box become true. • The conditions in the decision boxes are evaluated to

determine which path(s) are to be followed. • When a conditional output box is encountered along

such a path, the corresponding conditional outputs become true.

• If an output is not encountered along a path that output is assigned a FALSE (by default).

• Each exit path of an ASM block must lead to another state.

• Each possible path through an ASM block from entrance to exit is termed as link path.

S4 S3 S2

S1

Z2

Z1

x2

x1

many exit paths

Entry path

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 22

Page 23: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

ASM Block

An ASM Block can be drawn in several ways.

0

Z2

X1

S1/Z1

S2 S3

0 1

1

X2

X1

0

1

S2

Z2

X1

0

1

S3

Z2

0 1S1/Z1

X2

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 23

Page 24: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

ASM Block

Rules to Construct an ASM Block • For every valid combination of input variables, there

must be one exit path. • No internal feedback within an ASM block is allowed.

X1

S0/

0X1

S0/

1

0

1

• An ASM block can have several parallel paths that lead to the same exit path and more than one of these paths can be active at the same time.

Z2

1

0X2

Z1

1X1

S0/Z0

Z3

1

0X3

0

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 24

Page 25: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

ASM Chart

• An ASM chart consists of one or more ASM blocks connected in a consistent manner.

• In the case of autonomous sequential circuits ASM chart will consist of state boxes connected by direct transition link paths.

The ASM chart of a JK Flip-Flop Q

K

J

1 0

1

1 0

0

out 0

out 1 one

zero

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 25

Page 26: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

ASM Chart From State Diagram to ASM Chart

0/0

S1/Zb S2/Zc

0/0 1/0 0/Z1

1/0

1/Z2

0

1

1

0

1 0

00

S0/Za

• X is an input • Za, Zb & Zc are Moore Outputs • Z1 & Z2 are Mealy Outputs

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 26

Page 27: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

Realization of ASM Chart

Main Steps

• For each state variable (e.g. Qa, Qb, etc.), identify all states in which Q = 1

For each of these states, find all the link-paths that lead into the state.

For each of these link paths, find a product-term that is logic-1 when the link-path is followed. e.g. For a link path from state Si to Sj,

the product term will be 1 if the machine is in state Si and the conditions for Sj entry are satisfied.

• The expression for Q+ is formed by

ORing all the product-terms found for a particular state variable as above.

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 27

Page 28: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

Realization from ASM Chart

Example

S0/Za

0 1

0

X

01

S1/Zb

1

X

0

Z2 Z1

11

X 1

S2/Zc

00

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 28

Page 29: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

Realization from ASM Chart

Working Example For Next State: Consider Variable B Link-paths for States that has B = 1 are S1 and S2 states. Link-Path-1 • Starting with a present state AB = 00, takes the X=1

branch and terminates at state S1 during which B = 1. Link-Path-2 • Starting state 01, takes X=1 branch & ends at state 11.

Link-Path-3 • Starting at state 11, takes X=1 branch and ends in

state 11. Overall B+ = A'B'X + A'BX + ABX

For Next State: Consider State Variable A. • Two link paths terminate at S2 state

Moore Outputs Za = A'B'; Zb = A'B; Zc = AB

Conditional Output

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 29

Page 30: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

Binary Multipliers

Hand Multiplication:

11 1 1 0 1 Multiplicand * 13 1 0 1 1 Multiplier

1 1 0 1 1 1 0 1 0 0 0 0 1 1 0 1

143 1 0 0 0 1 1 1 1 Modified (serial) Multiplication

11 0 0 0 0 0 1 0 1 1 Initial contents of product register * 13 1 1 0 1 M bit=1, add multiplicand 0 1 1 0 1 1 0 1 1 Partial product before shift 0 0 1 1 0 1 1 0 1 Partial product after shift 1 1 0 1 Multiplier bit=1, add multiplicand 1 0 0 1 1 1 1 0 1 Partial product before shift 0 1 0 0 1 1 1 1 0 Partial product after shift Multiplier bit=0 skip addition 0 0 1 0 0 1 1 1 1 Partial product after shift 1 1 0 1 Multiplier bit=1, add multiplicand 1 0 0 0 1 1 1 1 1 Partial product before shift 0 1 0 0 0 1 1 1 1 After shift (Final answer)

Final Result = 0 1 0 0 0 1 1 1 1 © G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 30

Page 31: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

Multiplier Block Diagram

Control sign

n

log2n

n

n

n

Cout

Counter-P Register-B

Parallel Adder

Zero Detect

Control

Unit

Multiplicand

© G.Khan Com

Z

als

Q0 Multiplier

Re Re

0

C

puter Organization & Architect

Shift gister-A

ACC: Product O

ure-COE608: ASM and Control

Shift gister-Q

IN

n-1

G(Go)

n

ut

Page: 31

Page 32: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

Binary Multipliers

The multiplication of two binary numbers is performed by successive additions and shifting. B ← Multiplicand; Q ← Multiplier Partial product is formed in A and stored in A & Q.

Multiplier Circuit Operation • Q is an n-bit shift register where multiplier is loaded

that is shifted right. It vacates 1-bit space every time. This space accepts the lower part of the partial product.

• An n-bit parallel adder produces Sums as A ← A + B

• C flip-flop stores the carry from addition. It is reset to zero during the right shift.

• Counter P counts the number of add-shift or shift actions. It is initially set at (n-1) & it counts down.

• When P counts 0, the final product is in the double register A and Q.

Control Unit is the heart of Multiplier: • Its input, G initiate multiplication. • Control unit generate control signals to perform add-

shift or shift operations. • It uses Q0 (LSB of Q shift register) and counter zero-

detect, Z signals. © G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 32

Page 33: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

Multiplier Control, ASM

Multiplication Done

G 0 1

Q00 1

1

IDLE

0

MUL0

MUL1

P ← n - 1

C ← 0, C || A || Q ← sr C || A || QP ← P - 1

A ← A + B C ← Cout

C ← 0; A ← 0

Z

sr = shift right and C || A || Q ← sr C || A || Q is equivalent to 4 transfers A(n-1) ← C, A ← sr A, Q(n-1) ← A(0), Q ← sr Q

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 33

Page 34: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

Multiplier Control Unit

Control Unit is the Heart of Multiplier • Its input, G initiates multiplication. • It uses Q0 (LSB of Q shift register) and counter

zero-detect, Z signals. • Control unit generates control signals to activate

following micro-operations: Sum of A and B. PP transferred to A. Cout transferred to C. PP & multiplier in A:Q shifted right. Carry from C is shifted to MSB of A:

♦ LSB of Q is discarded. ♦ After right shift, 1-bit of PP is transferred

into Q and multiplier bits are shifted one bit right.

Control unit decides between add-shift and shift depending on the LSB of Q. Control unit checks Z for an end. Control unit checks G, to start

multiplication. © G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 34

Page 35: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

Multiplier Control ASM Chart Analysis

Multiplicand in register B

Multiplier in Q

State Changes from IDLE to MUL0

MUL0 State

MUL1 State • Decrement Counter P • Four transfers take place

A(n-1) ← C; A ← sr A; Q(n-1) ← A(0); Q ← sr Q;

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 35

Page 36: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

Control Unit Design • Control unit design by using classical FSM

design is impractical due to large number of inputs and states it may have.

• An attempt to minimize and simplify these circuits usually ends up in irregular networks that would be difficult to recognize and debug.

• An extension to the classical approach is used by experienced designer in designing control logic circuits:

Sequence register and decoder method. ♦

One flip-flop per state method. (One-hot state assignment method) Microprogramming.

The first two methods result in a hard-wired logic. Any modification will require rewiring.

The micro-program control uses ROM/PROM.

Modification of the PROM or replacing the ROM modifies the micro-program control.

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 36

Page 37: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

Hardwired Control Type of Registers Used for Datapath • Register A is a shift register with parallel

load and synchronous clear. • Register Q is a shift register. • C flip-flop needs a synchronous clear. • Register B has a parallel load. • Register Q has a parallel load.

To Implement Control Unit Consider: • Control of micro-operations i.e. generate

the control signals • Sequencing of control unit and micro-

operation i.e. to determine what happens next.

Control Unit Design Approach • Simplify ASM chart to represent only state

transitions. • Generate a new table to define control

signals in terms of states and inputs. © G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 37

Page 38: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

Control Signals for Multiplier

Micro-operations for each register

Block Diag Module

Micro-Operation Control Signal

Control Expression

Register A A ← 0

A ← A + B

C║A║Q←sr C║A║Q

Initialize

Load

Shift

Register B B ← IN Load_B FF C C ← 0

C ← Cout Clear_C Load

Register Q Q ← IN C║A║Q←sr C║A║Q

Load_Q Shift

Counter P P ← n − 1 P ← P − 1

Initialize Decrement Count

Same control signal for different registers:

Derive control signal logic from ASM Initialize: Clear_C:

Remove information on micro-operations and redraw the ASM for sequencing purposes only.

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 38

Page 39: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

ASM for Sequencing Part • Remove any decision boxes that do not affect the

next state situation.

• Remove all the output boxes and any outputs in the state boxes.

• Design the sequencing part of the control unit using the simplified ASM chart

MUL1

MUL0

Z0

IDLE

10 G

1

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 39

Page 40: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

Sequence Register and Decoder Method

Sequence Register for control states • Register with n-Flip-Flops can have 2n states. • n-bit sequence register has n-FFs & associated gates.

Decoder provides outputs corresponding to each state

Combination of the external inputs and feedback from the present state generates the next states.

Tn

T0

other control

Decoder Sequence

Register

Present State

Decision Logic

Input

conditions

External

If there is no external input then it reduces to a counter decoder control circuit.

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 40

Page 41: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

Sequence Register and Decoder Method

Binary Multiplier Control Sequencer • 3-states and 2-inputs:

State Table

Present State Inputs N. State Decoder Name M1 M0 G Z M1+ M0+ IDLE MUL0 MUL1

IDLE 0 0 0 0

0 x1 x

1 0 0 1 0 0

MUL0 0 1 x x 0 1 0 MUL1 1 0

1 0 x 0x 1

0 0 1 0 0 1

1 1 x x x x x

2 Flip-flops : M1 M0 States 00, 01 and 10: IDLE, MUL0 and MUL1

DM0 = M0+ DM1 = M1+ Outputs: Initialize, Clear_C, Shift and Load

Initialize and Shift already available Gates required for Clear_C and Load

Clear_C = Load =

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 41

Page 42: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

Sequence Register and Decoder Method

Implementation

Outputs toDatapathInputs

QD C

QD C

A0 0

2-to-4 1 Decoder

2

A1 3

Initialize Clear_C Load Shift_dec

Go (G) Z Q0

Clock

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 42

Page 43: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

Multiplier VHDL Code -- A behavioral model of a multiplier for -- unsigned binary-numbers that multiplies a -- 4-bit multiplicand by a 4-bit multiplier -- to give an 8-bit product.

-- The maximum number of clock cycles needed -- for a multiply is 10.

library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; entity mult4X4 is port ( Clk, St: in std_logic;

Mplier, Mcand: in std_logic_vector(3 downto 0);

Done: out std_logic); end mult4X4; architecture behave1 of mult4X4 is signal State: integer range 0 to 9; -- accumulator signal ACC: std_logic_vector(8 downto 0); -- Q0 is bit 0 of ACC alias Q0: std_logic is ACC(0); begin

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 43

Page 44: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

process begin -- executes on rising edge of clock wait until Clk = '1'; case State is when 0 => --initial State if St='1' then ACC(8 downto 4)<= "00000"; --Begin cycle

-- Load multiplier ACC(3 downto 0) <= Mplier;

State <= 1; end if; when 1 | 3 | 5 | 7 => --"add/shift" State if Q0 = '1' then --Add multiplicand ACC(8 downto 4) <=

add4(ACC(7 downto 4),Mcand,'0'); State <= State + 1; else -- Shift accumulator right ACC <= '0' & ACC(8 downto 1); State <= State + 2; end if; when 2 | 4 | 6 | 8 => --"shift" State

-- Right shift ACC <= '0' & ACC(8 downto 1); State <= State + 1;

when 9 => -- End of cycle State <= 0; end case; end process; Done <= '1' when State = 9 else '0'; end behave1;

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 44

Page 45: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

One Flip-Flop per State Method

Every state is assigned to one flip-flop.

Other control outputs

Decision Logic

Clock

Q

Q

Q

Q

D

D

D

D

External input conditions

State Box Entry

State Box Exit

S0

S1

S2

S3

The configuration of the 4-state control logic: • Four D-type flip-flops • One flip-flop for every state • Only one flip-flop will be active (level HIGH) at

any one time.

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 45

Page 46: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

One Flip-Flop per State Method

Only one flip-flop is in active state or "1" at a time that signifies one state. Main Features:

• The simplicity allows designers to design controller only by inspection from the ASM chart or state diagram.

• Cost saving in the design effort of controllers, however, it is not recommended for high volume production.

• Large number of flip-flops leads to high cost.

• Each of the flip-flop output is connected to the data-processing section of the digital system, to initiate certain micro-operations.

• If controllers do not have any input and the control needs to be repeated then it becomes a ring counter controller.

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 46

Page 47: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

One FF/State Implementation Suited for Implementing Control Unit from ASM charts.

ASM Transforming Rules

State Box

Entry

Exit

Entry

Exit

State Code(optional)

State_Name/ outputs (Moore)

Q D C

X

Exit 0 Decision Box

Exit 1

Entry Entry

Exit 1 Exit 0

1 X 0

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 47

Page 48: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

One FF/State Implementation ASM Transforming Rules

Output

X

Exit 1

Entry Entry

Exit 1

X 1

Conditional Output Box

Exit

Entry 1 Entry 2

Exit

Entry 2Entry 1

Junction

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 48

Page 49: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

One FF/State Implementation

ASM Chart for Binary Multiplier Control

MUL1

IDLE

Q00 1

10 Z

MUL0

Initialize

C ← 0, C || A || Q ← sr C || A || Q ; P ← P –1(Complex Shift)

Multiplication Done

(LOAD) A ← A + BC ← Cout

Clear_C

10 G

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 49

Page 50: ASM Chart: Multiplier Control COE608: Computer ... · ASM Chart: Multiplier Control COE608: Computer Organization ... • Realization of ASM ... • An ASM chart can be converted

One FF/State Implementation

Initialize

Clear_C

Load

Shift_dec

Z

G

Q D C

Q0

Clock

C

QD C

QD

© G.Khan Computer Organization & Architecture-COE608: ASM and Control Page: 50


Recommended