Skip to content

Josephood7/Caravel-SoC-FPGA-Labs

Repository files navigation

Caravel SoC FPGA Labs

Labs to experiment Caravel SoC FPGA module design with Verilog & HLS.

Introduce to Labs

  • lab1: AXI master read/write BRAM
  • lab2: spiflash protocol design and validation
  • lab3: Axilite access GPIO pins
  • labi: Caravel SoC FPGA integration (Community released Caravel SoC FPGA)
  • lab-exmem: Executing Function in User Project Memory
  • lab-interrupt: User Project Interrupt Enabling and Handling
  • lab-uart: AXI UART Lite for Caravel

Background Prerequisites

Toolchain Prerequisites

Setup Toolchain

Get presetup Vitis Virtual Machine from course TA or setup following toolchains yourself.

$ sudo apt update
$ sudo apt install gtkwave git -y
$ sudo wget -O /tmp/riscv32-unknown-elf.gcc-12.1.0.tar.gz https://github.com/stnolting/riscv-gcc-prebuilt/releases/download/rv32i-4.0.0/riscv32-unknown-elf.gcc-12.1.0.tar.gz
$ sudo mkdir /opt/riscv
$ sudo tar -xzf /tmp/riscv32-unknown-elf.gcc-12.1.0.tar.gz -C /opt/riscv
$ echo 'export PATH=$PATH:/opt/riscv/bin' >> ~/.bashrc
$ source ~/.bashrc

Git Clone Caravel SoC FPGA Labs

git clone https://github.com/bol-edu/caravel-soc_fpga-lab ~/caravel-soc_fpga-lab

Labs Specification

Draft design specs and design reference sources of labs.

Lab1 : AXI Master to read/write BRAM

  • Design spec: read_romcode.cpp
  • Lab Content:
  1. Add another axi-master path to write to PS Memory
  2. Load program.hex (RISCV code from any of the Caravel testbench) to PS memory buffer
  3. Develop host code to load program.hex to BRAM, and read from BRAM
  4. Compare the input and output buffer content is the same

Lab2 : spiflash protocol design and validation

  • Design spec: spiflash.cpp
    Note: this spiflash design only implements: single bit spiflash read
  • Lab Content:
  1. Develop flash controller spiflash_ctrl.v (you can find the design from Caravel) in Verilog
  2. Synthesize spiflash.cpp (this is flash memory device)
  3. Develop a simple BRAM behavior model, preload the content in testbench
  4. Integrate the spiflash_ctrl.v + spiflash.v and verify spiflash_ctrl.v can correctly read data from BRAM through spiflash.cpp
    Note: spiflash.cpp is not verified

Lab3 : Axilite access GPIO pins

  • Design spec: caravel_ps.cpp
  • Lab Content:
  1. Design a simple module mprj_control.v
    Use one mprj_i pin (synchronize with host code) to stage through several steps, e.g.
    a. Change mprj_o pins value
    b. Some of mprj pins used for loop-back, e.g. (b1) mprj_o[x] =mprj_i[n], (b2) Control mprj_en accordingly
    c. Host use axilite to read mprj_o, mprj_en values
  2. Integrate mprj_control.v & caravel_ps.v in Block design–generate bitstream
  3. Develop Python host code to verify its behavior

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published