Experiment - 09: Aim: Tools: Methodology: Theory: Ring Counter
Experiment - 09: Aim: Tools: Methodology: Theory: Ring Counter
METHODOLOGY: Behavioral
JOGNSON COUNTER-A twisted ring counter, also called switch-tail ring counter, walking ring
counter, Johnson counter.A Johnson counter is a different sort of ring counter, where the inverted
output of the shift register is fed back to the input. The MOD of the Johnson counter is 2n if n
flip-flops are used. The main advantage of the Johnson counter counter is that it only needs half
the number of flip-flops compared to the standard ring counter for the same MOD.
CIRCUIT DIAGRAM :
RING COUNTER-
43
JOHNSON COUNTER-
VERILOG CODE:
1-RING COUNTER-
module ring( input clk,input rst,output q0, output q1, output q2, output q3);
df d1(q0,clk,rst,q3);
df d2(q3,clk,rst,q2);
df d3(q2,clk,rst,q1);
df2 d4(q1,clk,rst,q0);
endmodule
initial
if(rst1==1)
else
44
begin q=d; end
endmodule
initial
if(rst2==1)
else
endmodule
RTL:
45
TEST BENCH:
initial begin
rst = 0;#100;
rst = 1;#100;
rst = 0;#100;
end
initial clk=1'b0;
always
#100 clk=~clk;
endmodule
OUTPUT WAVEFORM:
VERILOG CODE:
JOHNSON COUNTER-
module john(input clk,input rst,output q0,output q1,output q2,output q3);
dff d1(~q3,clk,rst,q0);
46
dff d2(q0,clk,rst,q1);
dff d3(q1,clk,rst,q2);
dff d4(q2,clk,rst,q3);
endmodule
initial
if(rst1==1)
else
endmodule
RTL:
47
TEST BENCH:
initial begin
// Initialize Inputs
rst = 0;#100;
rst = 1;#100;
rst = 0;#100;
end
initial clk=1'b0;
always
#100 clk=~clk;
endmodule
OUTPUT :
RESULT: 4 bit ring and Johnson counter are successfully designed using Xilinx.
48