Hi there.
I am having a problem regarding parameters. So we have some internal codegenerators that spits out a package file in system verilog. Depending on a configuration I provide in the codegenerator it will create a file like this
package my_pkg;
function tag()
return "tag1";
endfunction
function gen_v1()
return 1;
endfunction
endpackage
or it will generate a file package file like
package my_pkg;
function tag()
return "tag2";
endfunction
function gen_v2()
return 2;
endfunction
endpackage
The tag function will always be present.
Now in my module file I want to do something like this
case ( my_pkg::tag() )
"tag1": localparam int param1 = my_pkg::gen_v1();
"tag2": localparam int param1 = my_pkg::gen_v2();
endcase
// Continue using param1 as necessary
But this fails because if gen_v1 was generated by my codegenerator, it will fail on gen_v2 or viceversa. I dont know why these are getting evaluated because only one of those cases should come true.
Can anyone help me with this?