集成电路技术分享

 找回密码
 我要注册

QQ登录

只需一步,快速开始

搜索
查看: 901|回复: 1

求大神解释下这段代码

[复制链接]
随手雕龙 发表于 2013-3-26 16:17:15 | 显示全部楼层 |阅读模式
process(clk_in_40MHz)
   begin
      if(rising_edge(clk_in_40MHz))then
             if(key_in_buf='0')then
                plu_beipin <= '0';
                flag_50period<='0';
                beipin_cnt  <= X"0000";
                count_pluse <= X"000000";
                cnt_beipin  <= X"0000000000";
                        cnt_num     <= X"00";
             else
                denom_in_buf <= denom_in;
                pluse_buf <= pluse_in;
                        count_pluse <= count_pluse + 1;
                         
                        if((pluse_buf='1')and(pluse_in='0'))then
                           period      <= count_pluse + 1;
                           count_pluse <= X"000000";
                        end if;
                         
                        if((pluse_buf='0')and(pluse_in='1'))then
                           period_beipin <= quotient;
                           cnt_num       <= cnt_num + 1;
                           if(cnt_num=X"31")then
                              cnt_num <=X"00";
                              flag_50period <= '1';
                           end if;
                        end if;
                         
                        cnt_beipin <= cnt_beipin + period_beipin;
                        plu_beipin <= cnt_beipin(31);
                        if((plu_beipin='1')and(cnt_beipin(31)='0'))then
                           beipin_cnt <= beipin_cnt + 1;
                           if((beipin_cnt=denom_in_buf-1)and((flag_50period='1')))then
                              beipin_cnt<=X"0000";
                          flag_50period<='0';
                           end if;
                        end if;
                       
                        if(beipin_cnt=denom_in_buf)then
                       beipin_cnt<=denom_in_buf;
                       cnt_beipin<=X"0000000000";
                    end if;
                    
                        if((flag_50period='1')and(beipin_cnt=denom_in_buf))then
                       beipin_cnt<=X"0000";
                       flag_50period<='0';
                    end if;
                 end if;
          end if;
   end process;
您需要登录后才可以回帖 登录 | 我要注册

本版积分规则

关闭

站长推荐上一条 /1 下一条

QQ|小黑屋|手机版|Archiver|fpga论坛|fpga设计论坛 ( 京ICP备20003123号-1 )

GMT+8, 2025-6-27 07:18 , Processed in 0.061284 second(s), 21 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表