How do I read an environment variable in Verilog/System Verilog?
How do I read an environment variable in Verilog ? (Running on a VCS simulator) I am trying to accomplish File=$fopen("$PATH/FileName","r"); $PATH is an environment variable. You can simply use SystemVerilog DPI for getting environment. And because getenv is a standard C library for every POSIX platform, so you do not need to implement your own getenv() equivalent function for the function definition again. Example code in SV. import "DPI-C" function string getenv(input string env_name); module top; initial begin $write("env = %s\n", {getenv("HOME"), "/FileName"}); end endmodule Running