tiankongzhang 发表于 2013-10-27 16:49:02

急求大神啊!!!!

我刚学FPGA,对下面程序有点不解,求大神指教啊
process(clk,reset)
      variable cnt:integer range 0 to 300:=0;
      begin
             if resetb='1' then cnt:=0;bclk<='0';
             elsif rising_edge(clk) then
                      if cnt>=208 then
                            cnt:=0;
                            bclk<=1;
                      else
                            cnt:=cnt+1;
                            bclk<=0;
                      end if;
            end if;
end process;
它要求得到16分频的时钟,那么cnt>=208是怎么意思,我不明白。

ytphrx 发表于 2013-10-28 19:23:40

这个分频方法不对。而且看程序想208分频。
16分频是这么来的:
process(clk,reset)
         variable cnt:integer range 0 to 300:=0;
         begin
            if reset='1' then cnt:=0;bclk<='0';
            elsif rising_edge(clk) then
                     if cnt>=8 then
                           cnt:=0;
                           bclk<=not bclk;
                     else
                     cnt:=cnt+1;
                     end if;
               end if;
end process;

tiankongzhang 发表于 2013-10-30 13:27:05

ytphrx 发表于 2013-10-28 19:23 static/image/common/back.gif
这个分频方法不对。而且看程序想208分频。
16分频是这么来的:
process(clk,reset)


我也看得云里雾里的,看了你的程序,清楚多了,thank you!

IPO 发表于 2013-11-1 07:02:17

Gggggggggg
页: [1]
查看完整版本: 急求大神啊!!!!