04/05/2025
Instruction Codes
o Aprogram is a set of instructions that
specify the operations, operands, and the
sequence by which processing has to occur.
o A computer instruction is a binary code
that specifies a sequence of micro-
operations for the computer.
o An instruction code is a group of bits
that instruct the computer to perform a
specific operation.
4
5.
04/05/2025 5
Instruction Codes
Theuser of a computer can control the process by means
of a program
A program is a set of instructions that specify the
operations, operand, the sequence(control)
An instruction is a binary code that specifies a sequence
of micro operations.
Instruction codes together with data are stored in
memory(Stored Program Concept)
Instruction Cycle: The computer reads each instruction
from memory and places it in a control register. The
control then interprets the binary code of the instruction
and proceeds to execute it by issuing a sequence of
micro operations.
6.
04/05/2025
Instruction Codes…
o Instructionformat:
o Two major components of an instruction code:
o The operation code (opcode)
o Address
o An opcode specifies the operation for the instruction.
o An address specifies the registers and/or locations
in memory to use for that operation
Opcode
Fig: Instruction Format
11 0
15 14
I Address
12
Addressing
mode
6
7.
04/05/2025
Instruction Codes…
o AddressMode:
o The address field of an instruction represents
o Direct address: the address in memory of the data to
use
(the address of the operand)
oIndirect address: the address in memory of the
address in memory of the data to use
7
04/05/2025 9
Addressing Mode
Immediateoperand address: The second part of an
instruction code(address field) specifies an operand
Operand is specified in the instruction itself.
Direct operand address: The second part of an instruction
code specifies the address of an operand
Indirect operand address :The bits in the second part of the
instruction designate an address of a memory word in
which the address of the operand is found
one bit of the instruction code is used to distinguish
between a direct and an indirect address
Effective Address: The operand address in computation-
type instruction or the target address in a branch-type
instruction
10.
04/05/2025 10
Computer Registers
Basiccomputer registers and memory
Data Register(DR) : hold the operand(Data) read from
memory
Accumulator Register(AC) : general purpose processing
register
Instruction Register(IR) : hold the instruction read from
memory
Temporary Register(TR) : hold a temporary data during
processing
Address Register(AR) : hold a memory address, 12 bit.
11.
04/05/2025 11
Cont…
Program Counter(PC): Hold the address of the next
instruction to be read from memory after the current
instruction is executed.
Instruction words are read and executed in sequence
unless a branch instruction is encountered.
A branch instruction calls for a transfer to a
nonconsecutive instruction in the program.
The address part of a branch instruction is transferred to
PC to become the address of the next instruction.
To read instruction, memory read cycle is initiated, and
PC is incremented by one (next instruction fetch)
04/05/2025 14
Cont…
Common BusSystem
The basic computer has eight registers, a memory unit,
and a control unit
Paths must be provided to transfer information from one
register to another and between memory and registers
A more efficient scheme for transferring information in a
system with many registers is to use a common bus
The connection of the registers and memory of the basic
computer to a common bus system
04/05/2025
Computer Instructions…
o InstructionTypes:
o Functional Instructions
o Arithmetic, logic, and shift instructions
o ADD, CMA, INC, CIR, CIL, AND, CLA
o Transfer Instructions
oData transfers between the main memory
and the processor registers
o LDA, STA
o Control Instructions
oProgram sequencing and control
o BUN, BSA, ISZ
o Input/Output Instructions
oInput and output
oINP, OUT
18
19.
04/05/2025
Timing and Control
oControl Unit:
o Control units are implemented in one of
two ways:
o Hardwired Control
oCU is made up of sequential and combinational
circuits to generate the control signals
o Microprogrammed Control
oA control memory on the processor contains
microprograms that activate the necessary
control signals
19
20.
04/05/2025 20
Cont…
Two majortypes of control organization
Hardwired Control
The control logic is implemented with gates, decoders, and other
digital circuits,
Fast operation.
Wiring change (if the design has to be modified)
Micro programmed Control
The control information is stored in a control memory, and the
control memory is programmed to initiate the required sequence of
micro operations.
Any required change can be done by updating the micro program in
control memory.
Slow operation
21.
04/05/2025
Instruction Cycle
o Inthe basic computer each instruction
cycle consists:
i. Fetch an instruction from memory
ii. Decode the instruction
iii. Read the effective address from memory if the
instruction has an indirect address.
iv. Execute the instruction.
21
22.
04/05/2025 22
Design ofBasic Computer
The basic computer consists of the following hardware
components
1. A memory unit with 4096 words of 16 bits
2. Eight registers: AR, PC, DR, AC, IR, TR, OUTR, INPR
3. Seven F/Fs: I, S, E, R, IEN, FGI, and FGO
4. Two decoder in control unit: 3 x 8 operation decoder, 4
x 16 timing decoder
5. A 16-bit common bus
6. Control Logic Gates:
7. Adder and Logic circuit connected to the AC input
23.
04/05/2025
Input-Output and Interrupts…
oExternal events can force the computer to quit
the normal program flow to react fast on the
events.
o Such event that requires fast response by the
computer is called interrupt.
o interrupt routine: The collection of
instructions that have to be executed to
respond to the interrupt
o IEN (Interrupt-enable flip-flop)
o can be set and cleared by instructions
o when cleared, the computer cannot be interrupted
23