RISC-V 32bit CPU written in Chisel. This project is for my learning purpose to understand how to design/implement hardware with Chisel and what RISC-V architecture is. Working in progress.
- RISC-VとChiselで学ぶ はじめてのCPU自作: https://gihyo.jp/book/2021/978-4-297-12305-5
- 'Introduction to making your own CPU with RISC-V and Chisel' Japanese book
- Chisel API Document: https://www.chisel-lang.org/api/latest/chisel3/index.html
- RISC-V Spec: https://riscv.org/technical/specifications/
- Assembly Manual: https://github.com/riscv/riscv-asm-manual/blob/master/riscv-asm.md
- Reference simulator: https://github.com/riscv/riscv-isa-sim
- Proxy kernel: https://github.com/riscv/riscv-pk
- "V" vector extension: https://github.com/riscv/riscv-v-spec
- GNU toolchain: https://github.com/riscv/riscv-gnu-toolchain
- TODO: This repository currently refers to
rvv-0.9.xbranch but it should refer torvv-intrinsicbranch for RVV v1.0-rc.
- TODO: This repository currently refers to
This repository was imported from chisel-template@f5f33c6.
Clone this repository:
git clone --recursive https://github.com/rhysd/riscv32-cpu-chisel.gitBuild Docker image for RISC-V GNU toolchain and Scala toolchain:
docker build . -t riscv/mycpuStart an interactive shell with mounting this repository:
docker run -it -v $(pwd):/app riscv/mycpuVerilog sources can be generated from Chisel sources via sbt run:
make ./c/fib.hex # Make hex dump of memory image of program to run
make verilog MEMORY_HEX_FILE_PATH=./c/fib.hex # Generate Verilog sources
cat ./verilog/Top.vTo run all tests in riscv-tests:
make riscv-testsOutputs of tests are stored in riscv-tests-results directory.
To run a specific test case in riscv-tests (when running rv32ui-p-addi test case):
make ./riscv-tests-results/rv32ui-p-addi.outTo run all tests with C sources in c/ directory:
make c-testsOutputs of tests are stored in c-tests-results directory.
To run a specific test case in c-tests (when running fib.c test case):
make ./c-tests-results/fib.outTo run all tests with Rust sources in rust/ directory:
make rust-testsOutputs of tests are stored in rust-tests-results directory.
To run a specific test case in rust-tests (when running fib test case):
make ./rust-tests-results/fib.outRun docker run with the uploaded Docker image.
docker run --rm -v $(pwd):/app --workdir /app -t rhysd/riscv-cpu-chisel:latest make riscv-testsDistributed under the MIT license.