电竞比分网-中国电竞赛事及体育赛事平台

分享

利用Quartus設(shè)計(jì)4位同步二進(jìn)制加法計(jì)數(shù)器

 劉曦的書(shū)房 2016-05-19

http://blog.csdn.net/ys_073/article/details/8195312

一、設(shè)計(jì)原理

      4位同步二進(jìn)制加法計(jì)數(shù)器的工作原理是指當(dāng)時(shí)鐘信號(hào)clk的上升沿到來(lái)時(shí),且復(fù)位信號(hào)clr低電平有效時(shí),就把計(jì)數(shù)器的狀態(tài)清0。

      在clr復(fù)位信號(hào)無(wú)效(即此時(shí)高電平有效)的前提下,當(dāng)clk的上升沿到來(lái)時(shí),如果計(jì)數(shù)器原態(tài)是15,計(jì)數(shù)器回到0態(tài),否則計(jì)數(shù)器的狀態(tài)將加1

 二、VHDL源程序

  1. library ieee;  
  2. use ieee.std_logic_1164.all;  
  3. entity cnt4e is  
  4.    port(clk,clr:in std_logic;  
  5.   
  6.          cout:out std_logic;  
  7.          q:buffer integer range 0 to 15);  
  8.     end cnt4e;  
  9. architecture one of cnt4e is  
  10. begin  
  11.     process(clk,clr)  
  12.     begin  
  13.         if clk'event and clk='1'then  
  14.             if clr='1'then  
  15.                 if q=15 then q<=0;  
  16.                     cout<='0';  
  17.                 elsif q=14 then q<=q+1;  
  18.                     cout<='1';  
  19.                     else q<=q+1;  
  20.                     end if;  
  21.             else q<=0;  
  22.                 cout<='0';  
  23.             end if;  
  24.         end if;  
  25.     end process;  
  26. end one;  

三、仿真波形圖

 

VerilogHDL和一個(gè)的編程語(yǔ)言其實(shí)也差不多,關(guān)鍵在于首先要了解所搭的電路。不僅僅是純語(yǔ)言思想,同時(shí)動(dòng)手實(shí)踐也相當(dāng)重要。

 

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶(hù)發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買(mǎi)等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶(hù) 評(píng)論公約

    類(lèi)似文章 更多