Control Unit Study Notes for GATE CSE Exam

By Mukesh Kumar|Updated : November 1st, 2021

Control Unit Study Notes- The control unit is an important part of computer's central processing unit whose major responsibility is decoding the opcode and operand bits from the instruction register, and then it generates the control signals which are necessary to drive the hardware in the CPU to perform the sequence of micro-operations that comprises the instruction.

Table of Content

Design of Control Unit

In the computer, the major functioning of the control unit is to initialize sequences of micro-operations (the operations executed on the data stored in the CPU registers are called micro-operations). Designing of the control unit is as follows:

  • The number of numerous kinds of micro-operations that are available in a given system is limited (finite).
  • The control unit is said to be hardwired when the control signals are generated by hardware using conventional logic design techniques. 
  • Micro-programming is another alternative for designing the control unit of a digital computer.

image001

  • The control unit initializes a series of sequential steps of micro-operations. During any given time certain micro-operations are to be initiated, while others remain idle.
  • The control variables at any given time can be represented by a string sequence of 0's and 1's called a control word.

Approaches for Designing Control Unit

Hardwired Control:

  • Fixed logic circuits that correspond directly to the Boolean expressions are used to generate the control signals.
  • The hardwired control design is much faster than microprogrammed control.
  • A controller that hardwired designing approach can operate at high speed.
  • Control hardwire can be seen as a state machine that changes its state from one state to another in every clock cycle, depending on the contents of the condition codes, the instruction register, and the external inputs. The control signals are the outputs of the state machine. The sequence of operations carried out by this machine is determined by the wiring of the logic elements, hence it has the name “hardwired”.

image002

Micro-programmed Control:

  • The control signals associated with operations are stored in special memory units that are inaccessible by the programmer as control words.
  • Control signals are generated by a program that is similar to machine language programs.
  • It leads to a slower operating speed because it takes time to fetch microinstructions from the control store and then execute them.
  • Control word: A control word is defined as a word whose individual bits are used to represent the various control signals.
  • Micro-routine: A sequence of control words corresponding to the control sequence of a machine instruction constitutes the micro routine for that instruction,
  • Micro-instruction: Individual control words in this micro routine are referred to as microinstructions.
  • Micro-program: A sequence of microinstructions is called a microprogram, which is stored in a ROM or RAM called a control memory CM.

image003

  • Control Store: The micro-routines for all instructions in the instruction set of a computer are stored in a special memory called the control store.
  • The format for control word is as follows:   
Branch ConditionFlagControl FieldControl Memory Address

Micro-instructions are commonly divided into two categories: horizontal and vertical.

Horizontal Micro-Programming Control: Each micro-instruction is a series of bits each of which represents a single control line.

  • In this design, the Control signal is expressed with a decoded binary format per Control Signal.
  • There is no need for an external decoder to generate the control signal.
  • It is a bit flexible as compared to a hardwired control unit since it allows modification easily as compared to a hardwired control unit.
  • This concept is not in practice since managing the signals in the decoded format is not as easy as it leads to longer instructions.

Horizontal micro-instructions are characterized by:

  • Long formats;
  • Ability to express a high degree of parallelism;
  • Minimally encoded scheme
  • Many resources can be controlled
  • Operating speed is low

Vertical Micro-Programming Control: Groups of bits in the micro-instruction represent commands. This requires de-multiplexing or decoding before execution of the control commands.

  • In this Control Unit, the Control signal is expressed in encode binary format.
  • It requires an external decoder to decode the signal and process them.
  • It provides the ease for implementation of new instructions because of the encoded binary format.

Vertical micro-instructions are characterized by:

  • Short formats;
  • Limited ability to express micro-operation parallelism;
  • Highly encoded schemes, hence considerable lightly encoded.
  • Operating speed is high

Comparison between Horizontal and Vertical Micro-programming

  • Horizontal microinstruction control is faster but requires greater length microinstructions.
  • Horizontal programming allows more than one signal to be activated at the same time without any hardware modifications but vertical microprogramming require modification to the instruction format.

Operations:

Instruction Fetch Step: Read into Instruction Register from Memory at the address indicated by the Program Counter register. Then increment the program counter pointing to the next instruction.

IR <= InstrCache[PC];

PC <= PC + 4;

Instruction Decode and Register Read Step:

RS <= RegFile[IR[25:21]];

RT <= RegFile[IR[20:16]];

Immediate <= sign-extend(IR[15:0]);

pcALUOut <= PC + (Immediate << 2);

ALU Operation:

This is instruction-specific since control knows the instruction type.

R-Type Instruction: ALUOut <= RS op RT

Memory-Reference Instr: ALUOut <= RS + Immediate

Branch Instruction: If (RS/x compare RT/y) PC <= ALUOut

Jump Instruction: PC <= (PC(31:28), (IR[25:0],2*b00))

Data Cache Access:

R-Type Instruction: RegFile[IR[15:11]] <= ALUOut

Memory-Reference Instr:

Load Instr: DataCacheOut <= DataCache[ALUOut]

Store Instr: DataCache[ALUOut] <=RT/Y

Register Write-Back

Load Instr: RegFile[IR[20:16]] <= DataCacheOut

Fetch Instruction:

The following sequence of events in fetching an instruction:

  1. The contents of the PC are loaded into the MAR.
  2. The value in the PC is incremented. (This operation can be done in parallel with a memory access.)
  3. As a result of a memory read operation, the instruction is loaded into the MDR.
  4. The contents of the MDR are loaded into the IR.

Using single bus data path:

image004

Using Three bus data paths:

image005

Execution of an Instruction:

Simple Arithmetic Operation: Add R1, R2, R0

This instruction adds the contents of source registers R1 and R2, and stores the results in destination register R0.

This addition can be executed as in the following sequence:

  1. The registers R0, R1, R2, are extracted from the IR.
  2. The contents of R1 and R2 are passed to the ALU for addition.
  3. The output of the ALU is transferred to R0.

Using single bus datapath:

image006

Using two bus datapath:

image007

Using three bus datapath:

image008

Fetching a Word from memory:
  1. MAR [R1]
  2. Request memory READ and put the data to the address register
  3. Wait for the Memory Fetch Cycle (MFC) signal and put the result from [MDR] to R2.
  4. R2 [MDR]
Storing a Word in Memory:
  1. MAR [R1]
  2. MDR [R2]
  3. Request memory write
  4. Wait for the MFC signal
Interrupt Handling:

After the execution of an instruction, a test is performed to check for pending interrupts. If there is an interrupt request waiting, the following sequence of steps take place:

  1. The contents of the PC are loaded into MDR (to be saved).
  2. The MAR is loaded with the address at which the PC contents are to be saved.
  3. The PC is loaded with the address of the first instruction of the interrupt handling routine.
  4. The contents of MDR (old value of the PC) are stored in memory.
image009

You can follow the detailed champion study plan for GATE CS 2021 from the following link:

Detailed GATE CSE 2021 Champion Study Plan

Candidates can also practice 110+ Mock tests for exams like GATE, NIELIT with BYJU'S Exam Prep Test Series check the following link:

Click Here to Avail GATE CSE Test Series! (100+ Mock Tests)

Get unlimited access to 21+ structured Live Courses all 112+ mock tests with Online Classroom Program for GATE CS & PSU Exams:

Click here to avail Online Classroom Program for Computer Science Engineering

Thanks

#DreamStriveSucceed

Comments

write a comment

Follow us for latest updates