Chapter 5 - CO - BIM - III PDF
Chapter 5 - CO - BIM - III PDF
Chapter 5
Microprogrammed Control
The function of the control unit in a digital computer is to initiate sequences of microoperations. The number of
different types of rnicrooperations that are available in a given system is finite. The complexity of the digital
system is derived from the number of sequences of microoperations that are performed. When the control
signals are generated by hardware using conventional logic design techniques, the control unit is said to be
hardwired. Microprogramming is a second alternative for designing the control unit of a digital computer. The
principle of microprogramming is an elegant and systematic method for controlling the microoperation
sequences in a digital computer.
A computer that employs a microprogrammed control unit will have two separate memories: a main memory
and a control memory.
Control word: It is a string of control variables (0’s and 1’s) occupying a word in control memory.
Microprogram
Program stored in control memory that generates all the control signals required to execute the instruction
set correctly
Consists of microinstructions
Microinstruction
Contains a control word and a sequencing word
Control Word – contains all the control information required for one clock cycle
Sequencing Word - Contains information needed to decide the next microinstruction address
Microoperation
A microinstruction contains one or more microoperations to be completed.
Dynamic Microprogramming
Computer system whose control unit is implemented with a microprogram in WCS.
Microprogram can be changed by a systems programmer or a user.
Sequencer: The device or program that generates address of next microinstruction to be executed is called
sequencer. While the microoperations are being executed, the next address is computed in the next address
generator circuit and then transferred into the control address register to read the next microinstruction.
The location of the next microinstruction may be the one next in sequence, or it may be located somewhere else
in the control memory. Typical functions of a microprogram sequencer are incrementing the control address
register by one, loading into the control address register an address from control memory, transferring an
external address, or loading an initial address to start the control operations.
Control Data Register: CDR contains microinstruction read from memory. The microinstruction contains a
control word that specifies one or more microoperations. The data register is sometimes called a pipeline
register.
It allows the execution of the microoperations specified by the control word simultaneously with the generation
of the next microinstruction. This configuration requires a two-phase clock, with one clock applied to the
address register and the other to the data register.
Following is the block diagram for control memory and the associated hardware needed for selecting the next
microinstruction address.
The diagram shows four different paths from which the control address register (CAR) receives the address. The
incrementer increments the content of the control address register by one, to select the next microinstruction in
sequence. Branching is achieved by specifying the branch address in one of the fields of the microinstruction.
Conditional branching is obtained by using part of the microinstruction to select a specific status bit in order to
determine its condition. An external address is transferred into control memory via a mapping logic circuit. The
return address for a subroutine is stored in a special register whose value is then used when the microprogram
wishes to return from the subroutine.
Control address register receives address of next microinstruction from different sources.
Incrementer simply increments the address by one
In case of branching, branch address is specified in one of the field of microinstruction.
In case of subroutine call, return address is stored in the register SBR which is used when returning from
called subroutine.
Conditional Branch
Simplest way of implementing branch logic hardware is to test the specified condition and branch to the
indicated address if condition is met otherwise address resister is simply incremented. If Condition is true,
hardware set the appropriate field of status register to 1. Conditions are tested for O (overflow), N (negative), Z
(zero), C (carry), etc.
Unconditional Branch
Fix the value of one status bit at the input of the multiplexer to 1. So that, branching can always be done.
Mapping
Assuming operation code of 4-bits which can specify 16 (24) distinct instructions. Assume further and control
memory has 128 words, requiring an address of 7-bits. Now we have to map 4-bit operation code into 7-bit
control memory address. Thus, we have to map Op-code of an instruction to the address of the Microinstruction
which is the starting microinstruction of its subroutine in memory.
Direct mapping:
Directly use op-code as address of Control memory
Address
OP-codes of Instructions 0000 ADD Routine
ADD 0000 AND Routine
0001
LDA Routine
AND 0001 . 0010 STA Routine
LDA 0010 BUN Routine
0011
STA
.
0011 0100 Control
BUN
0100
. Storage
Extended idea: Mapping function implemented by ROM or PLD (Programmable Logic Device)
Use op-code as address of ROM where address of control memory is stored and then use that address as an
address of control memory. This provides flexibility to add instructions for control memory as the need arises.
OPCODE Mapping memory (PLD) Control Address Register Control Memory
Subroutines
Subroutines are programs that are used by another program to accomplish a particular task. Microinstructions
can be saved by employing subroutines that use common sections of micro code.
Example: the sequence of microoperations needed to generate the effective address is common to all memory
reference instructions. Thus, this sequence could be a subroutine that is called from within many other routines
to execute the effective address computation.
Subroutine register is used to save a return address during a subroutine call which is organized in LIFO (last in,
first out) stack.
Computer Configuration
It consists of two memory units: a main memory for storing instructions and data, and a control memory for
storing the microprogram.
Each microoperation below is defined using resister transfer statements and is assigned a symbol for use in
symbolic microprogram.
Description of CD Description of BR
CD (condition) field consists of two bits representing 4 status bits and BR (branch) field (2-bits) used together
with address field AD, to choose the address of the next microinstruction.
Microinstruction fields (F1, F2, F3)
Here, microoperations are subdivided into three fields of 3-bits each. These 3 bits are used to encode 7 different
microoperations. No more than 3 microoperations can be chosen for a microinstruction, one for each field. If
fewer than 3 microoperations are used, one or more fields will contain 000 for no operation.
E.g. the Fetch Routine
Binary microprogram