module counter_integer ( clk ,reset ,dout );

output [9:0] dout ;
reg [9:0] dout ;

input clk ;
wire clk ;
input reset ;
wire reset ;

initial dout = 0;

always @ (posedge (clk)) begin
if (reset)
dout <= 0;
else if (dout < 1023)
dout <= dout + 1;
else if (dout==1023)
dout <= 0;
end


endmodule

/***********************************************/

module Counter_4Bit ( clk ,reset ,dout );

output [3:0] dout ;
reg [3:0] dout ;

input clk ;
wire clk ;
input reset ;
wire reset ;

initial dout = 0;

always @ (posedge (clk)) begin
if (reset)
dout <= 0;
else
dout <= dout + 1;
end


endmodule

/*************************************************/

module BCD_Counter ( clk ,reset ,dout );

output [3:0] dout ;
reg [3:0] dout ;

input clk ;
wire clk ;
input reset ;
wire reset ;

initial dout = 0 ;

always @ (posedge (clk)) begin
if (reset)
dout <= 0;
else if (dout<=9) begin
dout <= dout + 1;
end else if (dout==9) begin
dout <= 0;
end
end


endmodule


/******************************************************

/*count := count + 1;
if count = 50000000-1 then
    count := 0;
end if;

if count <25000000 then
    clk_out <= '1';
else
   clk_out <= '0';
end if;

reg [23:0] count1; 

always @(posedge clk) begin
  LEDstatus <= count1[23];
  count1    <= count1 + 1;
end*/


