|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
module fp
(
CLK_in,
RSTn,
CLK_out
);
input CLK_in;
input RSTn;
output CLK_out;
reg CLK_out;
reg [3:0] count;
always @ (posedge CLK_in or negedge RSTn)
begin
if(!RSTn)
begin
count <= 4'b0;
end
else if(count == 4'd9)
begin
count <= 4'b0;
end
else
begin
count <= count + 4'd1;
end
end
always @ (posedge CLK_in or negedge RSTn)
begin
if(!RSTn)
begin
CLK_out <= 1'b0;
end
else if(count == 4'd9)
begin
CLK_out <= ~CLK_out;
end
end
endmodule |
|