Computer Instructions
• The basic computer has three instruction code formats.
• Each format has 16 bits.
• The operation code(op-code) part of the instruction contains three bits and
the meaning of remaining 13 bits depends upon the op-code encountered.
The Computer: Top-Level Structure
COMPUTER
Main
I/O Memory
System
Bus
CPU CPU
Register ALU
Internal
Control Unit Bus
Sequencing Control
Logic Unit
Control Unit
Registers and
Decoders
Control
Memory
Internal Block Diagram of a CPU
Internal Block Diagram of a CPU
Control Unit
The function of control unit is to generate relevant timing and control signals to all
operations in the computer.
Control Unit is “the brain within the brain”.
It controls the flow of data between the processor and memory and peripherals.
The examples of devices that require a control unit are CPUs and graphics
processing units (GPUs).
Control Unit
The control unit directs the entire computer system to carry out stored
program instructions.
The control unit must communicate with both the arithmetic logic unit (ALU)
and main memory.
The control unit instructs the arithmetic logic unit that which logical or
arithmetic operation is to be performed.
The control unit co-ordinates the activities of the other two units as well as all
peripherals and auxiliary storage devices linked to the computer
Control Unit Organization
Control unit generates control signals using one of the two organizations:
Hardwired Control Unit.
Control unit consist of a:
Instruction Register
Number of Control Logic Gates,
Two Decoders
4-bit Sequence Counter
Micro-programmed Control Unit.
Control Unit
Hardwired control units are implemented through use of sequential
logic units or circuits like gates , fliflops , decoders in hardware.
Hardwired control units are generally faster than micro-programmed
designs.
This architecture is preferred in reduced instruction set computers (RISC)
as they use a simpler instruction set.
The hardwired approach has become less popular as computers have evolved as at
one time, control units for CPUs were ad-hoc logic, and they were difficult to
design.
Control Unit
Advantages Disadvantages
Hardwired Control Unit is fast The control signals required by the
because control signals are generated CPU will be more complex
by combinational circuits.
Modifications in control signal are
The delay in generation of control very difficult. That means it requires
signals depends upon the number rearranging of wires in the
of gates. hardware circuit.
The performances is high as It is difficult to correct mistake in
compared to micro-programmed original design or adding new
control unit. features in existing design of
control unit.
Control Unit of Basic Computer
Instruction Register (IR)
15 14 13 12 11 - 0
Other Inputs
3× 8
Decoder
7 6 5 4 3 2 1 0
I D0
Control
...
Outputs
D7
Control
Logic Gates
T15
...
T0
. . .
15 14 .... 2 1 0 T0
4× 16
Decoder
Increment (INR)
4-Bit Sequence
Counter (SC) Clear (CLR)
Clock
Control Timing Signals
Control Timing Signals
Instruction Cycle
• A program residing in the memory unit of the computer consists of a
sequence of instructions.
• The program is executed in the computer by going thru a cycle for each
instruction.
• In basic computer, each instruction cycle consists of the following phases:
1. Fetch an instruction from memory.
2. Decode the instruction.
3. Read the effective address from memory.
4. Execute the instruction.
Flow chart for Instruction Cycle Initial Configuration
Start
Start
T0
AR PC
T1 Fetch
AR M[AR] PC PC+1
T2
Decode operation code in IR (12-14)
Decode
AR IR (0-11) , I IR(15)
Register or I/O 1= = 0 (Memory Reference)
D7
(I/O) 1= = 0 (Register) (Indirect) 1 = = 0 (Direct) Decision
I I
T3 T3 T3 T3
Execute I/O Ref. Ins. Execute Reg. Ref. Ins. AR M[AR] Nothing
SC 0 SC 0
Execution
Execute Mem. Ref. Ins.
SC 0
Microoperations for fetch and Decode
Microprogrammed Control Unit
The idea of microprogramming was introduced by Maurice Wilkes in 1951.
Micro-programs were organized as a sequence of microinstructions and
stored in special control memory.
The main advantage of the micro-program control unit is the simplicity of its
structure.
Outputs of the controller are organized in microinstructions and they can be
easily replaced
A micro-programmed control unit is implemented using programming
approach. A sequence of micro operations are carried out by executing a
program consisting of micro-instructions.
Micro-program, consisting of micro-instructions is stored in the control
memory of the control unit.
Execution of a micro-instruction is responsible for generation of a set of
control signals.
Microprogrammed Control Unit