模块未正确实例化?

Module not properly instantiated?

我有一个关于 T-Bird 尾灯的示例代码,它正在将状态传递到下一个模块。我修改了它不必通过状态的代码,但输出似乎没有变化(一直保持000)

这是我修改后的代码:

module TBird(E,B,L,R,int_clk,L_Light,R_Light);
input E,B,L,R,int_clk;
output [2:0] L_Light;
output [0:2] R_Light;
reg [19:0] C;
wire int_clk;

One_Side U1 (E,B,R,int_clk,R_Light);
One_Side U2 (E,B,L,int_clk,L_Light);
endmodule

module One_Side(e,b,t,clk,light_eb);
input e,b,t,clk;
output reg [2:0] light_eb=3'b000;
always @(posedge clk or e or b or t)
    begin
        case ({e,b,t})
        3'b000: light_eb=3'b000;
        3'b0?1: begin
                    if (light_eb==3'b000) begin
                        light_eb=3'b001;
                    end else if (light_eb==3'b001) begin
                        light_eb=3'b011;
                    end else if(light_eb==3'b011) begin
                        light_eb=3'b111;
                    end else begin
                        light_eb=3'b000;
                    end
                end
        3'b?10: light_eb=3'b111;
        3'b10?: begin
                    if (light_eb!==(3'b000|3'b111)) begin
                        light_eb=3'b000;
                    end
                    light_eb=~light_eb;
                end
        3'b111: begin
                    if (light_eb==3'b000) begin
                        light_eb=3'b001;
                    end else if (light_eb==3'b001) begin
                        light_eb=3'b011;
                    end else if(light_eb==3'b011) begin
                        light_eb=3'b111;
                    end else begin
                        light_eb=3'b000;
                    end
                end
        endcase
    end
endmodule

我在Java有过一些经验,但是我对verilog了解不多,所以我什至不知道哪里出了问题(在Java,eclipse有断点和调试器和类似的东西,)任何 suggestions/recommendations 都表示赞赏。

测试平台和设计中的一些错误。列表如下:

未提供任何时钟信号切换。所以不会检测到任何 posedge 的时钟。产生时钟的方式有很多种,其中一种方式如下:

always #5 clk = ~clk;

在设计中使用 reset 信号是一种很好的做法。从测试平台应用 reset 将 design 中的所有 i 内部寄存器设置为它们的 初始值.

重要的事情是您没有为设计提供任何输入激励。必须应用任何 随机刺激 才能获得输出。您必须提供一些输入才能获得输出,因此您的输出为 x.

initial
begin
forever
begin
  #6;
  E = $random;
  B = $random;
  R = $random; // and so on...
end
end

在设计中使用非阻塞 (<=) 赋值 是一种很好的编码习惯。此外,不要混合阻塞 (=) 和非阻塞 (<=) 分配

a = b; // never use this in sequential circuit.
a<= b; // use this in sequential circuit.

我已经为你的设计做了一个比较有效的测试平台,看看EDAPlayground link。

必须参考 this, this, and this link 以了解 通用测试平台架构