module demo
(
CLK, RSTn, Pin_out // 6分频
);
input CLK; //时钟输入
input RSTn; //异步复位
output Pin_out; //6分频输出
reg rOut;
reg [1:0]Count;
always@( posedge CLK or negedge RSTn )
if( !RSTn )
begin
rOut <= 1'b0;
Count <= 2'd0;
end
else
if( Count == 2'd2 )
begin
rOut <= ~rOut;
Count <= 6'd0;
end
else
Count <= Count + 1'b1;
assign Pin_out = rOut;
endmodule