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

[BUG] relative file name leads to $readmem file not found (Verilator model) #259

Open
1 task done
CharKeaney opened this issue Sep 20, 2022 · 1 comment
Open
1 task done
Assignees

Comments

@CharKeaney
Copy link

Is there an existing core-v-mcu bug for this?

  • I have searched the existing bug issues

Bug Description

The file loaded in module generic_memory by $readmemh is a relative file location, and so not found if the Verilator model is not run in an expected directory. In our example, the problem was triggered trying to open mem_init/TOP.core_v_mcu.i_soc_domain.l2_ram_i.bank_sram_pri0_i.u0.mem.

We tested this using the prototype embdebug Verilator model GDB server. The error message is as follows.

charlie@troughton:~/src/install/bin$ ./embdebug --soname /home/charlie/src/embdebug-target-core-v/target/target.so --rsp-port 1234
Loading ITarget interface from dynamic library: /home/charlie/src/embdebug-target-core-v/target/target.so
Timescale 1ns / 1ns
Listening for RSP on port 1234
Remote debugging from host 127.0.0.1
TOP.core_v_mcu.i_soc_domain.l2_ram_i.bank_sram_pri0_i.u0
%Error: mem_init/TOP.core_v_mcu.i_soc_domain.l2_ram_i.bank_sram_pri0_i.u0.mem:0: $readmem file not found
Aborting...
Aborted (core dumped)

Changing this to run from the build/openhwgroup.org_systems_core-v-mcu_0/model-lib-verilator directory, caused correct behavior as follows:

charlie@troughton:~/src/core-v-mcu/build/openhwgroup.org_systems_core-v-mcu_0/model-lib-verilator$ ../../../../install/bin/embdebug --soname /home/charlie/src/embdebug-target-core-v/target/target.so --rsp-port 1234
Loading ITarget interface from dynamic library: /home/charlie/src/embdebug-target-core-v/target/target.so
Timescale 1ns / 1ns
Listening for RSP on port 1234
Remote debugging from host 127.0.0.1
TOP.core_v_mcu.i_soc_domain.l2_ram_i.bank_sram_pri0_i.u0
TOP.core_v_mcu.i_soc_domain.l2_ram_i.bank_sram_pri1_i.u0
TOP.core_v_mcu.i_soc_domain.l2_ram_i.CUTS[0].bank_i.u0
TOP.core_v_mcu.i_soc_domain.l2_ram_i.CUTS[1].bank_i.u0
TOP.core_v_mcu.i_soc_domain.l2_ram_i.CUTS[2].bank_i.u0
TOP.core_v_mcu.i_soc_domain.l2_ram_i.CUTS[3].bank_i.u0
...

The solution is either to ensure the $readmemh uses the absolute filename, or that there is a way to specify the base for any relative file references.

@jeremybennett
Copy link
Contributor

@gmartin102 or @davideschiavone is this something where you might be able to suggest the most effective solution? Thanks.

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

3 participants