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

$prsim() is passed a space-padded string from plusarg, needs to be stripped #69

Open
fangism opened this issue Aug 4, 2016 · 0 comments

Comments

@fangism
Copy link
Owner

fangism commented Aug 4, 2016

Consider the following Verilog (used for cosimulation) that takes a file name from a plusarg:

  initial begin
    reg [128:0] prs_obj;
    if (!$value$plusargs("PRSIM_OBJ=%s", prs_obj)) begin
      prs_obj = "Missing required +PRSIM_OBJ= arg.";  // causes fatal error below
    end
    $prsim(prs_obj);
    ...
end

Passing the plusarg +PRSIM_OBJ=foo.haco-c to cosimulation gives:

Error opening object file " foo.haco-c".

(Note the leading space.)
If we used instead:

    string prs_obj;

then it works. However, string is a SystemVerilog type. It would be nice if this worked with plain Verilog. Enabling SystemVerilog string is the workaround.

The correct patch to fix this would be to call strip_spaces() in vpi-prsim.cc in the prsim_file() function.

@fangism fangism changed the title $prsim() passes a space-padded string, needs to be stripped $prsim() is passed a space-padded string from plusarg, needs to be stripped Aug 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant