Thanks to visit codestin.com
Credit goes to github.com

Skip to content

sknobs::get_value Always Returns Default Value Despite Passing CLI Argument with QuestaSim #17

@Ammar-10xe

Description

@Ammar-10xe

Hi, I’ve written a simple testbench to verify that I can pass a value via the command line and retrieve it using sknobs::get_value.

Here is the test code:

module test;
  int my_value;
  initial begin
    $display("[INFO] Reading knob 'my_knob'...");
    my_value = sknobs::get_value({".my_value"}, 1);
    $display("[INFO] Got knob value: my_knob = %0d", my_value);
  end
endmodule

I am using QuestaSim to run this code and check whether I receive the value from the command line. Here are the commands I used:

vlog +acc -sv -dpiheader sknobs.h ./src/verilog/sknobs.sv test.sv
vsim -sv_lib ./x86_64/lib64/libsknobs work.test +my_value=10~20 -c -do "run -all; quit"

However, I am getting the following output, which shows the value is not updated, and I receive the default value instead:

[INFO] Reading knob 'my_knob'...
0:I:sknobs: +.my_value=1
[INFO] Got knob value: my_knob = 1

If I am doing something wrong, please help me identify and correct it. Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions