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

Can't set value of enum parameter using 'chparam' #82

Open
tudortimi opened this issue Apr 12, 2020 · 2 comments
Open

Can't set value of enum parameter using 'chparam' #82

tudortimi opened this issue Apr 12, 2020 · 2 comments

Comments

@tudortimi
Copy link

I have the example.sv file:

module example;

  parameter enum { FOO, BAR } some_param = FOO;

endmodule

and example.sby:

[options]
mode cover

[engines]
smtbmc

[script]
read -verific
read -formal example.sv
hierarchy -chparam some_param BAR -top example
prep

[files]
example.sv

I would like to set the value of some_param to BAR via the script block.

I get the following error: ERROR: Can't decode value 'BAR'!.

I've also tried quoting the parameter value as "BAR", but then I get ERROR: Can't decode value '"BAR"'! (notice the extra quotes around BAR).

With single quotes ('BAR') I get input:0: ERROR: Digit larger than 1 used in in base-2 constant..

@jimmysitu
Copy link

jimmysitu commented May 1, 2021

Hi, All

I got similar issue

module priority_encoder #
(
    // LSB priority: "LOW", "HIGH"
    parameter LSB_PRIORITY = "LOW"
)
[script]
read -formal priority_encoder.v
--pycode-begin--
cmd = "hierarchy -top priority_encoder"
if ("high" in tags):
    cmd += ' -chparam LSB_PRIORITY "HIGH"'
output(cmd)
--pycode-end--
prep -top priority_encoder

[files]
priority_encoder.v

I got the error

ERROR: Can't decode value '"HIGH"'!

I dig some help with Yosys, and

yosys> help chparam

    chparam [ -set name value ]... [selection]

Re-evaluate the selected modules with new parameters. String values must be
passed in double quotes (").
yosys> help hierarchy
......
    -chparam name value 
       elaborate the top module using this parameter value. Modules on which
       this parameter does not exist may cause a warning message to be output.
       This option can be specified multiple times to override multiple
       parameters. String values must be passed in double quotes (").

It seems Yosys is support string value parameter, and it has some issue with hierarchy -chparam

@jimmysitu
Copy link

Hi, @tudortimi

I fixed by problem with chparam -set in yosys. May be you can try

[script]
read -verific
read -formal example.sv
chparam -set some_param "BAR"
hierarchy -top example
prep

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants