Professional Documents
Culture Documents
Dr. M.Aarthy
Assistant Professor Senior
School of Electronics Engineering
Vellore Institute of Technology
Counters
A register that goes through a prescribed sequence of states upon the application of
input pulses (clock pulse) is called a counter.
Synchronous counters
Ripple counters - Flip flop output serves as a source for triggering other flip flops
The sequence may follow the binary count or may be any other arbitrary sequence.
A0 J A1
J Q Q
C C
Q' K Q'
K
CLK
Synchronous (Parallel) Counters
Example: 3-bit synchronous binary counter (using T flip-flops, or JK flip-flops with identical
J, K inputs).
1 1 1 1 1 1 1
A2 1 A2 1 1 A2 1 1 1 1
A0 A0 A0
TA2 = A1.A0 TA1 = A0 TA0 = 1
Synchronous (Parallel) Counters
Example: 3-bit synchronous binary counter (cont’d).
TA2 = A1.A0 TA1 = A0 TA0 = 1
A2 A1 A0
Q Q Q
J K J K J K
Clk
1
Digital Logic Design 12/14/2021 11
Synchronous Up/Down counters
Up/Down Counter can either count up
or down on each clock cycle
101 011
111 010
110
Present Next Flip-flop
state state inputs
Q2 Q1 Q0 Q2+ Q1+ Q0+ JQ2 KQ2 JQ1 KQ1 JQ0 KQ0
0 0 0 0 0 1 0 X 0 X 1 X
0 0 1 0 1 1 0 X 1 X X 0
0 1 0 1 1 0 1 X X 0 0 X
0 1 1 0 1 0 0 X X 0 X 1
1 0 0 0 0 0 X 1 0 X 0 X
1 0 1 1 0 0 X 0 0 X X 1
1 1 0 1 1 1 X 0 X 0 1 X
1 1 1 1 0 1 X 0 X 1 X 0
Designing Synchronous Counters
3-bit Gray code counter: flip-flop inputs.
Q0 Q1 Q2
J Q J Q J Q
C C C
Q1 ' Q2 '
K Q' K Q' K Q'
Q0 '
CLK
Ring Counter
It is the special application of Shift register(circular shift register)
The output of the last FF is given as the input of the first FF.
always@(posedge clk)
begin
if(clr)
q <= 4‘b0;
else if (load)
q <= 4‘b0001;
else if(up)
q <= q + 4’b1;
else if(down)
q <= q – 4’b1;
end
endmodule
always@(posedge clk)
begin
if(clr)
q <= 4'd0;
else
begin
if (load)
q <= 4'd8;
else
q <= {q[0], q[3:1]};
end
end
endmodule
always@(posedge clk)
begin
if(clr)
q <= 4'd0;
else
begin
if (load)
q <= 4'd8;
else
q <= {!q[0], q[3:1]};
end
end
endmodule