Micro-Programmed Versus Hardwired Control Units The Control Unit
Micro-Programmed Versus Hardwired Control Units The Control Unit
In order to appreciate the difference and see how computers really work, we present a very
simple computer. A block diagram of its data path sections is shown in Figure 1.
1
A single 12-bit-wide bus provides for exchange of information between pairs of registers
within the data path section. The registers and the 256 X 12 bit RAM memory are controlled
by 16 control signals. Most of the registers have Load (L) and Enabled (E) signals. An active
L signal to a register causes the contents of the bus to be clocked into that register on the
next rising pulse from the system clock. An active E signal enables the tristate outputs of the
register, thereby making its contents available to the bus. Therefore, a register transfer from,
for example, register A to register B would require active EA and LB control signals.
The machine's RAM memory is accessed by first placing the 8-bit address in the Memory
Address Register (MAR). An active Read (R) control signal to the RAM will then cause the
selected word from the RAM to appear in the Memory Data Register (MDR). An active
Write (W) signal, on the other hand, will cause the word contained in the MDR to be stored
in the RAM at the address specified by the MAR. Since there are no input or output ports in
this simple computer, all I/O is memory mapped. In other words, several memory locations
are reserved for input/output devices. Memory reads from any of those locations will cause
data from the corresponding input device to appear in the MDR; memory writes to them will
cause data in the MDR to be sent to the corresponding output device. A word stored in any
given memory location may be data to be manipulated by the computer or a coded
instruction that specifies an action to be taken.
The data path section also contains a Program Counter (PC) whose function it is to point to
the address in RAM of the next instruction to be executed. The Increment Program Counter
(IP) control signal causes the contents of the PC to increase by one. Since, as we shall see,
instructions on this machine are one word long, this provides a simple mechanism for
sequential instruction execution. In addition there is an Instruction Register (IR) which holds
the instruction that is about to be execute and provides its opcode to the controller/sequencer.
Table 1 gives eight instructions that form the instruction set chosen for the machine. Also
shown in the table is the sequence of control signals necessary for execution of each of the
instructions in the machine's instruction set and for fetching the next instruction. In each case
the register transfers required for execution of each step are shown. For example, in the case
of the LDA (load accumulator) instruction, the first step consists of copying the address of
the operand, contained in the least significant 8 bits of the instruction register, to the memory
address register. Thus the EI (enable IR) and LM (load MAR) control signals are active. The
2
next step is to read the operand from memory into the memory data register. An active R
(memory read) signal performs that task. The last step required to execute the LDA
instruction is to copy the contents of the memory data register to the accumulator. Active ED
(enable MDR) and LA (load accumulator) do the trick.
3
Figure 2
The ring counter provides a sequence of six consecutive active signals that cycle
continuously. Synchronised by the system clock, the ring counter first activates its T0 line,
then its T1 line, and so forth. After T5 is active, the sequence begins again with T0. Figure 3
shows how the ring counter might be organised internally.
Figure 3
The instruction decoder takes its four-bit input from the op-code field of the instruction
register and activates one and only one of its 8 output lines. Each line corresponds to one of
the instructions in the computer's instruction set. Figure 4 shows the internal organisation of
this decoder.
4
Figure 4
The most important part of the hard-wired controller is the control matrix. It receives input
from the ring counter and the instruction decoder and provides the proper sequence of
control signals. Figure 5 is a diagram of how the control matrix for our simple machine
might be wired.
Figure 5
5
To understand how this diagram was obtained, we must look carefully at the machine's
instruction set (Table 1).
Table 2 shows which control signals must be active at each ring counter pulse for each of the
instructions in the computer's instruction set (and for the instruction fetch operation). The
table was prepared by simply writing down the instructions in the left-hand column. (In the
circuit these will be the output lines from the decoder). The various control signals are
placed horizontally along the top of the table. Entries into the table consist of the moments
(ring counter pulses T0, T1, T2, T3, T4, or T5) at which each control signal must be active in
order to have the instruction executed. This table is prepared very easily by reading off the
information for each instruction given in Table 1. For example, the Fetch operation has the
EP and LM control signals active at ring count 1, and ED, LI, and IPC active at ring count 2.
Therefore the first row (Fetch) of Table 2 has T0 entered below EP and LM, T1 below R,
and T2 below IP, ED, and LI.
Table 2. A Matrix of Times at which Each Control Signal Must Be Active in Order to
Execute the Hard-wired Basic Computer's Instructions
Control IP LP EP LM R W LD ED LI EI LA EA A S EU LB
Signal:
Instru-
ction
Fetch T2 T0 T0 T1 T2 T2
LDA T3 T4 T5 T3 T5
STA T3 T5 T4 T3 T4
MBA T3 T3
ADD T3 T3 T3
SUB T3 T3 T3
JMP T3 T3
JN T3* T3*
NF NF
Once Table 2 has been prepared, the logic required for each control signal is easily obtained.
For each an AND operation is performed between any active ring counter (Ti) signals that
were entered into the signal's column and the corresponding instruction contained in the far
left-hand column. If a column has more than one entry, the output of the ANDs are ORed
together to produce the final control signal. For example, the LM column has the following
entries: T0 (Fetch), T3 associated with the LDA instruction, and T3 associated with the STA
instruction. Therefore, the logic for this signal is:
LM = T0 + T3*LDA + T3*STA
This means that control signal LM will be activated whenever any of the following
conditions is satisfied: (1) ring pulse T0 (first step of an instruction fetch) is active, or (2) an
LDA instruction is in the IR and the ring counter is issuing pulse 3, or (3) and STA
instruction is in the IR and the ring counter is issuing pulse 3.
The entries in the JN (Jump Negative) row of this table require some further explanation.
The LP and EI signals are active during T3 for this instruction if and only if the
accumulator's negative flag has been set. Therefore the entries that appear above these
6
signals for the JN instruction are T3*NF, meaning that the state of the negative flag must be
ANDed in for the LP and EI control signals.
Figure 6 gives the logical equations required for each of the control signals used on our
machine. These equations have been read from Table 2, as explained above. The circuit
diagram of the control matrix (Figure 5) is constructed directly from these equations.
Figure 5
It should be noticed that the HLT line from the instruction decoder does not enter the control
matrix, Instead this signal goes directly to circuitry (not shown) that will stop the clock and
thus terminate execution.
The basic concept is shown in figure 7. The CROM contains eight locations, each of which
stores 4 bits, that is, an 8 x 4 ROM. The address input to the CROM is taken from a 3-bit
counter that is incremented by a clock signal. Thus, each of the locations in the CROM is
read out in sequence so generating a sequence of four output signals that are shown as
waveforms. The sequence repeats since the counter overflows back to zero.
7
CROM
1001
0011
A2 1001
A1 1000
A0 1001
1011
1000
1101
This replaces the counter with a register, the CROM Address Register, and to store the next
address within the CROM. The next address, as stored within the CROM, is loaded into the
CROM address register on every clock pulse. The CROM now contains two fields, the next
address field and the control signal field. The reason for this is so that the CROM can
generate any number of different sequences.
The contents of the CROM shown in Figure 8 reveals that two different output signal
sequences are stored in the CROM. One sequence begins at CROM location 0x00 while the
other begins at CROM location 0x05. Thus, if the CROM address register is initially 0x00,
the output sequence will be
Alternatively, if the CROM address register is initially 0x05, the sequence will be
8
ROM address
generator
CROM
A2
0 0 1 P0
A1 0 1 0 P1
0 1 1 P2
A0 1 0 0 P3
0 0 0 P4
1 1 0 P5
1 1 1 P6
1 0 1 P7
Clock
Output
signals
Figure 9 shows a simulator which shows the memory locations of a CROM. In the left hand
field is a decimal representation of the addresses, in the centre field is the next address field
in binary and the right hand field shows the contents of these address locations, known as the
Control Signal field..
The contents of the Control Signal field at CROM addresses 0x00 to 0x04 are output cyclic.
9
Figure 9
10
Figure 10
11