Assignment 4, due Sept 19

Part of the homework for 22C:60, Fall 2008
by Douglas W. Jones
THE UNIVERSITY OF IOWA Department of Computer Science

Remember to write your name on what you turn in! Homework must be turned in on paper and in class!

Homework

  1. Background: Consider the following 16-bit words. What hawk machine instruction does each of these words represent? (0.2 each)

    a) 00010010001101002 = 123416
    b) 11001101000100102 = CD1216
    b) 10111100110111102 = BCDE16
    b) 10101011110011012 = ABCD16
    b) 11011110111100012 = DEF116

    There are many ways to do this. You can rewrite this data as a sequence of H directives, assemble it with SMAL, load it in the Hawk emulator, and then view memory as machine instructions. Or, look up the instructions in the appendix of the Hawk manual. You can check your work this way.

  2. Background: Consider the following instruction sequence on the Hawk computer:
    	LIS	R1,1
    	ADD	R2,R1,R1
    	LIL	R3,3#10
    	ADDI	R4,R1,3
    	MOVE	R5,R3
    	ADDSI	R5,2#10
    	LIS	R6,0
    	ORIS	R6,6
    

    a) This assembles to a sequence of 10 halfwords in memory. Give the values of those halfwords in hexadecimal. You may use the SMAL assembler to help, but you should learn to do it by hand. (0.1 points per halfword)

    b) After this sequence of instructions has been executed, what values are in what registers. You may use the Hawk emulator to solve this problem, but you should learn to do it by hand. (0.5 points)

  3. Background: Find the definition of the macro for ORIS given in Chapter 4 of the notes, then look at the corresponding parts of the hawk.macs file and note the differences. Your ability to explain these differences will be the foundation for your answers to the following questions:

    a) Explain why the value of the symbol qREGISTERq never matters even though it is used in every reference to a register. (0.3 points)

    If the value of qREGISTERq never matters, why is it there? That is, why not use the simple version in Chapter 4 of the notes instead of the version in hawk.macs with its strange use of this odd symbol? (This is a deliberately hard question.) (0.2 points)