README.md 5.1 KB
Newer Older
1
# XiangShan
Z
add doc  
Zihao Yu 已提交
2

Y
Yinan Xu 已提交
3
XiangShan (香山) is an open-source high-performance RISC-V processor project.
Z
add doc  
Zihao Yu 已提交
4

5
中文说明[在此](readme.zh-cn.md)
Z
add doc  
Zihao Yu 已提交
6

Y
Yinan Xu 已提交
7
Copyright 2020-2021 by Institute of Computing Technology, Chinese Academy of Sciences.
Z
add doc  
Zihao Yu 已提交
8

Y
Yinan Xu 已提交
9 10
Copyright 2020-2021 by Peng Cheng Laboratory.

L
Lingrui98 已提交
11
## Docs and slides
Y
Yinan Xu 已提交
12
We gave 20+ presentations on RISC-V World Conference China 2021. XiangShan tutorial was held at the same place. Our slides for RVWC2021 have been updated on [our doc repo](https://github.com/OpenXiangShan/XiangShan-doc) (in Chinese).
W
wangkaifan 已提交
13

Y
Yinan Xu 已提交
14 15 16 17 18 19 20 21 22 23 24
我们在2021年RISC-V中国峰会的报告已经更新到[这里](https://github.com/OpenXiangShan/XiangShan-doc)。文档和相关信息也将持续更新到相同的仓库。

## Follow us

Wechat/微信:香山开源处理器

<div align=left><img width="340" height="117" src="images/wechat.png"/></div>

Zhihu/知乎:[香山开源处理器](https://www.zhihu.com/people/openxiangshan)

Weibo/微博:[香山开源处理器](https://weibo.com/u/7706264932)
W
wangkaifan 已提交
25

L
Lingrui98 已提交
26 27
You can contact us through [our mail list](mailto:xiangshan-all@ict.ac.cn). All mails from this list will be archived to [here](https://www.mail-archive.com/xiangshan-all@ict.ac.cn/).

W
wangkaifan 已提交
28 29
## Architecture

30
The first stable micro-architecture of XiangShan is called Yanqihu (雁栖湖) on this [branch](https://github.com/OpenXiangShan/XiangShan/tree/yanqihu), which has been developed since June 2020. The current version of XiangShan, also known as Nanhu (南湖), is still under development on the master branch.
W
wangkaifan 已提交
31 32 33

The micro-architecture overview is shown below.

Y
Yinan Xu 已提交
34
![xs-arch-single](images/xs-arch-simple.svg)
W
wangkaifan 已提交
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49



## Sub-directories Overview

Some of the key directories are shown below.

```
.
├── fpga                   # supported FPGA boards and files to build a Vivado project
├── read-to-run            # pre-built simulation images
├── scripts                # scripts for agile development
└── src
    ├── test               # test files (including diff-test, module-test, etc.)
    └── main/scala         # design files
W
wangkaifan 已提交
50 51 52 53 54 55 56 57
        ├── bus/tilelink   # tilelink utils
        ├── device         # virtual device for simulation
        ├── difftest       # diff-test chisel interface
        ├── system         # SoC wrapper
        ├── top            # top module
        ├── utils          # utilization code
        ├── xiangshan      # main design code
        └── xstransforms   # some useful firrtl transforms
W
wangkaifan 已提交
58 59 60 61 62 63 64 65 66 67 68 69 70 71
```



## Generate Verilog

* Run `make verilog` to generate verilog code. The output file is `build/XSTop.v`.
* Refer to `Makefile` for more information.



## Run Programs by Simulation

### Prepare environment
Z
add doc  
Zihao Yu 已提交
72

Y
Yinan Xu 已提交
73 74 75 76
* Set environment variable `NEMU_HOME` to the **absolute path** of the [NEMU project](https://github.com/OpenXiangShan/NEMU).
* Set environment variable `NOOP_HOME` to the **absolute path** of the XiangShan project.
* Set environment variable `AM_HOME` to the **absolute path** of the [AM project](https://github.com/OpenXiangShan/nexus-am).
* Install `mill`. Refer to [the Manual section in this guide](https://com-lihaoyi.github.io/mill/mill/Intro_to_Mill.html#_installation).
W
wangkaifan 已提交
77
* Clone this project and run `make init` to initialize submodules.
Z
add doc  
Zihao Yu 已提交
78

W
wangkaifan 已提交
79
### Run with simulator
80

Y
Yinan Xu 已提交
81 82
* Install [Verilator](https://verilator.org/guide/latest/), the open-source Verilog simulator.
* Run `make emu` to build the C++ simulator `./build/emu` with Verilator.
Y
Yinan Xu 已提交
83
* Refer to `./build/emu --help` for run-time arguments of the simulator.
Y
Yinan Xu 已提交
84
* Refer to `Makefile` and `verilator.mk` for more information.
Z
Zihao Yu 已提交
85

86
Example:
87

Y
Yinan Xu 已提交
88 89
```bash
make emu CONFIG=MinimalConfig SIM_ARGS=--disable-log EMU_THREADS=2 -j10
W
wakafa 已提交
90
./build/emu -b 0 -e 0 -i ./ready-to-run/coremark-2-iteration.bin --diff ./ready-to-run/riscv64-nemu-interpreter-so
91
```
Z
Zihao Yu 已提交
92

93 94 95 96
## Troubleshooting Guide

[Troubleshooting Guide](https://github.com/OpenXiangShan/XiangShan/wiki/Troubleshooting-Guide)

W
wakafa 已提交
97 98
## Acknowledgement

99
In the development of XiangShan, some sub-modules from the open-source community are employed. All relevant usage is listed below.
W
wakafa 已提交
100 101 102 103 104

| Sub-module         | Source                                                       | Detail                                                       |
| ------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| L2 Cache/LLC       | [Sifive block-inclusivecache](https://github.com/ucb-bar/block-inclusivecache-sifive) | We enhance the function and the timing of the original module, finally turning it into a Cache generator that can be configured as L2/LLC. |
| Diplomacy/TileLink | [Rocket-chip](https://github.com/chipsalliance/rocket-chip)  | We reused the diplomacy framework and TileLink utility that exist in rocket-chip to negotiate bus. |
105
| FPU                | [Berkeley hardfloat](https://github.com/ucb-bar/berkeley-hardfloat) | We use Berkeley-hardfloat as our FPU and implement an SRT-4 div/sqrt unit for it. Additionally, we split the FMA pipeline to optimize the timing. |
W
wakafa 已提交
106

107
We are grateful for the support of the open-source community and encourage other open-source projects to reuse our code within the scope of the [license](LICENSE).
W
wakafa 已提交
108