micro programmed control

16
Microprogrammed Control

Upload: suganrhithu9389

Post on 16-Jul-2016

213 views

Category:

Documents


0 download

DESCRIPTION

Micro Programmed Control

TRANSCRIPT

Page 1: Micro Programmed Control

Microprogrammed Control

Page 2: Micro Programmed Control

MICROPROGRAMMED CONTROL

Here control signals are created & controlled by a program. Some Terminology: 1.Control word:

A word whose individual bit represents the various control signals. PCout PCin READYin select

eg: 0 1 1 0 1 2.Microroutine:

A sequence of control words corresponding to the control sequence of a machine instruction constitutes the micro routine for that instruction.

Page 3: Micro Programmed Control

PCin

PCou

t

MA

Rin

Rea

d

MD

R out

IRin

Yin

Sele

ct

Add Z in

Zou

t

R1 ou

t

R1 i

n

R3 o

ut

WM

FC

End

01

0

00

0

0

00

0

00

0

1

10

0

00

0

0

10

0

10

0

0

10

0

10

0

0

00

1

00

1

0

00

1

00

0

0

01

0

01

0

0

10

0

00

0

0

10

0

00

1

0

10

0

00

1

0

01

0

00

0

1

00

0

01

0

0

00

0

00

0

1

00

0

10

0

0

01

0

01

0

0

Micro -instruction

12

3

45

6

7

Figure 7.15 An example of microinstructions for Figure 7.6.

3.Microinstruction: Individuals control words in the micro routines.

4. Control store:A special memory that stores the microinstructions for all

instructions in the instruction set of a computer.

Page 4: Micro Programmed Control

5.Micro programcounter:A special register that holds the address of the next micro instruction to be executedEvery time a new

instruction is loaded into the IR, starting address generator loads µPC.

The µPC is then automatically incremented by the clock, causing successive microinstructions to be read from the control store

One functioncannot be carriedout by this simpleorganization.

Basic organization of a microprogrammed control unit.

storeControl

generator

Startingaddress

CW

Clock mPC

IR

Page 5: Micro Programmed Control

OverviewStep Action

1 PCout, MAR in , Read,Select4,Add, Zin

2 Zout, PC in , Y in , WMF C3 MDRout, IR in

4 R3out , MAR in , Read5 R1out , Y in , WMF C6 MDRout, SelectY,Add, Zin

7 Zout, R1in , End

Figure7.6. Control sequenceforexecutionof theinstructionAdd (R3),R1.

Page 6: Micro Programmed Control

Microroutine For Branch InstructionThe previous organization cannot handle the

situation when the control unit is required to check the status of the condition codes or external inputs to choose between alternative courses of action.

Use conditional branch microinstruction.

Address Microinstruction

0 PCout , MAR in , Read,Select4,Add, Zin

1 Zout , PCin , Yin , WMFC2 MDRout , IRin3 Branchtostartingaddressofappropriatemicroroutine. ... .. ... ... .. ... .. ... ... .. ... ... .. ... .. ... ... .. ... .. ... ... .. ... ..25 If N=0, thenbranchtomicroinstruction026 Offset-field-of-IRout , SelectY,Add, Zin27 Zout , PCin , End

Figure 7.17. Microroutine for the instruction Branch<0.

Page 7: Micro Programmed Control

Microroutine For Branch InstructionA separate micro routine (procedure) is written to check the condition

code register and status flags.Whenever branch is to be performed, control can be transferred to the

microroutine. The conditions are checked and the branch address is computed

The instruction, Branch<0 may now be implemented by a microroutine.After loading the instruction into IR(step 1,2,3), a branch

microinstruction(step 3) transfers control to the corresponding microroutine, at location 25 & it is output of starting address generator.

The microinstruction at location 25 tests N bit of the condition codes. If this bit is equal to 0 a branch takes place to location 0 to fetch a new

machine instruction.Otherwise, the microinstruction at location 26 is executed to put the

branch target address into register ZMicroinstruction at 27 load this address into the PC

Page 8: Micro Programmed Control

Overview

Figure 7.18. Organization of the control unit to allowconditional branching in the microprogram.

Controlstore

Clock

generator

Starting andbranch address Condition

codes

inputsExternal

CW

IR

mPC

Page 9: Micro Programmed Control

MicroinstructionsA straightforward way to structure

microinstructions is to assign one bit position to each control signal.

However, this is very inefficient.The length can be reduced: most signals are

not needed simultaneously, and many signals are mutually exclusive.

All mutually exclusive signals are placed in the same group in binary coding.

Page 10: Micro Programmed Control

Partial Format for the MicroinstructionsF2 (3 bits)

000: No transfer001: PCin010: IRin011: Z in100: R0in101: R1in110: R2 in111: R3 in

F1 F2 F3 F4 F5

F1 (4 bits) F3 (3 bits) F4 (4 bits) F5 (2 bits)

0000: No transfer0001: PCout0010: MDRout0011: Zout0100: R0out0101: R1out0110: R2out0111: R3out1010: TEMPout1011: Offsetout

000: No transfer001: MARin010: MDRin011: TEMPin100: Y in

0000: Add0001: Sub

1111: XOR

16 ALUfunctions

00: No action01: Read10: Write

F6 F7 F8

F6 (1 bit) F7 (1 bit) F8 (1 bit)

0: SelectY1: Select4

0: No action1: WMFC

0: Continue1: End

Figure 7.19. An example of a partial format for field-encoded microinstructions.

Microinstruction

What is the price paid for this scheme?

Page 11: Micro Programmed Control

Further ImprovementEnumerate the patterns of required signals in

all possible microinstructions. Each meaningful combination of active control signals can then be assigned a distinct code.

Vertical organizationHorizontal organization

Page 12: Micro Programmed Control

Microprogram SequencingIf all microprograms require only straightforward

sequential execution of microinstructions except for branches, letting a μPC governs the sequencing would be efficient.

However, two disadvantages: Having a separate microroutine for each machine instruction

results in a large total number of microinstructions and a large control store.

Longer execution time because it takes more time to carry out the required branches.

Example: Add src, RdstFour addressing modes: register, autoincrement,

autodecrement, and indexed (with indirect forms).

Page 13: Micro Programmed Control

Microinstructions with Next-Address FieldThe microprogram we discussed requires

several branch microinstructions, which perform no useful operation in the datapath.

A powerful alternative approach is to include an address field as a part of every microinstruction to indicate the location of the next microinstruction to be fetched.

Pros: separate branch microinstructions are virtually eliminated; few limitations in assigning addresses to microinstructions.

Cons: additional bits for the address field (around 1/6)

Page 14: Micro Programmed Control

Microinstructions with Next-Address Field

Figure 7.22. Microinstruction-sequencing organization.

Control signals

Conditioncodes

IR

Decoding circuits

Control store

Next address

Microinstruction decoder

InputsExternal

mAR

mI R

Page 15: Micro Programmed Control

F1 (3 bits)

000: No transfer001: PCout010: MDRout011: Zout100: Rsrcout101: Rdstout110: TEMP out

F0 F1 F2 F3

F0 (8 bits) F2 (3 bits) F3 (3 bits)

000: No transfer001: PCin010: IRin011: Z in100: Rsrcin

000: No transfer001: MARin

F4 F5 F6 F7

F5 (2 bits)F4 (4 bits) F6 (1 bit)

0000: Add0001: Sub

0: SelectY1: Select4

00: No action01: Read

Microinstruction

Address of nextmicroinstruction

101: Rdstin

010: MDRin011: TEMPin100: Y in

1111: XOR

10: Write

F8 F9 F10

F8 (1 bit)

F7 (1 bit)

F9 (1 bit) F10 (1 bit)

0: No action1: WMFC

0: No action1: ORindsrc

0: No action1: ORmode

0: NextAdrs1: InstDec

Figure 7.23. Format for microinstructions in the example of Section 7.5.3.

Page 16: Micro Programmed Control

Implementation of the Microroutine

(See Figure 7.23 for encoded signals.)Figure 7.24. Implementation of the microroutine of Figure 7.21 using a

1

01

111100111110

001

001

121 0

000

000

00

00

00

00

00 0

0000

0 00101

11037

700000000

0 1111110

000

1707

F9

0

00

00

0

F10

0

00

00

0

00

0

00

00

0

F8F7F6F5F4

000 0 0 0 0 0

0

0

00

0

100

0

00

0

00

0

00

0 1

1

0

00 0

1

0

0

0

10000

00001100000

100

0

0

0

0

01

0 0

00

0

00

00 01

000000

001110

10010

F2

1

110 0 0 0 0 0

11

221

011110

111 001

12

0

21

000

addressOctal

111 00000

1 000000010000000

F0 F1

0

0 0 10 0

010010

0 11001

110100

0

0

0

1

10

1

F3

next-microinstruction address field.

011000 0 0 0 0 00 00 00000 0 0 0 0 030 0 00 0 0