【发布时间】:2020-12-30 19:25:33
【问题描述】:
我在测试台中的这段代码有问题,因为它给了我cout 的 X,但我找不到问题。
启用的三位计数器 Verilog:
`timescale 1ns/1ns
module three_bit_counter(output cout,input en,clk);
reg [2:0] w;
always@(negedge clk)begin
if (en)
w <= w + 1;
end
assign cout= w & en;
endmodule
这是我的测试平台:
`timescale 1ns/1ns
module three_bit_counterTB();
reg en;
reg clk=1;
wire cout;
three_bit_counter tbc(cout,en,clk);
always #20 clk=~clk;
initial begin
#20 en=1;
#100;
$stop;
end
endmodule
【问题讨论】:
标签: verilog