Sap-1 Instruction Set Architecture Workshop
Solutions
Discuss and answer the following questions about the Sap-1 Instruction
Set Architecture.
1. Write a Sap-1 program to perform the calculation ((4+7)-2). Give the
assembly language for the program and then give the machine code translation
in both hexadecimal and binary for each numbered location. Also give your
symbol table mapping labels to addresses.
Solution:
Assembly language Machine code translation Symbol Table
Label Op Arg Loc Hex Bin Label Location
----- --- --- --- --- --- ----- --------
lda x 0 05 0000 0101 x: 5
add y 1 16 0001 0110 y: 6
sub z 2 27 0010 0111 z: 7
out 3 E0 1110 0000
hlt 4 F0 1111 0000
x: dat 4 5 04 0000 0100
y: dat 7 6 07 0000 0111
z: dat 2 7 02 0000 0010
2. Give an exection trace for the assembly program in the previous problem.
Solution:
An execution trace illustrates the state-transformation model of the Sap-1.
The numbers are all in hexadecimal.
machine state
instr pc a out memory contents 16 locations (xx means don't care)
----- -- -- -- --------------------------------------------------
lda 0 - - 05 16 27 E0 F0 04 07 02 xx xx xx xx xx xx xx xx
add 1 4 - same
sub 2 B - same
out 3 9 - same
hlt 4 9 9 same
Sunday, January 25, 2009
Sap-1 Instruction Set Architecture Workshop
Posted by Reema at 6:22 PM
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment