The document describes implementing up, down, and up/down counters using Verilog code. It includes:
1) Code for a 4-bit up counter that counts from 0 to 15 when the clock signal changes.
2) Code for a 4-bit down counter that counts from 15 to 0 when the clock signal changes.
3) Code for a 4-bit up/down counter that counts up when the up signal is high and down when the down signal is high, controlled by the clock.
3. Theory:
An up counter simply counts from 0 to 9. We
can use this circuit to make , This circuit can
also be used to make a digital clock.
Both Synchronous and Asynchronous counters
are capable of counting “Up” or counting
“Down”, but their is another more “Universal”
type of counter that can count in both directions
either Up or Down depending on the state of
their input control pin and these are known
as Bidirectional Counters.
Bidirectional counters, also known as a up
down counter.
PROGRAMME CODES
4bit up counter:
module fbuc(clk,reset,q);
input clk,reset;
output [3:0]q;
reg [3:0]q;
always@(clk)
begin if(reset)
q=0;
else if(reset==0&&q<15)
q=q+1;
end
endmodule