In the provided LA tests, how are the delays betwe...
# caravel
a
In the provided LA tests, how are the delays between assignments to the registers set? For instance, when setting a single mprj_io bit high to signal the start of the test and then setting it back to low to finish, only the last write to that register will persist.
Copy code
//start test
reg_mprj_datal = 0x00000001
// Do stuff
//End test
reg_mprj_datal = 0x00000000
When I look at the waveform for that code, once all the pins are set and the program is loaded, the 0-th bit will be 0, but if I comment out the last line, it will be 1. This seems like the register is being overwritten. If I use two separate pins for start and end, I can see that the timestamp of when it sees each bit after the wait statement is the same. Is there some way to add delays or prevent this overwriting, so that I can write to the reg_la_data registers? I was more or less modifying the two given la tests to send data over the interface
m
@Tim Edwards you wrote the LA. it's just a memory mapped register, so this has to be a software issue right? These memory locations are declared volatile which means they can't be optimized away
Any recommendations who may know? @Matt Venn?
t
@Matthew Guthaus: Mohamed Shalan wrote the logic analyzer. All I did was to make it full duplex.
m
@mshalan Can you help with this?
t
@Amogh Lonkar: I don't really get the gist of your question, though. The mprj_io has nothing to do with the logic analyzer. But yes, those addresses are registered. There is a 38-bit register at reg_mprj_datal (the address is hard-wired; "reg_mprj_datal" is just a definition from defs.h pointing to the hard-wired address), one register bit per GPIO channel. Writing to it is like writing to any other valid memory address.
m
It's true this isn't an LA issue, but I believe we see the same thing there with the memory mapped registers.
Volatile addresses seem to get optimized into a single assignment.
m
I've never seen that happen ( the optimization into a single assignment) but I'm not sure that's even what the op is describing. @Amogh Lonkar can you post screenshots of the firmware and waveforms to better describe the issue you're having?
I just ran a test with this firmware
image.png
and got this waveform
image.png
which is exactly what I'd expect
so I think @Amogh Lonkar maybe you are not understanding how the LA is meant to work, or the firmware or something else
and here's the same thing with mprj_io
image.png
image.png
reading back the original question 'how are the delays between assignments to registers set' - maybe shows a misunderstanding of how the overall system works? these assignments are made in the c firmware, which is compiled to a hex, loaded into a memory model and then picorv32 boots up and runs the firmware. So the delay between the assignments are the number of clock cycles it takes for picorv32 to execute those instructions.
๐Ÿ™Œ 1
hope that helps
m
@Matt Venn I can confirm that is exactly what were doing with the LA and GPIO... and we expected it to be the delays of the CPU + wishbone bus.
Oh, the one difference is the reg_mprj_xfer. What is that actually doing?
We had it after our code which is the problem.
The only place that is mentioned is the defs.h and in the test. It's not in the other documentation. https://caravel-harness.readthedocs.io/en/latest/memory-mapped-io-summary.html
t
@Matthew Guthaus (and maybe @Amogh Lonkar)? If the issue has to do with the configuration of the GPIO, the setup is that in order to prevent having thousands of wires going from the management SoC to the pads, I implemented a GPIO controller block that sits locally next to the GPIO, under the padframe power buses, and supplies all the DC settings to the pad. The controller block has its own local registers for the GPIO configuration, and is programmed by a serial shift register that wraps around the entire padframe. The GPIO configuration is therefore held in two registers: One in the management SoC, and one in the GPIO controller. Applying the "reg_mprj_xfer" bit is what transfers the configuration from the SoC to the local GPIO controller blocks. The transfer takes some time, which is why my testbench C code always loops on querying the bit that says that the transfer is done. At the end of the serial transfer, all GPIO configuration blocks are updated simultaneously. The GPIO configuration is not directly accessible to the user. The registers such as "reg_mprj_io_31" are the value that is registered within the SoC. So this serial programming is only for the DC signals (there are 11 of them, I think), not the actual signal on the pad. But that reduces the wiring back to the SoC on most of the GPIO pads to a single wire that is the input/output data line. Programming the "reg_mprj_datal" and "reg_mprj_datah" lines set or read those input/output data lines, so those values are instantaneous and not related to the static configuration of the GPIO. Does all that make sense?
๐Ÿ‘ 3
@Matthew Guthaus: This was pretty well described in the original documentation I made, which was a PDF file available in one of the earlier versions of the caravel repository. Unfortunately, the decision was made to convert everything to Sphinx, so now I don't know how to tell you where to find anything.
m
This all makes sense. We saw all operations "squashed" together because they were applied after the config was shifted in. I thought that while loop was an end of program wait so that it wouldn't go into undefined memory... (Amogh is a grad student working with me...)
t
We need an organizational chart of who is related to who and what institutions.
@Matthew Guthaus: FYI, the "start.S" assembly code has a self-loop after the call to main() so that if main() returns the process will continue running; it won't go into a fault state.
๐Ÿ‘ 1
m

https://youtu.be/pmgeKmqoxTsโ–พ

Mostly still correct
Actually I think this is still correct, it's only the logic analyser that has changed a little
a
@Matt Venn It was looking like this. It made sense that each line of code correspond to instructions executing one after the other but the timing of the assignments threw me off. I will try now with the proper config for xfer.
@Tim Edwards @Matt Venn I have much more clarity on how the interface is designed to work, thank you!
๐Ÿ‘ 1