CEG 2136 - Fall 2011 - Final PDF
CEG 2136 - Fall 2011 - Final PDF
CEG 2136 - Fall 2011 - Final PDF
Data register DR
Control Register
(Register bank)
If X1 => it is a register - reference instruction that will T3 X1 : execute an RRI instruction (Table 4)
T3 be executed now T3 X1 : SC ← 0
If(RRI)
X0 or X2 , read the memory address of the T3 IR(6)’ : AR ← PC
operand and place it in AR, and increment PC.
T3 Recall that (X0 + X2 ) = IR(6)’ T3 IR(6)’ S’ : PC ← PC + 1
T4 Read memory address into AR T4 IR(6)’ : AR ← M [AR]
If indirect addressing, read the operand address from T5 X2 : AR ← M [AR]
T5 memory location pointed to by AR
If direct addressing, don’t do anything, as the operand
T5 address is already in AR since T6 T5 X0 : (nothing)
T6 Y0 : DR ← M [AR]
ADD Y0 = IR(6)’ IR(1) IR(0)’
T7 Y0 : AC ← AC + DR , SC ← 0
T6 Y1 : DR ← M [AR]
LDA Y1 = IR(6)’ IR(2)
T7 Y1 : AC ← DR , SC ← 0
T6 : (cycle not used to allow for the
STA Y2 = IR(6)’ IR(3) address bus to stabilize)
T7 Y2 : M [AR] ← AC , SC ← 0
BUN Y3 = IR(6)’ IR(4) T6 Y3 : PC ← AR , SC ← 0
ISZ (assuming that the T6 Y4 : DR ← M [AR]
next instruction is a T7 Y4 : DR ← DR + 1
memory-reference T8 Y4 : M [AR] ← DR
instruction, stored at 2 Y4 = IR(6)’ IR(5) T9 Y4 : if (DR = 0)S’ then (PC ← PC + 1)
memory locations T10Y4 : if (DR = 0)S’ then (PC ← PC + 1)
further down) T10 Y4 : SC ← 0
T6 Y5 : DR ← M [AR]
AND Y5 = IR(6)’ IR(1)’ IR(0)
T7 Y5 : AC ← AC ∧ DR , SC ← 0
T6 Y6 : DR ← M [AR]
SUB Y6 = IR(6)’ IR(1)’ IR(0)
T7 Y6 : AC ← AC − DR , SC ← 0