What could be the cause of “Warning: Extra bit(s) in control store file ucode.”?
This means that the ucode file has more than 35 columns. One reason why this can happen is if you've transferred the ucode 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 ucode ucode
on any LRC SunOS or Linux machine. If this doesn't work, check to make sure that your ucode file has at most 35 columns.
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.
How do we handle Memory Mapped I/O for this lab?
You do not need to implement Memory Mapped I/O for this lab.
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.
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.
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.
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.
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
You need to make sure that when you store values in a variable you mask them properly.
For instance you would need to assign
var2 using the statement
var1 = var2 & 0xFFFF, or
var1 = Low16bits(var2). This zeroes out the top 16 bits before writing
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.
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:
a & b == 0means
a & (b == 0), therefore you might want to write
(a & b) == 0
a >> 1 + bmeans
a >> (1 + b), therefore you might want to write
(a >> 1) + b
a = b + c? d : emeans
a = (b + c)? d : e, therefore you might want to write
a = b + (c? d : e)
How do I convert my control store spreadsheet into the ucode 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 “ucode.” To use this file on a linux machine with the simulator, you will need to change the filename from “ucode.txt” to “ucode”. 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 “ucode”.
The control signals in your ucode file must be encoded according to Tables C.1 and C.2 in Appendix C (also labeled as Tables A.1 and A.2 in the microarchitecture handout distributed in class). For each signal, the first (leftmost) signal value must be encoded as 0, the next value as 1, the value after that as 2 (binary 10) and so on. For example, Table C.1 lists the signal values for the two bit signal ALUK as follows: ADD, AND, XOR, PASSA. This means that ADD must be encoded as binary 00, AND as 01, XOR as 10, and PASSA as 11.
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.