马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
大家好!写了一段testbench,想把每次得到的结果输出到同一个文件中,但是发现最后的值覆盖了前面的几个,代码如下:
- always @(rxd or txd)
- begin
- write_out_file = $fopen("write_out_file.txt","w");
- #1200;
- if(txd===rxd)
- begin
- $fdisplay(write_out_file,"\n **** time=%t ****",$time);
- $fdisplay(write_out_file,"OK! txd=%d,rxd=%d",txd,rxd);
- end
- else
- begin
- $fdisplay(write_out_file,"\n **** time=%t ****",$time);
- $fdisplay(write_out_file,"ERROR! txd != rxd" );
- $fdisplay(write_out_file,"ERROR! txd=%d, rxd=%d",txd,rxd);
- end
- $fclose(write_out_file);
- end
复制代码
想不到解决办法,求助啊,谢谢大家! |