在 Vivado 仿真中自动关闭文件
Closing a file automatically in a Vivado simulation
我有一个使用 $fopen
和 $fwrite
编写输出的测试平台。在模拟结束时,以下代码关闭文件:
initial
begin
#10000 begin
$fclose(file);
$finish;
end
end
但是,如果我希望模拟 运行 更长或更短,我该怎么办?我能否以某种方式使文件在模拟结束时自动关闭?
退出前不需要调用 $fclose(file)
。
By default, before the simulator terminates, all open files are closed. This means that the user does not have to close any files, and closing is done automatically by the simulator.
我有一个使用 $fopen
和 $fwrite
编写输出的测试平台。在模拟结束时,以下代码关闭文件:
initial
begin
#10000 begin
$fclose(file);
$finish;
end
end
但是,如果我希望模拟 运行 更长或更短,我该怎么办?我能否以某种方式使文件在模拟结束时自动关闭?
退出前不需要调用 $fclose(file)
。
By default, before the simulator terminates, all open files are closed. This means that the user does not have to close any files, and closing is done automatically by the simulator.