This code is taken from Digital Design and Computer Architecture by Harris and Harris.
Please give enough time understanding how it workds.
Three changes should be made to the code in this repo:
- Implementing the
lbinstruction. It is an I-type instruction which is the same aslwbut it stores the first byte seen on the given address. The Opcode for this instruction is100000. - Implementing the
jrinstruction. This instruction loads the$rainto$pc. It's anr-typeinstruction. The Opcode and funct for this instruction in order are000000and001000. - Implementing the
jalinstruction.
After all the resulting architecture must be impelemented using either verilog or system-verilog.
It's definitely easier to code using system-verilog, but it is not fully supported by iverilog compiler. Hence if you want to use iverilog as you tool in this project, you have to change the given code to verilog.
There is a test bench file named testbench.sv and a file memfile.dat which holds the program to be tested. The assembly program which is equivalent of the machine codes written in memfile.dat is in the file instructions.txt. Consider reading testbench.sv and instructions.txt in order to figure out how the testing is going on.