Stored Program Organization

Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

Instruction Codes

A computer instruction is a binary code that specifies a sequence of microoperations for the computer.
Instruction code together with data are stored in the memory.
An instruction code is a group of bits that instructs the computer to perform a specific operation. It is
usually divided into parts, each having its own particular interpretation. The most basic part of an
instruction code is its operation part. The operation code of an instruction is a group of bits that define
such operation as add, subtract, multiply, shift and complement.
• Stored Program Organization
The simplest way to organize a computer is to have one process register and an instruction code format
with two parts. The first part specifies the operation to be performed and the second specifies an
address. The memory address tells the control unit where to find an operand in memory. This operand
is read from memory and used as the data to be operated on together with the data stored in the
processor register.
• Indirect Address
One bit of the instruction code can be used to distinguish between a direct and an indirect address.
When I = 0 (Direct address) and when I = 1 (Indirect address)
▪ When address of an instruction code specifies an operand – immediate operand
▪ When address specifies address of operand – direct address
▪ Else, address specifies an address of memory word where address of operand is found – indirect address.
Computer Registers
• Registers are a type of computer memory used to quickly accept, store, and transfer data and instructions that
are being used immediately by the CPU. The registers used by the CPU are often termed as Processor registers.
• A processor register may hold an instruction, a storage address, or any data (such as bit sequence or individual
characters).
• The computer needs processor registers for manipulating data and a register for holding a memory address. The
register holding the memory location is used to calculate the address of the next instruction after the execution of
the current instruction is completed.

Register Symbol No. Function


of
bits
Data DR 16 Holds memory operand
register

Address AR 12 Holds address for the


register memory

Accumulator AC 16 Processor register

Instruction IR 16 Holds instruction code


register

Program PC 12 Holds address of the


counter instruction

Temporary TR 16 Holds temporary data


register

Input INPR 8 Carries input character


register

Output OUTR 8 Carries output character


register
Computer Instructions
Computer instructions are a set of machine language instructions that a particular processor
understands and executes. A computer performs tasks on the basis of the instruction provided.
An instruction comprises of groups called fields. These fields include:
• The Operation code (Opcode) field which specifies the operation to be performed.
• The Address field which contains the location of the operand, i.e., register or memory
location.
• The Mode field which specifies how the operand will be located.
A basic computer has three instruction code formats which are:
• Memory - reference instruction
• Register - reference instruction
• Input-Output instruction
Timing and Control
The timing for all registers in the basic
computer is controlled by a master clock
generator. The clock pulses are applied to all
flip flops and registers both in system and in
the control unit. The clock pulses do not
change the state of a register unless the
register is enabled by a control signal. The
control signals are generated in the control
unit and provide control inputs for
multiplexers and process registers.
There are two major types of control
organization ; hardwired control and
microprogrammed control.
In microprogrammed control, the control
information is stored in a control memory. The
control memory is programmed to initiate the
required sequence of micro operations.
In hardwired control, the control logic is
implemented with gates, flip flops, decoders
and other digital circuits. It can be optimized
to produce a fast mode of operation.
• A Hard-wired Control consists of two
decoders, a sequence counter, and a
number of logic gates.
• An instruction fetched from the
memory unit is placed in the instruction
register (IR).
• The component of an instruction
register includes; I bit, the operation
code, and bits 0 to 11.
• The operation code in bits 12 through
14 are coded with a 3 x 8 decoder.
• The outputs of the decoder are
designated by the symbols D0 through
D7.
• The operation code at bit 15 is
transferred to a flip-flop designated by
the symbol I.
• The operation codes from Bits 0 to 11
are applied to the control logic gates.
• The Sequence counter (SC) can count in
binary from 0 to 15.
Instruction Cycle
A program in memory unit is
executed in the computer by going
through a cycle for instruction. In
the basic computer each
instruction cycle consists of
following phases:
1. Fetch an instruction form
memory.
2. Decode the instruction.
3. Read the effective address from
memory if the instruction has
an indirect address.
4. Execute the instruction.
This process continues indefinitely
until HALT instruction is
encountered.
Memory-Reference Instructions
In order to specify the
microoperations needed for the
execution of each instruction, it
is necessary that the function
that they are intended to
perform be defined precisely.
Some instructions have an
ambiguous description. This is
because the explanation of an
instruction in words is usually
lengthy, and not enough space is
available in the table for such a
lengthy explanation.
Input Output Interrupt

PSW : Program Status Word


Questions
• What are instruction codes and how do they relate to computer instructions?
• What are computer registers and what role do they play in a computer system?
• Can you provide an overview of the different types of computer instructions?
• How do timing and control mechanisms work in a computer system?
• What is the instruction cycle and what are its main stages?
• Can you explain memory reference instructions and their role in computer
operations?
• What is the purpose of input and output interrupts in a computer system?
• How do interrupts improve the efficiency of input and output operations?
• What are the key differences between memory reference instructions and
input/output instructions?
• How do modern computer architectures handle timing and control to optimize
performance and power consumption?

You might also like