这是2月5日发布的一个跟进问题。我不知道如何跟进该线程,因此这个新问题。
我已经更新了测试台。它包含$ fwrite等。
现在收到警告" file/Multi-channel descriptor (2) passed to $fclose in not valid
&#34 ;. AA2.txt文件为空。使用$ fwrite(而不是$ fmonitor)并且它有效,但有相同的警告。我应该忽略这个警告吗?我也尝试使用" reset" (SEE CODE)根据DUT输出信号(negedge ASM_FLAG)的状态,在模拟结束时从1变为0,停止写入文件,但复位始终为1,因此无输出。似乎模拟还没有开始。你可以解释一下吗?
``timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 16:57:34 12/04/2014
// Design Name: ADC_SAMPLE
// Module Name: C:/Xilinx131/SOC/SOC501V2/ADC_SAMPLE_tb.v
// Project Name: SOC501V2
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: ADC_SAMPLE for review with Honeywell
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module ADC_SAMPLE_tb;
// Inputs
reg CLK;
reg ASM_SEL;
reg [11:0] ADC_BUS;
reg [7:0] ADC_Wait_Time;
// Outputs
wire [7:0] ASM_HB;
wire [7:0] ASM_LB;
wire AS_SConv;
wire AS_OE;
wire ASM_FLAG;
wire [3:0] S;
parameter PERIOD = 100;
parameter real DUTY_CYCLE = 0.5;
parameter OFFSET = 0;
// Instantiate the Unit Under Test (UUT)
ADC_SAMPLE uut (
.CLK(CLK),
.ASM_SEL(ASM_SEL),
.ADC_BUS(ADC_BUS),
.ADC_Wait_Time(ADC_Wait_Time),
.ASM_HB(ASM_HB),
.ASM_LB(ASM_LB),
.AS_SConv(AS_SConv),
.AS_OE(AS_OE),
.ASM_FLAG(ASM_FLAG),
.S(S)
);
initial begin
// Initialize Inputs
CLK = 0;
ASM_SEL = 1;
ADC_BUS = 12'hABC;
ADC_Wait_Time = 4;
end
initial
begin
#OFFSET;
forever
begin
CLK = 1'b1;
#(PERIOD-(PERIOD*DUTY_CYCLE)) CLK = 1'b0;
#(PERIOD*DUTY_CYCLE);
end
end
initial begin
// Wait 100 ns for global reset to finish
// Add stimulus here
#200 ASM_SEL=1;
#150 ASM_SEL=0;
end
integer h1;
reg reset;
initial begin
reset = 0;
@(negedge ASM_FLAG) reset = 1;//at completion of sim, ASM_FLAG goes 0;
end
initial begin
$display("ADC_SAMPLE_tb simulator output");
$display ("h1,CLK, ASM_SEL,ASM_HB,ASM_LB,AS_SConv, AS_OE, ASM_FLAG,S");
end
initial begin
h1 = $fopen("AA2.txt");//did not work as a seperate init/begin block..
end
always @ (posedge CLK)
begin
repeat (10)
// while (reset == 0)
begin
$fwrite(h1,"%d,%b,%b,%b,%h,%h,%b,%b,%b,%h,\n",
h1,reset,CLK, ASM_SEL,/* ADC_BUS,ADC_Wait_Time,*/ASM_HB,ASM_LB,
AS_SConv, AS_OE, ASM_FLAG,
S);
end
$fclose (h1);
end
endmodule
`
答案 0 :(得分:0)
您继续关闭always
块中每个CLK posedge的文件。不要这样做。在您的情况下,甚至无需调用$fclose
,因为它将在模拟终止时关闭。