Using Verilog design a mod60 BCD counter that performs a cou
Solution
verilog code for Mod 60:
module mod60 ( clk ,clear ,BCD1,BCD0 );
output reg [3:0] BCD1 ;
output reg [3:0] BCD0 ;
reg [7:0] dout ;
input clk ;
wire clk ;
input clear ;
wire clear ;
initial dout = 0 ;
always @ (posedge (clk)) begin
if (clear)
dout <= 0;
else if (dout<=59) begin
dout <= dout + 1;
end
else if (dout==60)
begin
dout <= 0;
end
BCD1=dout[7:4];
BCD0=dout[3:0];
end
endmodule
for mod-24:
verilog code for Mod 60:
module mod60 ( clk ,clear ,BCD1,BCD0 );
output reg [3:0] BCD1 ;
output reg [3:0] BCD0 ;
reg [7:0] dout ;
input clk ;
wire clk ;
input clear ;
wire clear ;
initial dout = 0 ;
always @ (posedge (clk)) begin
if (clear)
dout <= 0;
else if (dout<24) begin
dout <= dout + 1;
end
else if (dout==24) begin
dout <= 0;
end
BCD1=dout[7:4];
BCD0=dout[3:0];
end
endmodule

