modules20(clk,rst,clk_out);
inputclk,rst;
outputclk_out;
regclk_out;
reg[4:0]count1;
always@(posedgeclkornegedgerst)
if(!rst)
begin
count1
clk_out
end
else
if(count1
if(count1>=10)
endmodule
clk_out為輸出引腳,rst復位,clk為輸入,進行20次計數實現分頻,佔空比1:1
modules20(clk,rst,clk_out);
inputclk,rst;
outputclk_out;
regclk_out;
reg[4:0]count1;
always@(posedgeclkornegedgerst)
if(!rst)
begin
count1
clk_out
end
else
begin
if(count1
begin
count1
if(count1>=10)
clk_out
else
clk_out
end
else
count1
end
endmodule
clk_out為輸出引腳,rst復位,clk為輸入,進行20次計數實現分頻,佔空比1:1