Verilog 代码已编译,但没有“vcdplus.vpd”文件使用“$vcdpluson”时创建的波形文件- FSM 序列检测器
我的有限状态机 - 摩尔(非重叠) - 序列检测器的 verilog 代码在编译后没有生成“vcdplus.vpd”波形文件。我正在使用 vcs -debug-access+all <模块名称> 编译我的 verilog 代码。之后我运行 ./simv 模拟报告。
对于我以前的 verilog 代码,我能够看到“vcdplus.vpd”文件和其他文件。我的问题可能是什么?我确信它就在我眼皮子底下,但我在这上面花了太多时间,并且非常感谢任何帮助或建议。我已经运行了两次干净编译(删除所有文件),甚至创建了一个新目录。同样不想要的结果。如果这有影响的话,我正在使用 Mobaxterm SSH,而不是 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
感谢任何帮助。
My verilog code for my Finite State Machine - Moore (Non-Overlapping) - Sequence detector is not generating a "vcdplus.vpd" waveform file after I have compiled. I'm compiling my verilog code with vcs -debug-access+all <module name>. After that I run a ./simv simulation report.
For my previous verilog codes, I was able to see a "vcdplus.vpd" file with my other files. What could be my issue? I'm sure its right under my nose but I've spent too much time on this and would appreciate any help or advice. I've ran clean compiles (removed all files) twice and even made a new directory. Same unwanted results. I'm using Mobaxterm SSH if that makes a difference, not Xilinx/Vivado (can't use that for this course). My code & testbench are below:
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
Any help is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您提供的代码根本无法编译。
它包含两个错误:
initialforever#5clock=~clock;
可以解决这个问题。fsm uut(.clock(clock), .reset(reset), .x(x), .z(z));
修复这两个错误后,
-debug_all
(或其他一些调试 qaul)将允许您使用 vpd 跟踪。The code you provided cannot be compiled at all.
It contains two errors:
initial forever #5 clock = ~ clock;
would fix the issue.fsm uut( .clock(clock), .reset(reset), .x(x), .z(z));
After fixing both errors,
-debug_all
(or some other debug qaul) will allow you to use vpd traces.