HELP !!!EDA高手来 点击:484 | 回复:0



☆霜之哀伤★

    
  • 精华:0帖
  • 求助:0帖
  • 帖子:2帖 | 0回
  • 年度积分:0
  • 历史总积分:6
  • 注册:2005年5月18日
发表于:2005-05-23 11:40:00
楼主
程序如下:         LIBRARY IEEE;   USE IEEE.STD_LOGIC_1164.ALL;   ENTITY AD IS    PORT( D : IN STD_LOGIC_VECTOR(7 DOWNTO 0);    CLK ,EOC : IN STD_LOGIC;    Q : INOUT STD_LOGIC_VECTOR(7 DOWNTO 0);    LOCK1, ALE, START ,OE, ADDA : OUT STD_LOGIC ;    E : OUT STD_LOGIC_VECTOR(4 DOWNTO 0);    LED7S1 : OUT STD_LOGIC_VECTOR(6 DOWNTO 0);    LED7S2 : OUT STD_LOGIC_VECTOR(6 DOWNTO 0) );   END AD;      ARCHITECTURE one OF AD IS   TYPE states IS (st0,st1,st2,st3,st4,st5,st6);    SIGNAL current_state,next_state: states :=st0;    SIGNAL REGL : STD_LOGIC_VECTOR(7 DOWNTO 0);    SIGNAL LOCK : STD_LOGIC;      BEGIN    ADDA<='1'; LOCK1<=LOCK;    PRO: PROCESS(current_state,EOC) BEGIN    CASE current_state IS    WHEN st0=> ALE<='0';START<='0';OE<='0';LOCK<='0';    next_state<=st1;    WHEN st1=> ALE<='1';START<='0';OE<='0';LOCK<='0';    next_state<=st2;    WHEN st2=> ALE<='0';START<='1';OE<='0';LOCK<='0';    next_state<=st3;    WHEN st3=> ALE<='0';START<='0';OE<='0';LOCK<='0';    IF(EOC='1')THEN next_state<=st3;    ELSE next_state<=st4;    END IF;    WHEN st4=> ALE<='0';START<='0';OE<='0';LOCK<='0';    IF (EOC='0') THEN next_state<=st4;    ELSE next_state<=st5;    END IF;    WHEN st5=> ALE<='0';START<='0';OE<='1';LOCK<='0';    next_state<=st6;    WHEN st6=> ALE<='0';START<='0';OE<='1';LOCK<='1';    next_state<=st0;    WHEN OTHERS=> ALE<='0';START<='0';OE<='0';LOCK<='0';    next_state<=st0;    END CASE;    END PROCESS PRO;    PROCESS(CLK)    BEGIN    IF(CLK'EVENT AND CLK='1')THEN    current_state<=next_state;    END IF;    END PROCESS;       PROCESS(LOCK)    BEGIN    IF LOCK='1' AND LOCK'EVENT THEN REGL<=D;    END IF;    END PROCESS;    Q<=REGL;       END ARCHITECTURE one;         ARCHITECTURE behav OF AD IS       BEGIN   PROCESS(Q)    BEGIN    CASE Q IS   WHEN "00000000" =>LED7S1 <="0111111";LED7S2 <="0111111";E<="00000";   WHEN "00000001" =>LED7S1 <="0111111";LED7S2 <="1011011";E<="00000";   WHEN "00000010" =>LED7S1 <="0111111";LED7S2 <="1100110";E<="00000";   WHEN "00000011" =>LED7S1 <="0111111";LED7S2 <="1111101";E<="00000";   WHEN "00000100" =>LED7S1 <="0111111";LED7S2 <="1111111";E<="00000";   WHEN "00000101" =>LED7S1 <="0000110";LED7S2 <="0111111";E<="00000";   WHEN "00000110" =>LED7S1 <="0000110";LED7S2 <="0000110";E<="00000";   WHEN "00000111" =>LED7S1 <="0000110";LED7S2 <="1100110";E<="00000";   WHEN "00001000" =>LED7S1 <="0000110";LED7S2 <="1111101";E<="00000";   WHEN "00001001" =>LED7S1 <="0000110";LED7S2 <="1111111";E<="00000";   WHEN "00001010" =>LED7S1 <="1011011";LED7S2 <="0111111";E<="00000";   WHEN "00001011" =>LED7S1 <="1011011";LED7S2 <="1011011";E<="00000";   WHEN "00001100" =>LED7S1 <="1011011";LED7S2 <="1100110";E<="00000";   WHEN "00001101" =>LED7S1 <="1011011";LED7S2 <="1101101";E<="00000";   WHEN "00001110" =>LED7S1 <="1011011";LED7S2 <="0000111";E<="00000";   WHEN "00001111" =>LED7S1 <="1011011";LED7S2 <="1101111";E<="00000";   WHEN "00010000" =>LED7S1 <="1001111";LED7S2 <="0000110";E<="00000";   WHEN "00010001" =>LED7S1 <="1001111";LED7S2 <="1001111";E<="00000";   WHEN "00010010" =>LED7S1 <="1001111";LED7S2 <="1101101";E<="00000";   WHEN "00010011" =>LED7S1 <="1001111";LED7S2 <="0000111";E<="00000";   WHEN "00010100" =>LED7S1 <="1001111";LED7S2 <="1101111";E<="00000";   WHEN "00010101" =>LED7S1 <="1100110";LED7S2 <="0000110";E<="00000";   WHEN "00010110" =>LED7S1 <="1100110";LED7S2 <="1001111";E<="00000";   WHEN "00010111" =>LED7S1 <="1100110";LED7S2 <="1101101";E<="00000";   WHEN


热门招聘
相关主题

官方公众号

智造工程师