Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Outdated information in examples/rv/README.rst #6

Closed
mbty opened this issue Apr 1, 2021 · 8 comments
Closed

Outdated information in examples/rv/README.rst #6

mbty opened this issue Apr 1, 2021 · 8 comments

Comments

@mbty
Copy link

mbty commented Apr 1, 2021

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?

@cpitclaudel
Copy link
Collaborator

Woops, excellent catch, thanks. Let me update the READMEs and then get back to your question :)

@cpitclaudel
Copy link
Collaborator

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

  1. to remove the multiplier (this is trivial to do, just change Module Multiplier := ShiftAddMultiplier Mul32Params. to Module Multiplier := DummyMultiplier Mul32Params. in RVCore.v) and
  2. 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.

@mbty
Copy link
Author

mbty commented Apr 6, 2021

Thanks a lot, I will try some of these things eventually and update this thread accordingly. Closing the issue for the time being.

@mbty mbty closed this as completed Apr 6, 2021
@cpitclaudel
Copy link
Collaborator

👍 Please keep me posted. I think the easiest is the UART interface with an FTDI (and that works very nicely on the ULX3S).

@mbty
Copy link
Author

mbty commented Jun 9, 2021

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?

@cpitclaudel
Copy link
Collaborator

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?

@mbty
Copy link
Author

mbty commented Jul 15, 2021

I am using the UART and I can load both programs that use the LED and the console.

@cpitclaudel
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants