COUNTER
COUNTER
input clk,
input reset,
input up_down,
output [3:0] counter
);
wire [3:0] d;
wire [3:0] q;
endmodule
module tb_up_down_counter_structural;
reg clk;
reg reset;
reg up_down;
wire [3:0] counter;
initial begin
// Initialize signals
clk = 0;
reset = 1;
up_down = 0;
// Apply reset for 10 time units
#10 reset = 0;
// Test counting up
up_down = 0;
#100; // Let counter increment for 100 time units
// End simulation
$stop;
end
// Monitor the counter value, up_down, reset, and clk for debugging
initial begin
$monitor("Time = %0t | Counter = %b | Up_Down = %b | Reset = %b | CLK =
%b", $time, counter, up_down, reset, clk);
end
endmodule