Exercises
Computer Organization I, HW 3
- Integers. Assume, that desimal number -13 is stored in memory in byte address 0x1230. What are the contents of bytes 0x1230-0x1233, when that number is stored in the following representation:
- 32 bit Big-Endian sign and magnitude
- 32 bit Big-Endian two's complement
- 16 bit Big-Endian two's complement
- 8 bit Big-Endian two's complement
- 32 bit Big-Endian one's complement
- 16 bit Big-Endian biased by 32767
- 32 bit Little-Endian two's complement
- 16 bit Little-Endian two's complement
- 8 bit Little-Endian two's complement
- Floating point numbers
- Give an example of a real number that can be exactly represented as floating point number.
- Give an example of a real number that can not be exactly represented as floating point number. How big is the error?
- What is IEEE floating point representation of desimal number 4.25? Is it exact or not?
- What is binary number 101010.1010 in decimal?
- What is IEEE floating point representation of desimal number 5.1? Is it exact or not?
- Compute the values for expressions "(1.0666668-1.0666666) * 1.23456" and "1.0666668*1.23456 - 1.0666666*1.23456" using some programming language supporting 32-bit IEEE floating points. Insert some output statement in the first expression before the multiplication, (see, e.g.. test.c), so that the compiler would not optimize the code too much. Why are the results different? Which one is correct? Why would using 64-bit IEEE floating point numbers (C:n or Java data type double) remove this discrepancy?
- Assume that programming language MyLan has boolean and floating point data types. For example, one can use boolean or float variables in MyLan programs.
- Ttk-91 does not have such data types. Could one make a MyLan compiler for ttk1, so that one could run MyLan programs in ttk-91? If the answer is "yes", how would one implement boolean operation AND and floating point addition? If the answer is "no", why not?
- How should one expand ttk-91 architecture (hardware) definition so that ttk-91 could execute floating point operations in hardware? Specify precisely all such modifications.
- Memory references and interrupts
- How many memory references is needed to run machine instruction "STORE R1, @5(R2)"? What are they?
- How many memory references is needed to run machine instruction "ADD R4, R5"? What are they?
- How are interrupts implemented in the processor? What happens after the interrrupt is processed?
- Assume that certain application requires its own interrupt handler to be invoked with certain interrrupts. How would one implement this in practice at machine instruction level, i.e., how does one select just that interrupt handler with certain interrupts when this application is running?
- Give an example on a situation where it would be good the disable interrupt handling? How is this done at processor level? What happens if interrupts are disabled very long time?
- Some processors have an option to define whether floating point overflows cause an interrupt or not. What use would such an option be for and how could one utilize it?
- Do level B TitoTrainer problems b-200, b-350 ja b-400.
Teemu Kerola