2025年3月7日 星期五

Verilog $value$plusargs

平常用 iverilog 時,最常使用的是 -D 選項,此選項是 for 編譯時期使用。

如果我們想要在 simulation 時期傳遞參數,就必須使用 Verilog-2001 新增的語法 $value$plusargs

既然是 simulation 時期,故必須在模擬時傳遞參數,也就是需要傳遞參數給 vvp 這支程式。

module TB;
reg[512*8:1] _new_path;
initial begin
if ($value$plusargs("NEWPATH=%s", _new_path)) begin
$display("%0s", _new_path);
end
else begin
$display("No NEWPATH");
end
end
endmodule

vvp -n test.vcd +NEWPATH="XXXXX"

沒有留言:

張貼留言