我正在使用ISIM来模拟设计并将结果写入文本文件。这是代码段:
initial begin
out_file = $fopen("output_data.txt","w");
forever begin
@(posedge dout_start)
#4; // wait for 2 clock cycles
if (dout_valid) begin
$fwrite(out_file,"%s\n","--------------------------------");
for (j=0; j<64; j=j+1) begin
#2;
$fwrite(out_file,"%h\n",dout_flat);
end
end
end
$fclose(out_file);
end
但是输出文件写入突然停止,结果不完整。例如:
52xxxxxxxx99xxxxxxxxxxxxxxxxxxxx
d8xxxxxxxx05xxxxxxxxxxxxxxxxxxxx
89xxxxxxxxccxxxxxxxxxxxxxxxxxxxx
85xxxxxxxx7axxxxxxxxxxxxxxxxxxxx
43xxxxxxxx06xxxxxxxxxxxxxxxxxxxx
4cxxxxxxxxddxxxxxxxxxxxxxxxxxxx
(这应该是64行!) 我已经运行了几次,结果没有改变。
谢谢