164fc9c9dSZihao Yu# NOOP 264fc9c9dSZihao Yu 364fc9c9dSZihao YuNOOP(NJU Out-of-Order Processor) is a processor targeting super-scalar out-of-order execution. 464fc9c9dSZihao YuCurrently it only supports riscv32. 564fc9c9dSZihao Yu 664fc9c9dSZihao Yu## Compile chisel code 764fc9c9dSZihao Yu 89b259174SZihao Yu* Install `mill`. Refer to [the Manual section in this guide][mill]. 964fc9c9dSZihao Yu* Run `make` to generate verilog code. The output file is `build/TopMain.v`. 1064fc9c9dSZihao Yu 119b259174SZihao Yu[mill]: http://lihaoyi.com/mill#manual 1264fc9c9dSZihao Yu 1364fc9c9dSZihao Yu## Run programs by simulation 1464fc9c9dSZihao Yu 15534f7036SZihao Yu* Set a new environment variable `NEMU_HOME` to the **absolute path** of the NEMU project. 1664fc9c9dSZihao Yu* Set a new environment variable `NOOP_HOME` to the **absolute path** of the NOOP project. 1764fc9c9dSZihao Yu* Clone the [AM project](https://github.com/NJU-ProjectN/nexus-am.git). 1864fc9c9dSZihao Yu* Set a new environment variable `AM_HOME` to the **absolute path** of the AM project. 19*5c647eb5SZihao Yu* Add a new AM `riscv64-noop` in the AM project if it is not provided. 20*5c647eb5SZihao Yu* Run the application in the AM project by `make ARCH=riscv64-noop run`. 2164fc9c9dSZihao Yu 22*5c647eb5SZihao Yu## Run on FPGA 2364fc9c9dSZihao Yu 24*5c647eb5SZihao Yu### Sub-directories Overview 25*5c647eb5SZihao Yu``` 26*5c647eb5SZihao Yufpga 27*5c647eb5SZihao Yu├── board # supported FPGA boards and files to build a Vivado project 28*5c647eb5SZihao Yu├── boot # PS boot flow of zynq and zynqmp 29*5c647eb5SZihao Yu├── lib # HDL sources shared by different boards 30*5c647eb5SZihao Yu├── Makefile 31*5c647eb5SZihao Yu├── Makefile.check 32*5c647eb5SZihao Yu└── noop.tcl # wrapper of NOOP core in the Vivado project 33*5c647eb5SZihao Yu``` 34*5c647eb5SZihao Yu 35*5c647eb5SZihao Yu### Build a Vivado project 36*5c647eb5SZihao Yu 37*5c647eb5SZihao Yu* Install Vivado 2019.1, and source the setting of Vivado and SDK 38*5c647eb5SZihao Yu* Run the following command to build a Vivado project 3964fc9c9dSZihao Yu``` 4064fc9c9dSZihao Yucd fpga 41*5c647eb5SZihao Yumake PRJ=myproject BOARD=axu3cg 4264fc9c9dSZihao Yu``` 43*5c647eb5SZihao YuChange `axu3cg` to the target board you want. Supported boards are listed under `board/`. 44*5c647eb5SZihao YuThe project will be created under `board/axu3cg/build/myproject-axu3cg`. 45*5c647eb5SZihao Yu* Open the project with Vivado and generate bitstream. 46*5c647eb5SZihao Yu 47*5c647eb5SZihao Yu### Prepare SD card 48*5c647eb5SZihao Yu 49*5c647eb5SZihao YuRefer to the instructions of [fpga/boot/README.md](fpga/boot/README.md). 50*5c647eb5SZihao Yu 51*5c647eb5SZihao YuNOTE: Remember to put the bitstream into BOOT.BIN, since the guide is going to boot everything from SD card. 52*5c647eb5SZihao Yu 53*5c647eb5SZihao Yu### Set your board to SD boot mode 54*5c647eb5SZihao Yu 55*5c647eb5SZihao YuPlease refer to the user guide of your board. 56*5c647eb5SZihao Yu* [zedboard](http://www.zedboard.org/sites/default/files/ZedBoard_HW_UG_v1_1.pdf) 57*5c647eb5SZihao Yu* [zcu102](https://www.xilinx.com/support/documentation/boards_and_kits/zcu102/ug1182-zcu102-eval-bd.pdf) 58*5c647eb5SZihao Yu* [sidewinder](http://sidewinder.fidus.com) 59*5c647eb5SZihao Yu* ultraZ (currently not avaliable to the public) 60*5c647eb5SZihao Yu* axu3cg (currently not avaliable to the public) 61*5c647eb5SZihao Yu 62*5c647eb5SZihao Yu### Boot linux in PS 63*5c647eb5SZihao Yu 64*5c647eb5SZihao YuJust insert the SD card into the board, open a serial terminal and powerup the board. 65*5c647eb5SZihao Yu 66*5c647eb5SZihao Yu### Boot NOOP (the RISC-V subsystem) 67*5c647eb5SZihao Yu 68*5c647eb5SZihao YuTo boot the RISC-V subsystem 69*5c647eb5SZihao Yu* Send `fpga/resource/ddr-loader/ddr-loader.c` to PS. 70*5c647eb5SZihao YuThis can be achieved by either copying the file to SD card, 71*5c647eb5SZihao Yuor by sending the file with `scp` if you have your board connected to your host by network. 72*5c647eb5SZihao Yu* Compile the loader by gcc on PS. 73*5c647eb5SZihao Yu``` 74*5c647eb5SZihao Yugcc -O2 -o ddr-loader ddr-loader.c 75*5c647eb5SZihao Yu``` 76*5c647eb5SZihao Yu* Send the RISC-V program (bin file, should start at 0x80000000) to PS. 77*5c647eb5SZihao Yu* Open minicom on PS to connect to the UART of NOOP. 78*5c647eb5SZihao YuNote that you can connect to PS via `ssh` and use `tmux` to get multiple terminals. 79*5c647eb5SZihao Yu``` 80*5c647eb5SZihao Yuminicom -D /dev/ttyUL1 81*5c647eb5SZihao Yu``` 82*5c647eb5SZihao Yu* Use the loader to load the program to NOOP memory and start running NOOP. 83*5c647eb5SZihao Yu``` 84*5c647eb5SZihao Yu./ddr-loader axu3cg bin-file 85*5c647eb5SZihao Yu``` 86*5c647eb5SZihao Yu* To shutdown the board, first run `poweroff` in PS. 87