Recitation 2
Recitation 2
Computer Organization
Recitation 2
Spring 2024
23.05.2024
QUESTION 1-a
(a) In accord with the given CPU organization, implement
memory subtract (MES) that subtracts the value of AC
register from the given address at the memory, and
write the result to the next address:
M[EA + 1] ß M[EA] - AC
𝐷𝑅 ← 𝑀 𝐴𝑅 , 𝐴𝐶 ← 𝐴𝐶′
2’s complement of AC
𝐴𝐶 ← 𝐴𝐶 + 1, 𝐴𝑅 ← 𝐴𝑅 + 1
𝐴𝐶 ← 𝐴𝐶 + 𝐷𝑅
𝐷𝑅 ← 𝐴𝐶
𝑀[𝐴𝑅] ← 𝐷𝑅
𝐷𝑅 ← 𝑀 𝐴𝑅 , 𝐴𝐶 ← 𝐴𝐶′
SOLUTION 1-a 𝐴𝐶 ← 𝐴𝐶 + 1, 𝐴𝑅 ← 𝐴𝑅 + 1
𝐴𝐶 ← 𝐴𝐶 + 𝐷𝑅
0010000 = 16 (decimal)
𝐷𝑅 ← 𝐴𝐶
𝑀[𝐴𝑅] ← 𝐷𝑅
ORG 16
MES: READ, COM U JMP NEXT
INCAC, INCAR U JMP NEXT
ADD U JMP NEXT
ACTDR U JMP NEXT
WRITE U JMP FETCH
QUESTION 1-b
(b) Convert your micro-program from part (a) into
machine codes using codes that are given in
Figures 1 and 3.
SOLUTION 1-b
Show the contents of the registers along with the corresponding RTL
statements after the positive
transition of each clock pulse using a chart.
MEMORY
Address Content
1B1 52FF
SOLUTION 2 … …
2FF 0B43
Time Microoperation PC AR IR I SC
… …
T0 AR ß PC 1B1 1B1 - - 1
B43 0DFF
T1 IR ß M[AR], 1B2 1B1 52FF - 2
PCßPC+1 PC 1B1
T2 Decode ß IR[12-14] 1B2 2FF 52FF 0 3
AR ß IR[0-11]
I ß IR[15]
T3 Nothing 1B2 2FF 52FF 0 4
T4 M[AR] ß PC 1B2 300 52FF 0 5
AR ß AR +1
T4 PC ß AR, SC ß 0 300 300 52FF 0 0
BSA = Branch
and Save
Address
QUESTION 3-a
Destreg: 101
Srcreg1: 000 à R0
Srcreg2: 000
Not used: 00
M[SP] ß R0, SP ß SP - 1
Push content of R0 to Stack.
QUESTION 3-b
M[SP] ß R0:
• OutASel = 00
• FunSelALU = Transfer A
• OutCSel = 11
• MuxBSel = 00
• MemLoad = 1
SP ß SP – 1
• FunSel = 10
• RegSel = 111
QUESTION 4
RTL: Symbolic:
ORG 0x28
; ELSE BLOCK
ELSE, LDA 300 ; Load value at 0x300 into AC
STA 400 ; Store AC at 0x400
; Set *number1 = 0
ENDIF, CLA ; Clear AC
STA 300 ; Store 0 at 0x300
; Set *number2 = 0
STA 350 ; Store 0 at 0x350