Assignment 3, due Sep 12

Part of the homework for CS:2630 (22C:60), Fall 2014
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 (usually Friday). 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. A Problem: Consider this SMAL code:
            B       #D5
            B       #EF
            B       #E4
            T       #654321
            B       #33
            B       #54
    

    a) Write a sequence of SMAL H (halfword) directives that loads the same data in memory. The tricky part here is the order of the bytes in a halfword. (0.5 points)

    b) Write a sequence of SMAL W (word) directives that loads the same data in memory. The tricky part here is the order of the halfwords in a word. (0.5 points)

    c) Write a sequence of SMAL Hawk machine instructions equivalent to the above. The instructions you need are all discussed in the early part of Chapter 4. (0.5 points)

    d) If the Hawk CPU executed this sequence of machine instructions, what if any registers would be changed, and how would they change. (0.5 points)

    Suggestion: You can gain some insight by assembling the SMAL code given above and then (without linking) running the Hawk processor on this code. Do not hit the r key to make the Hawk run, but rather, hit the s key to make it execute just one instruction at a time, and watch how things change as you do so.

  2. A problem: Write a sequence of SMAL Hawk instructions that stores the ASCII letter a in memory location FF00010816. You will find that there are two challenges here: First, loading the address FF00010816 into a register (it is too big for an LIL instruction), and second, storing the letter in that address. (1.0 points)

    Suggestion: You can gain some insight by assembling your SMAL code (using the "hawk.h" include file), and then (without linking) running the Hawk processor on this code. Do not hit the r key to make the Hawk run, but rather, hit the s key to make it execute just one instruction at a time, and watch how things change as you do so. Note that the hexadecimal address used for this problem is in the I/O part of the Hawk memory.