How Does and What is the Control Unit of a Processor?

Control Unit of a Processor

If we had to define in which parts a processor is composed, then the safest thing is that 99% of the time we would make a dividing line between two parts, on the one hand, the execution units and all the elements necessary for its operation and for On the other hand, the control unit, which is in charge of the capture, but especially of the decoding of each instruction, for this we have to understand the instruction cycle.

To understand how the control unit works , we must first understand how the cycle of each instruction works , where an instruction is first captured from memory and placed in the instruction register, the next step is the decoding of the instruction by the control unit , which after finishing its work sends the instruction to the execution unit that corresponds to that instruction.

What are the tasks of the Control Unit?

unidad de control

The control unit is an indispensable part that performs the following list of jobs continuously and transparently:

  • It coordinates the movement and order of the data that moves inside and outside the processor, as well as between the different subunits that are part of it.
  • Interpret the instructions.
  • It controls the different ALUs and execution units of the processor.
  • It is not only in charge of capturing and decoding the instructions, but also of writing the results in the registers, caches or in the corresponding address of the RAM.

The control unit is therefore the true shadow brain inside the CPU, which is in charge of managing that all the parts of the CPU receive the correct data and execute the correct instructions at all times.

Decoding instructions

Decodificación Instrucciones Each processor has a set of registers and instructions or ISA that we can understand as the language of the processor, so depending on each processor a binary code can mean one thing or another . But, in all of them the instruction is always divided into two parts: the opcode and the data . The opcode is the instruction code , each instruction always corresponds to the same opcode within an ISA

Suppose we have a computer with a 3-bit opcode so this gives 2 ^ 3 instructions, through a decoder of n bits we can generate an output of 2 ^ n bits, in this case 3 bits generate 8 different paths, according to The type of instruction to be executed will be taken one way or another to solve it during the execution stage of the instruction.

Not all the instructions will go through the same units and the same processes, not all of them have a pipeline of the same length and therefore they will not all have the same treatment, because it is not the same to carry out a sum than to move a data.

Types of control units

Procesador Render

We mainly have two types of control units, the wired and the microprogrammed.

  • Wired control units are used in very simple processors , since in them the table of registers and instructions cannot be changed since all the data paths previously wired in a fixed way are found , in a wired control unit the instructions will have always the same performance and they will not be able to add new ones or optimize their operation.
  • In the case of microprogrammed control units, a processor is used that is responsible for performing all the functions of the control unit , this allows optimizing the way in which the instructions are to be executed and even adding new instructions.

Due to the complexity of the microprogrammed control unit, they perform the decoding of the instructions much more slowly, which is why depending on the type of instruction, one type of control unit or another is used when it comes to Try each of the instructions.