我的有限状态机-摩尔(不重叠)序列检测器的verilog代码在编译后不会生成"vcdplus.vpd“波形文件。我正在用vcs编译verilog代码-调试-访问+all。之后,我运行一个./simv模拟报告。
对于以前的verilog代码,我能够看到一个"vcdplus.vpd“文件和我的其他文件。我有什么问题?我肯定这是在我的眼皮底下,但我花了太多的时间在这方面,并将感谢任何帮助或建议。我已经运行了两次干净的编译(删除了所有文件),甚至创建了一个新目录。同样不想要的结果。我使用的是Mobaxterm,如果这有区别的话,而不是Xilinx/Vivado (不能在本课程中使用)。我的代码和测试平台如下:
module fsm (clock, reset, x, z);
input clock;
input reset;
input x;
output reg z;
parameter s0=4'b0000;
parameter s1=4'b0001;
parameter s2=4'b0010;
parameter s3=4'b0011;
parameter s4=4'b0100;
parameter s5=4'b0101;
reg [3:0] current_state, next_state;
always @(posedge clock or negedge reset) begin
if(reset==1)
current_state <= s0;
else
current_state <= next_state;
end
always @(current_state,x)
begin
case(current_state)
s0: begin
if(x==0)
next_state <= s0;
else
next_state <= s1;
end
s1: begin
if(x==0)
next_state <= s2;
else
next_state <= s1;
end
s2: begin
if(x==0)
next_state <= s3;
else
next_state <= s1;
end
s3: begin
if(x==0)
next_state <= s0;
else
next_state <= s4;
end
s4: begin
if(x==0)
next_state <= s2;
else
next_state <= s5;
end
s5: begin
if(x==0)
next_state <= s0;
else
next_state <= s1;
end
endcase
end
always @(current_state)
begin
case(current_state)
s0: z <= 0;
s1: z <= 0;
s2: z <= 0;
s3: z <= 0;
s4: z <= 0;
s5: z <= 1;
default: z <= 0;
endcase
end
endmodule`include "fsm_moore.v"
module fsm_moore_tb;
reg clock;
reg reset;
reg x;
wire [3:0] z;
fsm_moore_tb uut( .clock(clock), .reset(reset), .x(x), .z(z));
initial begin
$vcdpluson;
clock = 1'b0;
reset = 1'b1;
#15 reset = 1'b0;
end
forever #5 clock = ~ clock;
initial begin
#12 x=0;#10 x=1;#10 x=1;#10 x=0;
#12 x=0;#10 x=0;#10 x=1;#10 x=0;
#12 x=1;#10 x=0;#10 x=0;#10 x=1;
#12 x=1;#10 x=1;#10 x=1;#10 x=1;
#12 x=0;#10 x=1;#10 x=0;#10 x=0;
#10 $finish;
end
endmodule任何帮助都是非常感谢的。
发布于 2022-03-29 00:40:16
您提供的代码根本无法编译。它包含两个错误:
initial forever #5 clock = ~ clock;将修复这个问题。fsm uut( .clock(clock), .reset(reset), .x(x), .z(z));在修复了这两个错误之后,-debug_all (或其他一些调试质量)将允许您使用vpd跟踪。
https://stackoverflow.com/questions/71634831
复制相似问题