0% found this document useful (0 votes)
13 views93 pages

Chapter 4 - Processor - p3

The document provides an overview of the Control Unit (CU) in a CPU, detailing its functions such as sequencing and execution, and the components involved like the Instruction Register and Program Counter. It discusses the two types of control units: microprogrammed and hardwired, highlighting their characteristics, advantages, and disadvantages. Additionally, it explains the structure and implementation of microinstructions, including encoding types and their impact on control word width.

Uploaded by

Alaa Awaysa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views93 pages

Chapter 4 - Processor - p3

The document provides an overview of the Control Unit (CU) in a CPU, detailing its functions such as sequencing and execution, and the components involved like the Instruction Register and Program Counter. It discusses the two types of control units: microprogrammed and hardwired, highlighting their characteristics, advantages, and disadvantages. Additionally, it explains the structure and implementation of microinstructions, including encoding types and their impact on control word width.

Uploaded by

Alaa Awaysa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 93

The control path

”The Control Unit“


The functioning of the
Control Unit
• the control unit is in charge of
coordinating and synchronizing
activities inside the CPU and also with
the other subsystems of the computer.
• A set of control signals activates the
micro-operations which have to be
executed in a given control step.
• Each control step corresponds to one
timing state in the CPU.
The functioning of the
Control Unit
• Thus the control unit performs two tasks:
– Sequencing
• Causing the CPU to step through a series of
micro-operations
– Execution
Processor Clock
• The clock drives the Control unit and
synchronizes the micro-operations.
• The control unit issues one or more micro-
operations per clock cycle.
• More micro-operations per clock is feasible in a
control step subject to
– the pipelining and parallelism in the architecture
When that the micro-operations don’t conflict with
resource usage in that control step.
• (for example, only one of them is allowed to output on the bus)
External Control bus
• The external sub-system status is
communicated to the CPU over the
Control Bus.
• Signals like Interrupts from IO
Subsystem indicate the attention
required from CPU.
External Control bus
• During Memory Read
– the memory is required to indicate that Read
Data is available on the Data Bus.
– This is a kind of acknowledgement or sync from
memory is triggerred on the external control bus.
• Similarly, Interrupt Acknowledgement (IACK)
is issued by CPU to the subsystem that has
raised the Interrupt as part of the service
routine.
• There are few other signals like these.
The following figure pictorially represents a model control unit with
inputs and outputs

Model of a Control Unit


The control unit (CU)
• The design of a control unit can vary
depending on the architecture and
technology used, but it typically includes
these components:
The control unit (CU)
– Instruction Register (IR)
• stores the instruction currently being executed.
– Program Counter (PC)
• keeps track of the memory address of the next instruction to be
executed.
– Register File
• holds the values of the computer's general-purpose registers.
– Memory Buffer Register (MBR)
• holds the data being transferred to or from memory.
The control unit (CU)
– Decoder
• translates the binary instruction into a set of control
signals for the rest of the CPU.
– ALU Control Unit
• controls the operation of the Arithmetic Logic Unit (ALU)
that performs mathematical and logical operations.
– Control Unit Logic
• implements the decision-making process for
determining what operation should be performed next.
Control Unit 5.5
• A sequence of steps t0, t1, t2, … (t0 < t1 < t2 <…)
– are used to execute a certain instruction.
Control Unit
• All timing states need not be of the
same duration.
• For example,
– a memory read cycle
• is longer than CPU internal operations and
• depends on the memory characteristics and
bus availability.
– In such a case the Timing state gets
extended in multiples of the CPU clock until
the memory is done with read/write.
Control Unit
• The op-code field of a fetched instruction is
decoded to
– provide the control signal generator
• with information about the instruction to be executed.
• Step information generated by a logic circuit
module is
– used with other inputs to generate control signals.
• The signal generator can be specified simply by
– a set of Boolean equations for its output in terms of its
inputs.
Typical Control Unit Implementation

Control signal generator


The Control Unit
Example 1:
let us revisit the add operation in which we
add the contents of source registers R1, R2,
and stores the results in destination register
R0.
The operation can be done in one step using
three-bus organization.
Control Unit 5.5
Control Unit Design
Control Unit Design
• There are mainly two different types of
control units:
– Microprogrammed
• The control signals associated with operations are
stored in special memory unit as control words
– (inaccessible by the programmer.)
– Hardwired
• Fixed logic circuits that correspond directly to the
Boolean expressions, which are used to
– generate the control signals.
Hardwired Control Unit
Hardwired Control Unit
• is implemented using Combinational
Logic which includes Logic Gates,
Decoders, Encoders, and Counters.
• Very interesting that these simple
circuits can rule the CPU!!
Hardwired Control Unit
• Remember !!!
– Each instruction has a defined set of
machine cycles and each machine cycle
has a set of defined micor-steps primarily
based on the instruction.
– The micro-steps are numbered as T0,T1,
T2,..Tn-1.
– These numbers are to be reset at the end
of each machine cycle to clear the way for
the start of a next machine cycle.
Hardwired Implementation
• For each control line (control signal),
– one must find the Boolean expression in
terms of the input to the control signal
generator.
Hardwired Implementation
Hardwired Control Unit
• Just for your imagination
• Assume, a hypothetical (theoritical) CPU
– has 32 instructions, each instruction has 4
machine cycles and each machine cycle has 4
timing states to execute (assume for simplicity
that each timing state includes only one micro-
operation).
– The number of control signals we can visualize
are 32x4x4=256.
– We need to add interrupt, trap servicing cycles,
etc.
Hardwired Control Unit
• In reality,
– a CPU has 400+ instructions, 5 to 8
machine cycles and 4 to 8 timing states
for each machine cycle for each
instruction (on average).
– Not only the designer is expected to be
knowledgeable (‫ة‬LL‫)على دراي‬but also very
disciplined (‫)منضبط‬.
Hardwired Control Unit
• Similarly,
– the next step in the sequence needs to
be created and triggered.
– The next step could be
• a micro-step timing state,
• machine cycle or
• new instruction cycle.
– This is another complex logic.
Characteristics of
Hardwired Control Unit
• Hardwired Control Unit provides the
highest speed of execution
• Complex sequencing & micro-
operation logic.
• Difficult to design and test
• Inflexible design
• Difficult to add new instructions
Characteristics of
Hardwired Control Unit
• RISCs are implemented with
hardwired control unit.
– RISCs are said to be one instruction per
clock cycle machines.
– Three-bus CPU structures,
– Register to Register operations
Hardwired control unit make it a
reality.
Characteristics of
Hardwired Control Unit
• When the instructions set becomes
complex like CISCs,
– The Hardwired Control Unit is
impracticable.
Microprogrammed
Control Unit
Microprogrammed
Control Unit
• Microprogramming was motivated by
– the desire to reduce the complexities involved with
hardwired control.
• Much of the difficulty of designing and
implementing hardwired control units
arises from the need to optimize the next
state generation logic.
• If we could use memory to hold the state
transition table for the control unit,
– we wouldn’t have to bother about optimizing
any logic.
Microprogrammed
Control Unit
• Alternatively, look for a memory-based
control unit design, wherein the contents of
a Control Memory location, when decoded,
become the control signals for the current
state.
• The current state is used as an "address" to
access the Control Memory.
• The next state information for each state is
also stored in the Control Memory Word.
Microprogrammed
Control Unit
• Thus Microprogrammed Control Unit
is an alternative to Hardwired Control
Unit implementation.
• The following figure defines the
components of a typical
Microprogrammed Control Unit.
Microprogrammed Control Unit
Microprogrammed
Control Unit
• A microprogrammed control unit is
implemented like another CPU
inside a CPU.
• It executes microprograms stored in
the Control Store.
• Before we proceed, let us see some
vocabulary related to
Microprogrammed Control Unit.
Microprogrammed
Control Unit
Control Store (Control Memory):
– A RAM or ROM that holds the truth table
for a microprogrammed control system.
– The Control Store stores the
Microprogram;
– called Firmware or Microprogram
Memory.
Microprogrammed
Control Unit
Control word (CW): 1/2
•The contents of a single location in
the Control Memory.
•Practically represents the set of
control signals of the current state;
•theoretically, each bit in a CW
corresponds to one control signal (in
case of horizontal implementation).
Microprogrammed
Control Unit
Control word (CW): 2/2
•Control Word contains 1’s and 0’s
corresponding to the active and
nonactive control signals.
•One CW corresponds to one Microstep
(Timing state) in the execution.
•A CW is also referred to as a
Microinstruction.
Microprogrammed
Control Unit
Micro program / Microcode/Micro
routine:
•Microprogram for the CPU control unit is
– A set of Micro Routines.
•A Microcode or Micro Routine corresponds
to a machine instruction or machine cycle.
•Every Micro Routine ends with an END
statement to indicate the end of the
machine cycle.
Typical Microcode structure in a Control Store for a CPU
MicroInstruction Format
• A MicroInstruction specifies the control
signals required in a particular timing
state.
• It is the content of a location in the
Control Store.
• It has two parts:
1. a set of control fields that specify the control
signals to be activated.
2. an address field that contains the address of
the next microinstruction to be executed.
Address field
• This explicit address specification
has the advantage that no time is
lost in Micro Instruction address
generation,
– but is wasteful of Control Memory space.
• The address fields can be eliminated
from most of the instructions but not
for branch instructions.
Address field
• An alternative way of generating
address is by
– using a Micro Program Counter.
• Further, the encoding of the control
fields reduces the width of the
control word (in case of vertical
implementation).
Micro-instruction Implementation
• Microinstruction width i.e the number
of bits. It is decided by considering
the following factors:
– Maximum number of simultaneous
micro-operations that must be carried
out in a timing state
– How the Control field information is
encoded or represented
– The way microinstruction address is
specified in the next address field
Micro-instruction Implementation
• The microinstruction format is broadly
classified as
– horizontal and vertical types
based on the capability to accommodate
encoding.
• The encoding possibilities are
diagrammatically detailed in the
following figure.
Control Word Encoding types

Vertical

Horizontal
Micro-instruction Implementation
• By now, it is clear that more the
encoding, the less is the width of the
Control Word.
• Thus
– Vertical formats require less width for
Control Word.
• while
– the horizontal format with least encoding
demands larger width for Control Word.
Horizontal versus Vertical Microinstruction

• Horizontal Microinstructions
– Individual bits in horizontal microinstructions
correspond to
• individual control lines.
– Horizontal microinstructions are
• long and
• allow maximum parallelism
since each bit controls a single control line.
Horizontal versus Vertical Microinstruction

• Vertical Microinstructions
– control lines are
• coded into specific fields within a microinstruction.
– Decoders are needed to map a field of k bits to 2k
possible combinations of control lines.
Horizontal versus Vertical Microinstruction

• Difference:
– Because of the encoding,
• vertical microinstructions are much shorter than
horizontal ones.
– Control lines encoded in the same field cannot be
activated simultaneously when using vertical
microinstructions. Therefore,
• vertical microinstructions allow only limited parallelism.
Add Sub Mu Di & | SR SL

1 0 0 0 0 0 0 0

R0 R1 R2 .. R14 R15 PC IR MAR MDR

0 1 0 0 0 0 0 0 0 0

R0 R1 R2 .. R14 R15
0 0 1 0 0 0

R0 R1 R2 .. R14 R15 PC IR MAR MDR

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

0 0 0 0 1

0 0 0 1 0

0 0 0 0 0
Example 3
• Refer to the previous example but now
suppose two bus data path.
• Write the format of the microinstruction if
– Horizontal implementation
– Vertical implementation
Is used.
! Horizontal
• Source 1: 16 GPRS+4 SPRS+A
• Source 2: 16 GPRS
• Destination:16 GPRS+4 SPRS+A
• ALU functions: 8 functions
Add Sub Mu Di & | SR SL

1 0 0 0 0 0 0 0

R0 R1 R2 R3 … R14 R15 A PC IP MA MD
R R
0 1 0 0 0 0 0 0 0 0 0 0

R0 R1 R2 R3 … R14 R15
0 0 1 0 0 0 0

R0 R1 R2 R3 … R14 R15 A PC IP MA MD
R R
0 0 0 0 0 0 0 1 0 0 0 0
Add Sub Mu Di & | SR SL

0 0 0 0 0 0 0 0

R0 R1 R2 R3 … R14 R15 A PC IP MA MD
R R
0 0 0 0 0 0 0 1 0 0 0 0

R0 R1 R2 R3 … R14 R15
0 0 0 0 0 0 0

R0 R1 R2 R3 … R14 R15 A PC IP MA MD
R R
1 0 0 0 0 0 0 0 0 0 0 0
! VERTICAL
• ALU FUNCTION: 8+none 4 bits
• SOURCE 1: 16+4+A= none 5 bits
• SOURCE 2: 16+ none  5 bits
• DESTINATION:16+4+A+none  5 bits
FUN CODE S1 D CODE D CODE
NONE 0000 R0 R0 00000 R0 00000
ADD 0001 R1 R1 00001 R1 00001
SUB 0010 R2 R2 00010 R2 00010
… … R3 R3 00011 R3 00011
… … … …. ….
R14 R14 01110 R14 01110
R15 R15 01111 R15 01111
A A 10000 NONE 10000
PC PC 10001
IR IR 10010
MAR MAR 10011
MDR MDR 10100
NONE NONE 10101
0 0 0 1

0 0 0 0 1

0 0 0 1 0

1 0 0 0 0
0 0 0 0

1 0 0 0 0

1 0 0 0 0

0 0 0 0 0
hw
• Submit the following hw due to next
Sunday 20-10 (written by hands).
Merits and Demerits
of
Microprogrammed Control Units
Merits of Microprogrammed
Control Units
• Easy to design, write and modify
• Design architecture and microcode
can be done in parallel
• Bugs in the control logic can usually
be fixed by changing the contents of
the RAM/ROM
• Can make use of internal registers
more effectively
Demerits of Microprogrammed
Control Units
• Speed is often slower than the
computation in hardwired logic
• Parallelism in machine cycle is
restricted
• When State Space goes off, it
demands very large Control Store;
– When memory is costly, this becomes a
serious limitation.
Demerits of Microprogrammed
Control Units
• ISAs with very complex instructions
benefit more from the
Microprogrammed Control Unit.
• However, Microprogramming is out of
favors when the entire Processor Chip is
fabricated at one time, including
Control Unit.
– In this scenario,
• the ability to do bug fixing by changing the
Control Store is a less useful feature.
Nano programming
• Nano means smaller than Micro.
• Instead of a microprogram decode
– another level of control memory is used
for decoding and generating control
signals.
• This second-level control store is
called Nano control memory
• This method of generating control
signals is called Nano Programming.
Nano programming
• Nano control memory controls the hardware
and contains nano instructions.
• The objective of nano programming is
– to reduce the total size of control memory
– have design flexibility in generating control
signals.
• The design flexibility results from
– the relaxation of the words between instructions
and Hardware with two intermediate levels of
control store rather than one.
Nano programming
• The disadvantages of nano
programming are:
– the two-level approach causes loss of
speed due to extra memory access
– more complex control unit organization
Dynamic Programming
• Dynamic Programming is another
microprogramming technique
implemented in a WCM (Writable
Control Memory).
• It allows a systems programmer to
dynamically change a processor’s
instruction set by changing
microprogram that interprets the
instruction set.
Dynamic Programming
• In principle, provide the same
machine with multiple instruction
set, tailored to special applications.
• Since the Control Memory contents
are altered under program control,
the name dynamic programming.
• Set-Top boxes used with television is
a practical application and a good
example.

You might also like