Assignment 12, due Dec. 2

Part of the homework for 22C:60 (CS:2630), Fall 2011
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. Problems from Chapter 13 of the notes:

    r) (1.0 points)

  2. Background: Consider the following subroutine. This subroutine only works correctly if it is assembled into RAM, so assume that is done.
    SL:     ; given R3 a value to be shifted left
            ; given R4 is an integer between 1 and 16 (inclusive)
            ; returns R3 shifted left R4 places
            ; wipes out R4,R5
            TRUNC   R4,4
            SL      R4,8	   ; put R4 into the shift-count field
            LIL     R5,#00A3   ; SL R3,16
            OR      R4,R5      ; compose an instruction that does SL R3,R4
            STORE   R4,SLINST  ; put it in RAM
            BR      SLINST     ; go execute it
            ALIGN   4
    SLINST: SL      R3,16      ; this instruction will be changed
            NOP
            JUMPS   R1
    

    a) Why is the ALIGN directive required and why is the NOP required? There is one explanation for both of these. (0.4 point)

    b) This code used to work on a bottom-of-the-line HAWK processor. Then you bought a machine that had a simple write-through L1 cache between the CPU and memory. Would you expect it to continue working? Why? (0.4 point)

    c) This code used to work on a bottom-of-the-line HAWK processor. Then you bought a machine that had separate I-cache and D-cache. Would you expect it to continue working? Why? (0.4 point)

  3. Background Problems l) in Chapter 14 of the notes asks how the Hawk memory management unit can be used to prevent user programs from directly accessing any input-output device. The first part of the answer is obvious: Set up the MMU so that no virtual address maps to memory locations FF00000016 and up. Here, we are interested in more subtle questions:

    a) How can we prevent the user program from changing the contents of the MMU? Major parts of the answer to this question depend on material presented in previous chapters of the notes. (0.4 point)

    b) Suppose we wanted to be able to specifically allow user programs to access just some Hawk devices but not others, with a different subset of the devices accessible to each program. If we did not have this constraint, each device register could be arbitrarily assigned any unused 32-bit address above FF00000016. How should addresses be assigned to the different device registers of each device in order to conform to this constraint. (0.4 point)