The Central Processing Unit is the most important part of a computer. It is responsible for regulating the various operations which are undertaken by a computer. A Central Processing Unit or the CPU has three main parts which are the Arithmetic Logic Unit (ALU), the control unit (CU), and the Memory Unit. The control unit is an important component of the CPU. It directly controls the functions of the memory unit, the ALU, and the input and output devices. It handles all the signals of the processor and is also regarded as the brain of the processor. Control Unit takes input from the status registers and the instruction registers.
What is the Control Unit?
A control unit is an integral part of the central processing unit of the computer. The main function of this is to instruct the memory, the arithmetic logic unit, and the input and output devices on how they should process a particular instruction. It provides timing and control signals to the various other units of the CPU. All the important resources of the computer system are managed by this unit. It also enables data transfer between the various devices and the CPU. This is also included as a part of Von Neumann architecture. The control unit block diagram is shown below.
Components of the Control Unit
The components of this unit include:
Input Components
Input components include flags, clock, and control signals.
- Clock: The clock enables the control unit to maintain time. One microinstruction (or a set of microinstructions) can be performed in one clock pulse.
- Flags: Flags are required to determine the outcome of the preceding ALU operation and the exact status of the processor.
- Control Signals from the control bus: The control bus generates control signals such as acknowledgment and interrupts signals. These signals are sent to the control unit.
Instruction Register
Instruction Register is used to storing the instruction which is currently being executed.
Output Components
The outputs include control signals inside the processor and the control signals to the control bus.
- Control Signals inside the processor: These signals are used to transfer the data from one register to another. Some control signals are also responsible for activating certain ALU functions.
- Control Signals to the control bus: This includes control signals to the memory and control signals to the input/output devices.
Functions of the Control Unit
- This unit enables the sequential flow of data between the different parts of the Central Processing Unit.
- It can interpret the instructions and perform the necessary actions.
- This handles multiple operations like fetching, decoding, and execution of instructions.
- It controls the flow of data inside the process.
- This also controls the execution units like ALU, registers, and data buffers which are present in the CPU.
Design of Control Unit
These are designed in two ways:
Hardwired Control Unit
In Hardwired Control, special hardware logical circuits are responsible for generating the signals which enable signal execution. We will not be able to alter the method of signal generation without actually modifying the signal structure. The operation code will contain all the basic data which are related to the generation of the control signal. The instructor decoder will then decode the operation code. The instructor decoder contains a number of decoders that will decode the different fields of the opcode. The signals generated by the control signal generator matrix will be sent as input to the subsequent control state generator matrix.
Micro Programmable Control Unit
In the case of the Micro programmable type, the consecutive instruction words will be stored into the instructor register in a completely normal way. The operation code of the instructions will however not be decoded immediately. Here, the binary control values are stored as words in the memory. Each word contains microinstructions that are responsible for performing various tasks.
Types of Control Units
These are basically of two types:
Hardwired
Here, the signals are generated by special hardwired logic circuits. This type of unit is difficult to modify. They are also quite expensive and are not capable of handling complex instructions. This is used by those computers which use RISC architecture.
Microprogrammed
In this type, the signals are generated using microinstructions which are stored in the control memory. It is easier to modify and is also less expensive. However, it is slower as compared to a hardwired type. It is capable of handling complex instruction and is used in devices that use CISC architecture. The microprogrammed type is again of two types:
Horizontal Microprogrammed
The control signals will be represented in the form of a decoded binary format which is 1 bit/ CS. It supports a high degree of parallelism and is mostly used in parallel processing applications.
Vertical Microprogrammed
The control signals will be represented in the form of an encoded binary format. If we use N control signals, then the number of bits required with be log2(N). The degree of parallelism is low. Also, the speed of this unit is comparatively slow.
Verilog Code for a Control Unit
module Control_Logic( input[1:0] stage, input [11:0] IR, input [3:0] SR, output reg PC_E,Acc_E,SR_E,IR_E,DR_E,PMem_E,DMem_E,DMem_WE,ALU_E,MUX1_Sel,MUX2_Sel,PMem_LE, output reg [3:0] ALU_Mode);
parameter LOAD = 2’b00,FETCH = 2’b01, DECODE = 2’b10, EXECUTE = 2’b11;
always @(*)
begin
PMem_LE = 0;
PC_E = 0;
Acc_E = 0;
SR_E = 0;
IR_E = 0;
DR_E = 0;
PMem_E = 0;
DMem_E = 0;
DMem_WE = 0;
ALU_E =0;
ALU_Mode = 4’d0;
MUX1_Sel = 0;
MUX2_Sel = 0;
if(stage== LOAD )
begin
PMem_LE = 1;
PMem_E = 1;
end
else if(stage== FETCH ) begin
IR_E = 1;
PMem_E = 1;
end
else if(stage== DECODE ) begin
if( IR[11:9] == 3’b001)
begin
DR_E = 1;
DMem_E = 1;
end
else
begin
DR_E = 0;
DMem_E = 0;
end
end
else if(stage== EXECUTE )
begin
if(IR[11]==1) begin // ALU I-type
PC_E = 1;
Acc_E = 1;
SR_E = 1;
ALU_E = 1;
ALU_Mode = IR[10:8];
MUX1_Sel = 1;
MUX2_Sel = 0;
end
else if(IR[10]==1) // JZ, JC,JS, JO
begin
PC_E = 1;
MUX1_Sel = SR[IR[9:8]];
end
else if(IR[9]==1)
begin
PC_E = 1;
Acc_E = IR[8];
SR_E = 1;
DMem_E = !IR[8];
DMem_WE = !IR[8];
ALU_E = 1;
ALU_Mode = IR[7:4];
MUX1_Sel = 1;
MUX2_Sel = 1;
end
else if(IR[8]==0)
begin
PC_E = 1;
MUX1_Sel = 1;
end
else
begin
PC_E = 1;
MUX1_Sel = 0;
end
end
end
endmodule
FAQs
1). What is the work of a control unit?
The control unit is mainly responsible for directing the various operations of the processor. It tells the ALU, memory, and the input/output devices how to process a particular instruction.
2). What is the control memory?
Control memory contains the addressable storage registers. It is a type of Random Access Memory (RAM).
3). What is the Wilkes control unit?
The Wilkes control unit is basically used to replace the sequential and combinational circuits of a hardwired control unit and replaced them with a simple control unit and a storage unit.
4). What is a hardwired control unit?
Hardwired Control Unit generates signals by using specific logic circuits. The signals can be altered by changing the design of the circuit.
Please refer to this link to know more about Control Unit MCQs.
5). What is a control memory?
Control memory contains the addressable storage registers. It is a type of Random Access Memory (RAM).
Know more about Priority Encoder & Distributed Control System.
So, this was all about control units. We got to know about the different components and types of a control unit. We also came to know about its different functions. Do you know about any other function of the Control Unit?