xref: /XiangShan/README.md (revision 5c7674fe439b80ea3bb6c6207b7d169ed6183be5)
1# XiangShan
2
3XiangShan is a processor targeting super-scalar out-of-order execution.
4Currently it supports riscv64GC.
5
6## Compile chisel code
7
8* Install `mill`. Refer to [the Manual section in this guide][mill].
9* Run `make init` to init git submodules
10* Run `make` to generate verilog code. The output file is `build/TopMain.v`.
11
12[mill]: http://lihaoyi.com/mill#manual
13
14## Run programs by simulation
15
16### Prepare environment
17
18* Set a new environment variable `NEMU_HOME` to the **absolute path** of the NEMU project.
19* Set a new environment variable `NOOP_HOME` to the **absolute path** of the XiangShan project.
20* Clone the [AM project](https://github.com/NJU-ProjectN/nexus-am.git).
21* Set a new environment variable `AM_HOME` to the **absolute path** of the AM project.
22* Add a new AM `riscv64-noop` in the AM project if it is not provided.
23
24### Verilator simulation
25
26Install verilator:
27
28TBD
29
30Generate verilog files and compile them using verilator:
31* Move to project root, run `make emu` to compile verilator simulator. You can use `make emu config=CONFIG_NAME` to choose different size of XiangShan.
32* To speed up compiling, use `make emu REMOTE=YOUR_REMOTE_SERVER`. (If you have remote server setuped)
33
34Run program generated by verilator:
35* If compile succeed, you can run the application in the AM project by `make ARCH=riscv64-noop run`.
36* Or you can run emulator and select image manually: `./build/emu -i PROGRAM_IMAGE`
37* Use parameters to control emulator behavior: `./build/emu [-b DUMP_BEGIN_TIME] [-e DUMP_END_TIME] [--force-dump-result] [--dump-wave] -i PROGRAM_IMAGE`.
38* Run `./build/emu` for further instructions.
39
40Example:
41```makefile
42make emu config=MinimalSimConfig
43./build/emu -b 0 -e 0 --force-dump-reult -i ./mem.bin
44```
45
46`debug` dir provides some scripts for verilator simulation.
47
48### VCS simulation
49
50Make sure you have VCS installed.
51
52* Run `make simv` to compile vcs simulator.
53* After that, run `./simv`