6,158
社区成员




module count_10(
clk,
count
);
input clk;
output [3:0] count;
reg [3:0] count;
always@(posedge clk)
begin
if(count >= 4'd9)
count <= 4'd0;
else
count <= count + 1'b1;
end
endmodule
module count_10_tb();
reg clk;
wire [3:0] count;
count_10 count_10(
.clk(clk),
.count(count)
);
initial begin
clk = 0;
count_10.count = 4'b0000; //这里 需要对待测试模块中的所有 reg 变量初始化。如果待测试模块有 reset 则 不需要这个了。
forever #5 clk = ~clk;
end
initial
begin
$fsdbDumpfile("wave_test.fsdb");
$fsdbDumpvars;
end
endmodule