【发布时间】:2015-11-03 07:56:04
【问题描述】:
verilog 专家您好,
在下面的verilog代码中,我可以100%相信top.test.p会被系统初始化为200吗?
或者我会在变量初始化和初始语句之间进行竞争吗?也就是说,有的模拟器会给我top.test.p == 100,有的给我top.test.p == 200?
谢谢
module test;
parameter real P = 1e3;
real P=p;
endmodule
module top;
test #(100) test();
initial
begin
// override the variable initialization (race condition????)
test.p = 200;
end
endmodule
【问题讨论】:
-
你的意思是
parameter real P = 1e3的参数吗?我猜它必须是p而不是P(可能是拼写错误),而且它必须是变量,而不是参数。参数不能在程序块中更改,它们只能在实例化时或被defparam覆盖。