A VexRiscv with AES128 on the memory mapped bus. Works in simulation and on the ULX3S.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

2.7 KiB

Vexriscv with AES128 ECB on the memory mapped bus

Prerequisites:

  1. All the Tools. Best served with the QuantumRisc Virtual Machine:

https://random-oracles.org/risc-v/

  1. The SpinalHDL Crypto project must be installed in your system. Follow the instructions from the Git README (its really simple):

https://github.com/SpinalHDL/SpinalCrypto/wiki/Getting-started

In the simulation:

From inside the folder vexriscv start the simulation with

sbt "runMain quantumrisc.PQVexRiscvSim"

Connect openocd-vexriscv to the simulation. Therefore open a new console, navigate again to the vexriscv folder and go with

openocd-vexriscv -f vexriscvsim.cfg

Now you might want to compile and upload the C code to the simulation. Compile the C project from inside the folder c_project with

make PLATFORM=pqvexriscvsim

The compilation has created a file with the name main.elf. Upload this file via GDB to the simulation (from inside the folder c_project) with

riscv64-unknown-elf-gdb -tui -ex 'set remotetimeout 30' -ex 'target extended-remote :3333' -ex 'load' -ex 'break main' -ex 'continue' main.elf

One breakpoint at the start of the main function is already set. You might want to set another one inside the While(1) loop. Mabye at line 70 with:

b 70

Continuing the next breakpoint works with c.

The UART output from the Vexriscv is visible in the first concolse, where you started the simulation.

On the ULX3S Board:

sbt "runMain quantumrisc.PQVexRiscvUlx3s"

Copy the created *ulx3s.v verilog file and the memory files *ulx3s*.bin to the folder ulx3s. From there run make to create the bitstream:

make PQVexRiscvUlx3s.bit

Flash the bitstream to the board:

sudo fujprog PQVexRiscvUlx3s.bit

The Vexrisc is now running on the ULX3S Board. Now connect openocd to it. To do that, you need an external JTAG Adapter. The one i'm using is a Adafruit TF232H.

The description for the wiring is available in one of my other projects:

https://github.com/ThorKn/vexriscv-ulx3s-simple-plugin

This time you need a different configfile, contained in the vexriscv folder:

sudo openocd-vexriscv -f tf2323h_openocd.cfg

Build the C project for a different PLATFORM then before (in the sim):

make PLATFORM=pqvexriscvulx3s

Uploading via GDB and using GDB is the same as above:

riscv64-unknown-elf-gdb -tui -ex 'set remotetimeout 30' -ex 'target extended-remote :3333' -ex 'load' -ex 'break main' -ex 'continue' main.elf

To see the UART output you can use the UART interface from the ULX3S board. Just open a Terminal program of your choice (i.e. GTKTerm) and connect it over USB with the parameters 115200 - 8 - N - 1.