Design and VHDL implementation of RISC CPU with 5-stage pipeline.
Name | Section | B. N |
---|---|---|
Evram Youssef | 1 | 9 |
Remonda Talaat | 1 | 20 |
Mahmoud Adas | 2 | 21 |
Mohamed Shawky | 2 | 16 |
- docker
19.03.6
- GNU bash
4.4.19(1)-release
- gtkwave (only to view simulation output)
3.3.93
- python3
-
Run Docker Daemon
$ sudo systemctl enable --now docker
-
To run docker without sudo (https://docs.docker.com/engine/install/linux-postinstall/):
$ sudo groupadd docker
$ sudo usermod -aG docker $USER
$ newgrp docker
-
To compile and run all vunit tests:
$ ./run-test
-
To compile and run vunit test
y.vhdl
in directorytest
:$ ./run-test y
-
If file
y.vhdl
has test case with namesome_test_name
, you can view its waveform (after./run-test
) with:$ ./wave y.some_test_case
$ ./list-tests
lists all available test cases.
- If
y.vhdl
is not vunit test file, then type$ ./wave y
To view logs of test case some_test_name
of file y.vhdl
:
$ ./logs y.some_test_case
Run any assembly you want on the cpu simulation, just give it to playgournd
script from the stdin, and it will compile test/main_tb.vhdl
and run the cpu till hlt (you should add 'end' instruction at the end).
playground
script dumps the ccr, reg-file and data-mem at the end to out/{ccr,data_mem,reg_file}.playground.out
.
$ printf 'and r0, r1, r2 \n end' | ./playgournd
$ ./playgournd <input/full_test/Branch.asm
$ ./scripts/asm < /path/to/input.asm > /path/to/output.binary
modelsim_tests_do
: contains the following :
cases
: the provided test cases assembly. An END instruction is added to mark the end of each section, in order to end the simulation.cases_binary
: the file that contains binary code from assembler.cases_do_memory
: do files to initially load instructions in memory one by one.cases_hex
: same ascases_binary
but in hex.cases_mem
: modelsim memory files to be loaded directly to the simulation.cases_with_NOP
: same ascases
but with NOPs added to test disabled hazard handling.do_files
: contains do files for all provided test cases insideMAIN
folder. However,MAIN with NOP
folder contains do files for cases tested with NOPs.scripts
: some python scripts to automate memory loading do files.waves
: screenshots of the waves produced by all provided test cases.
- For using modelsim with provided test cases :
- Copy all vhdl files to a new modelsim project and compile them.
- Run the do file corresponding to the cases from
modelsim_tests_do/do_files/MAIN/*
. - You might need to change the path of the
.mem
file in do file to correspond to memory files inmodelsim_tests_do/cases_mem
or simply addcases_mem
folder to your modelsim project.
- For using modelsim with other test cases :
- Copy all vhdl files to a new modelsim project and compile them.
- Create the binary file from assembler.
- Load memory file to modelsim one by one.
- Execute the desired do file.