always @ (posedge clk_in)
begin
if (!rst) //同步复位
begin
clk_out <= 1'b0;
count <= 0;
state <= `s0;
end
else
case (state)
`s0 : if (count < LW-1)
begin
count <= count + 1;
state <= `s0; //显式状态
end
else
begin
count <= 0;
clk_out <= 1'b1;
state <= `s1;
end
`s1 : if (count < HW-1)
begin
count <= count + 1;
state <= `s1; //显式状态
end
else
begin
count <= 0;
clk_out <= 1'b0;
state <= `s0;
end
endcase
end