Outdated information in examples/rv/README.rst
mbty opened this issue · 8 comments
An "FPGA" section has been (relatively) recently added to the main README of the repository, including the information that the RV32I model does not fit on the TinyFPGA BX at the time. However, the README in examples/rv
contains some older information that gives the impression that the TinyFPGA BX is supposed to work. Maybe replacing this duplication with a redirection to the "FPGA" section of the main README would be clearer.
I am in fact interested in demonstrating some properties of a slightly modified version of the RV32I example, and I recently got my hands on this FPGA model. I was looking for a way of testing it on this device to change from simulation and tried to synthesize Kôika's RV32I as a first step, and I stumbled upon an error unrelated to the size issue mentionned in the main README (of which I was not aware of at the time):
[...]
3.2.1. Analyzing design hierarchy..
ERROR: Module `\usb_uart_i40' referenced in module `\top_ice40_usb' in cell `\uart' is not part of the design.
make: *** [Makefile:269: top_ice40_usb.json] Error 1
I noticed that this file exists in the tinyfpga_bx_usbserial repository and spotted an issue seemingly related to Kôika there, which leads me to assume that there is some undocumented dependency on this project but I did not go further than this.
If the break did not happen too far back, I would be interested in trying to make my version run on the FPGA. Could you possibly recommend an older Kôika commit with which synthesis should work? Also, do you think that removing the multiplication module on my end would be enough to fix the size issue, or is this hard to say?
Woops, excellent catch, thanks. Let me update the READMEs and then get back to your question :)
Maybe replacing this duplication with a redirection to the "FPGA" section of the main README would be clearer.
Done, thanks again
I am in fact interested in demonstrating some properties of a slightly modified version of the RV32I example, and I recently got my hands on this FPGA model. I was looking for a way of testing it on this device to change from simulation and tried to synthesize Kôika's RV32I as a first step, and I stumbled upon an error unrelated to the size issue mentionned in the main README (of which I was not aware of at the time):
Right; originally I was hoping to combine the core with a USB controller for simplicity, but it's hard to fit both on the chip and pass timing.
I noticed that this file exists in the tinyfpga_bx_usbserial repository and spotted an issue seemingly related to Koîka there, which leads me to assume that there is some undocumented dependency on this project but I did not go further than this.
Exactly. If you want to experiment in that direction, the way to go is to take the dependency from that project and build that way. But the core is too big for this to work well.
If the break did not happen too far back, I would be interested in trying to make my version run on the FPGA. Could you possibly recommend an older Kôika commit with which synthesis should work? Also, do you think that removing the multiplication module on my end would be enough to fix the size issue, or is this hard to say?
The way to go if you want the USB interface and RV32I would be
- to remove the multiplier (this is trivial to do, just change
Module Multiplier := ShiftAddMultiplier Mul32Params.
toModule Multiplier := DummyMultiplier Mul32Params.
in RVCore.v) and - to move the register file to RAM (this was suggested to my by @threonorm a few weeks ago), which would save a lot of space, but is a more complicated change
If you're OK with a bit more tinkering, you can use the UART interface, and connect your FPGA to a UART-USB bridge; the UART transmitter costs very little area, so you may even be able to fit the RV32I with no multiplier. The RV32E fits, at least.
Thanks a lot, I will try some of these things eventually and update this thread accordingly. Closing the issue for the time being.
👍 Please keep me posted. I think the easiest is the UART interface with an FTDI (and that works very nicely on the ULX3S).
A quick update about this (I ended up not doing much with the TinyFPGA BX until recently).
I got rid of the multiplier module and reduced memory size (8KiB of instruction memory left, the same for data memory). Some tests use more memory than this left me with, so I simplified them (removed some data from rvbench_median_dataset
and rvbench_qsort_dataset
, generated a smaller image for img
). This fits, not by much but it seems to work as it should.
Is there a rationale behind the memory size originally in use besides the fact that it allows for more realistic tests?
I don't remember a deep rationale behind the memory size. Are you using the USB interface or the UART one, or just running programs that use the LED but not the console?
I am using the UART and I can load both programs that use the LED and the console.
Thanks. I left the necessary hardware (the FTDI chip) back in my office at the beginning of the pandemic, I'll try to get it.