Verilog 代码已编译,但没有“vcdplus.vpd”文件使用“$vcdpluson”时创建的波形文件- FSM 序列检测器

发布于 2025-01-17 03:21:07 字数 3518 浏览 1 评论 0原文

我的有限状态机 - 摩尔(非重叠) - 序列检测器的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

短叹 2025-01-24 03:21:07

您提供的代码根本无法编译。
它包含两个错误:

  1. fsm_moore_tb 模块中的 forever 语句位于任何过程块之外,这是非法的。 initialforever#5clock=~clock;可以解决这个问题。
  2. 您在同一模块内递归实例化模块fsm_moore_tb。这是非法的。我想,你需要实例化fsmfsm 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:

  1. the forever statement in the fsm_moore_tb module is outside of any procedural block, which is illegal. initial forever #5 clock = ~ clock; would fix the issue.
  2. you recursively instantiate module fsm_moore_tb inside the same module. This is illegal. I guess, you need to instantiate fsm: 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文