This is an example project demonstrating integration of Pulpino zero-riscy RISC-V core into Altera Platform Designer platform (formerly called Qsys or SOPC). HW integration code/scripts are on its own submodule under ip subdirectory, and sw subdirectory contains an example application that prints "Hello World" and lights up a few LEDs using other Altera platform IP (jtag_uart and pio). The code is targeted for DE2-115 development board, but it can be simulated on Modelsim-Altera without real HW or easily ported to other Altera FPGAs. The instructions below are mainly made with *nix systems in mind but everthing should work with Cygwin on Windows as well.
- Quartus Lite including Cyclone IV device support, Nios II EDS and ModelSim-Intel FPGA Edition.
- RISC-V GNU Compiler Toolchain
- (Optional) DE2-115 development board
- Download, configure, build and install RISC-V toolchain with Newlib + multilib support:
git clone --recursive https://github.com/riscv/riscv-gnu-toolchain
cd riscv-gnu-toolchain
./configure --prefix=/opt/riscv --enable-multilib
make
make install
- Compile custom binary to IHEX converter:
cd pulpino_qsys_test
gcc tools/bin2hex.c -o tools/bin2hex
- Compile example application image
cd sw
make
- Load the project (pulpino_qsys_test.qpf) in Quartus
- Generate QSYS output files
- Open Platform Designer (Tools -> Platform Designer)
- Load platform configuration (sys.qsys)
- Generate output (Generate -> Generate HDL, Generate)
- Close Platform Designer
- Generate FPGA bitstream (Processing -> Start Compilation)
- Tools -> Run Simulation Tool -> RTL Simulation
- Check that "Hello World" is printed on simulator console and "led" on waveform window changes into "11110000"
- Program bitstream (output_files/pulpino_qsys_test.sof) on the board
- Ensure that LEDG[7:4] are turned on
- Open nios2-terminal and check that "Hello World" is printed out
- Modify sw/hello.c (e.g. change LED output from 0xf0 to 0xff)
- Run "make rv-reprogram" on sw subdirectory
- Ensure that board is reset and updated LED pattern is shown
- (Optional) If you want to update bitstream with the new RISC-V code (no RTL changes), just run "Processing->Update Memory Initialization File" and "Processing->Start->Start Assembler" in Quartus
- Better linker script
- Get rid of hard-coded address map values
- Adapt Altera BSP/HAL system