4 Lab 1 Assignment
4.1 Steps To Prepare for Doing Lab 1
This part is only for students at NCKU.
After accepting Lab 1 on the GitHub Classroom, you should have your own repository which contains the code template for lab 1. Please clone the owned repository into your docker development environment under the path /home/ubuntu/workspace.
4.2 How to Start to Write Codes?
In most cases, the only file you must modify is src/core.c. More precisely, you should complte the missing parts of the two functions Core_decode() and Core_execute().
4.3 After Completing Coding
After finishing the implementation of the ISS, you can now compile it and run the unit tests. There are a few steps to do to run unit tests:
Compile the unit tests itself
Compile the ISS you implement

Build the ISS Execute
ctestto run all the 37 instruction unit testsCautionPlease make sure that you are inside the folder
build.
Run CTest
Besides, you can run the command below if you want to run a specific test case (e.g., runs ADD instruction only):
Furthermore, you can also run tests in the unit of a opcode-type (e.g., runs OP-IMM opcode-type instructions only):
As the minimal requirement, you should pass the 37 unit tests for instructions we implement in the ISS.
The expressions add\$ and ^OPIMM_[a-z]+ are related to regular expression and escape character. If you are interested in regular expression, you can use the website regex101 to test and verify the regex patterns you write.
4.4 What You Must Do To Complete The Assignment?
There are two parts you must complete in the assignment:
- The program part (i.e., the ISS) — 80% of scores
- Assignment Report — 20% of scores
In the program part, the score is further divided into two parts:
- ISS compilation test
- You can get 10% of scores if your ISS can be compiled without any error
- Instruction unit tests with
riscv-tests- TA divides the 37 instruction unit tests into 9 parts according to the opcode map, and the division of scores is related to the number of instructions for each opcode-type.
- OP, (15 pts)
- OP-IMM (15 pts)
- LOAD (8 pts)
- STORE (8 pts)
- BRANCH (8 pts)
- JAL (4 pts)
- JALR (4 pts)
- LUI (4 pts)
- AUIPC (4 pts)
- You will get 70 pts if you pass all the 9 groups of test mentioned above.
- TA divides the 37 instruction unit tests into 9 parts according to the opcode map, and the division of scores is related to the number of instructions for each opcode-type.
4.5 How to Turn in Your Assignment Report
You should see a file called report.md inside your homework repository. Please complete the report in plcae, commit it, and push the commit to your remote repository on GitHub.