I have an opentitan like processor which can be simulated with verilator.
For this, there is a top_verilator function like this:
module top_verilator(input logic clk_i, rst_ni);
...
system #(
.SRAMInitFile("/home/user/location/to/vmem")
) u_system (
.clk_i,
.rst_ni
);
endmodule
what i want to do is read the vmem location out of a enviornment variable as multiple people work on the project.
what i tried to do is import getenv like this
import "DPI-C" function string getenv(input string env_name);
as shown here How do I read an environment variable in Verilog/System Verilog?. However, this does not function with recent systemverilog versions, as this gives the error
Constant function may not be DPI import (IEEE 1800-2023 13.4.3)
as described here https://github.com/verilator/verilator/issues/3103. Is there another way to do this?