1.RISC-V
工具链安装
参考网站:https://github.com/chipsalliance/rocket-chip
1)
下载rocket-chip
:
$ gitsubmodule update --init
$ git clone https://github.com/freechipsproject/rocket-tools
$ cd rocket-tools
$ gedit .gitmodules #查看每个子文件的下载源,然后使用下面的命令单个子模块进行克隆
$ git clone --recursive https://github.com/riscv/riscv-isa-sim.git(其余同理)
对于riscv-gnu-tools可以直接拷贝之前已经下载好的文件到对应文件夹中。
3)
设置环境变量
$ sudo gedit ~/.bashrc
在该文件末尾处添加
$ exportTOP=/home/pengl/fsf
$ exportRISCV=$TOP/riscv_install_tools
$ exportPATH=$PATH:$RISCV/bin
安装依附包:sudo apt-get install autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev libusb-1.0-0-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev device-tree-compiler pkg-config libexpat-dev libfl-dev
$ sudoRISCV=/home/pengl/fsf/riscv_install_tools ./build.sh(若编译32位工具链,则使用./build-rv32ima.sh)
最终可以在~/fsf/riscv_install_tools/bin中产生riscv工具链和pk和spike
至此,工具链生成完成。
2.
为Rocket-chip
创建可以产生RTL
的环境。
1
)克隆和测试chisel
和firrtl
$ git clone https://github.com/freechipsproject/chisel3.git
$ cd chisel3
$ sbt compile
产生FPGA或VLSI可综合的verilog代码
$ cd vsim
$ make verilog #Default Config
$ make verilog CONFIG=freechips.rocketchip.system.DefaultConfig ##Default Config
$ make verilog CONFIG=freechips.rocketchip.system.RoccExampleConfig #RoccConfig
在emulator下产生verilator和generated-src:
1)在rocket-chip目录下的Makefrag中CONFIG更改为*.RoccExampleConfig;
2)在rocket-chip/emulator下打开终端,运行make,产生verilator和generated-src两个文件夹;
3)如果在产生上面两个文件的时候发生错误,则将两个makefile文件拷贝出来,删除该emulator,再新建emulator,并将刚拷贝的两个makefile放入该新建文件夹,再运行make,运行成功。