process(rst,clk)
begin
if rst = '1' then
clk_cnt <= x"0000";
elsif clk'event and clk = '1' then
if clk_1us = '1' then
clk_cnt <= x"0000";
else
clk_cnt <= clk_cnt + '1';
end if;
end if;
end process;
clk_1us <= '1' when clk_cnt = cnt_cfg - '1' else '0';
cnt_cfg为配置寄存器的值。