A good answer might be:

0000 1111 1010 0101  0FA5
0011 0110 1000 1111  368F
---- ---- ---- ----  ----
0011 1111 1010 1111  3FAF

Running the Program

To run the program:

  1. Create a source file.
  2. Start SPIM.
  3. Load the source file.
  4. Set simulator switches (only the following matter at this time):
    • ON --- general registers in hexadecimal.
    • ON --- bare machine.
    • OFF --- allow pseudo instructions.
    • OFF --- load trap file.
  5. Initialize the PC to the first instruction address.
  6. Push F10 once per instruction.

The picture shows the result of running the program. The result in $10 is what was expected. The source code is at the right of each line in the code window (not seen in the cropped window of the picture). The version of the code in the middle column gives the bit patterns in decimal.


QUESTION 7:

Here is the complete line for the first instruction from the source window:

[0x00400000]    0x34080fa5    ori  $8, $0, 4005       ori  $8,$0,0x0FA5

Look at the 32-bit machine instruction. Do you see the immediate operand in it?