I am writing a code that needs to be constantly modified due to the nature of my experiment. It is annoying having to spend a lot of time waiting for the FPGA to reconfigure, so I was wondering if there is any way to modify the outputs using externally updated data (i.e. via a text file that is uploaded to the FPGA using the USB C port?)
Here is my code that I am trying to modify! I would like to modify all of the outs (out[0] to out [5])
module values (
output out[6][8] //six different eight-bit outputs need to be cycled through
) {
always {
out[0] = 8h99; //hexadecimal number is converted to an eight-bit binary output
out[1] = 8h9a; //these values must be manually changed between experimental setups
out[2] = 8h9b;
out[3] = 8h9c;
out[4] = 8h9d;
out[5] = 8h9e; //this index is the max value of the counter module's value
//after the counter reaches 5, it resets to 0, thus calling out[0]
}
It can be done, but it won’t be trivial as there is no ready-to-use block to do this.
You have to make several changes to achieve this :
Change the values module to make it writable (either making it a register or a RAM block)
Add an UART module if you don’t have one
Possibly implement a command or protocol parser/decoder if you use UART for more than one thing
Implement a module that will take decoded UART data and fill the “values” module, and then restart the experiment without resetting the whole FPGA (which would reset the registers).
On the PC side you may need to write a program or a script that would send the commands and data over the COM port.
Something like this could be adapted maybe? RegisterInterface
I still have to do something like this myself so I can’t help further for now XD
If you know cpp, I have built a little library to set and receive data through a protocol build around uart, for which I built a plug and play verilog module.
If you don’t know cpp, I’m building a UI for the a client to run on your PC, but it is really bare at the moment .
I’m currently in the process of writing documentation for the protocol, but I can share the code if you want.
Keep in mind this is in the earliest possible stage of development, so not perfect at all, but you will gladly accept any kind of constructive feedback.
If you have any question you can mp (I think it’s possible) me or post message me here directly.
This is actually really easy to do using the register interface. I realized the tutorial for it was ancient so I just posted an updated version.
You could simply map each of the out values to different addresses. From there you could either use the built-in tool to read/write them or write your own program that makes it easier to set them all.