581305-6 Computer Organization I, 2 ov, final exam 27.3.2001     (toisella puolella suomeksi in English)

Write in each answer sheet: your name and signature, id-number, course name, and page nr/total nr of pages
  1. [15 p] Data representation
    1. Give separately Big Endian ja Little Endian 16-bit representations for decimal numbers +23 and -75 in a machine that uses
      1. signed
      2. two's complement
      3. one's complement
      4. biased by 32767 (Note that 32767=215-1)
      integer representations.
    2. Assume now that we have the most common Big Endian byte order. What floating point value corresponds to 32-bit IEEE standard (8 bit exponent) representation 0x41300000?
      (Prefix "0x" means that the number after that is in hexadesimal notation)
    3. The tkk-91 machine has no floating point instructions. Can one do floating point arithmetics with ttk-91? If "yes", then how? If "no", then why not?
    4. Ttk-91 integer instructions are there for integer computations. What happens if one tries to use them add together a machine instruction and an integer value, for example with the following instructions:
                LOOP    LOAD   R1, LOOP
                        ADD    R1, =1
                        STORE  R1, LOOP
      
      If this leads to an error situation, explain that situation. If this does not lead to an error situation, explain what happens.

  2. [15 p] Virtual memory
    1. Why does virtual memory exist? What problem does it solve? How does paging virtual memory basically work?
    2. What does the concept "page fault" mean and what happens in the system with a page fault?
    3. What is TLB and why is it needed? What does the concept "TLB miss" mean and what happens in the system with a TLB miss?
    4. Give a machine language level example on a situation where a TLB miss occurs but a page fault does not. Give a detailed explanation on which part of instruction execution the TLB miss occurs, and and explanation on why there is no page fault in this case.
    5. Give a machine language level example on a situation where a page fault occurs but a TLB miss does not. Give a detailed explanation on which part of instruction execution the page fault occurs, and and explanation on why there is no TLB miss in this case.

  3. [15 p] Program execution
    1. How does a processor execute machine language programs?
    2. What types of events cause disruptions to the normal order of instruction execution?
    3. How are these disruptions handled?
    4. How does the handling of these exceptional situations relate to subroutine call and subroutine returns? Differences/similarities?

  4. [15 p] Ttk-91 assembly language programming
    We have a 2-dimensional integer array T[4,6] defined at main program level. I.e., the array has 4 words (rows 0,...,3) and 6 colums (columns 0,...,5). Integer variables i and j have been defined on the main program level.
    1. Give assembly language instructions to print the value of element T[i,j].
    2. Give assembly language instructions to print the sum of elements at row i.
    3. Write integer function RowSum(Tbl, iRow), that returns as its value the sum of elements at row iRow in array Tbl. Array Tbl has the same type as array T and it is passed as a call-by-reference parameter. Parameter iRow is passed as a call-by-value parameter.


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