下面的分频的代码是否有问题?
BDR是一个8位的二进制数,来实现0-256任意分频
Divi_Pro: process(areset,clk_in,BDR)
variable counter :std_logic_vector(7 downto 0);
begin
if (areset='1') then
clk_mid<='0';
counter:="00000000";
elsif rising_edge( clk_in) then
if counter=(BDR-1) then
clk_mid<='1';
counter:="00000000";
else
clk_mid<='0';
counter:=counter+1;
end if;
end if;
end process Divi_Pro;
Tf_Pro: process(areset,clk_mid)
begin
if(areset='1')then
qn<='0';
elsif falling_edge(clk_mid) then
qn<=not qn;
end if;
clk_out<=qn;
end process Tf_Pro; |