Open nuntipat opened 1 year ago
I think you're right that this is not the desired behavior. In the hardware there is a flag controlling whether the simulation control is generated: https://github.com/lowRISC/ibex-demo-system/blob/main/rtl/system/ibex_demo_system.sv#L394-L409
Maybe we can use that same flag in the assembly file?
I think that naming the flags VERILATOR
is not self-explanatory, but I'm okay with either name. Please see my pull request #53 and let me know whether it is the right fix and which name you prefer. Thank you.
I created a new test program and used the CMake build script in the sw directory to build it. However, after the FPGA is programmed, the load_demo_system.sh script only works the first time and consistently fails on subsequent attempts. (Note: I have adapted the design to work on the PYNQ-Z2 board, but that shouldn't be the root of the problem as the script worked the first time.)
The reason, as far as I can tell, is that my program returns 0 and transfers control back to crt0.S instead of running in an infinite loop like the other demo program. The problem is solved by adding a
while(1)
loop at the end of the program, although a sleep_loop in crt0.S should have also worked. Further investigation indicates that the design appears to be stopped after writing 1 toSIM_CTRL_BASE + SIM_CTRL_CTRL
, preventing the design from receiving commands from openocd until the FPGA is reprogrammed.Should we put the code to halt simulation under
#ifdef
, which can be controlled by the CMake option? Or should we make a modification such that the design can only be halted in the simulator but not in the FPGA? Thank you for your suggestion, and either way, I would be happy to create a PR for the fix.