581305-6 Computer Organization I, 2 cu, course exam 13.12.2004
Write on each answer sheet:
your name and signature, id number,
course name, and page nr/total nr of pages
- [12 p] Data representation
- [6 p]
Assume that we have the most common
Big Endian byte order. If the byte address 184 has the value OxFF and the byte
address 185 has the value OxD7,
what is the decimal number these bytes together represent
in a machine
that uses
- two's complement
- one's complement
- biased by 32767 (Note that 32767=215-1)
integer representations.
(Prefix "0x" means that the number after that
is in hexadecimal notation.)
- [3 p] What is the decimal number 11.325 in binary representation?
- [3 p] What is the 32-bit IEEE floating point standard representation of
decimal number 11.325?
[12 p] Compiling, loading, and linking. Assume that a program is
written in an ordinary programming language (for example C or Pascal).
- [6 p] What happens while compiling the program?
- [3 p] What happens while linking the program?
- [3 p] What happens while loading the program?
[12 p] Program execution
- How does a processor execute machine language programs?
- What types of events cause disruptions to
the normal order of instruction execution?
- How are these disruptions handled?
- How does the handling of these exceptional
situations relate to subroutine call and
subroutine returns? Differences/similarities?
[12 p] Ttk-91 assembly language programming
We have an
integer array T[24] defined at the main program level.
I.e., the array has 24 elements (elements 0,...,23).
- [2 p]
Give a definition for a table T.
- [4 p] Implement a function Count(S, N, Pos, Neg), which returns the count of
positive elements of the table S consisting of N elements.
In addition the function should return in the out parameter Pos
the sum of positive
elemets and in the out parameter Neg the absolute value of
the sum of the negative elements.
Follow the subroutine (function) implementation and call mechanism
recommended.
The parameters S, Pos, and Neg
are given as call-by-reference parameters, and the parameter N as
a call-by-value parameter.
- [3 p] Give ttk-91 symbolic assembly language instructions that will use
function Count to print the count and the sum of the positive elements
in the table T (which is defined at the main program level).
Follow the subroutine (function) implementation and call mechanism
recommended.
The parameters S, Pos, and Neg
are given as call-by-reference parameters, and the parameter N as
a call-by-value parameter.
- [3p] Draw a picture of the activation record stack
-
after the call of
the Count in b) (after the execution of the CALL instruction)
- when the value of the stack pointer SP is greatest during execution of the
function Count
- before the
execution of the EXIT instruction of the function Count
- after the
execution of the EXIT instruction of the function Count.
The TTK-91 assembly language instructions are:
NOP, STORE, LOAD,
IN, OUT, ADD, SUB, MUL, DIV, MOD, AND, IR, XOR, SHL,
SHR, COMP, JUMP, JNEG, JZER, JPOS, JNNEG, JNZER, JNPOS,
JLES, LEQU, JGRE, LNLES, LNEQU, NGRE, CALL, EXIT,
PUSH, POP, PUSHR, POPR, SVC