On Friday, August 5, 2016 at 4:27:28 AM UTC-4, Sand Glass wrote:
> test.v
> module test(
> a,b
> );
> parameter AA = 1;
> input a;
> output b;
> assign b = AA==1'b1 ? a : 0;
> endmodule
>
> tb.v
> module tb();
> parameter PAR_A = 0;
> //int width;
> //scanf(width);
> //if(width == 10)PAR_A=0;
> //else if(width == 20)PAR_A=1;
>
> test #(.AA(PAR_A)) (
> .a(1'b1),
> .b()
> );
> endmodule
>
> I want to sometimes PAR_A = 1, sometimes PAR_A=0, sometimes PAR_A = other value.
> How can I do it ?
> The environment support systemveilog, but tb.v cannot be changed to tb.sv.
The parameter value must be decided during elaboration. If you're looking for changing its value at run time, then you have to use port instead.
Regards,
Michael