日本黄色一级经典视频|伊人久久精品视频|亚洲黄色色周成人视频九九九|av免费网址黄色小短片|黄色Av无码亚洲成年人|亚洲1区2区3区无码|真人黄片免费观看|无码一级小说欧美日免费三级|日韩中文字幕91在线看|精品久久久无码中文字幕边打电话

當前位置:首頁 > EDA > 電子設計自動化
[導讀]例1:FPGA驅動LED靜態(tài)顯示  --文件名:decoder.vhd  --功能:譯碼輸出模塊,LED為共陽接法  --最后修改日期:2004.3.24  library IEEE;  use IEEE.STD_LOGIC_1164.ALL;  use IEEE.STD_LOGIC_ARITH.ALL; 

例1:FPGA驅動LED靜態(tài)顯示

  --文件名:decoder.vhd

  --功能:譯碼輸出模塊,LED為共陽接法

  --最后修改日期:2004.3.24

  library IEEE;

  use IEEE.STD_LOGIC_1164.ALL;

  use IEEE.STD_LOGIC_ARITH.ALL;

  use IEEE.STD_LOGIC_UNSIGNED.ALL;

  entity decoder is

  Port (seg:in std_logic_vector(3 downto 0 ); --四位二進制碼輸入

  q3:out std_logic_vector(6 downto 0) ); --輸出LED七段碼

  end decoder;

  architecture Behavioral of decoder is

  begin

  process(seg)

  begin

  case seg is

  when "0000" => q3<="0000001";--0

  when "0001" => q3<="1001111";--1

  when "0010" => q3<="0010010";--2

  when "0011" => q3<="0000110";--3

  when "0100" => q3<="1001100" --4

  when "0101" => q3<="0100100";--5

  when "0110" => q3<="0100000";--6

  when "0111" => q3<="0001111";--7

  when "1000" => q3<="0000000";--8

  when "1001" => q3<="0000100";--9

  when others => q3<="1111111";

  end case;

  end process;

  end Behavioral;

例2:FPGA驅動LED動態(tài)顯示(4位)

 

  --文件名:dynamic.vhd。

  --功能:動態(tài)掃描模塊,位選信號高電平有效。

  --最后修改日期:2004.3.24。

  library IEEE;

  use IEEE.STD_LOGIC_1164.ALL;

  use IEEE.STD_LOGIC_ARITH.ALL;

  use IEEE.STD_LOGIC_UNSIGNED.ALL;

  entity dynamic is

  Port ( clk : in std_logic;

  reset: in std_logic;

  din1 : in std_logic_vector(6 downto 0); --譯碼后的數(shù)據(jù)信號1(4位2進制數(shù)據(jù)

  通過例1中的decoder模塊譯碼得到din1,din2,din3,din4)

  din2 : in std_logic_vector(6 downto 0); --譯碼后的數(shù)據(jù)信號2

  din3 : in std_logic_vector(6 downto 0); --譯碼后的數(shù)據(jù)信號3

  din4 : in std_logic_vector(6 downto 0); --譯碼后的數(shù)據(jù)信號4

  shift: out std_logic_vector(3 downto 0); --位選信號

  bus4 : out std_logic_vector(6 downto 0)); --數(shù)據(jù)信號

  end dynamic;

  architecture Behavioral of dynamic is

  signal scan_clk:std_logic_vector(1 downto 0);

  begin

  process(clk,scan_clk,reset) --分頻進程

  variable scan:std_logic_vector(17 downto 0);

  begin

  if reset='1' then

  scan:="000000000000000000";

  scan_clk<="00";

  elsif clk'event and clk='1'then

  scan:=scan+1;

  end if;

  scan_clk<=scan(17 downto 16);

  end process;

  process(scan_clk,din1,din2,din3,din4) --掃描進程

  begin

  case scan_clk is

  when "00"=>

  bus4<=din1;

  shift<="0001";

  when "01"=>

  bus4<=din2;

  shift<="0010";

  when "10"=>

  bus4<=din3;

  shift<="0100";

  when "11"=>

  bus4<=din4;

  shift<="1000";

  when others=> bus4<="0000000";shift<="0000";

  end case;

  end process;

  end Behavioral;

本站聲明: 本文章由作者或相關機構授權發(fā)布,目的在于傳遞更多信息,并不代表本站贊同其觀點,本站亦不保證或承諾內(nèi)容真實性等。需要轉載請聯(lián)系該專欄作者,如若文章內(nèi)容侵犯您的權益,請及時聯(lián)系本站刪除( 郵箱:macysun@21ic.com )。
換一批
延伸閱讀
關閉