Assignment 3, due Jun 19

Part of the homework for CS:2630, Summer 2018
by Douglas W. Jones
THE UNIVERSITY OF IOWA Department of Computer Science

On every assignment, write your name legibly as it appears on your University ID card! Homework is due on paper at the start of class on the day indicated (Tuesday or Thursday). Exceptions will be made only by advance arrangement (excepting "acts of God"). Late work must be turned in to the TA's mailbox (ask the CS receptionist in 14 MLH for help). Never push homework under someone's door!

  1. Background: Here is a sequence of Hawk instructions, expressed in SMAL
            USE     "hawk.h"
    .       =       0
            LIS     R3,'a'
            ADDSI   R3,#2
            ADDI    R4,R3,-99
            ADD     R3,R3,R4
            END
    

    a) What registers does this (small and useless) Hawk program change, and what values does it put in them? Give the values in binary. (0.6 points)

    b) Assemble the above instructions, by hand or by machine, and show how the program is represented in the Hawk memory. Show the result as a sequence of 32 bit words, expressed in hexadecimal. Note that it is entirely fair to ask a question like this on an exam, so you should learn to convert assembly language to binary or hex by hand. For a homework like this, you can check your work by using SMAL. (1.0 points)

  2. Background: Here is a sequence of halfwords in the Hawk memory, given in hex:
            00E3
            0100
            00D4
            A3F4
    

    a) If the Hawk CPU's program counter points to the first halfword in this sequence, what instructions does it see? Note: You can do this by hand using the appendix at the back of the Hawk manual that gives a list of Hawk instructions listed in numeric order, and you can also check your work by putting this sequence of halfwords into the Hawk emulator's memory and letting it show you the instructions it recognizes. (1.0 points)

    b) What does this program fragment do? That is, what registers or memory locations does it change and what values does it put in them? (0.5 points)