always@(posedge IDout or posedge reset)
begin
if(reset)
begin
clk_out<='b0;
counter_D<=10'b0;
end
else
begin
if(counter_D>=((counter_N- 10'b1)>>1))
begin
clk_out<=~clk_out;
counter_D<=10'b0;
end
else
begin
counter_D<=counter_D+10'b1;
end
end
end
endmodule