Passing .hex file to RTL

Hi ,

Good Day :)
I am trying to pass HEX file to RTL via a parameter
RTL file

module xyz # (
 parameter HEX_FILE = "RTL_HEX_FILE"
) (
 input clk
);

TB top

module tb_top;
 xyz #(
 .HEX_FILE("DV_HEX_FILE")
) dut(
 .clk(clk)
);

Question - If I pass direct path(out_test/123/hex_file.hex) then my code is working, but If I give the dynamic path like $OUT/$SEED/.hex, then my code is not working.

Thanks & Regards,
Saikrishna

In reply to Saikrishna B:
Understanding syntax like “$SEED” is shell variable syntax, not SystemVerilog. You will need to have the shell script that invokes your tool expand the variables before passing it on to your tool.

Hi Dave ,

Thanks for the reply,

TB TOP-

module tb_top;
string dv_init_file;
 xyz #(
 .HEX_FILE(dv_init_file)
) dut(
 .clk(clk)
);
initial begin
  $value$plusargs("INIT_FILE=%s",dv_init_file);
  $display("TB_TOP: DV INIT FILE 1 PATH : %s",dv_init_file);
end

I am trying to get the INIT_FILE from my script as a run time variable and passing the path to a parameter , now I am seeing a compile error,

Error-[NCE] Non-constant expression
The following expression should be a constant.
Expression: dv_init_file
“tb_top”,
Source info: .HEX_FILE (dv_init_file),

without passing dv_init_file to DUT, I am able to see the path of my hex file from the print, but only the issue is if I parse that to DUT then I am seeing the error.

Thanks & regards,
Saikrishna B

In reply to Saikrishna B:

Parameters cannot be set with values evaluated at run-time.

You can compile your code with a +define+INITFILE=“filename”

and then in your testbench

module tb_top;
string dv_init_file;
 xyz #(
 .HEX_FILE(`INIT_FILE)
) dut(
 .clk(clk)
);


Getting your tool to recognize “filename” as a string literal is going to be shell and tool specific.

This Mentor/Siemens EDA sponsored public forum is not for discussing tool specific usage or issues. Please read your tool’s user manual or contact your tool vendor directly for support.

In reply to dave_59:

Hi Dave,

Thanks for your reply, Issue resolved

`define STRCONCAT(s1,s2) `"s1``s2`"
module tb_top;
localparam INIT_FILE = `STRCONCAT(`PWD,init_file.hex);

 xyz #(
 .HEX_FILE(INIT_FILE)
) dut(
 .clk(clk)
);

I am driving PWD from my tool define.

Thanks & regards,
Saikrishna B