A work-in-progress RISC-V 32-bit co-simulation model. It includes RTL of a developing RISC-V core design, UVM testbenches, and SystemVerilog DPI (svdpi) interfaces to communicate with the C++ code from the associated projects riscv32-decoder and riscv32-sim.
Before you begin, ensure you have met the following requirements:
- Vivado 20xx.x
- XSIM
- C/C++ compiler
- make
- p7zip or any other software that supports v2.0 DEFLATE can be used. If you decide to use a different software, you will need to adjust data/Makefile accordingly.
- jq
- perl
To use Easier UVM perl script you'll need:
- perl>=5.8.0.
- the following packages, which can be installed either through CPAN or your distribution's package manager:
use File::Copy::Recursive qw(dircopy);
use File::Copy "cp";
use File::stat;- Clone the repository
git clone --recursive https://github.com/ssayin/riscv32-cosim-model.git- Navigate to the directory
cd riscv32-cosim-modelIf you have already cloned the repository, you can fetch the submodules with:
git submodule update --init --recursiveThis project uses a Makefile for building and running the co-simulation model. The Makefile provides several targets for different tasks:
-
libdpi.so: Compile the shared library that exposes riscv32-decoder routines. -
compile: Compile the SystemVerilog files using the Xilinx Vivado Suite. -
clean: Remove all generated files from the previous build.
Please check Makefile for further details.
To build and run the project, follow these steps:
-
Open a terminal in the project root directory.
-
Run the following program:
make sim- To clean the project (remove all generated files), enter the following command:
make clean./tools/intel_synth.shTo build and run the UART tool, follow these steps:
- Set the
QUARTUS_ROOTenvironment variable to the path of your Quartus installation. For example, if you're using Quartus version 22.1 Lite and it's installed at/opt/intelFPGA_lite/22.1std/quartus/, you can set it using the following command:
export QUARTUS_ROOT=/opt/intelFPGA_lite/22.1std/quartus/- Build the UART client by running the following program:
make QUARTUS_ROOT=$QUARTUS_ROOT uart_clientImportant: Whenever you open a new shell session to work with the UART tool, remember to reset the LD_LIBRARY_PATH using the previously defined QUARTUS_ROOT value. Exporting this variable in a file sourced by your shell i.e. your .bashrc can save you time.
- Edit the ./tools/uart file and adjust the LD_LIBRARY_PATH variable to include $QUARTUS_ROOT:
LD_LIBRARY_PATH=$QUARTUS_ROOT uart_client $@- Run the program:
./tools/uart HiReplace "Hi" with whichever message you want to transmit. If no argument string is provided, the program reads from stdin.
echo "Hi" | ./tools/uartIf you would like to contribute, please fork the repository and submit a pull request. For major changes, please open an issue first to discuss what you would like to change.
- Serdar Sayın
This project is licensed under the Apache 2.0 License - see the LICENSE file for details.
I would like to thank the RISC-V community for their comprehensive ISA specification, which made this project possible.
-
alterajtaguart by thotypous: Disassembling
jtag_atlantic.soand providing an associated API. -
jtag_uart_example by tomverbeure: Providing examples for integrating the Intel JTAG UART API into projects.