-
Number Representations: Give representations for 4310 in each
of the following forms (6 points):
- as an ASCII string on a Hawk machine,
packed into a 16 bit word _____________________________
- as a BCD number shown in binary
most significant digit first _____________________________
- as a binary number __________________________________
- as an 8-bit two's complement binary
number shown in hexadecimal _________________________
- as an 8-bit unsigned fixed point
binary number with 2 places after
the point, shown in hexadecimal ________________________
- as a 16-bit floating point number with
a sign bit for the mantissa, a 7 bit
biased exponent, and an 8-bit fixed
point binary fraction to complete the
mantissa, shown in binary _____________________________
-
What is the difference between an interrupt, a trap and a procedure call?
All three involve a transfer of control to some routine and a transfer of
control back to the original program! Your answer must be short and general,
not with reference to any specific machine and discussing only the differences
between these control structures! (3 points)
___________________________________________________________________
___________________________________________________________________
___________________________________________________________________
___________________________________________________________________
___________________________________________________________________
-
Recursion and calling sequences:
Using the calling sequence of your choice, write Hawk assembly code
equivalent to the following code, making sensible assumptions
about the definition of symbolic names for node fields (pointed to
by t).
(4 points).
reverse(t) procedure reverse(t:noderef)
struct node * t var temp:noderef;
{ begin
struct node * temp if t <> nil then begin
if (t != NULL) { reverse( t^.left );
reverse( t->left ); reverse( t^.right );
reverse( t->right ); temp := t^.left;
temp = t->left; t^.left := t^.right;
t->left = t->right; t^.right := temp;
t->right = temp; end;
} end;
}
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
-
Arrays and multiplication: Consider the following equivalent declarations
(in C and Pascal) for the array A:
int A[5][9]; A: array [0..4,0..8] of integer;
Write good Hawk code to fetch A[i,j] into R3, assuming that integers are
32 bits and, R4 and R5 initially hold i and j, and your code is free to
wipe out both R4 and R5 (3 points).
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
-
The IBM Model 1301 Disk Storage System, sold with the IBM 7040 computer in
the early 1960's, had 25 disk platters on a common spindle, with a head
positioning assembly that had 24 access arms arranged like teeth on a comb,
one arm in the gap between two platters, and two heads per arm. The disks
spun at 1790 rpm or about 30 revolutions per second. Each disk surface
had 250 tracks on it, and 8 recording surfaces were reserved for special
purposes (not used for data storage). Each track can hold roughly 2K bytes
of data. (4 points)
- How many cylinders were there? _________________
- How many surfaces were there? __________________
- How many tracks were there? ___________________
- What is the total storage capacity? _________________
- How long would it take to
read all the data on the system? ___________________
- How many bits would you expect there
to be in the cylinder select register? _________________
- How many bits would you expect there
- to be in the surface select register? ___________________
-
Macros and other architectures: Consider a 2's complement binary
computer with 64K 32 bit words of main memory address space, where
there is only one instruction, with the following format:
_______________________________ _______________________________
|_______________________________|_______________________________|
|31 dst 16|15 src 0|
This instruction is a conditional move instruction, moving data from
M[src] to M[dst] when the condition bit is zero; the instruction always
clears the condition bit just before storing the operand.
Instructions are executed in sequence, just as on a typical modern machine.
This machine would be useless if it were not for the fact that all registers
inside the machine are memory mapped!
- FFFF16 -- The program counter
- FFFE16 -- The condition bit is bit 0 at this address
- FFFD16 -- The accumulator (AC)
- FFFC16 -- Data stored here is subtracted from AC
- FFFB16 -- Data stored here is added to AC
- FFFA16 -- The sign bit of AC is bit 0 at this address
Define a SMAL macros for:
- MOVE A,B -- M[A] = M[B] (Note that BR and BPOS do
- BR A -- PC = M[A] not set PC = A, they set
- ADD A -- AC = AC + M[A] PC = M[A]! This makes
- BPOS A -- if AC > 0, PC = M[A] the exam question easier!)
You should use MOVE to help define the others! (4 points)
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________