久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 2546|回復: 0
打印 上一主題 下一主題
收起左側

利用元件例化VHDL語言編寫的六位數字頻率計源碼

[復制鏈接]
跳轉到指定樓層
樓主
ID:440194 發表于 2018-12-5 16:40 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
Cnt10/10進制計數器
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity cnt10 is
port(clk,clr,en:in std_logic;
                carry_out:out std_logic;
      cq:out std_logic_vector(3 downto 0));
    end cnt10;
architecture bhv of cnt10 is
signal cnt:std_logic_vector(3 downto 0);
begin
    cq<=cnt;
    process(clr,en,clk)
begin
        if clr='1' then
        cnt <= "0000";
        elsif clk'event and clk='1' then
                if (en='1') then
                        if cnt="1001" then cnt<="0000";
                                carry_out<='1';
                        else cnt<=cnt+1;
                                carry_out<='0';
                        end if;
                end if;
        end if;
end process;
end bhv;

Cnt10x6 /六合一十進制計數器
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity cnt10x6 is
port(fx,clr,en:in std_logic;
      q:out std_logic_vector(23 downto 0));
    end cnt10x6;
architecture a of cnt10x6 is
component cnt10
port(clk,clr,en:in std_logic;
                carry_out:out std_logic;
      cq:out std_logic_vector(3 downto 0));
      end component;
      signal c:std_logic_vector(5 downto 0);
      begin
u1:cnt10 port map(clk=>fx,clr=>clr,en=>en,cq=>q(3 downto 0),carry_out=>c(0));
u2:cnt10 port map(clk=>c(0),clr=>clr,en=>en,cq=>q(7 downto 4),carry_out=>c(1));
u3:cnt10 port map(clk=>c(1),clr=>clr,en=>en,cq=>q(11 downto 8),carry_out=>c(2));
u4:cnt10 port map(clk=>c(2),clr=>clr,en=>en,cq=>q(15 downto 12),carry_out=>c(3));
u5:cnt10 port map(clk=>c(3),clr=>clr,en=>en,cq=>q(19 downto 16),carry_out=>c(4));
u6:cnt10 port map(clk=>c(4),clr=>clr,en=>en,cq=>q(23 downto 20),carry_out=>c(5));
end a;

Reg24 鎖存器
library ieee;
use ieee.std_logic_1164.all;
entity reg24 is
port(load:in std_logic;
din:in std_logic_vector(23 downto 0);
dout:out std_logic_vector(23 downto 0));
end;
architecture rtl of reg24 is
begin
        process(load)
        begin
        if (load'event and load='1') then dout<=din;
        end if;
        end process;
end rtl;

Fp 分頻器
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity fp is
port(clkin:in std_logic;
                clkout:out std_logic);
end ;
architecture rtl of fp is
signal tmp:integer range 0 to 500;
begin
process(clkin)
begin
if clkin'event and clkin='1' then
        if tmp=499 then
                tmp<=0;
        else tmp<=tmp+1;
        end if;
end if;
if tmp=249 then
        clkout<='1';
        else clkout<='0';
end if;
end process;
end rtl;

Ctrl 頻率控制器
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity ctrl is
port(clk:in std_logic;
                en,load,clr:out std_logic);
end ;
architecture rtl of ctrl is
signal tmp:std_logic;
begin
process(clk)
begin
    if clk'event and clk='1' then
        tmp<=not tmp;
        end if;

        en<=tmp;
        load<=not tmp;

if clk='0'and tmp='0' then
clr<='1';
else
clr<='0';
end if;
end process;
end rtl;

Disp 動態顯示
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity disp is
port(din:in std_logic_vector(23 downto 0);clk:in std_logic;
        wk:out std_logic_vector(5 downto 0);
        dm:out std_logic_vector(6 downto 0));
end;
architecture str of disp is
signal tmp:std_logic_vector(2 downto 0);
signal do:std_logic_vector(3 downto 0);
begin
process(clk)
begin
if clk'event and clk='1' then
tmp<=tmp+1;
end if;
end process;
process(tmp)
begin
      case tmp is
      when "000"=>wk<="111110";do<=din(3 downto 0);
      when "001"=>wk<="111101";do<=din(7 downto 4);
      when "010"=>wk<="111011";do<=din(11 downto 8);
      when "011"=>wk<="110111";do<=din(15 downto 12);
      when "100"=>wk<="101111";do<=din(19 downto 16);
      when "101"=>wk<="011111";do<=din(23 downto 20);
      when others=>wk<="111111";do<="0000";
      end case;
      end process;

process(do)
begin
case do is
when"0000"=>dm<="0111111";
when"0001"=>dm<="0000110";
when"0010"=>dm<="1011011";
when"0011"=>dm<="1001111";
when"0100"=>dm<="1100110";
when"0101"=>dm<="1101001";
when"0110"=>dm<="1111101";
when"0111"=>dm<="0000111";
when"1000"=>dm<="1111111";
when"1001"=>dm<="1101111";
when others=>dm<="0000000";
end case;
end process;
end str;

Plj 打包
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity plj is
port(fx,clk:in std_logic;
        wk:out std_logic_vector(5 downto 0);
        dm:out std_logic_vector(6 downto 0));
    end plj;
architecture a of plj is
component cnt10x6
port(fx,clr,en:in std_logic;
      q:out std_logic_vector(23 downto 0));
      end component;
component reg24
port(load:in std_logic;
din:in std_logic_vector(23 downto 0);
dout:out std_logic_vector(23 downto 0));
end component;

component disp
port(din:in std_logic_vector(23 downto 0);clk:in std_logic;
        wk:out std_logic_vector(5 downto 0);
        dm:out std_logic_vector(6 downto 0));
end component;

component fp
port(clkin:in std_logic;
                clkout:out std_logic);
end component;

component ctrl
port(clk:in std_logic;
                en,load,clr:out std_logic);
end component;
signal c,en1,load1,clr1:std_logic;
signal din1,dout1:std_logic_vector(23 downto 0);
begin
u1:fp port map(clk,c);
u2:ctrl port map(c,en1,load1,clr1);
u3:cnt10x6 port map(fx,clr1,en1,din1);
u4:reg24 port map(load1,din1,dout1);
u5:disp port map(dout1,clk,wk,dm);
end a;



plj.docx

13.13 KB, 下載次數: 20, 下載積分: 黑幣 -5

六位數字頻率計

評分

參與人數 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎勵!

查看全部評分

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

手機版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

快速回復 返回頂部 返回列表
主站蜘蛛池模板: 亚洲高清视频一区二区 | 成人午夜 | 久久99久久99| 国产精品一区二区三区在线播放 | 日韩精品一区二区三区视频播放 | 黑人巨大精品欧美一区二区免费 | 国产视频亚洲视频 | www日本在线观看 | 欧美日韩亚洲国产 | 久久在线 | 婷婷综合激情 | 日本 欧美 国产 | 看a级黄色毛片 | 一级黄色片网站 | 久久精品亚洲 | 亚洲日韩中文字幕一区 | 一区二区日本 | 一道本不卡视频 | 九九热免费看 | 久久99精品久久久久 | 国产成人99久久亚洲综合精品 | 亚洲国产精品99久久久久久久久 | 中文字幕一区二区三区在线乱码 | 国产一级视频免费播放 | 欧洲一级毛片 | 夜夜骚 | 欧美日韩高清在线观看 | 国产四区 | 国产欧美一级二级三级在线视频 | 日韩精品一区二区三区中文在线 | 一区二区三区亚洲视频 | 精品美女| 一二区电影 | 久久大陆| 久久久精品网 | 亚洲精品一二三 | 91视频大全 | 亚洲精品视频在线 | 日韩视频中文字幕 | 欧美久久一级特黄毛片 | 先锋影音资源网站 |