EE 460N: Lab Assignment 3 Clarifications

  1. What could be the cause of “Warning: Extra bit(s) in control store file ucode3.”?

    This means that the ucode3 file has more than 35 columns. One reason why this can happen is if you've transferred the ucode3 file from Windows to Unix. Run dos2unix program on UNIX machines to remove the extra control characters inserted by Windows. You can do this by typing:

    dos2unix ucode3

    on any LRC Linux machine. If this doesn't work, check to make sure that your ucode3 file has at most 35 columns.

  2. What is CYCLE_COUNT? Is this the counter for memory access?

    CYCLE_COUNT is a global variable used by the simulator to count the number of machine cycles elapsed since the program started execution. Do not change this variable. You will need to use another variable for simulating memory latency.

  3. How do we handle Memory Mapped I/O for this lab?

    You do not need to implement Memory Mapped I/O for this lab.

  4. You do not have to implement the RTI instruction for this lab. You can assume that the input file to your simulator will not contain any RTI instructions.

  5. For this assignment, you can assume that the programmer will always give aligned addresses, and your simulator does not need to worry about unaligned cases.

  6. You may assume that the code running on your simulator has been assembled correctly and that the instructions your simulator sees comply with the ISA specifications, i.e. all instructions are valid and there are no unaligned accesses.

  7. In your code that you write for lab 3, do not assign the current latches to the next latches. This is already done in the shell code.

  8. I am getting values like xFFFFFFFF in my registers when they should be xFFFF instead, why is this?

    The variables in your c program are 32 bit values, so the nubmer -1 is xFFFFFFFF. You need to make sure that when you store values in a variable you mask them properly. For instance you would need to assign var1 to var2 using the statement var1 = var2 & 0xFFFF, or its equivalent var1 = Low16bits(var2). This zeroes out the top 16 bits before writing var2 into var1.

  9. Do we need to implement the TRAP routines?

    No. Whenever a TRAP instruction is processed, after the last state, PC will be set to 0, if you implement the TRAP instruction correctly. The simulator halts whenever PC becomes 0. You are still implementing states 15, 28, and 30 associated with the TRAP instruction.

  10. Why am I not getting the result I expect from a C expression?

    Please read and make sure you understand the precedence of C operators. Examples:

    1. a & b == 0 means a & (b == 0), therefore you might want to write (a & b) == 0
    2. a >> 1 + b means a >> (1 + b), therefore you might want to write (a >> 1) + b
    3. a = b + c? d : e means a = (b + c)? d : e, therefore you might want to write a = b + (c? d : e)
    4. there are other examples from some lab 2 implementations... If you do not want to remember or to think too much about this, just use parentheses!
  11. How do I convert my control store spreadsheet into the ucode3 file to use in my simulator?

    • Windows machine: Once you have filled in the control store spreadsheet, select only the cells that contain the 0s and 1s that form the microinstructions (rows 2-65, columns B-AJ). Choose “copy” from the Edit menu. Open up a new Word document and choose “paste special” from the Edit menu. Then, choose “unformatted text” and click on OK. Finally, select “replace” from the Edit menu. In the “Find what” box, type “^t” (without the quotes); leave the “Replace with” box empty. Click on the “Replace All” button. Save your file as a plain text file with filename “ucode3.” To use this file on a linux machine with the simulator, you will need to change the filename from “ucode3.txt” to “ucode3”. You will also need to run dos2unix on this file (see #7 on How to port code from Windows to sunfire).

    • Linux machine: Use the OpenOffice spreadsheet program (oocalc) to open and fill in the spreadsheet. Select the cells that contain the 0s and 1s that form the microinstructions (rows 2-65, columns B-AJ). Choose “copy” from the Edit menu. Open up a text editor (eg. gedit, gvim, oowriter) and choose “paste” from the Edit menu (with OpenOffice oowriter, select “paste special” and choose “unformatted text”). Do a search and replace, searching for “\t” (without the quotes), and leaving the replace field empty. Save your file as “ucode3”.

  12. If none of the tri-state buffers (GatePC, GateALU, etc.) are driving the bus in a given cycle, please put zero onto the bus in that cycle.