保存
システムタスク $save(“filename”) でシミュレーションの状態をファイルに保存。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
initial begin | |
#100; $display("a"); | |
#100; $display("b"); | |
$save("checkpoint"); | |
#100; $display("c"); | |
#100; $display("d"); | |
end |
差分保存の $incsave(“incremental_filename”) もある。
再開
$restart(“filename”) で再開。書くならこんな感じ?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
initial begin | |
integer fd; | |
fd = $fopen("checkpoint", "rb"); | |
if (fd !== 0) begin | |
$fclose(fd); | |
$restart("checkpoint"); | |
end | |
end |
VCS の場合、simv -r checkpoint で指定可能なよう。
注意点
(ツールの実装によるかもしれないけど)$save を呼び出した同時刻までの処理が完了した状態で保存されるので、次のような場合 CHECKPOINT は再開時に表示されない。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
initial begin | |
$save("checkpoint"); | |
$display("CHECKPOINT"); // $save 呼び出しと sim 時間が同じ | |
end |