Files
SystemVerilog-Learning/counter_4b/tb_counter_4b.sv
T
2026-11-29 10:34:26 +01:00

62 lines
870 B
Systemverilog

`timescale 1ns/1ps
module tb_counter_4b;
logic clk;
logic rst;
logic en;
logic load;
logic [3:0] data_in;
logic max_tick;
logic [3:0] count;
counter_4b dut (
.clk(clk),
.rst(rst),
.en(en),
.load(load),
.data_in(data_in),
.max_tick(max_tick),
.count(count)
);
initial begin
clk = 1'b0;
forever #5 clk = ~clk;
end
initial begin
$dumpfile("counter_4b.vcd");
$dumpvars(0, tb_counter_4b);
rst = 1'b1;
en = 1'b0;
load = 1'b0;
data_in = 4'b0100;
#20; // Maintien du reset pendant 2 coups d'horloge
@(posedge clk);
rst <= 1'b0;
en <= 1'b1;
load <= 1'b1;
#20;
load <= 1'b0;
repeat (15) @(posedge clk);
#20;
$display("Fin de la simulation.");
$finish;
end
endmodule