马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
`timescale 1ns / 1ps
`define NULL 0
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 14:06:57 09/30/2018
// Design Name: system
// Module Name: D:/Xilinx/exercise/system/system_display.v
// Project Name: system
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: system
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module system_display;
integer fp_r;
integer fp_w;
integer flag;
reg[3:0] bin;
reg [15:0] data_in;
reg [15:0] cnt = 10;
initial
begin:file_fscanf//块名ç§
fp_r = $fopen("data_in.txt","r");
fp_w = $fopen("data_out.txt","w");
if(fp_r == `NULL)//ERROR
disable file_fscanf;
if(fp_w == `NULL)//ERROR
disable file_fscanf;
while(cnt>0)begin
flag = $fscanf(fp_r,"%d",data_in);
cnt = cnt -1;
$write("%d",data_in,",");
$fwrite(fp_w,"%d\n",data_in);
#5;
end
$fclose(fp_r);
$fclose(fp_w);
end
endmodule
仿真结果如下:显示无法打开文件,其中我把data_in.txt与data_out.txt文件放在system_display.v的同目录下
|