- Back to Home »
- CS501 Assignment no 2 Fall 2012 Full Solution
Posted by : Anonymous
Saturday, 1 December 2012
Q. Total Marks = 15
In assignment # 1 you were asked to write an SRC assembly language program to evaluate the given expression i.e. f = 4(k+32) + 16(g-h)
The sequence of instructions is given and you need to find out the hexadecimal memory contents of all the instructions in the given table except which is not required, accordingly.
Label
|
Address
|
Value
|
k
|
300
|
Unknown
|
g
|
302
|
Unknown
|
h
|
304
|
Unknown
|
f
|
306
|
Unknown
|
Memory Address
|
Memory
Contents
|
Hexadecimal Memory Contents
|
400
|
ld R1,g
| |
402
|
ld R2,h
|
Not Required
|
404
|
sub R3,R1,R2
| |
406
|
shl R7,R3,4
| |
408
|
ld R4,k
|
Not Required
|
410
|
addi R6,R4,32
|
Not Required
|
412
|
shl R8,R6,2
|
Not Required
|
414
|
add R9, R8,R7
| |
416
|
st R9,f
|