RVSCC/README.md

63 lines
2.9 KiB
Markdown
Raw Normal View History

2023-03-01 15:11:23 +00:00
# RISC-V Simple Core Collection
Collection of SystemVerilog RV32I cores and modules
2022-12-27 03:03:15 +00:00
2022-12-27 05:29:28 +00:00
## Table of contents
2023-03-01 15:11:23 +00:00
- [Features](#features)
2022-12-27 03:03:15 +00:00
- [Directory structure](#directory-structure)
- [Requirements](#requirements)
- [Build](#build)
- [Tests](#tests)
2023-03-01 15:11:23 +00:00
## Features
2022-12-24 06:07:57 +00:00
- Single cycle processor
2022-12-27 03:03:15 +00:00
- 5-Stage pipelined processor with hazard detection
2023-03-01 15:11:23 +00:00
- N-Way associative cache memory
2022-12-24 06:07:57 +00:00
2022-12-27 03:03:15 +00:00
## Directory structure
2022-12-24 06:07:57 +00:00
.
├── fw # Firmware
│ ├── sandbox # C/Assembly sandbox firmware source
│ └── test # Assembly programs used for testbenchs
2023-03-01 15:11:23 +00:00
├── include # SystemVerilog include directory
├── rtl # SystemVerilog RTL modules
2023-03-02 20:50:12 +00:00
├── scripts # Utility scripts
2022-12-24 06:07:57 +00:00
└── test # SystemVerilog testbenchs
## Requirements
2023-03-01 15:11:23 +00:00
- Verilator or another SystemVerilog simulator
2022-12-24 06:07:57 +00:00
- CMake
- 32-bit GNU RISC-V toolchain
2023-03-01 15:11:23 +00:00
> If your package manager does not provide the RISC-V GNU toolchain you can either download the binaries from the [xPack GNU RISC-V Embedded GCC](https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases) package or it can be compiled from their [main repository](https://github.com/riscv-collab/riscv-gnu-toolchain). Also you can take a look to the [docker enviroment](#docker-enviroment) provided.
2023-01-29 23:06:42 +00:00
### Docker enviroment
There is a docker enviroment image with all the dependencies already pre-installed.
For getting docker check their [installation instruction site](https://docs.docker.com/get-docker/).
> **Tip:** If you run into problems running docker make sure you have:
> - **WSL2** installed in case of Windows
> - **Secure Boot disabled** and **Virtualization enabled** in your BIOS settings
2023-03-01 15:11:23 +00:00
To set up the enviroment you can create a [dev enviroment](https://docs.docker.com/desktop/dev-environments) pointing to this repository or you can pull the image directly from the container registry and then run it:
2023-01-29 23:06:42 +00:00
```
docker pull git.1159.cl/mario1159/rvscc
docker run -it git.1159.cl/mario1159/rvscc
```
2022-12-24 06:07:57 +00:00
## Build
2023-03-01 15:11:23 +00:00
To build the firmware that will be loaded in the instruction memory and the simulation testbenchs execute CMake in the project root directory using your system default toolchain (the [CMake toolchain file](cmake/riscv-toolchain.cmake) will search automatically for a RISC-V toolchain to build the firmware).
2022-12-24 06:07:57 +00:00
```
2023-02-13 00:34:07 +00:00
cmake -Bbuild
cmake --build build
2022-12-24 06:07:57 +00:00
```
2023-03-02 20:50:12 +00:00
This will generate a `sandbox.mem` file in the `/build/fw/sandbox` folder. For other simualtors than verilator make sure to add the firmware it to your simulator sources and that the memory path matches the path specified in the memory module.
2022-12-27 03:03:15 +00:00
## Tests
2023-03-02 20:50:12 +00:00
After building, tests can be runned using CMake CTest.
2023-02-13 00:34:07 +00:00
```
ctest --test-dir build
2023-03-02 20:50:12 +00:00
```
## Sandbox
For experimenting with a custom firmware, configure the project with one from the following options and use the examples in the [sandbox](fw/sandbox) folder.
```
cmake -Bbuild [-DSANDBOX_ASM=ON] [-DSANDBOX_C=ON]
2023-03-01 15:11:23 +00:00
```