computer organization control unit - dr. ali r. hurson · 2018-08-30 · control unit ─hardwired...

37
Computer Organization Control Unit 1 Department of Computer Science Missouri University of Science & Technology [email protected]

Upload: others

Post on 01-Apr-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Computer Organization Control Unit - Dr. Ali R. Hurson · 2018-08-30 · Control Unit ─Hardwired State Table Method Delay Element Method Sequence Counter Programmable Logic Array

Computer OrganizationControl Unit

1

Department of Computer Science Missouri University of Science & Technology

[email protected]

Page 2: Computer Organization Control Unit - Dr. Ali R. Hurson · 2018-08-30 · Control Unit ─Hardwired State Table Method Delay Element Method Sequence Counter Programmable Logic Array

Note, this unit will be covered in threelectures. In case you finish it earlier, thenyou have the following options:

1) Take the early test and start CS3889.module62) Study the supplement module

(supplement CS3889.module5)3) Act as a helper to help other students in

studying CS3889.module5Note, options 2 and 3 have extra credits as noted in courseoutline. 2

Computer Organization

Page 3: Computer Organization Control Unit - Dr. Ali R. Hurson · 2018-08-30 · Control Unit ─Hardwired State Table Method Delay Element Method Sequence Counter Programmable Logic Array

Glossary of prerequisite topics

Familiar with the topics?No Review

CS3889.module5.background

Yes

Remedial actionYes

NoTake the Module

Take Test

Pass?

Glossary of topics

Familiar with the topics?Yes

Pass?

Take Test

Yes

Options

Lead a group of students in this module (extra credits)?

Study more advanced related topics (extra credits)?

Study next module?

No

{

Extra Curricular activities

Enforcement of background

{Current Module

At the end give a test, record the score, and impose remedial

action if not successful

No

Computer Organization

Page 4: Computer Organization Control Unit - Dr. Ali R. Hurson · 2018-08-30 · Control Unit ─Hardwired State Table Method Delay Element Method Sequence Counter Programmable Logic Array

Computer Organization

4

CU ALU

CPU

Memory Unit

Information

Input Unit Output UnitResult

Data Path

Control Path

Page 5: Computer Organization Control Unit - Dr. Ali R. Hurson · 2018-08-30 · Control Unit ─Hardwired State Table Method Delay Element Method Sequence Counter Programmable Logic Array

Computer Organization

Control UnitIn general control unit has two major

tasks:Instruction Sequencing: the way

instructions are selected.Instruction Interpretation: the way

instructions are executed.

5

Page 6: Computer Organization Control Unit - Dr. Ali R. Hurson · 2018-08-30 · Control Unit ─Hardwired State Table Method Delay Element Method Sequence Counter Programmable Logic Array

Computer Organization

Control Unit ─ Instruction Interpretation Each assembly (machine) level instruction is an orderly sequence

of µ-operations. Assembly (machine) level instructions are executed by means of

control functions (control signals). Each control function is a Boolean function which enables the

execution of a µ-operation. It is the task of control unit to generate control signals in an orderly

fashion. A control unit is the realization of control functions. It is simply a

decoder that based on an input pattern, generates a proper outputpattern, where each output signal is a control signal.

6

Page 7: Computer Organization Control Unit - Dr. Ali R. Hurson · 2018-08-30 · Control Unit ─Hardwired State Table Method Delay Element Method Sequence Counter Programmable Logic Array

Computer Organization

Control Unit ─ Simple machine

7

.

Counter

OPR

Control Unit

3 x 8 Decoder

q0

q7

...

I

2 x 4 Decoder

t3

t0

Clock2 x 4 Decoder

C3C0 C1 C2

F R

..

.

MAR ⇐PC

MBR ⇐ (M[MAR])

Control Signals

Page 8: Computer Organization Control Unit - Dr. Ali R. Hurson · 2018-08-30 · Control Unit ─Hardwired State Table Method Delay Element Method Sequence Counter Programmable Logic Array

Computer Organization

Control Unit ─ Simple machine In the simple machine, main memory has been repeatedly read in

various routine.

8

ct0

1

ct11

q

ct21

0

qt2

11

q

ct21

2

qt2

16

c

c

M B R ⇐ ( M [ M AR] )This signal initiates:

c0t0: MAR ← PCc0t1: MBR ← (M[MAR]), PC ← (PC) + 1c0t2: OPR ← (MBR(op)), I ← (MBR(I)) q'7Ic0t3: R ← 1(q7+I')c0t3: F ← 1

c1t0: MAR ← (MBR(ADDRESS))c1t1: MBR ← (M[MAR])c1t2: idlec1t3: F ← 1, R ← 0

q0c2t0: MAR ← (MBR(address))q0c2t1: MBR ← (M[MAR])q0c2t2: AC ← (AC) Λ (MBR)q0c2t3: ...

Page 9: Computer Organization Control Unit - Dr. Ali R. Hurson · 2018-08-30 · Control Unit ─Hardwired State Table Method Delay Element Method Sequence Counter Programmable Logic Array

Computer Organization

Control UnitNaturally, such an ad hoc approach is justifiable when

dealing with simple organizations. In case of complexsystems one needs to use a more systematic approach inthe design of control unit. Two approaches have beenproposed:

Hardwired: Realization of the control unit as asequential device.

µ-Programming: Realization of the control unit bymeans of programming routines.

9

Page 10: Computer Organization Control Unit - Dr. Ali R. Hurson · 2018-08-30 · Control Unit ─Hardwired State Table Method Delay Element Method Sequence Counter Programmable Logic Array

Computer Organization

Control Unit ─ HardwiredState Table MethodDelay Element MethodSequence CounterProgrammable Logic Array

10

Page 11: Computer Organization Control Unit - Dr. Ali R. Hurson · 2018-08-30 · Control Unit ─Hardwired State Table Method Delay Element Method Sequence Counter Programmable Logic Array

Computer Organization

Control Unit ─ µ-ProgrammedAs one can visualize, a hardwired control unit is a "big

decoder" which, at each moment in time, based on theinput pattern (system's status) generates a bit pattern asoutput (control signals). This bit pattern then activatesthe proper functional boxes.

A microprogrammed control unit is simply amechanism which allows to: i) Store all possible output bit patterns in a memory, and ii) Read them in an orderly fashion.

11

Page 12: Computer Organization Control Unit - Dr. Ali R. Hurson · 2018-08-30 · Control Unit ─Hardwired State Table Method Delay Element Method Sequence Counter Programmable Logic Array

Computer Organization

Control Unit ─ µ-ProgrammedSuppose we have a memory (control memory), like any

other memory organization, composed of memorywords (control word).

Further, each bit of a memory word is designated by amnemonic name which represents a specific function:

12

PC ⇐ (PC) + 1

• • •

ControlWord

MAR ⇐ PC MBR ⇐(M[MAR])

Page 13: Computer Organization Control Unit - Dr. Ali R. Hurson · 2018-08-30 · Control Unit ─Hardwired State Table Method Delay Element Method Sequence Counter Programmable Logic Array

Computer Organization

Control Unit ─ µ-Programmed

It is also assumed that we have a facility to setup the control words by different patterns:

13

1 0 0 0 0• • •

0 1 1 0 0• • •• • •

Page 14: Computer Organization Control Unit - Dr. Ali R. Hurson · 2018-08-30 · Control Unit ─Hardwired State Table Method Delay Element Method Sequence Counter Programmable Logic Array

Computer Organization

µ-Programmed Control UnitIf one has a mechanism to fetch the control

words and interpret their contents, then fetchingthe previous two memory words in properorder, generates the sequence of controlfunctions needed to perform fetch cycle.

14

Page 15: Computer Organization Control Unit - Dr. Ali R. Hurson · 2018-08-30 · Control Unit ─Hardwired State Table Method Delay Element Method Sequence Counter Programmable Logic Array

Computer Organization

µ-Programmed Control Unit ─ HardwareRequirementsControl Store to store micro instructions. This storage

could be a part of main memory or a dedicated storagemedium.

Hardware facility to fetch, decode and execute microinstructions.

Mechanism to map the operation codes (at assemblylevel) to the proper addresses in the control store.

15

Page 16: Computer Organization Control Unit - Dr. Ali R. Hurson · 2018-08-30 · Control Unit ─Hardwired State Table Method Delay Element Method Sequence Counter Programmable Logic Array

Computer Organization

µ-Programmed Control Unit ─ Flow of ControlMicro instructions are stored in groups. Each group of

micro instructions represents a macro instruction(assembly instruction). Similar to a "case statement",the operation code of a macro instruction transferscontrol to a designated collection of micro instructions.A macro instruction is fetched.The operation code is mapped into a block of the control store

which represents that macro instruction.The designated micro instructions are fetched and executed in

an orderly fashion.

16

Page 17: Computer Organization Control Unit - Dr. Ali R. Hurson · 2018-08-30 · Control Unit ─Hardwired State Table Method Delay Element Method Sequence Counter Programmable Logic Array

Computer Organization

µ-Programmed Control Unit ─ Flow ofControl

17

• • •

Main Memory

PC

Macro (assembly level) instructions

1

Fetch a Macro Inst.

2

Map macro inst. to a block

3

Fetch and execute the µ - inst.

Each block represents a sequence of µ - inst. for a macro inst.

Control Store

Page 18: Computer Organization Control Unit - Dr. Ali R. Hurson · 2018-08-30 · Control Unit ─Hardwired State Table Method Delay Element Method Sequence Counter Programmable Logic Array

Computer Organization

µ-Programmed Control Unit

18

Macro Inst.

Mapping Process

Control Address Register Return Address Reg. or Stack

Control Memory

Branch Logic

Micro operations

Status bits

Increment

Page 19: Computer Organization Control Unit - Dr. Ali R. Hurson · 2018-08-30 · Control Unit ─Hardwired State Table Method Delay Element Method Sequence Counter Programmable Logic Array

Computer Organization

µ-Programmed Control Unit ─ µ-InstructionFormatA µ-instruction (in general) is composed to two parts:

control field and address field.Control field is used to activate functional units.Address field is used to fetch µ-instructions in an orderly fashion.

However, similar to the concept of the program counter, the addressfield can be eliminated at the expense of a register called microprogram counter.

In some cases control words have additional field(s) calledEmit-Field(s) - say to initialize a register.

19

Page 20: Computer Organization Control Unit - Dr. Ali R. Hurson · 2018-08-30 · Control Unit ─Hardwired State Table Method Delay Element Method Sequence Counter Programmable Logic Array

Computer Organization

QuestionsCompare and contrast µ-programmed and

hardwired control units against each other.How can we reduce the length of the µ-

instructions?Discuss the factors that could effect the length

of the µ-instructions.

20

Page 21: Computer Organization Control Unit - Dr. Ali R. Hurson · 2018-08-30 · Control Unit ─Hardwired State Table Method Delay Element Method Sequence Counter Programmable Logic Array

Computer Organization

µ-Programmed Control Unit ─ µ-Instruction FormatBased on the degree of parallelism and

representation of µ-operations, µ-instructionscan be classified into three groups:HorizontalVerticalDiagonal

21

Page 22: Computer Organization Control Unit - Dr. Ali R. Hurson · 2018-08-30 · Control Unit ─Hardwired State Table Method Delay Element Method Sequence Counter Programmable Logic Array

Computer Organization

µ-Programmed Control Unit ─ µ-Instruction Format Horizontal: each bit of the control part represents a distinct µ-operation.

A horizontal µ-instruction is characterized by: Long format. Ability to express a high degree of parallelism. Little encoding of the control information.

Vertical: control part represents just one µ-operation. A vertical format ischaracterized by: Short format No degree of parallelism Considerable encoding of the control information

Diagonal: it is a compromise between horizontal and vertical formats. Itis characterized by: Moderate length format Some degree of parallelism Some encoding of the control information

22

Page 23: Computer Organization Control Unit - Dr. Ali R. Hurson · 2018-08-30 · Control Unit ─Hardwired State Table Method Delay Element Method Sequence Counter Programmable Logic Array

Computer Organization

µ-Programmed Control Unit ─ An Example

The computer configuration is as follows:

23

Main Memory

2k * 16

MBR

AC

1 16

1 16

SBR1 7

CAR1 7

Control Store

128 * 20

MAR

PC1 11

1 11

Page 24: Computer Organization Control Unit - Dr. Ali R. Hurson · 2018-08-30 · Control Unit ─Hardwired State Table Method Delay Element Method Sequence Counter Programmable Logic Array

Computer Organization

µ-Programmed Control Unit ─ An Example

Macro Instruction Format

24

1 2 5 6 16

Mode BitOp-Code

Operand

Page 25: Computer Organization Control Unit - Dr. Ali R. Hurson · 2018-08-30 · Control Unit ─Hardwired State Table Method Delay Element Method Sequence Counter Programmable Logic Array

Computer Organization

µ-Programmed Control Unit ─ An Example

Sixteen possible instructions, such asADD 0000 AC⇐ (AC)+(M)BRANCH 0001 if AC<0 then PC ⇐ effective addressSTORE 0010 M ⇐ (AC)

25

Page 26: Computer Organization Control Unit - Dr. Ali R. Hurson · 2018-08-30 · Control Unit ─Hardwired State Table Method Delay Element Method Sequence Counter Programmable Logic Array

Computer Organization

µ-Programmed Control Unit ─ An Exampleµ-Instruction Format

F1, F2, and F3 fields are the control part. Having F1, F2,and F3 as part of control part implies some degree ofparallelism. 000 100 101 implies 2 micro operationsF1 = 000 ⇒ no operationF2 = 100 ⇒ MBR ⇐ (M[MAR])F3 = 101 ⇒ PC ⇐ (PC) + 1CD, BR and ADF fields collectively represent a (conditional)

transfer control.26

F1 F2 F2 CD BR ADF3 3 3 2 2 7

Page 27: Computer Organization Control Unit - Dr. Ali R. Hurson · 2018-08-30 · Control Unit ─Hardwired State Table Method Delay Element Method Sequence Counter Programmable Logic Array

Computer Organization

µ-Programmed Control Unit ─ An Example

CD is 2-bits long and defines status conditions:

CD Condition

00 U unconditional 101 I Indirect mode bit MBR(I)10 S Sign of AC AC(S)11 Z Zero value in AC AC = 0

27

Page 28: Computer Organization Control Unit - Dr. Ali R. Hurson · 2018-08-30 · Control Unit ─Hardwired State Table Method Delay Element Method Sequence Counter Programmable Logic Array

Computer Organizationµ-Programmed Control Unit ─ An ExampleBR is 2-bits long and defines different types of branches:

ADF is 7-bits long and represents the address field.

BR

00 JMP CAR ⇐ (ADF) if condition is trueCAR ⇐ (CAR)+1 otherwise

01 CALL CAR⇐ (ADF), SBR⇐ (CAR)+1 if condition is trueCAR ⇐ (CAR)+1 otherwise

10 RET CAR ⇐ (SBR)

11 MAP CAR(2-5) ⇐ (MBR(Op-Code)), CAR(1,6,7) ⇐ 0

28

Page 29: Computer Organization Control Unit - Dr. Ali R. Hurson · 2018-08-30 · Control Unit ─Hardwired State Table Method Delay Element Method Sequence Counter Programmable Logic Array

Computer Organization

µ-Programmed Control Unit ─ An ExampleSimilar to the assembly instructions, a symbolic

notation can be used to represent each µ-instruction.In our system, each µ-instruction is composed of six

elements:A label followed by semi-colonsµ-op-codes separated by commasCD fields (U, I, S, Z)BR field (JMP, CALL, RET, MAP)ADF field (a label, NEXT, or blank)Comments

29

Page 30: Computer Organization Control Unit - Dr. Ali R. Hurson · 2018-08-30 · Control Unit ─Hardwired State Table Method Delay Element Method Sequence Counter Programmable Logic Array

Computer Organization

µ-Programmed Control Unit ─ An ExampleFETCH CycleThe first 64 words in the control store represent the

micro instructions for 16 macro instructions. For eachmacro instruction, a block of four µ-instruct-ions isdesignated. Therefore, the micro code to represent theinstruction fetch cycle is stored somewhere in the highorder half part of the control store.

FETCH: PCTAR U JMP NEXTREAD, INCPC U JMP NEXT

BRTAR U MAP

30

Page 31: Computer Organization Control Unit - Dr. Ali R. Hurson · 2018-08-30 · Control Unit ─Hardwired State Table Method Delay Element Method Sequence Counter Programmable Logic Array

Computer Organization

µ-Programmed Control Unit ─ AnExampleADD

ADD: NOP I CALL INDRCTREAD U JMP NEXTADD U JMP FETCH

BRANCHBRANCH: NOP S JMP OVER

NOP U JMP FETCHOVER: NOP I CALL INDRCT

BRTPC U JMP FETCH

31

Page 32: Computer Organization Control Unit - Dr. Ali R. Hurson · 2018-08-30 · Control Unit ─Hardwired State Table Method Delay Element Method Sequence Counter Programmable Logic Array

Computer Organization

µ-Programmed Control Unit ─ AnExample

STORESTORE: NOP I CALL INDRCT

ACTBR U JMP NEXTWRITE U JMP FETCH

Indirect CycleINDRCT: READ U JMP NEXT

BRTAR U RET32

Page 33: Computer Organization Control Unit - Dr. Ali R. Hurson · 2018-08-30 · Control Unit ─Hardwired State Table Method Delay Element Method Sequence Counter Programmable Logic Array

Computer Organization

µ-Programmed Control Unit ─ Microprocessor Sequencer

It is a unit which allows to fetch the µ-instructions in anorderly fashion.

33

L

Switch Logic

MUX.1 I S Z

S0

S1

3 2 1 0

Map External

CAR

Control Memory

T

I1I0

Increment

SBR

L

µ-codes CD BR ADF

Macro Inst.

Mapping Process

Control Address Register Return Address Reg. or Stack

Control Memory

Branch Logic

Micro operations

Status bits

Increment

Page 34: Computer Organization Control Unit - Dr. Ali R. Hurson · 2018-08-30 · Control Unit ─Hardwired State Table Method Delay Element Method Sequence Counter Programmable Logic Array

Computer Organization

µ-Programmed Control Unit ─ MicroprocessorSequencer

34

BR I0 I1T S0 S1 L

JMP 00 0 0 0 0 0 0JMP 00 0 0 1 1 0 0CALL 01 0 1 0 0 0 0CALL 01 0 1 1 1 0 1RET 10 1 0 X 0 1 0MAP 11 1 1 X 1 1 0

S0 = I 0I 1T+I 0I 1T+I 0I 1 = I 0T( I 1+I 1)+ I 0I 1 = I 0T+I 0I 1

S1 = I 0I 1+I 0I 1 = I 0( I 1+I 1)=I 0

L = I 0I 1T

Page 35: Computer Organization Control Unit - Dr. Ali R. Hurson · 2018-08-30 · Control Unit ─Hardwired State Table Method Delay Element Method Sequence Counter Programmable Logic Array

Computer Organization

Control Unit Control unit: A computer module with two major tasks:

instruction sequencing and instruction interpretation. Instruction sequencing: The way instructions are selected. Instruction Interpretation: The way instructions are executed. Hardwired control unit: A way to design the control unit, in which

the control signals are generated by random logic.

35

Page 36: Computer Organization Control Unit - Dr. Ali R. Hurson · 2018-08-30 · Control Unit ─Hardwired State Table Method Delay Element Method Sequence Counter Programmable Logic Array

Computer Organization

Control UnitMicro programming: A way to design the control unit,

in which the control signals are generated by readingthem from the control store.

State table method: A hardwired technique for thedesign of control unit.

Delay elements method : A hardwired technique for thedesign of control unit.

Sequence counter method: A hardwired technique forthe design of control unit.

Programmable logic array: A hardwired technique forthe design of control unit.

36

Page 37: Computer Organization Control Unit - Dr. Ali R. Hurson · 2018-08-30 · Control Unit ─Hardwired State Table Method Delay Element Method Sequence Counter Programmable Logic Array

Computer Organization

QuestionsIn a general purpose computer, what are the major tasks

of a control unit?Based on our earlier discussion about the simple

machine, there are missing input signals to the controlunit diagram of the simple machine. What are they?

What is a correct answer? Control unit: Is a decoder which interprets the status of the computer at each

moment of time. Is a black box which generates control signals in an orderly

fashion. Initiates the execution of micro operations.None of the above.

37