Exercises
Computer Organization I, HW 2
- Memory reference modes.
Assume that for each instruction below the starting point is the state given in this slide. 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.
- LOAD R4, 200
- LOAD R3, One(R1)
- LOAD R3, =One(R1)
- STORE R0, One(R1)
- STORE R2, @9(R3)
- LOAD R0, @R1
- LOAD R1, @(R1)
- STORE R1, @(R1)
- STORE R0, R1
- STORE R2, =One
- Ttk-91 computer and its simulator
- 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 tt-91?
- What different methods are there to reference data in memory with ttk-91 computer at machine instruction level?
- Can one machine instruction modify both the contents of a register and memory? How or why not?
- How large number will fit into the constant part of the ttk-91 instruction? What can be done, if a bigger number is needed?
- Assume that there were 256 registers in ttk-91 instead of just 8. What effect would this have for the machine instruction structure?
- 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?
- Arrays and records
- 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?
- Assume that you have 1-dimensional array Person, whose elements are 5-field records {id, height, weight, grade, level}. Give ttk-91 instructions to implement assignment "X = Person[i].grade".
- Give ttk-91 instructions to implement assignment "X = T3D[i][j][k]", where T3D is 3-dimensional array stored row-wise.
- [2 hwp] Titokone and TitoTrainer
- Learn to use Titokone and TitoTrainer.
- 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. This way you receive better error messages and have better software development environment. You may use your own study circle for consult, but try to solve problems independently.
- If you want, you may do all other level A TitoTrainer problems for project 3.
Teemu Kerola