为什么同样的verilog代码前者可以输出数据,后者输出为0-FPGA常见问题论坛-FPGA CPLD-ChipDebug

为什么同样的verilog代码前者可以输出数据,后者输出为0

为什么前者可以输出数据,后者输出为0
源代码:
module register(latch_en,fs_cnt_temp1,fx_cnt_temp1, fx_data_latch);
input [31:0] fs_cnt_temp1;
input [31:0] fx_cnt_temp1;
input latch_en; //锁存使能端
output reg [31:0] fx_data_latch;
//parameter define
parameter CLK_FS = 32’d50_000_000;
//main mode
always@ (latch_en)
begin
if (!latch_en)
fx_data_latch <= 32’d0;
else
fx_data_latch <= (CLK_FS / fs_cnt_temp1) * fx_cnt_temp1;
end

endmodule
仿真波形图:
1.jpg
2.jpg
两者只是在tb文件里输入不同;
前者仿真文件:
initial
begin
fs_cnt_temp1 = 32’d50_000_000; fx_cnt_temp1 = 32’d2000;
latch_en = 1’b0;

#10 latch_en = 1’b1;

#100 latch_en = 1’b0;

#100 $stop(0);
end
后者仿真文件:
initial
begin
fs_cnt_temp1 = 32’d50_000_000; fx_cnt_temp1 = 32’d2000;
latch_en = 1’b0;

#10 latch_en = 1’b1;fs_cnt_temp1 = 32’d50_000_001;

#100 latch_en = 1’b0;

#100 $stop(0);
end
想请问各位大佬,是源代码中进行算术运算的问题还是有别的原因?

请登录后发表评论