-
Notifications
You must be signed in to change notification settings - Fork 0
RISC16
- Don't forget to add a
NOPafter aMOVI(if you're writing your directly into the simulator). -
JALRdoes not work with a label. - Don't forget to end your code with
HALT
- When writing instructions in the simulator, you first need to press the
Assemblybutton at the bottom before you can run it. If what is in theContentcolumn is not the correct opcode for your ASM command, you probably did not press theAssemblybutton. - Only put ONE
HALTat the end of any code (use BEQ 0,0, to jump to the halt and the end of your code) - In the
REGISTER BANKblock,1and2designate the input operands,Tthe destination (a.k.a. target). - When using a label, don't put a space between the label and the column
:. - Labels should not be alone on a line, place them in front of instructions.
- Labels should not contain any word or part of word that may also be an instruction, like "addition", "nand_this".
- Check you chose the correct exercise.
- Many students will forget that the online simulator will erase the first
2nlines of any uploaded code, wherenis the number of input registers needed for the exercise.
Here are some more considerations about the erasure of the first few lines:
- The online simulator is only needed for specific question, chosen through the drop-down list on the welcome screen.
- The online simulator needs to test the program for different input values, e.g. is 0 * 0 = 0 ? Is 1 * 45 = 45 ?
To do so, it assumes the input operands (1 and 45 hereabove) are stored in some specific registers. The simulator will replace the first few lines of the program with
moviinstructions to load those values in the appropriate registers. Why overwrite the first lines and not prepend the uploaded code? So that the user can use the same trick for the offline simulator: the first lines of the program are themoviinstructions to load the registers.
For example, the question 8 of the first lab tells you that it will add the "unsigned content of 32-bit numbers stored in reg4(MSB), reg3 and reg6(MSB), reg5 and writes the result in reg4(MSB), reg3." This sums up to 4 input registers needed to be filled.
This means that the online simulator will replace the 4 * 2 = 8 instructions (4 registers are used and movi needs 2 opcodes) with movi instructions.
The best way to leverage this behaviour is to mimic it offline: use the first 4 lines (in the case of question 8) to load registers 3 through 6.
Beware, if you insert nop instructions in between your movi, you may not pass the online tests, as some instructions will not be overwritten by the online tool.
Don't leave a label alone on its line, it might pose problem when "assembling" the instructions.
label:
addi 1,1,1 // BAD
label: addi 1,1,1 // GOOD- By the end of the first lab, you should have answered up to question 5.
- Question 3: Don't spend too much time on the graph. The idea is to analyse a full instruction and spot which blocks are active at every half-clock.
- Labs 1 & 2:
risc16.jarorRiSC16_seq.jar. Lab 3:RiSC16asm.jar. Lab 4:RiSC16_pipeline.jar.
In this context, we talk about "cycle per instruction" where a cycle is the time unit needed to get the result from one instruction. For a sequential implementation, one instruction is outputted every cycle (CPI = 1), but it needs 20 half-clock cycles to do so.
However, a pipelined architecture with a CPI = 1 will be faster as each cycle only lasts 14 half-clock cycles.
It would thus be 20/14 = 1.43 times faster.
A higher CPI does not necessarily mean that the architecture is worst, it should put into perspective with the half-clock cycle duration of a cycle.