Lecture 9
Lecture 9
Baghdad University
Asst. Prof. Dr. Muna Hadi Third stage
College of Engineering
2023-2024
Electrical Engineering Department
Lecture-9
Microprogrammed Control
Control Memory
The function of the control unit in a digital computer is to initiate sequences of
microoperations. The number of different types of microoperations 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.
The control function that specifies a microoperation is a binary variable. When it is in one binary
state, the corresponding microoperation is executed. A control variable in the opposite binary state
does not change the state of the registers in the system. The active state of a control variable may
be either the 1 state or the 0 state, depending on the application. In a bus-organized system, the
control signals that specify microoperations are groups of bits that select the paths in multiplexers,
decoders, and arithmetic logic units.
Control Word
The control unit initiates a series of sequential steps of microoperations. During any given
time, certain microoperations are to be initiated, while others remain idle. The control variables at
any given time can be represented by a string of 1's and 0's called a control word. As such, control
words can be programmed to perform various operations on the components of the system. A
control unit whose binary control variables are stored in memory is called a microprogrammed
control unit. Each word in control memory contains within it a microinstruction.
-67-
Computer Architecture
Baghdad University
Asst. Prof. Dr. Muna Hadi Third stage
College of Engineering
2023-2024
Electrical Engineering Department
Lecture-9
Control Memory
A more advanced development known as dynamic microprogramming permits a
microprogram to be loaded initially from an auxiliary memory such as a magnetic disk. Control
units that use dynamic microprogramming employ a writable control memory. This type of
memory can be used for writing (to change the microprogram) but is used mostly for reading. A
memory that is part of a control unit is referred to as a control memory. A computer that employs
a microprogrammed control unit will have two separate memories: a main memory and a control
memory. The main memory is available to the user for storing the programs. The contents of the
main memory may alter when the data are manipulated and every time that the program is changed.
The user's program in the main memory consists of machine instructions and data. In
contrast, the control memory holds a fixed microprogram that cannot be altered by the occasional
user. The microprogram consists of microinstructions that specify various internal control signals
for the execution of register microoperations. Each machine instruction initiates a series of
microinstructions in the control memory. These microinstructions generate the microoperations to
fetch the instruction from main memory; evaluate the effective address, execute the operation
specified by the instruction, and return control to the fetch phase in order to repeat the cycle for
the next instruction. The general configuration of a microprogrammed control unit is demonstrated
in the block diagram of Fig. 7-1. The control memory is assumed to be a ROM, within which all
control information is permanently stored.
-69-
Computer Architecture
Baghdad University
Asst. Prof. Dr. Muna Hadi Third stage
College of Engineering
2023-2024
Electrical Engineering Department
Lecture-9
Hardwired Control
It should be mentioned that most computers based on the reduced instruction set computer
(RISC) architecture concept use hardwired control rather than a control memory with a
microprogram. An example of a hardwired control for a simple computer is presented previously.
Address Sequencing
Microinstructions are stored in control memory in groups, with each group specifying a
routine. Each computer instruction has its own microprogram routine in control memory to
generate the microoperations that execute the instruction. The hardware that controls the address
sequencing of the control memory must be capable of sequencing the microinstructions within a
routine and be able to branch from one routine to another. To appreciate the address sequencing in
a microprogram control unit, let us enumerate the steps that the control must undergo during the
execution of a single computer instruction. An initial address is loaded into the control address
register when power is turned on in the computer. This address is usually the address of the first
microinstruction that activates the instruction fetch routine.
The fetch routine may be sequenced by incrementing the control address register through
the rest of its microinstructions. At the end of the fetch routine, the instruction is in the instruction
register of the computer. The control memory next must go through the routine that determines the
effective address of the operand. A machine instruction may have bits that specify various
addressing modes, such as indirect address and index registers. The effective address computation
routine in control memory can be reached through a branch microinstruction, which is conditioned
on the status of the mode bits of the instruction. When the effective address computation routine
is completed, the address of the operand is available in the memory address register
Mapping
The next step is to generate the microoperations that execute the instruction fetched from
memory. The microoperation steps to be generated in processor registers depend on the operation
code part of the instruction. Each instruction has its own microprogram routine stored in a given
location of control memory. The transformation from the instruction code bits to an address in
control memory where the routine is located is referred to as a mapping process. A mapping
procedure is a rule that transforms the instruction code into a control memory address. Once the
required routine is reached, the microinstructions that execute the instruction may be sequenced
by incrementing the control address register, but sometimes the sequence of microoperations will
depend on values of certain status bits in processor registers. Microprograms that employ
subroutines will require an external register for storing the return address. Return addresses cannot
be stored in ROM because the unit has no writing capability. When the execution of the instruction
is completed, the control must return to the fetch routine.
-70-
Computer Architecture
Baghdad University
Asst. Prof. Dr. Muna Hadi Third stage
College of Engineering
2023-2024
Electrical Engineering Department
Lecture-9
This is accomplished by executing an unconditional branch microinstruction to the first address of
the fetch routine. In summary, the address sequencing capabilities required in a control memory
are:
1. Incrementing of the control address register.
2. Unconditional branch or conditional branch, depending on status bit conditions.
3. A mapping process from the bits of the instruction to an address for control memory.
4. A facility for subroutine call and return
Figure 7-2 shows a block diagram of a control memory and the associated hardware needed
for selecting the next microinstruction address. The microinstruction in control memory contains
a set of bits to initiate microoperations in computer registers and other bits to specify the method
by which the next address is obtained. 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.
-71-
Computer Architecture
Baghdad University
Asst. Prof. Dr. Muna Hadi Third stage
College of Engineering
2023-2024
Electrical Engineering Department
Lecture-9
-72-
Computer Architecture
Baghdad University
Asst. Prof. Dr. Muna Hadi Third stage
College of Engineering
2023-2024
Electrical Engineering Department
Lecture-9
Conditional Branching
The branch logic of Fig. 7-2 provides decision-making capabilities in the control unit. The
status conditions are special bits in the system that provide parameter information such as the
carry-out of an adder, the sign bit of a number, the mode bits of an instruction, and input or output
status conditions. Information in these bits can be tested and actions initiated based on their
condition: whether their value is 1 or 0. The status bits, together with the field in the
microinstruction that specifies a branch address, control the conditional branch decisions generated
in the branch logic. The branch logic hardware may be implemented in a variety of ways. The
simplest way is to test the specified condition and branch to the indicated address if the condition
is met; otherwise, the address register is incremented.
This can be implemented with a multiplexer. Suppose that there are eight status bit
conditions in the system. Three bits in the microinstruction are used to specify any one of eight
status bit conditions. These three bits provide the selection variables for the multiplexer. If the
selected status bit is in the 1 state, the output of the multiplexer is 1; otherwise, it is 0. A 1 output
in the multiplexer generates a control signal to transfer the branch address from the
microinstruction into the control address register.
A 0 output in the multiplexer causes the address register to be incremented. In this
configuration, the microprogram follows one of two possible paths, depending on the value of the
selected status bit. An unconditional branch microinstruction can be implemented by loading the
branch address from the control memory into the control address register. This can be
accomplished by fixing the value of one status bit at the input of the multiplexer, so it is always
equal to 1. A reference to this bit by the status bit select lines from control memory causes the
branch address to be loaded into the control address register unconditionally.
-73-