36
Savio Chau Overview of Control Hardware Development Control may be designed using one of several initial representations. The choice of sequence control, and how logic is represented, can then be determined independently; the control can then be implemented with one of several methods using a structured logic technique.

Savio Chau Overview of Control Hardware Development Control may be designed using one of several initial representations. The choice of sequence control,

  • View
    216

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Savio Chau Overview of Control Hardware Development Control may be designed using one of several initial representations. The choice of sequence control,

Savio Chau

Overview of Control Hardware Development

• Control may be designed using one of several initial representations. The choice of sequence control, and how logic is represented, can then be determined independently; the control can then be implemented with one of several methods using a structured logic technique.

Page 2: Savio Chau Overview of Control Hardware Development Control may be designed using one of several initial representations. The choice of sequence control,

Savio Chau

Hardwired Control Approach

• Simple to Implement

See class example for drawing a finite state diagram for the multi-cycle add data path

Page 3: Savio Chau Overview of Control Hardware Development Control may be designed using one of several initial representations. The choice of sequence control,

Savio Chau

1 1 0 X

Example of State Transition and Control Signals

Instruction Memory

ALU

Next Address Logic

PC+4

rs

rt

rd

RegWr ALUctr

Instr Reg PCWr

Clk Clk

Clk

Clk

IRWr

Simple Multi-Cycle Data Path of add Instruction

Control UnitOpcode

State # 0 (Instr Fetch)

State # 1(Decode/Operand Fetch)

State # 2(Exec & Write

Back)

PCwr = 1, IRwr = 1RegWr = 0, ALUctr = XPC

0 0 0 X

BA

PCwr = 0, IRwr = 0 RegWr = 0, ALUctr = XRd addr1

Rd addr2

0 0 1 add

PCwr = 0, IRwr = 0RegWr = 1, ALUctr = add

Register FileWr addr

Wr data

See class example for designing the simple state machine for the multi-cycle add data path

Page 4: Savio Chau Overview of Control Hardware Development Control may be designed using one of several initial representations. The choice of sequence control,

Savio Chau

Initial Representation: Finite State Diagram

1: PCWritePCsrc = 10x: others

JComplete

J

0

12

3

4

5 6

7

10

11

8

9

See class example 2, a simpler data path and finite state diagram

Page 5: Savio Chau Overview of Control Hardware Development Control may be designed using one of several initial representations. The choice of sequence control,

Savio Chau

Sequencing Control: Explicit Next State Function

Current state number

Next state n

um

ber

Each output line is a logical sum (i.e., OR) of minterms (i.e., AND) of the input lines. Example:

NS3 = OP5·OP4·OP3·OP2·OP1·OP0·S3·S2·S1·S0 + OP5·OP4·OP3·OP2·OP1·OP0·S3·S2·S1·S0 + OP5·OP4·OP3·OP2·OP1·OP0·S3·S2·S1·S0 + S3·S2·S1·S0

Page 6: Savio Chau Overview of Control Hardware Development Control may be designed using one of several initial representations. The choice of sequence control,

Savio Chau

Logic Representation: State Transition TableFor Next State Output

Translating the State Diagram into State Transition Table

Current State Op Code Input Next StateState 0 State 1State 1 (( op= lw) or (op= sw)) State 2State 1 (op= r- type) State 6State 1 (op= beq) State 8State 1 (op= jmp) State 9State 1 (op= ori) State 10State 2 (op= lw) State 3State 2 (op= sw) State 5State 3 State 4State 4 State 0State 5 State 0State 6 State 7State 7 State 0State 8 State 0State 9 State 0State 10 State 11State 11 State 0

See class example 2 for translating finite state diagram to state transition table

Page 7: Savio Chau Overview of Control Hardware Development Control may be designed using one of several initial representations. The choice of sequence control,

Savio Chau

Truth Table can be Translated into Logic Equations. Example:NS0 = S3·S2·S1·S0 + S3·S2·S1·S0·OP5·OP4·OP3·OP2·OP1·OP0 +

S3·S2·S1·S0·OP5·OP4·OP3·OP2·OP1·OP0 + S3·S2·S1·S0 + S3·S2·S1·S0·OP5·OP4·OP3·OP2·OP1·OP0 + S3·S2·S1·S0

Logic Representation: Truth TableFor Next State Output

Translating the State Transition Table into Truth Table

See example below

Current State Op Code Input Next StateS3 S2 S1 S0 OP5 OP4 OP3 OP2 OP1 OP0 NS3 NS2 NS1 NS00 0 0 0 0 0 0 10 0 0 1 1 0 0 0 1 1 0 0 1 00 0 0 1 1 0 1 0 1 1 0 0 1 00 0 0 1 0 0 0 0 0 0 0 1 1 00 0 0 1 0 0 0 1 0 0 1 0 0 00 0 0 1 0 0 0 0 1 0 1 0 0 10 0 0 1 0 0 1 1 0 1 1 0 1 00 0 1 0 1 0 0 0 1 1 0 0 1 10 0 1 0 1 0 1 0 1 1 0 1 0 10 0 1 1 0 1 0 00 1 0 0 0 0 0 00 1 0 1 0 0 0 00 1 1 0 0 1 1 10 1 1 1 0 0 0 01 0 0 0 0 0 0 01 0 0 1 0 0 0 01 0 1 0 1 0 1 11 0 1 1 0 0 0 0

Page 8: Savio Chau Overview of Control Hardware Development Control may be designed using one of several initial representations. The choice of sequence control,

Savio Chau

What About the Control Signals?

PCsrc

2

1

0

MU

X

Page 9: Savio Chau Overview of Control Hardware Development Control may be designed using one of several initial representations. The choice of sequence control,

Savio Chau

Control Signals and States

1: PCWritePCsrc = 10x: others

JComplete

J

0

12

3

4

5 6

7

10

11

8

9

Page 10: Savio Chau Overview of Control Hardware Development Control may be designed using one of several initial representations. The choice of sequence control,

Savio Chau

Logic Representation: Logic EquationsFor Control Signal Output

Translating the State Diagram into Control Output Table

Output Signals StatePCWrite State 0 + State 9PCWriteCond State 8IorD State 3 + State 5ExtOp State 1 + State 2MemWrite State 5IRWrite State 0MemtoReg State 4PCSource1 State 9PCSource0 State 8ALUOp1 State 6ALUOp0 State 8ALUSrcB1 State 1 + State 2 + State 10ALUSrcB0 State 0 + State 1ALUSrcA State 2 + State 6 + State 8 + State 10RegWrite State 4 + State 7 + State 11RegDst State 7

See class example 2 for translating finite state diagram to control output table

Page 11: Savio Chau Overview of Control Hardware Development Control may be designed using one of several initial representations. The choice of sequence control,

Savio Chau

Logic Representation: Logic EquationsFor Control Signal Output

Current State Op Code Input Next State

S3

S2

S1

S0

OP

5

OP

4

OP

3

OP

2

OP

1

OP

0

NS

3

NS

2

NS

1

NS

0

PC

Write

PC

Write

Co

nd

IorD

Ex

tOp

Me

mW

rite

IRW

rite

Me

mto

Re

g

PC

So

urc

e1

PC

So

urc

e0

AL

UO

p1

AL

UO

p0

AL

US

rcB

1

AL

US

rcB

0

AL

US

rcA

Re

gW

rite

Re

gD

st

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

For clarity, zeros are not shown in these columns

See the simpler state machine in class example 2

Page 12: Savio Chau Overview of Control Hardware Development Control may be designed using one of several initial representations. The choice of sequence control,

Savio Chau

Logic Representation: Logic EquationsFor Control Signal Output

Current State Output Signals S3 S2 S1 S0 0 0 0 0 PCWrite 1 0 0 1

PCWriteCond 1 0 0 0 0 0 1 1 IorD 0 1 0 1 0 0 0 1 ExtOp 0 0 1 0

MemWrite 0 1 0 1 IRWrite 0 0 0 0 MemtoReg 0 1 0 0 PCSource1 1 0 0 1 PCSource0 1 0 0 0 ALUOp1 0 1 1 0 ALUOp0 1 0 0 0

0 0 0 1 0 0 1 0

ALUSrcB1

1 0 1 0 0 0 0 0 ALUSrcB0 0 0 0 1 0 0 1 0 0 1 1 0 1 0 0 0

ALUSrcA

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

RegWrite

1 0 1 1 RegDst 0 1 1 1

Truth Table of Output Signals:

RegWrite = !S3 & S2 & !S1 & !S0 + !S3 & S2 & S1 & S0 + S3 & !S2 & S1 & S0

Page 13: Savio Chau Overview of Control Hardware Development Control may be designed using one of several initial representations. The choice of sequence control,

Savio Chau

Current State Op Code Input Next State

S3

S2

S1

S0

OP

5

OP

4

OP

3

OP

2

OP

1

OP

0

NS

3

NS

2

NS

1

NS

0

PC

Write

PC

Write

Co

nd

IorD

Ex

tOp

Me

mW

rite

IRW

rite

Me

mto

Reg

PC

So

urce

1

PC

So

urce

0

AL

UO

p1

AL

UO

p0

AL

US

rcB

1

AL

US

rcB

0

AL

US

rcA

Re

gW

rite

Re

gD

st

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

Example of Control Sequence: R-Type

0 0 0 0 0 0 0 1

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

Page 14: Savio Chau Overview of Control Hardware Development Control may be designed using one of several initial representations. The choice of sequence control,

Savio Chau

Current State Op Code Input Next State

S3

S2

S1

S0

OP

5

OP

4

OP

3

OP

2

OP

1

OP

0

NS

3

NS

2

NS

1

NS

0

PC

Write

PC

Write

Co

nd

IorD

Ex

tOp

Me

mW

rite

IRW

rite

Me

mto

Re

g

PC

So

urce

1

PC

So

urce

0

AL

UO

p1

AL

UO

p0

AL

US

rcB

1

AL

US

rcB

0

AL

US

rcA

Re

gW

rite

Re

gD

st

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

Example of Control Sequence: R-Type

0 0 0 1 0 1 1 0

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

Page 15: Savio Chau Overview of Control Hardware Development Control may be designed using one of several initial representations. The choice of sequence control,

Savio Chau

Current State Op Code Input Next State

S3

S2

S1

S0

OP

5

OP

4

OP

3

OP

2

OP

1

OP

0

NS

3

NS

2

NS

1

NS

0

PC

Write

PC

Write

Co

nd

IorD

ExtO

p

Mem

Write

IRW

rite

Mem

toR

eg

PC

So

urce1

PC

So

urce0

AL

UO

p1

AL

UO

p0

AL

US

rcB1

AL

US

rcB0

AL

US

rcA

Re

gW

rite

Re

gD

st

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

Example of Control Sequence: R-Type

0 1 1 0 0 1 1 1

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

Page 16: Savio Chau Overview of Control Hardware Development Control may be designed using one of several initial representations. The choice of sequence control,

Savio Chau

Current State Op Code Input Next State

S3

S2

S1

S0

OP

5

OP

4

OP

3

OP

2

OP

1

OP

0

NS

3

NS

2

NS

1

NS

0

PC

Write

PC

Write

Co

nd

IorD

Ex

tOp

Me

mW

rite

IRW

rite

Me

mto

Re

g

PC

So

urc

e1

PC

So

urc

e0

AL

UO

p1

AL

UO

p0

AL

US

rcB

1

AL

US

rcB

0

AL

US

rcA

Re

gW

rite

Re

gD

st

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

Example of Control Sequence: R-Type

0 1 1 1 0 0 0 0

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

Page 17: Savio Chau Overview of Control Hardware Development Control may be designed using one of several initial representations. The choice of sequence control,

Savio Chau

Example of Control Sequence: R-TypeCurrent State Op Code Input Next State

S3

S2

S1

S0

OP

5

OP

4

OP

3

OP

2

OP

1

OP

0

NS

3

NS

2

NS

1

NS

0

PC

Write

PC

Write

Co

nd

IorD

Ex

tOp

Me

mW

rite

IRW

rite

Me

mto

Reg

PC

So

urce

1

PC

So

urce

0

AL

UO

p1

AL

UO

p0

AL

US

rcB

1

AL

US

rcB

0

AL

US

rcA

Re

gW

rite

Re

gD

st

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

0 0 0 0 0 0 0 1

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

Page 18: Savio Chau Overview of Control Hardware Development Control may be designed using one of several initial representations. The choice of sequence control,

Savio Chau

Implementation Technique:Programmable Logic Array

S3 S2 S1 S0OP5 OP4 OP3 OP2 OP1 OP0

NS

0

NS

1

NS

2

NS

3

PC

Write

PC

Write

Co

nd

IorD

ExtO

p

Me

mW

rite

IRW

rite

Me

mto

Re

g

PC

So

urce

1

AL

UO

p1

AL

UO

p0

AL

US

rcB1

AL

US

rcB0

AL

US

rcA

Re

gW

rite

Re

gD

st

OR PlaneAND Plane

PC

So

urce

0

States that have mutliple next-states need multiple minterms

1 01

0

X

Page 19: Savio Chau Overview of Control Hardware Development Control may be designed using one of several initial representations. The choice of sequence control,

Savio Chau

Programmable Logic Array Circuit DesignOR PlaneAND Plane

1 1

0 0

10

0

1

1 0

Don’tcare

Don’tcare

on

off

on

off

selected

Page 20: Savio Chau Overview of Control Hardware Development Control may be designed using one of several initial representations. The choice of sequence control,

Savio Chau

Summary of PLA Implemention of Multi Cycle Data Path Control

Step 1: Develop the state diagram and assign a number to each state

Step 2: Translate the state diagram into state transition table, in which each entry is consisted of the current state number and transition conditions (op code) as inputs, and the next state number and control signal as outputs

Step 3: Translate the state transition table into truth table with all the bits shown explicitly

Step 4: Translate the truth table into PLA diagram. Use the following convention in this class

Step 5: Check the truth table and PLA diagram and make sure only one minterm is selected at any time (Note: some styles of PLA design allows multiple minterms selected, but it is more difficult because extreme care has to be used to make sure all output signals are correct in any state)

Truth table entry

PLA representation

1 0 X 1 0

Inputs (AND Plane) Outputs (OR Plane)

Note: Step 1 is the most important. Many modern design tools have automated the other steps

Page 21: Savio Chau Overview of Control Hardware Development Control may be designed using one of several initial representations. The choice of sequence control,

Savio Chau

Using Sequencer for Next State

• For complex control functions, it is more efficient to use a sequencer to supply the sequential next state because the it requires less number of bits than encoding the next state explicitly

Page 22: Savio Chau Overview of Control Hardware Development Control may be designed using one of several initial representations. The choice of sequence control,

Savio Chau

Sequencer-Based Control Unit

For sequential state transitions, next state is automatically increased by the counter rather than explicitly supplied by the Next State output

Ad

drC

tl

Page 23: Savio Chau Overview of Control Hardware Development Control may be designed using one of several initial representations. The choice of sequence control,

Savio Chau

Logic for Non-Sequential State Transitions

Supplying an op code to the sequencer will force the finite state machine to the first state of the instruction

Ad

drC

tl

AddrCtl Action0 Set State to 01 Use ROM 12 Use ROM 23 Increment by 1

AddrCtl

Page 24: Savio Chau Overview of Control Hardware Development Control may be designed using one of several initial representations. The choice of sequence control,

Savio Chau

Implementing Control with a ROMSince next-state address is supplied externally, a ROM can be used and needs only one word per state (“ Control word”).

In comparison, in the Explicit Next State Function approach, State 1 has 6 control words and State 2 has 2 control words.

State Number(Control Word Address)

Output Signals(Control Word 18:2)

Address Control(Control Word 1:0)

0 10010100000001000 11

1 00000000010011000 01

2 00000000000010100 10

3 00110000000010100 11

4 00110000000010110 00

5 00101000000010100 00

6 00000000001000100 11

7 00000000001000111 00

8 01000000100100100 00

9 10000001000000000 00

10 ... 11

11 ... 00

Page 25: Savio Chau Overview of Control Hardware Development Control may be designed using one of several initial representations. The choice of sequence control,

Savio Chau

Example: Micro Sequencer Operations for Load

Bits 18 - 2

Bits 1-0

State No.

Control Word Bits

18 – 2 (page C-27)

Ctrl Word Bits 1-0

0 10010100000001000 11

1 00000000010011000 01

2 00000000000010100 10

3 00110000000010100 11

4 00110000000010110 00

5 00101000000010100 00

6 00000000001000100 11

7 00000000001000111 00

8 01000000100100100 00

9 10000001000000000 00

10 ... 11

11 ... 00

0

11

100011

I Fetch

Decode

Adr Cal

Rd Mem

Wr Reg1

Page 26: Savio Chau Overview of Control Hardware Development Control may be designed using one of several initial representations. The choice of sequence control,

Savio Chau

Example: Micro Sequencer Operations for Load

Bits 18 - 2

Bits 1-0

State No.

Control Word Bits

18 – 2 (page C-27)

Ctrl Word Bits 1-0

0 10010100000001000 11

1 00000000010011000 01

2 00000000000010100 10

3 00110000000010100 11

4 00110000000010110 00

5 00101000000010100 00

6 00000000001000100 11

7 00000000001000111 00

8 01000000100100100 00

9 10000001000000000 00

10 ... 11

11 ... 00

I Fetch

Decode

Adr Cal

Rd Mem

Wr Reg

1

01

100011

2

00100011

100011

Page 27: Savio Chau Overview of Control Hardware Development Control may be designed using one of several initial representations. The choice of sequence control,

Savio Chau

Example: Micro Sequencer Operations for lw

Bits 18 - 2

Bits 1-0

State No.

Control Word Bits

18 – 2 (page C-27)

Ctrl Word Bits 1-0

0 10010100000001000 11

1 00000000010011000 01

2 00000000000010100 10

3 00110000000010100 11

4 00110000000010110 00

5 00101000000010100 00

6 00000000001000100 11

7 00000000001000111 00

8 01000000100100100 00

9 10000001000000000 00

10 ... 11

11 ... 00

I Fetch

Decode

Adr Cal

Rd Mem

Wr Reg

Bits 1-0

2

10

100011

3

00100011

100011

00100011

Page 28: Savio Chau Overview of Control Hardware Development Control may be designed using one of several initial representations. The choice of sequence control,

Savio Chau

Example: Micro Sequencer Operations for lw

Bits 18 - 2

Bits 1-0

State No.

Control Word Bits

18 – 2 (page C-27)

Ctrl Word Bits 1-0

0 10010100000001000 11

1 00000000010011000 01

2 00000000000010100 10

3 00110000000010100 11

4 00110000000010110 00

5 00101000000010100 00

6 00000000001000100 11

7 00000000001000111 00

8 01000000100100100 00

9 10000001000000000 00

10 ... 11

11 ... 00

I Fetch

Decode

Adr Cal

Rd Mem

Wr Reg

Bits 1-0Bits 1-0

3

11

100011

4

Page 29: Savio Chau Overview of Control Hardware Development Control may be designed using one of several initial representations. The choice of sequence control,

Savio Chau

Example: Micro Sequencer Operations for lw

Bits 18 - 2

Bits 1-0

State No.

Control Word Bits

18 – 2 (page C-27)

Ctrl Word Bits 1-0

0 10010100000001000 11

1 00000000010011000 01

2 00000000000010100 10

3 00110000000010100 11

4 00110000000010110 00

5 00101000000010100 00

6 00000000001000100 11

7 00000000001000111 00

8 01000000100100100 00

9 10000001000000000 00

10 ... 11

11 ... 00

I Fetch

Decode

Adr Cal

Rd Mem

Wr Reg

Bits 1-0Bits 1-0Bits 1-0

4

00

100011

0

Page 30: Savio Chau Overview of Control Hardware Development Control may be designed using one of several initial representations. The choice of sequence control,

Savio Chau

Example: Micro Sequencer Operations for lw

Bits 18 - 2

Bits 1-0

State No.

Control Word Bits

18 – 2 (page C-27)

Ctrl Word Bits 1-0

0 10010100000001000 11

1 00000000010011000 01

2 00000000000010100 10

3 00110000000010100 11

4 00110000000010110 00

5 00101000000010100 00

6 00000000001000100 11

7 00000000001000111 00

8 01000000100100100 00

9 10000001000000000 00

10 ... 11

11 ... 00

I Fetch

Decode

Adr Cal

Rd Mem

Wr Reg

Bits 1-0

0

11

100011

Page 31: Savio Chau Overview of Control Hardware Development Control may be designed using one of several initial representations. The choice of sequence control,

Savio Chau

Microprogram Implementation• ROM can be Thought of as a Sequence of Control Words

• Control Word can be Thought of as an Instruction: “Microinstruction”

• Rather Than Program in Binary, Use Symbolic Language Which Can Be Translated Into Input and Output Signals by a Microcode Assembler

• Microprogramming: A Particular Strategy for Implementing the Control Unit of a Processor by “Programming” at the Level of Register Transfer Operations

• MicroArchitecture: Logical Structure and Functional Capabilities of the Hardware as Seen by the Microprogrammer

Page 32: Savio Chau Overview of Control Hardware Development Control may be designed using one of several initial representations. The choice of sequence control,

Savio Chau

Designing a Microinstruction Set

• Start with List of Control Signals

• Group Signals Together That Make Sense: Called “Fields”

• Places Fields In Some Logical Order (ALU operation & ALU Operands First and MicroInstruction Sequencing Last)

• Create a Symbolic Legend for the Microinstruction Format, Showing Name of Field Values and How They Set the Control Signals. Example:

• To Minimize the Width, Encode Operations that Will Never be Used at the Same Time

ALU Control SRC1 SRC2 Reg Control Memory PC Write Control Sequencing

Page 33: Savio Chau Overview of Control Hardware Development Control may be designed using one of several initial representations. The choice of sequence control,

Savio Chau

Details of Microinstruction Fields

Field Name Values Signals Active Function Add ALUop=00 ALU Adds Subtract ALUop=01 ALU Subtracts

ALU Control

Func Code ALUop=10 ALU does Function Code PC ALUSrcA=0 1st ALU input = PC SRC1 A ALUSrcA=1 1st ALU Input = Reg A B ALUSrcB=00 2nd ALU Input = Reg B 4 ALUSrcB=01 2nd ALU Input = 4 Extend ALUSrcB=10 2nd ALU Input = sign ext. IR< 15: 0>

SRC2

ExtShft ALUSrcB=11 2nd ALU Input = sign ex. IR< 15: 0>, lft shft 2 bits Read No control signals A = Reg[ rs], B = Reg[ rt] Write ALU to rd RegWrite=1, RegDst=1

MentoReg = 0 Reg[ rd] = ALUOut

Write ALU to rt RegWrite=1, RegDst=0 MentoReg = 0

Reg[ rt] = ALUOut

Register Control

Write MDR RegWrite=0, RegDst=0, MentoReg = 1

Reg[ rt] = MDR

Read w. PC IorD=0, IRWrite=1 MemWrite=0

IR = Mem[ PC]

Read w. ALU IorD=1, MemWrite=0 MDR = Mem[ ALUOut]

Memory

Write w. ALU IorD=1, MemWrite=1 Mem[ ALUOut] = B ALU PCSource=01, PCWrite=1 PC = Output of ALU ALUOut - Cond PCSource=01, PCWriteCond=1 If ALU Zero Then PC = ALUOut

PC Write

Jump Addr. PCSource=10, PCWrite=1 PC = JumpAddress, PCSrc = 2 Seq AddrCtl=11 Goto Sequential Instruction Fetch AddrCtl=00 Goto the First MicroInstruction Dispatch 1 AddrCtl=01 Dispatch using ROM1

Sequencing

Dispatch 2 AddrCtl=10 Dispatch using ROM2

Page 34: Savio Chau Overview of Control Hardware Development Control may be designed using one of several initial representations. The choice of sequence control,

Savio Chau

MIPS Multicycle Microprogram for lw and sw

Label (State #)

ALU Control

Src 1 Src2 Register Control

Memory PC Write Control

Sequence

000 00 0 01 xxx 001 011 11

001 00 0 11 xxx xxx xxx 01

010 00 1 10 xxx xxx xxx 10

011 xxx xxx xxx xxx 100 xxx 11

100 xxx xxx xxx 001 xxx xxx 00

101 xxx xxx xxx xxx 110 xxx 00

Note: Usually it is safe to set all don’t cares to 0 or disabled

Label (State #)

ALU Control

Src 1 Src2 Register Control

Memory PC Write Control

Sequence

Fetch Add PC 4 Read w. PC ALU Seq

Reg/Dec Add PC ExtShift Read Dispatch1

AdrCal1 Add A Extend Dispatch2

LWMem2 Read w. ALU Seq

LwWr WriteMDR Fetch

SwMem2 xxx Write w. ALU Fetch

Page 35: Savio Chau Overview of Control Hardware Development Control may be designed using one of several initial representations. The choice of sequence control,

Savio Chau

Two Styles of Microprogramming

• Most Microprogramming- based Controllers Vary Between:– Horizontal Organization

• 1 Control Bit Per Control Point

– Vertical Organization • Grouping of Related Control Points into Encoded Fields• Need Additional Level of Decoding between the Control Word and

the Actual Control Signals

• Horizontal+ More Control Over the Potential Parallelism of Operations in

the Data-path

- Uses up Lots of Control Store

• Vertical+ Compact Microinstruction Format

+ Easier to Program, Not Very Different from Programming a RISC Machine in Assembly Language

- Extra Level of Decoding May Slow the Machine Down

Page 36: Savio Chau Overview of Control Hardware Development Control may be designed using one of several initial representations. The choice of sequence control,

Savio Chau

Microprogramming Pros and Cons

• Flexibility– Easy to Adapt to Changes in Organization, Timing, Technology

– Can make Changes Late in Design Cycle, or Even in the Field

• Can Implement Very Powerful Instruction Sets (just more control memory)

• Generality– Can Implement Multiple Instruction Sets on Same Machine (Emulation)

– Can Tailor Instruction Set to Application

• Compatibility– Many Organizations, Same Instruction Set

• Costly to Implement– Need sequencer and ROM (mostly external)

• Slow– Need to read external ROM to get microinstructions

• Microprogramming is suitable for processor designs on a circuit board, while PLA is suitable for processor designs on a chip