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.

71 lines
2.4 KiB

4 years ago
  1. ## Vexriscv with AES128 ECB on the memory mapped bus
  2. ### In the simulation:
  3. From inside the folder ```vexriscv``` start the simulation with
  4. ```
  5. sbt "runMain quantumrisc.PQVexRiscvSim"
  6. ```
  7. Connect ```openocd-vexriscv``` to the simulation. Therefore open a new console,
  8. navigate again to the ```vexriscv``` folder and go with
  9. ```
  10. openocd-vexriscv -f vexriscvsim.cfg
  11. ```
  12. Now you might want to compile and upload the C code to the simulation.
  13. Compile the C project from inside the folder ```c_project``` with
  14. ```
  15. make PLATFORM=pqvexriscvsim
  16. ```
  17. The compilation has created a file with the name ```main.elf```.
  18. Upload this file via GDB to the simulation
  19. (from inside the folder ```c_project```) with
  20. ```
  21. riscv64-unknown-elf-gdb -tui -ex 'set remotetimeout 30' -ex 'target extended-remote :3333' -ex 'load' -ex 'break main' -ex 'continue' main.elf
  22. ```
  23. 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:
  24. ```
  25. b 70
  26. ```
  27. Continuing the next breakpoint works with ```c```.
  28. The UART output from the Vexriscv is visible in the first concolse, where you started the simulation.
  29. ### On the ULX3S Board:
  30. ```
  31. sbt "runMain quantumrisc.PQVexRiscvUlx3s"
  32. ```
  33. 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:
  34. ```
  35. make PQVexRiscvUlx3s.bit
  36. ```
  37. Flash the bitstream to the board:
  38. ```
  39. sudo fujprog PQVexRiscvUlx3s.bit
  40. ```
  41. 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.
  42. The description for the wiring is available in one of my other projects:
  43. https://github.com/ThorKn/vexriscv-ulx3s-simple-plugin
  44. This time you need a different configfile, contained in the ```vexriscv``` folder:
  45. ```
  46. sudo openocd-vexriscv -f tf2323h_openocd.cfg
  47. ```
  48. Build the C project for a different ```PLATFORM``` then before (in the sim):
  49. ```
  50. make PLATFORM=pqvexriscvulx3s
  51. ```
  52. Uploading via GDB and using GDB is the same as above:
  53. ```
  54. riscv64-unknown-elf-gdb -tui -ex 'set remotetimeout 30' -ex 'target extended-remote :3333' -ex 'load' -ex 'break main' -ex 'continue' main.elf
  55. ```
  56. 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```.