Professional Documents
Culture Documents
Computer Organization:
Instruction codes, Computer Registers, Common Bus System, Computer Instructions,
Timing and Control, Instruction Cycle, Memory Reference Instructions, Input-output
and Interrupt
Content
Instruction codes
Computer Registers
Computer Instructions
Instruction Cycle
15 0
4095
Instructions
Program
A sequence of (machine) instructions
(Machine) Instruction
A group of bits that tell the computer to perform a specific operation (a sequence of micro-operation)
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
Instruction Format
Instruction Format 15
I
14
Opcode
12 11
Address
0
Addressing
Instruction Codes mode
A group of bits that tell the computer to perform a specific operation (a sequence of micro-operation)
A computer instruction is often divided into two parts
An opcode (Operation Code) that specifies the operation for that instruction
Sometimes called as Macro-operation
An address that specifies the registers and/or locations in memory to use for that operation
In the Basic Computer, the memory contains 4096 (= 2 12) words, we needs 12 bit to specify
which memory address this instruction will use
In the Basic Computer, bit 15 of the instruction specifies the addressing mode
0: direct addressing
1: indirect addressing
Since the memory words, and hence the instructions, are 16 bits long, that leaves 3 bits for the
instruction’s opcode
Instruction Format …
Sometimes the address bit of instruction code represent various different information,
classified into different Instruction formats:
Immediate Instruction: when second part of instruction specifies operand
When second part of address specify address:
Direct Addressing: second part of instruction specifies address of an operand
Indirect Addressing: second part of instruction designates an address of a memory in
which the address of the operand is found
Addressing Mode
The address field of an instruction can represent either
Direct address: the address in memory of the data to use (the address of the operand)
Indirect address: the address in memory of the address in memory of the data to use (Effective
Address)
300 1350
457 Operand
1350 Operand
List of BC Registers
DR 16 Data Register Holds memory operand
AR 12 Address Register Holds address for memory
AC 16 Accumulator Processor register
IR 16 Instruction Register Holds instruction code
PC 12 Program Counter Holds address of instruction
TR 16 Temporary Register Holds temporary data
INPR 8 Input Register Holds input character
OUTR 8 Output Register Holds output character
Content
Instruction codes
Computer Registers
Computer Instructions
Instruction Cycle
AR 1
LD INR CLR
PC 2
LD INR CLR
DR 3
AC on the bus (S2, S1, S0 = 100), enabling LD
LD INR CLR
input of DR
E
Transferring the content of DR through adder and ALU AC 4
logic circuit into AC, enabling LD input of AC LD INR CLR
All during the same clock cycle
INPR
IR 5
LD
TR 6
LD INR CLR
OUTR
Clock
LD
Common Bus System …
Three control lines, S2, S1, and S0 control which register the bus selects as its input
S2 S1 S0 Register
0 0 0 x
0 0 1 AR
0 1 0 PC
0 1 1 DR
1 0 0 AC
1 0 1 IR
1 1 0 TR
1 1 1 Memory
Either one of the registers will have its load signal activated, or the memory will have its write signal
activated
Will determine where the data from the bus gets loaded
Memory places its 16 bit output on bus when read input is activated and S2, S1, S0 = 111
Common Bus System …
4 register DR, AC, IR, TR is 16 bit. The 12-bit registers, AR and PC, have 0’s loaded onto
the bus in the high order 4 bit positions
When the 8-bit register OUTR is loaded from the bus, the data comes from the low order 8
bits on the bus
INPR – connected to provide information to bus
– receives character from input device and transfer to AC
OUTR – can only receive information from bus
– receives a character from AC and delivers to Output device
Three types of input to AC:
from AC: complement AC, Shift AC
from DR: arithmetic and logic microoperation
from INPR
Bus lines connected to inputs of 6 registers and memory
If the memory size is 64K , then how many bits required to
represent its location
A. 10
B. 12
C. 14
D. 16
If the memory size is 64K , then how many bits required to
represent its location
A. 10
B. 12
C. 14
D. 16
In the instruction binary code if the 15th (MSB) is 1 then it
indicates
A. Immediate Addressing
B. Direct Addressing
C. Indirect Addressing
D. Effecting Addressing
In the instruction binary code if the 15th (MSB) is 1 then it
indicates
A. Immediate Addressing
B. Direct Addressing
C. Indirect Addressing
D. Effecting Addressing
In basic computer, PC is of how many bits register
A. 8
B. 12
C. 14
D. 16
In basic computer, PC is of how many bits register
A. 8
B. 12
C. 14
D. 16
Content
Instruction codes
Computer Registers
Computer Instructions
Instruction Cycle
However register – reference and input – output instructions use remaining 12 bit as part of
operation code
Computer Registers
Computer Instructions
Instruction Cycle
Control Unit (CU) of a processor translates from machine instructions to the control signals
for the microoperations that implement them
Control units are implemented in one of two ways
Hardwired Control
CU is made up of sequential and combinational circuits to generate the control signals
Advantage: optimized to provide fast mode of operations
Disadvantage: requires changes in wiring if design has been modified
Microprogrammed Control
A control memory on the processor contains microprograms that activate the necessary control signals
We will consider a hardwired implementation of the control unit for the Basic Computer
Timing and Control
Instruction register (IR)
15 14 13 12 11 - 0
Other inputs
3x8
decoder
7 6543 210
D 0
I Combinational
D 7 Control Control
logic signals
T 15
T0
15 14 . . . . 2 1 0
4 x 16
decoder
T0 T1 T2 T3 T4 T0
Clock
T0
T1
T2
T3
T4
D3
CLR
SC
Example
After an instruction is executed, the cycle starts again at step 1, for the next instruction
This process continues indefinitely unless a HALT instruction is encountered
Note: Every different processor has its own (different) instruction cycle
Fetch and Decode
Initially PC loaded with address of first instruction and Sequence counter cleared to 0,
giving timing signal T0
After each clock pulse, SC is incremented by 1 (T0, T1, T2, and so on)
Fetch and Decode
At T0: T1
S2
PC 2
INR
IR 5
LD
Clock
Common bus
Determine the Type of Instructions
Start
SC <-- 0
AR <-- PC
T0
Execute a register-reference Instruction
T1 Execute a Input-output Instruction
IR <-- M[AR], PC <-- PC + 1
T2
Decode Opcode in IR(12-14),
AR <-- IR(0-11), I <-- IR(15)
T3 T3 T3 T3
Execute Execute AR <-- M[AR] Nothing
input-output register-reference
instruction instruction
SC <-- 0 SC <-- 0 Execute T4
memory-reference
instruction
SC <-- 0
Register–Reference Instructions
e.g.