Computer Organization and
Architecture
KCS302
LECTURE 37
Unit-3: Control Unit
•Instruction types
•Instruction formats
•Instruction cycles and sub cycles (Fetch and Execute etc)
•Micro operations
•Execution of a complete instruction
•Program Control
•Reduced Instruction Set Computer
•Pipelining
•Hardwire and micro programmed control:
•Micro programme sequencing
•Concept of horizontal and vertical microprogramming.
Instructions
• The organization of the computer is defined by its internal registers, the
timing and control structure, and the set of instructions that It uses.
• The generalpurpose digital computer is capable of executing various
microoperations and, can be instructed as to what specific sequence of
operations it must perform.
• The user of a computer can control the process by means of a program.
– A program is a set of instructions (binary code) that specify the
operations, operands, and the sequence by which processing has to
occur.
– Both instructions and data are stored in memory (Stored Program
concept).
– Every computer has its own unique instruction set.
• Instruction Code:
Operation Code + Operand
– The control unit receives the instruction from memory and interprets the operation code
bits.
– It then issues a sequence of control signals to initiate microoperations in internal computer
registers.
• Many variations for arranging the binary code of instructions
– each computer has its own particular instruction code format
– conceived by computer designers
• Basic Computer:
• The Basic Computer has two components: a processor and memory
• For example, the memory has 4096 words in it
– 4096 = 212, so it takes 12 bits to select a word in memory
• Each word is 16 bits long
• If each instruction code is in one 16-bit memory word,
– operation code: 4 bits (16 possible operations)
– address of an operand: 12 bits
• Program:
– A sequence of instructions
• Instruction:
– A group of bits that tell the computer to perform a specific operation (a
sequence of micro-operation)
• The instructions of a program, along with any needed data are stored in memory
• The CPU reads the next instruction from memory
• It is placed in an Instruction Register (IR)
• Control circuitry in control unit then translates the instruction into the sequence of
microoperations necessary to implement it
• Note: in the coming slides, we will be using the following registers:
– PC, IR, AR, AC, DR, TR, INPR, OUTR
Instruction Format
• The basic computer has three instruction code formats as shown below (in the
diagram at the right).
– I (Leftmost bit) specifies the address mode (0 = Direct, 1 = Indirect)
• The diagram at the left shows Direct and Indirect addressing modes.
– Another option is Immediate addressing mode: second part of an instruction code
specifies an operand
• Effective Address = address of the operand in a computation-type instruction,
or the target address in a branch-type instruction
Instruction Types
• If the three opcode bits in positions 12 though • Basic Computer Instructions:
14 are equal to 111
• If I = 0, then register (AC) reference
• If I = 1, then I/P instruction
• Else, the instruction is a memory-reference
• If I = 0, then direct addressing mode
• If I = 1, then Indirect addressing mode
• Even though only three bits (23 = 8) of the instruction
are used for the operation code,
but as register-reference and input-output instructions
use the remaining 12 bits as part of the operation code,
the total number of instructions can exceed eight.
• In fact, the total number of instructions chosen for the basic computer is equal to 25.
• Instruction Set Completeness:
• A computer should have a set of instructions so that the user can construct
machine language programs to evaluate any function that is known to be
computable.
• The set of instructions are said to be complete if the computer includes a
sufficient number of instructions in each of the following categories:
1. Arithmetic, logical, and shift instructions
• ADD, CMA, INC, CIR, CIL, AND, CLA
2. Instructions for moving information to and from memory and
processor registers
• LDA, STA
3. Program control instructions together with instructions that check
status conditions
• BUN, BSA, ISZ
4. Input and output instructions
• INP, OUT
Hardwired and Microprogrammed
• Hardwired control unit:
– implemented as logical circuit (gates, filp-flops, decoders etc.) in the hardware
– faster
– used in RISC
– can't handle complex instructions
– modification is difficult
• Microporgrammed control unit:
– implemented using programming approach
• 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
– slower
– used in CISC
– easier to handle complex intruction sets
– cheaper and more flexible
• We will now explore hardwired control unit design.
Instruction Cycle
• In Basic Computer, a machine instruction is executed in the following cycle:
1. Fetch an instruction from memory
2. Decode the instruction and calculate effective address (EA)
3. Fetch operand: Read the EA from memory if the instruction has an
indirect address
4. Execute the instruction
• After an instruction is executed, the cycle starts again at step 1, for the next
instruction
• Note: Every different processor has its own (different) instruction cycle
T0: AR ← PC (S0S1S2=010, T0=1)
T1: IR ← M [AR], PC ← PC + 1 (S0S1S2=111, T1=1)
T2: D0, . . . , D7 ← Decode IR(12-14), AR ← IR(0-11), I ← IR(15)
Register transfers for the fetch phase
Flowchart for Instruction Cycle
Instruction Types and Microoperations
• Basic Computer Instructions:
Register Reference
Memory Reference
• The execution of MR instruction starts with T4
Branch and Save Return Address
Input-Output Reference
A Terminal with a keyboard and a Printer
❑ Program Interrupt
Sequence of execution of instructions
Design of Basic Computer
• Design of Basic Computer:
• The basic computer consists of the following hardware components:
1. A memory unit with 4096 words of 16 bits each
2. Nine registers: AR, PC, DR, AC, IR, TR, OUTR, INPR, and SC
3. Seven flip-flops: I, S , E, R, lEN, FGI, and FGO
4. Two decoders: a 3 x 8 operation decoder and a 4 x 16 timing decoder
5. A 16-bit common bus
6. Control logic gates
7. Adder and logic circuit connected to the input of AC
❑ Control Functions & Microoperations for the Basic Computer
❑ Control of Registers and Memory
• In a similar fashion we can derive the control gates for the other registers as well as
the logic needed to control the read and write inputs of memory.
• Similarly, a few logic diagrams are shown next.
❑ Control of Flags
❑ Control of Common Bus
❑ Design of Accumulator Logic
❑ Control of AC Register
❑ ALU (Adder & Logic Circuits)