example_riscv_fpga_advanced:example_fpga_advanced:example_riscv_advanced:example_advanced:example_riscv_fpga:example_fpga:example_riscv:example

RISC-V System on Chip (FPGA example)

RISC-V System on Chip
FPGA example


This walkthough aims to introduce you to a simple RISC-V SoC and the hardware/software design flow.

This walkthough is one of a number which help to illustrate the principles of RISC-V SoC design:

While the three standard versions include examples of custom interface hardware typical of a System-on-Chip design, the three simplified versions include non-specific input and output ports in the manner of a microcontroller system. While the use of custom interface hardware is likely to yield better results (if it doesn't yield better results you will probably be better off using a microcontroller rather than an SoC), the use of non-specific input and output ports can aid understanding and are used here as a starting point for the design of custom interface hardware.

There is also an ARM version for those interested in alternative architectures.


Overview of a Simple RISC-V SoC

A very simple RISC-V System on Chip has been designed:

The design includes three slaves:

  1. RAM
    16K bytes for program and data memory (including stack)

  2. Switch Interface
    Occupying three 16-bit memory locations

  3. Output Interface
    Occupying two 16-bit memory locations

Memory Map

Files

In order to build the RISC-V SoC, we need SystemVerilog files to model the hardware plus 'C' program files and other support files to build the software. Further files are required to support simulation:


Operation of the custom interface modules

SoC design is a blend of hardware design and software design including third-party components such as microprocessor cores and library software and custom components such as custom interfaces and application software. When looking at the custom components, there is often a trade-off to be made between undertaking a particular task in hardware or software. Some tasks may be easily carried out in hardware leading to simplified software while other tasks may be more easily carried out in software leading to simplified hardware.

In this example we have two custom interface modules which have been designed to integrate with the external world (in this case just switches, buttons and LEDs) and simplify the software:


Preparation

Compile C Program

Simulate RISC-V SoC


Synthesis

In order to synthesise the system onto an FPGA development board you will need a top level "wrapper" file and a matching constraints file:

FPGA Vendor wrapper file constraints file
Nexys 4Xilinxnexys4_wrapper.svnexys4_wrapper.xdc
DE0Altera
(Intel)
de0_wrapper.svDE0.qsf
DE1-SoCAltera
(Intel)
de1_soc_wrapper.svDE1_SoC.qsf
DE2Altera
(Intel)
de2_wrapper.svDE2.qsf
DE2-115Altera
(Intel)
de2_wrapper.svDE2-115.qsf

Iain McNally
10-8-2023