Computer Organization I, Spring 2011, Exercise 2

You are expected to (try to) solve the problems on your own or with your study team before the meeting.

The issues of the question 4 are covered in web lectures 1, 2, and 3.

Problems:

  1. Memory reference modes. Assume that for each instruction below the starting point is the state given in the table. For each instruction, please give the effective memory address and either the modified register contents or the address and the contents of the modified memory location. If some instructions are not legal, give explanation for it.
    Registers
    Memory   Symbol table
    Registers, memory, and symbol table
    R0 104   0     Tbl 200
    R1 10   ...     X 10
    R2 201   10 200   One 1
    R3 200   11 300      
    R4 11   ...        
    R5 0   200 3000      
    SP=R6     201 10      
    FP=R7     ...        
          LIMIT        
    1. LOAD R4, 200
    2. LOAD R3, One(R1)
    3. LOAD R3, =One(R1)
    4. STORE R0, One(R1)
    5. STORE R2, @9(R3)
    6. LOAD R0, @R1
    7. LOAD R1, @(R1)
    8. STORE R1, @(R1)
    9. STORE R0, R1
    10. LOAD R1, =X(R0)
    11. STORE R2, =One

  2. Ttk-91 computer and its simulator
    1. What data types can be processed in ttk-91 computer at machine instruction level? Are there data types, that can be processed at machine instruction level with some modern computers, but not with ttk-91?
    2. What different methods are there to reference data in memory with ttk-91 computer at machine instruction level?
    3. Can one machine instruction modify both the contents of a register and memory? How or why not?
    4. How large number will fit into the constant part of the ttk-91 instruction? What can be done, if a bigger number is needed?
    5. Assume that there were 256 registers in ttk-91 instead of just 8. What effect would this have for the machine instruction structure?
    6. Assume that we add 46 new machine instructions to process various length integers and floating point values, truth values, characters and character strings. What effect would this have for the machine instruction structure?
  3. Arrays and records
    1. Most programming languages implement 2-dimensional arrays row-wise. Why would one do it this way? Will one save memory? Is the solution faster than storing data column-wise? Why?
    2. Assume that you have 1-dimensional array Person, elements of which are 5-field records {id, height, weight, grade, level}. Give ttk-91 instructions to implement assignment "X = Person[i].grade".
    3. Give ttk-91 instructions to implement assignment "X = T3D[i][j][k]", where T3D is 3-dimensional array stored row-wise.
  4. [2 hwp] Titokone and TitoTrainer
    1. Learn to use Titokone and TitoTrainer.
    2. Do level A TitoTrainer problems a-050, a-100, a-110 and a-150. You may want to run the programs (defined in TitoTrainer) first in Titokone and only then in TitoTrainer. Titokone gives you better error messages and has better software development environment. You may use your own study circle for consulting, but try to solve problems independently.
    3. If you want, you may do all other level A TitoTrainer problems.


Tiina.Niklander@cs.helsinki.fi