Chapter - 2 Basic Computer Organization and Design: Common Bus
Chapter - 2 Basic Computer Organization and Design: Common Bus
Lecture 2.2
• Common Bus
Basic Computer Organization & Design 2 Registers
11 0
PC
Memory
11 0
4096 x 16
AR
15 0
IR CPU
15 0 15 0
TR DR
7 0 7 0 15 0
OUTR INPR AC
List of 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
Computer Organization Computer Architectures Lab
How registers, memory and I/O device communicates
• Path must be provided to transfer information between these eight registers and memory.
• The number of wires will be excessive if connections are made between the outputs of each register and the
inputs of other register.
• A more efficient way is to use a common bus system using a multiplexer or three state buffer gates.
• The outputs of the seven register and memory is connected to the bus.
• The specific output that is selected for the bus lines at any given time is determined from the binary value of
the selection variables S2, S1, and S0.
Basic Computer Organization & Design 4 Registers
LD INR CLR
PC 2
LD INR CLR
DR 3
LD INR CLR
E
ALU AC 4
LD INR CLR
INPR
IR 5
LD
TR 6
LD INR CLR
OUTR
Clock
LD
16-bit common bus
7
Lecture Outline
—Computer Instructions
—Addressing Modes
—Computer Instructions
—Timing and Control
—Instruction Cycle
Mano’s Basic Computer
Instruction Format
1514 1211 0
I Opcode Address
Addressing
mode
Mano's Computer: Instructions Formats
Each instruction occupies one Memory Words (16 bits).
Bit 15 of the instruction specifies the addressing mode (0: direct
addressing, 1: indirect addressing)
15 12 11 0
MODES
• The address field of an instruction can represent either
— Direct address: the address filed indicates the address of an operand, or
— Indirect address: the address filed indicates the address of address of an operand or
operand accessed indirectly.
Direct addressing Indirect addressing
22 0 ADD 457 35 1 ADD 300
300 1350
457 Operand
1350 Operand
+ +
AC AC
15
BASIC COMPUTER
INSTRUCTIONS
Hex Code
Symbol I=0 I=1 Description
AND 0xxx 8xxx AND memory word to AC
• Only 3 bits are used for
ADD 1xxx 9xxx Add memory word to AC opcode. It may seem that
LDA 2xxx Axxx Load AC from memory
STA 3xxx Bxxx Store content of AC into memory the computer is restricted
BUN 4xxx Cxxx Branch unconditionally to 8 operations.
BSA 5xxx Dxxx Branch and save return address
ISZ 6xxx Exxx Increment and skip if zero
3x8
decoder
7 6543 210
D0
I Combinational
D7 Control Control
logic signals
T15
T0
15 14 . . . . 2 1 0
4 x 16
decoder
T0 : AR = PC
Timing and Control
• Step 2: How do we obtain the instruction from
memory at T1?
– The instruction code is transferred immediately to the
Instruction Register (IR)
T1 : IR = M[AR] , PC = PC + 1
Memory
Data bus
INC
M[AR] IR LD PC
CPU bus
AR LD
Address bus
Timing and Control
• Step 3: How do we decode the instruction intention (ie.
meaning, operational
NOTE:
definition) at T2?
–AllThe OpCode, Mode and Address field bits all serve as inputs
instructions share the steps T0,
to the Control Logic Gates that select the specific instruction
T1 and T2.
semantics
However, depending on what each
• Direct
specific addressing
instruction the next steps
will addressing
• Indirect various.
• CPU register addressing
• Input
• Output
2 1 0
Signal the SC to
3x8 DEC advance (INC) to
7 6 5 4 3 2 1 0 next timing
value, or reset.
Control
Control
Logic
Outputs
Timing inputs Gates
F E D C B A 9 ... 1 0
4x16 DEC
3 2 1 0
4-bit INC
Sequence
Counter (SC) CLR
INSTRUCTION CYCLE
24
Instruction Cycle
T1
S2
T0 S1 Bus
S0
Memory
7
unit
Address
Read
AR 1
LD
PC 2
INR
IR 5
LD Clock 25
Common bus
Instrction Cycle
T0
AR PC
T1
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
D'7IT3: AR M[AR]
D'7I'T3: Nothing
26
D7I'T3: Execute a register-reference instr.
D7IT3: Execute an input-output instr.
Instruction Cycle
AR = 135 135 21
136 Subroutine PC = 136 Subroutine
29
1 BUN 135 1 BUN 135
Memory Memory
Memory Reference Instructions
• Branch UNconditional instruction
– I = 0 :: Replace PC by address in IR(0-11)
– I = 1 :: Replace PC by the address found at the address in IR(0-11)
• That is :: PC = M[ M[ IR(0-11) ] ]
Operation Codes
Direct Indirect
I=0 I=1 Mnemonic RTL
4 C BUN AR = IR(0-11)
PC = AR
Memory Reference Instructions
• Branch and SAve instruction
– Used for programming subroutine calls
Operation Codes
Direct Indirect
I=0 I=1 Mnemonic RTL
5 D BSA AR = IR(0-11)
M[AR] = PC , PC = AR + 1
M M
Return addr.
Subr. entry instr. Subr. entry instr.
Memory Reference Instructions
• Increment and Skip if Zero instruction
– Used to implement a counter based <do-while> construct
ISZ: Increment and Skip-if-Zero
D6T4: DR M[AR]
D6T5: DR DR + 1
D6T4: M[AR] DR, if (DR = 0) then (PC PC + 1), SC 0
Memory-reference instruction
D0 T 4 D1 T 4 D2 T 4 D 3T 4
DR M[AR] DR M[AR] DR M[AR] M[AR] AC
SC 0
D0 T 5 D1 T 5 D2 T 5
AC AC DR AC AC + DR AC DR
SC 0 E Cout SC 0
SC 0
D4 T 4 D5 T 4 D6 T 4
PC AR M[AR] PC DR M[AR]
SC 0 AR AR + 1
D5 T 5 D6 T 5
PC AR DR DR + 1
SC 0
D6 T 6
M[AR] DR
If (DR = 0) 33
then (PC PC + 1)
SC 0
EXERCISE
An instruction at address 021 in the basic computer has I
= 0, an operation code of the AND instruction, and an
address part equal to 083(all are in hexadecimal). The
memory word at address 083 contain an operand B8F2
and the content of AC is A937. Go over the instruction
cycle and determine the contents of the following
registers at the end of the execution phase: PC, AR, DR,
AC, and IR. Do the problem for all memory reference
instructions.
35