example_arm_altera_simplified:example_altera_simplified:example_arm_fpga_simplified:example_fpga_simplified:example_arm_simplified:example_simplified:example_arm_altera:example_altera:example_arm_fpga:example_fpga:example_arm:example

ARM System on Chip (Altera FPGA example with hardware customisation)

ARM System on Chip
Altera FPGA example with hardware customisation


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

This walkthough is one of a number which help to illustrate the principles of ARM 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 a RISC-V version for those interested in alternative architectures.


Overview of a Simple ARM SoC

A very simple ARM System on Chip has been designed:

The design includes three slaves:

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

  2. Input Port
    Occupying one 32-bit memory location

  3. Output Port
    Occupying one 32-bit memory location

Memory Map

Files

In order to build the ARM 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:


Preparation

Compile C Program

Simulate ARM 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
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

Create a custom interface

The key to system-on-chip design is the creation of custom interface hardware.

A modified ARM System on Chip including a simple custom interface is to be designed:

The steps required are:

  1. Create the custom interface

    The file name for the interface should be ahb_custom_interface.sv and it should be placed in the existing behavioural/ directory.

    A template for the custom interface can be found here: ahb_custom_interface.sv

    You will need to take the template and fill in the code where it is missing. You can base the code that you enter on the code from the output port module: ahb_output_port.sv. Since the custom interface supports more than one address, you will need to add code to generate a word_address signal during the address phase. An example of this sort of code can be found in this example module: ahb_switches.sv

  2. Create a new SoC top-level module

    The file name for the top-level module should be soc_custom.sv and it should be placed in the existing behavioural/ directory.

    You can base the new module on the existing SoC module code: soc.sv.

    Changes that you should make are:

  3. Update the memory map in the interconnect module: ahb_interconnect.sv

  4. Simulate the complete design

    The testbench/ directory already includes a soc_custom_stim.sv testbench file to test the new system. The command to use is:

        ./simulate testbench/soc_custom_stim.sv &
    

    If all goes well, the behaviour of the new system will match that of the old one since the the 'C' program is unchanged (there are no memory accesses for the custom slave).

  5. Modify the 'C' program

    Now modify the 'C' program to access the other registers in the custom interface.

    Changes that you should make are:

    After each change you should recompile the code then re-run the simulation and check that the new behaviour is as you expect.

  6. Synthesise the modified design and download it to your FPGA board.

    For this synthesis you will need a different "wrapper" file which knows about the new oA, oB, oC and oD outputs:

    FPGA Vendor wrapper file
    DE0Altera
    (Intel)
    de0_wrapper_custom.sv
    DE1-SoCAltera
    (Intel)
    de1_soc_wrapper_custom.sv
    DE2Altera
    (Intel)
    de2_wrapper_custom.sv
    DE2-115Altera
    (Intel)
    de2_wrapper_custom.sv

    If your synthesis is successful, you should receive a simple message via the seven-segment display on your FPGA board.


Having completed this lab walkthrough, you should have a basic understanding of SoC design including an ability to build a simple custom interface and write a 'C' program to access the interface.

At this stage you can experiment with other changes to the system but you should try to make only small changes between simulations to increase the chances of being able to debug the system.


Iain McNally
10-8-2023