22c:060 - Homework 3

  1. The addresses to be evaluated start at 9170710 (also 1663B16 or 101100110001110112): 91707, 91708, 91709, 91710. The validity of the address for byte, halfword and word addresses is determined by the two least significant bits of the address in base-2 (or by the result of the address modulo 4) [see page 33 of the course notes]

    Address Location Valid Byte? Valid Halfword? Valid Word?
    91707
    (91707 % 4 = 3)
    Yes No No
    91708
    (91708 % 4 = 0)
    Yes Yes Yes
    91709
    (91709 % 4 = 1)
    Yes No No
    91710
    (91710 % 4 = 2)
    Yes Yes No

  2. The address 0x1663B (9170710) is in the Hawk's RAM. [see page 35 of the course notes]
  3. The HW3.l file should look like this, but with the student's name in the place of "Student":

    ^LSMAL32 (rev  9/03)              "Student"                    00:37:59  Page  1
                                                                 Wed Sep 19 2007
    
                                 1  TITLE   "Student"
                                 2
                                 3  ; The following assembles into 100 to 107
                                 4  .       =       100
                                 5
     000064: 00                  6          B       0               ; 100
     000065: FF                  7          B       -1              ; 101
     000066: 0F0F                8          H       #0F0F           ; 102 and 103
     000068: 55555555            9          W       8#12525252525   ; 104 to 107
                                10
                                11          END
                        no errors
        
    1. When the 'A' is added the locations of all subsequent bytes, halfwords and words are offset by 1 byte (become 1 byte higher). This does not matter for bytes, but if the new memory location is no longer even for a halfword, or no longer divisible by 4 for a word, then an aligment problem will occur because the halfword or word will span over two valid halfwords or words. The Hawk does not support non-aligned data so there may be an error when a misaligned program is assembled. [see page 35 of course notes]
    2. The new HW3.l file should look similar to this (added ALIGN directives bolded):

      ^LSMAL32 (rev  9/03)              "Student"                    00:51:43  Page  1
                                                                   Wed Sep 19 2007
      
                                   1  TITLE   "Student"
                                   2
                                   3  ; The following assembles into 100 to 111
                                   4
                                   5          USE     "hawk.macs"
                                   6
                                   7  .       =       100
                                   8
       000064: 00                  9          B       0               ; 100
       000065: FF                 10          B       -1              ; 101
       000066: 41                 11          B       'A'             ; 102
                                  12          ALIGN   2               ; skip to next valid halfword location
       000068: 0F0F               13          H       #0F0F           ; 104 and 105
                                  14          ALIGN   4               ; skip to next valid word location
       00006C: 55555555           15          W       8#12525252525   ; 108 to 111
                                  16
                                  17          END
                          no errors