Figure below shows the simplifid diagram of a CPU interfaced with an external memory. CPU has a unit called timing and control unit whose one of the most important function is to decode the instruction and generate the control signals for performing the micro-operations.
Instruction from the memory are read into the IR, decoded in the control unit. Now the control unit will generate various control signals for carrying out various micro-operations. E.g An ADD instruction upon decoding tells how the operands will be read into the processor. The operand can be immediate/in registers/in memory
For every operation code, the control issues a sequence of microoperations needed for the hardware implementation of the specified operation.
Type of control units:
1. Hardwired control unit
2. Microprogrammed contrl unit
Figure below shows a simplified block diagram of the hardwired control unit. The control unit is built using the logic gates and is designed as a sequential state machine.
The instruction are passed to the contro unit for decoding, and the control unit generates a set of microperations for each instruction. These microoperations control the internal operation of the CPU.
Example of a Hardwired control Unit
Hardwired control logic is shown in figure-2. It consists of:
3×8 instruction decoder
Flag I to store the addressing mode bit
4×16 sequence decoder
4-bit Sequence counter
When an instruction is fetched from the memory, it is transferred into the instruction register(IR). The opcode part of the instruction is decoded using a 3×8 decoder which generates D7 – D0 signals to mean unique operations. IR(15), decoded(D7-D0), IR(11-0) and the timing signal (T15 – T0) are all fed to the control logic for generation of the control signals
Timing and Cont rol Signals generated:
The figure which is referenced from CSA book by M. Morris Mano describes the timing diagram for varios micro-operations.
The sequence counter generates the precisely controlled T0-to-T15 a total of 16 timing pulses. As an operation say memory operation completes in 4 T states, it is required to clear the sequence counter so that another operation can be initiated.
The logic for clearing the SC :
D3.T4 : SC <– 0
The timing diagram shows this micro-operation.
D3 bcomes active at the end of T2 pulse
D3T4 is anded to produce a low CLRSC at the and of T4.
clears SC <– 0 at the end of T4
2. Micro-programmed control unit:
micro-programs for performing the micro-operations for the instructions are stored in the control memory. This control memory is in the form of ROM. A microprogram is written for every instruction supported by the CPU. Each instruction of a program causes the corresponding micro-program to be fetched and its contol information extracted in a manner that resembles the fetching and execution of a program from the main memory. Since the control signals are embedded into a kind of low-level software -this is also referred as firmware. The general features of MCU is:
One time Programmable, programmed during manufacture
We can change its functionlity, but generally not required once designed
Reusability-code as h/w
Advantage of MCU:
Microprogramming makes control unit design more systematic by organising the control signals into formatted words (microinstructions).
Design changes can easily be made just by altering content of the control unit.
Code Re-usability allows control unit to be designed faster
Disadvantages of MCU:
MCU are more costlier to manufacture than hardwired unit due to the presence of the control memory and its access circuitary.
MCU also tend to be slower because of the extra time required to fetch microinstructions from vontrol memory.
We can compare the micrprogramming with assembly language; however a microprogrammer requires more knowledge of the processor hardware than the assembly programmer. So, specialized programmer are required which adds to the cost of MCU.