ASSIGNMENT # 2(Solution)
CS501
QUESTION.1
Specify the condition for the branch instruction and the status of
the PC after the branch instruction executes with a true branch condition.
Solution:
Instruction
|
Condition
|
PC status
|
Jump[20]
|
Always
|
PC← PC+20
|
Jnz
r3,[33]
|
If
R[3] ≠ 0
|
PC← PC+33
|
Jz r1,[16]
|
If
R[1] = = 0
|
PC← PC+16
|
Jpl
r5,[37]
|
If
R[5] ≥0
|
PC← PC+37
|
Jmi
r7,[40]
|
If
R[7] < 0
|
PC← PC+40
|
Q.2
Identify the addressing modes and Register Transfer Language (RTL)
description (meaning) for the given Falcon-A instructions
Solution:
Instruction
|
Addressing Mode
|
RTL description(meaning)
|
Load
r3,[r5+27]
|
Displacement
|
R[3]
← M[R[5] +27]
|
Jnz
r5,[15]
|
Relative
|
(If
R[5] ≠ 0): PC← PC+15
|
Shiftl
r3,r2,5
|
Immediate
|
Shift
r2 left 5 times and store in r3
|
Add
r6,r5,r7
|
Register
|
R[6]
← R[5] + R[7]
|
Subi
r4,r3,17
|
Immediate
|
R[4]
← R[3] -17
|
No comments:
Post a Comment
“You can't change the past, but you can ruin the present by worrying about the future”