读取TXT文件
- integer i;
- reg [11:0]Xin_reg[999:0];
- initial begin
- $readmemb("E4_7_Bin_s.txt",Xin_reg);
- i = 0;
- repeat(1000)begin
- i = i+1;
- Xin = Xin_reg;
- #(`Clock_period*1);
- end
- end
写入TXT文件
- //将仿真数据dout写入外部TXT文件中(out.txt)
- integer file_out;
- initial begin
- //文件放置在"工程目录\simulation\modelsim"路径下
- file_out = $fopen("E4_7_Sout.txt");
- if(!file_out) begin
- $display("could not open file!");
- $finish;
- end
- end
- wire clk_write;
- wire signed [14:0] Yout_s;
- assign Yout_s = Yout; //将数据转换成有符号数据
- assign clk_write = clk & rst_n;//产生写入时钟信号,复位状态时不写入数据
- always @(posedge clk_write)
- $fdisplay(file_out,"%d",dout_s);
关闭
站长推荐
/3
curton 2019-9-16 21:18