找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 885|回复: 0
打印 上一主题 下一主题
收起左侧

关于eda的事例

[复制链接]
跳转到指定楼层
楼主
ID:498053 发表于 2019-3-25 19:00 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本人做的一些eda代码,如果有需要可以下载
  1. 半加器代码

  2. ENTITY lytadder5091 IS
  3.                 PORT(A, B:IN bit;
  4.              C, Sum:OUT bit);
  5. END ENTITY lytadder5091;

  6. ARCHITECTURE rtl of lytadder5091 is
  7. begin
  8.       Sum<=(A XOR B);
  9.       C<=(A AND B);
  10. END ARCHITECTURE rtl;


  11. 全加器代码

  12. ENTITY quanjiaqi5091 IS

  13. PORT(A, B, D:IN bit;

  14. C, Sum:OUT bit);

  15. END ENTITY quanjiaqi5091;


  16. ARCHITECTURE rtl of quanjiaqi5091 is

  17. begin

  18. Sum<=A XOR B XOR D;

  19. C<=(A AND B)OR(A AND D)OR(D AND B);

  20. END ARCHITECTURE rtl;




  21. 三人表决器代码(一灯)

  22. ENTITY SRBJQ5091 IS
  23.                 PORT(A, B,C:IN bit;
  24.              JIEGUO:OUT bit);
  25. END ENTITY SRBJQ5091;

  26. ARCHITECTURE rtl of SRBJQ5091 is
  27. begin
  28.       JIEGUO<=(A AND B)OR(A AND C)OR(C AND B);
  29.       
  30. END ARCHITECTURE rtl;






  31. 三人表决器代码(8灯)

  32. ENTITY SRBJQ5091 IS
  33.                 PORT(A, B,C:IN bit;
  34.      D0,D1,D2,D3,D4,D5,D6,D7:OUT bit);
  35. END ENTITY SRBJQ5091;

  36. ARCHITECTURE rtl of SRBJQ5091 is
  37. begin
  38.       D0<=(A AND B)OR(A AND C)OR(C AND B);
  39.                 D1<=(A AND B)OR(A AND C)OR(C AND B);
  40.                 D2<=(A AND B)OR(A AND C)OR(C AND B);
  41.                 D3<=(A AND B)OR(A AND C)OR(C AND B);
  42.                 D4<=(A AND B)OR(A AND C)OR(C AND B);
  43.                 D5<=(A AND B)OR(A AND C)OR(C AND B);
  44.                 D6<=(A AND B)OR(A AND C)OR(C AND B);
  45.                 D7<=(A AND B)OR(A AND C)OR(C AND B);
  46.                      
  47. END ARCHITECTURE rtl;



  48. 三人表决器(1灯)




  49. ENTITY SRBJQ5091 IS
  50.                 PORT(A, B,C:IN bit;
  51.      D:OUT bit);
  52. END ENTITY SRBJQ5091;

  53. ARCHITECTURE rtl of SRBJQ5091 is
  54. begin
  55.       cale:process(A,B,C)
  56.                 VARIABLE TMP1,TMP2,TMP3,TMP4:BIT;
  57.                 BEGIN
  58.                 TMP1:=A AND B;
  59.                 TMP2:=A AND C;
  60.                 TMP3:=B AND c;
  61.                 TMP4:=TMP1 OR TMP2 OR TMP3;
  62.                 d<=tmp4;
  63.                 END PROCESS;
  64.                
  65.                      
  66. END ARCHITECTURE rtl;





  67. 三人表决器(8灯)


  68. ENTITY SRBJQ5091 IS
  69.                 PORT(A, B,C:IN bit;
  70.      D:OUT bit_VECTOR(0 TO 7));
  71. END ENTITY SRBJQ5091;

  72. ARCHITECTURE rtl of SRBJQ5091 is
  73. begin
  74.       cale:process(A,B,C)
  75.                 VARIABLE TMP1,TMP2,TMP3,TMP4:BIT;
  76.                 BEGIN
  77.                 TMP1:=A AND B;
  78.                 TMP2:=A AND C;
  79.                 TMP3:=B AND c;
  80.                 TMP4:=TMP1 OR TMP2 OR TMP3;
  81.                 d(0)<=tmp4;d(1)<=tmp4;
  82.                 d(2)<=tmp4;d(3)<=tmp4;
  83.                 d(4)<=tmp4;d(5)<=tmp4;
  84.                 d(6)<=tmp4;d(7)<=tmp4;
  85.                 END PROCESS;
  86.                
  87.                      
  88. END ARCHITECTURE rtl;




  89. 三人表决器
  90. ENTITY SRBJQ5091 IS
  91.                 PORT(A, B,C:IN bit;
  92.      D:OUT bit_vector(0 to 7));
  93. END ENTITY SRBJQ5091;

  94. ARCHITECTURE rtl of SRBJQ5091 is
  95. begin
  96.       cale:process(A,B,C)       
  97.                 BEGIN
  98.                 if ((A AND B)OR(A AND C)OR(C AND B))='0'
  99.                 then d<="00000000";
  100.                 else d<="11111111";
  101.                 end if;
  102.                
  103.                 END PROCESS;
  104.                
  105.                      
  106. END ARCHITECTURE rtl;




  107. 四人表决器





  108. ENTITY SRBJQ5091 IS
  109.                 PORT(A, B,C,E:IN bit;
  110.      D:OUT bit_vector(0 to 7));
  111. END ENTITY SRBJQ5091;

  112. ARCHITECTURE rtl of SRBJQ5091 is
  113. begin
  114.       cale:process(A,B,C,E)
  115.                 BEGIN
  116.                 if ((A AND B)OR(A AND E)OR(C AND A))='1'
  117.                 then d<="00000000";
  118.                 else d<="11111111";
  119.                 end if;
  120.                
  121.                 END PROCESS;
  122.                
  123.                      
  124. END ARCHITECTURE rtl;







  125. 七段译码器









  126. -


  127. LIBRARY ieee;
  128. USE ieee.std_logic_1164.ALL;

  129. ENTITY QIDUANYIMAQI IS
  130.    PORT(bcdin : IN std_logic_vector(3 DOWNTO 0);
  131.         segout : OUT std_logic_vector(6 DOWNTO 0);
  132.                   T : OUT BIT);
  133. END QIDUANYIMAQI;

  134. ARCHITECTURE ver3 OF QIDUANYIMAQI IS
  135. BEGIN
  136.    T<='0';
  137.    WITH bcdin SELECT
  138.       segout <= "0000001" WHEN X"0",
  139.           "1001111" WHEN X"1",
  140.        
  141.           "0010010" WHEN X"2",
  142.           "0000110" WHEN X"3",
  143.           "1001100" WHEN X"4",
  144.           "0100100" WHEN X"5",
  145.           "0100000" WHEN X"6",
  146.           "0001111" WHEN X"7",
  147.           "0000000" WHEN X"8",
  148.           "0000100" WHEN X"9",
  149.           "1111111" WHEN OTHERS;
  150. END ver3;










  151. library ieee;
  152. use ieee.std_logic_1164.all;
  153. use ieee.std_logic_unsigned.all;

  154. entity xue is
  155. port (
  156. clkin:in std_logic;
  157. clkout:out std_logic_vector(7 downto 0);
  158. enout:out std_logic_vector(3 downto 0)
  159. );
  160. end entity;
  161. architecture behave of xue is
  162. signal mtime:std_logic_vector(15 downto 0);
  163. signal me:std_logic_vector(1 downto 0);
  164. signal m7_0:std_logic_vector(7 downto 0);
  165. signal m7_1:std_logic_vector(7 downto 0);
  166. signal m7_2:std_logic_vector(7 downto 0);
  167. signal m7_3:std_logic_vector(7 downto 0);
  168. begin
  169. process(clkin)
  170. begin
  171.     if(clkin'event and clkin='1')then
  172.         mtime<=mtime+1;
  173.         if(mtime="1000000000000000")then
  174.             mtime<=(others=>'0');
  175.             if(me="11")then
  176.                 me<=(others=>'0');
  177.             else
  178.                 me<=me+1;
  179.             end if;
  180.         end if;
  181.         m7_0<="10011110";
  182.         m7_1<="00001000";
  183.         m7_2<="00000010";
  184.         m7_3<="01001000";
  185.         if(me="00")then
  186.             enout<="1110";
  187.             clkout<=m7_0;
  188.         end if;
  189.         if(me="01")then
  190.             enout<="1101";
  191.             clkout<=m7_1;
  192.         end if;
  193.         if(me="10")then
  194.             enout<="1011";
  195.             clkout<=m7_2;
  196.         end if;
  197.         if(me="11")then
  198.             enout<="0111";
  199.             clkout<=m7_3;
  200.         end if;
  201.     end if;
  202.     end process;
  203. end behave;








  204. library ieee;
  205. use ieee.std_logic_1164.all;
  206. use ieee.std_logic_unsigned.all;

  207. entity xue is
  208. port (c:in bit;
  209. clkin:in std_logic;
  210. clkout:out std_logic_vector(7 downto 0);
  211. enout:out std_logic_vector(3 downto 0)
  212. );
  213. end entity;
  214. architecture behave of xue is
  215. signal mtime:std_logic_vector(15 downto 0);
  216. signal me:std_logic_vector(1 downto 0);
  217. signal m7_0:std_logic_vector(7 downto 0);
  218. signal m7_1:std_logic_vector(7 downto 0);
  219. signal m7_2:std_logic_vector(7 downto 0);
  220. signal m7_3:std_logic_vector(7 downto 0);
  221. signal m0:std_logic_vector(7 downto 0);
  222. signal m1:std_logic_vector(7 downto 0);
  223. signal m2:std_logic_vector(7 downto 0);
  224. signal m3:std_logic_vector(7 downto 0);
  225. begin
  226. process(clkin,c)
  227. begin
  228.     if(clkin'event and clkin='1')then
  229.         mtime<=mtime+1;
  230.         if(mtime="1000000000000000")then
  231.             mtime<=(others=>'0');
  232.             if(me="11")then
  233.                 me<=(others=>'0');
  234.             else
  235.                 me<=me+1;
  236.             end if;
  237.         end if;
  238.         m7_0<="10011110";
  239.         m7_1<="00001000";
  240.         m7_2<="00000010";
  241.         m7_3<="01001000";
  242.                   m0<="00011110";
  243.                   m1<="00000010";
  244.                   m2<="10011110";
  245.                   m3<="00100100";
  246.         if(me="00"and c='1')then
  247.             enout<="1110";
  248.             clkout<=m7_0;
  249.         end if;
  250.         if(me="001"and c='1')then
  251.             enout<="1101";
  252.             clkout<=m7_1;
  253.         end if;
  254.         if(me="010"and c='1')then
  255.             enout<="1011";
  256.             clkout<=m7_2;
  257.         end if;
  258.         if(me="011"and c='1')then
  259.             enout<="0111";
  260.             clkout<=m7_3;
  261.                   end if;
  262.                   if(me="000"and c='0')then
  263.           enout<="1110";
  264.           clkout<=m0;
  265.         end if;
  266.         if(me="001"and c='0')then
  267.            enout<="1101";
  268.            clkout<=m1;
  269.         end if;
  270.         if(me="010"and c='0')then
  271.            enout<="1011";
  272.            clkout<=m2;
  273.         end if;
  274.         if(me="011"and c='0')then
  275.            enout<="0111";
  276.            clkout<=m3;
  277.         end if;
  278.     end if;
  279.     end process;
  280. end behave;






  281. library ieee;
  282. use ieee.std_logic_1164.all;
  283. use ieee.std_logic_unsigned.all;

  284. entity qiduanyimaqi5091 is
  285. port (
  286. clk:in std_logic;--时钟信号
  287. led:out std_logic_vector(7 downto 0);--led灯
  288. led1_4:out std_logic_vector(3 downto 0)--选择触发的
  289. );
  290. end entity qiduanyimaqi5091;
  291. architecture lyt of qiduanyimaqi5091 is
  292. signal clk1:std_logic_vector(15 downto 0);
  293. signal clk2:std_logic_vector(2 downto 0);
  294. signal m0:std_logic_vector(7 downto 0);
  295. signal m1:std_logic_vector(7 downto 0);
  296. signal m2:std_logic_vector(7 downto 0);
  297. signal m3:std_logic_vector(7 downto 0);
  298. signal m4:std_logic_vector(7 downto 0);
  299. signal m5:std_logic_vector(7 downto 0);--保存十个不同数字的信号
  300. signal m6:std_logic_vector(7 downto 0);
  301. signal m7:std_logic_vector(7 downto 0);
  302. signal m8:std_logic_vector(7 downto 0);
  303. signal m9:std_logic_vector(7 downto 0);
  304. begin
  305. process(clk)
  306. begin
  307.     if(clk'event and clk='1')then
  308.         clk1<=clk1+1;
  309.         if(clk1="1000000000000000")then
  310.             clk1<=(others=>'0');            ---时钟控制
  311.             if(clk2="011")then
  312.                 clk2<=(others=>'0');
  313.             else
  314.                clk2<=clk2+1;
  315.             end if;
  316.         end if;
  317.         m0<="00000011";
  318.                   m1<="10011111";
  319.                   m2<="00100101";
  320.                   m3<="00001101";
  321.                   m4<="10011001";--储存十个不同数字
  322.                   m5<="01001001";
  323.                   m6<="01000001";
  324.                   m7<="00011111";
  325.                   m8<="00000001";
  326.                   m9<="00001001";
  327.         if(clk2="000")then
  328.             led1_4<="0111";
  329.             led<=m5;
  330.         end if;
  331.         if(clk2="001")then
  332.             led1_4<="1011";
  333.             led<=m0;      --赋值
  334.         end if;
  335.         if(clk2="010")then
  336.             led1_4<="1101";
  337.             led<=m9;
  338.         end if;
  339.         if(clk2="011")then
  340.             led1_4<="1110";
  341.             led<=m1;
  342.         end if;
  343.     end if;
  344.     end process;
  345. end lyt;








  346. library ieee;
  347. use ieee.std_logic_1164.all;
  348. use ieee.std_logic_unsigned.all;

  349. entity qiduanyimaqi15091 is
  350. port (c:in bit;--控制显示数字
  351. clk:in std_logic;--时钟信号
  352. led:out std_logic_vector(7 downto 0);--led灯
  353. led1_4:out std_logic_vector(3 downto 0));--控制七段译码管
  354. end qiduanyimaqi15091;
  355. architecture lyt of qiduanyimaqi15091 is
  356. signal clk1:std_logic_vector(15 downto 0);
  357. signal clk2:std_logic_vector(2 downto 0);
  358. signal m0:std_logic_vector(7 downto 0);
  359. signal m1:std_logic_vector(7 downto 0);
  360. signal m2:std_logic_vector(7 downto 0);
  361. signal m3:std_logic_vector(7 downto 0);
  362. signal m4:std_logic_vector(7 downto 0);
  363. signal m5:std_logic_vector(7 downto 0);--保存十个不同数字的信号
  364. signal m6:std_logic_vector(7 downto 0);
  365. signal m7:std_logic_vector(7 downto 0);
  366. signal m8:std_logic_vector(7 downto 0);
  367. signal m9:std_logic_vector(7 downto 0);
  368. begin
  369. process(clk)
  370. begin
  371.     if(clk'event and clk='1')then
  372.         clk1<=clk1+1;
  373.         if(clk1="1111111111111111")then
  374.             clk1<=(others=>'0');            ---时钟控制
  375.             if(clk2="111")then
  376.                 clk2<=(others=>'0');
  377.             else
  378.                clk2<=clk2+1;
  379.             end if;
  380.         end if;
  381.         m0<="00000010";
  382.                   m1<="10011111";
  383.                   m2<="00100101";
  384.                   m3<="00001101";
  385.                   m4<="10011001";--储存十个不同数字
  386.                   m5<="01001001";
  387.                   m6<="01000001";
  388.                   m7<="00011111";
  389.                   m8<="00000001";
  390.                   m9<="00001001";
  391.         if(clk2="000"and c='0')then
  392.             led1_4<="0111";
  393.             led<=m2;
  394.         end if;
  395.         if(clk2="001"and c='0')then
  396.             led1_4<="1011";
  397.             led<=m0;      --赋值
  398.         end if;
  399.         if(clk2="010"and c='0')then
  400.             led1_4<="1101";
  401.             led<=m1;
  402.         end if;
  403.         if(clk2="011"and c='0')then
  404.             led1_4<="1110";
  405.             led<=m7;
  406.         end if;
  407.                   if(clk2="100"and c='1')then
  408.             led1_4<="0111";
  409.             led<=m5;
  410.         end if;
  411.         if(clk2="101"and c='1')then
  412.             led1_4<="1011";
  413.             led<=m0;  
  414.                   end if;
  415.         if(clk2="110"and c='1')then
  416.             led1_4<="1101";
  417.             led<=m9;
  418.         end if;
  419.         if(clk2="111"and c='1')then
  420.             led1_4<="1110";
  421.             led<=m1;
  422.         end if;
  423.     end if;
  424.     end process;
  425. end lyt;













  426. library ieee;
  427. use ieee.std_logic_1164.all;
  428. use ieee.std_logic_unsigned.all;

  429. entity shiyan3 is
  430. port (K1,K2,K3:in bit;--控制显示数字
  431.            clk:in std_logic;--时钟信号
  432.            led:out std_logic_vector(7 downto 0);--led灯
  433.                          STAR:out std_logic_vector(7 downto 0);--二极管
  434.         led1_4:out std_logic_vector(3 downto 0));--控制七段译码管
  435. end shiyan3;
  436. architecture lyt of shiyan3 is
  437. signal clk1:std_logic_vector(15 downto 0);
  438. signal clk2:std_logic_vector(2 downto 0);
  439. signal clk3:std_logic_vector(25 downto 0);
  440. signal clk4:std_logic_vector(3 downto 0);
  441. signal m0:std_logic_vector(7 downto 0);
  442. signal m1:std_logic_vector(7 downto 0);
  443. signal m2:std_logic_vector(7 downto 0);
  444. signal m3:std_logic_vector(7 downto 0);
  445. signal m4:std_logic_vector(7 downto 0);
  446. signal m5:std_logic_vector(7 downto 0);--保存十个不同数字的信号
  447. signal m6:std_logic_vector(7 downto 0);
  448. signal m7:std_logic_vector(7 downto 0);
  449. signal m8:std_logic_vector(7 downto 0);
  450. signal m9:std_logic_vector(7 downto 0);
  451. signal N0:std_logic_vector(7 downto 0);
  452. signal N1:std_logic_vector(7 downto 0);
  453. signal N2:std_logic_vector(7 downto 0);
  454. signal N3:std_logic_vector(7 downto 0);
  455. signal N4:std_logic_vector(7 downto 0);
  456. signal N5:std_logic_vector(7 downto 0);
  457. signal L0:std_logic_vector(7 downto 0);
  458. signal L1:std_logic_vector(7 downto 0);
  459. signal L2:std_logic_vector(7 downto 0);
  460. signal L3:std_logic_vector(7 downto 0);
  461. signal L4:std_logic_vector(7 downto 0);
  462. begin
  463. P1:process(clk,K1)---控制七段显示学号的进程
  464. begin
  465.     if(clk'event and clk='1')then
  466.         clk1<=clk1+1;
  467.                   clk3<=clk3+1;
  468.         if(clk1="1111111111111111")then
  469.             clk1<=(others=>'0');            ---时钟控制
  470.             if(clk2="011")then
  471.                 clk2<=(others=>'0');
  472.             else
  473.                clk2<=clk2+1;
  474.             end if;                       
  475.         end if;
  476.                   if(clk3="10111110101111000010000000")then
  477.             clk3<=(others=>'0');            ---时钟控制
  478.             if(clk4="1001")then
  479.                 clk4<=(others=>'0');
  480.             else
  481.                clk4<=clk4+1;
  482.             end if;
  483.         end if;                   
  484.         m0<="00000011";
  485.                   m1<="10011110";
  486.                   m2<="00100100";
  487.                   m3<="00001100";
  488.                   m4<="10011000";--储存十个不同led数字
  489.                   m5<="01001000";
  490.                   m6<="01000000";
  491.                   m7<="00011110";
  492.                   m8<="00000000";
  493.                   m9<="00001000";                                    
  494.         if(clk2="0000"and K1='1')then
  495.             led1_4<="0111";
  496.             led<=m5;
  497.         end if;
  498.         if(clk2="0001"and K1='1')then
  499.             led1_4<="1011";
  500.             led<=m0;      --赋值
  501.         end if;
  502.         if(clk2="0010"and K1='1')then
  503.             led1_4<="1101";
  504.             led<=m9;
  505.         end if;
  506.         if(clk2="0011"and K1='1')then
  507.             led1_4<="1110";
  508.             led<=m1;
  509.         end if;
  510.                   if(K1='0')then
  511.             led1_4<="1111";
  512.             led<=m1;
  513.         end if;
  514.              
  515.     end if;
  516.     end process P1;
  517. P2:process(clk4,K1)--控制流水灯模式1的进程
  518. begin   
  519.         N0<="00011111";
  520.                   N1<="10001111";
  521.                   N2<="11000111";
  522.                   N3<="11100011";
  523.                   N4<="11110001";--储存六个第一种二极管信号
  524.                   N5<="11111000";
  525.         if(k1 and k2 and k3)='1' then
  526. star<="11111111"        ;
  527. end if;
  528.         if(clk4="0000"and ((K1 AND(K2 XOR K3))OR(NOT K1 AND K2 AND K3))='1')then
  529.         STAR<=N0;   
  530.         end if;
  531.         if(clk4="0001"and ((K1 AND(K2 XOR K3))OR(NOT K1 AND K2 AND K3))='1')then
  532.         STAR<=N1;   
  533.         end if;
  534.                   if(clk4="0010"and ((K1 AND(K2 XOR K3))OR(NOT K1 AND K2 AND K3))='1')then
  535.         STAR<=N2;   
  536.         end if;
  537.                   if(clk4="0011"and ((K1 AND(K2 XOR K3))OR(NOT K1 AND K2 AND K3))='1')then
  538.         STAR<=N3;   
  539.         end if;
  540.                   if(clk4="0100"and ((K1 AND(K2 XOR K3))OR(NOT K1 AND K2 AND K3))='1')then
  541.         STAR<=N4;   
  542.         end if;
  543.                   if(clk4="0101"and ((K1 AND(K2 XOR K3))OR(NOT K1 AND K2 AND K3))='1')then
  544.         STAR<=N5;   
  545.         end if;
  546.                   if(clk4="0110"and ((K1 AND(K2 XOR K3))OR(NOT K1 AND K2 AND K3))='1')then
  547.         STAR<=N4;   
  548.         end if;
  549.                   if(clk4="0111"and ((K1 AND(K2 XOR K3))OR(NOT K1 AND K2 AND K3))='1')then
  550.         STAR<=N3;   
  551.         end if;
  552.                   if(clk4="1000"and ((K1 AND(K2 XOR K3))OR(NOT K1 AND K2 AND K3))='1')then
  553.         STAR<=N2;   
  554.         end if;
  555.                   if(clk4="1001"and ((K1 AND(K2 XOR K3))OR(NOT K1 AND K2 AND K3))='1')then
  556.         STAR<=N1;   
  557.         end if;
  558.     end process P2;
  559. ---P3:process(clk4,K2)--控制流水灯模式2的进程
  560. --begin   
  561.        -- L0<="11100111";
  562.                  -- L1<="11010011";
  563.                   --L2<="10111101";
  564.                  -- L3<="01111110";
  565.                  -- L4<="11111111";--储存五个第二种二极管信号
  566.        -- if(clk4="0000"and K1='0'and k2='0'and k3='1')then
  567.         --STAR<=L0;   
  568.        -- end if;
  569.         --if(clk4="0001"and K1='0'and k2='0'and k3='1')then
  570.        -- STAR<=L1;   
  571.         --end if;
  572.                   --if(clk4="0010"and K1='0'and k2='0'and k3='1')then
  573.         --STAR<=L2;   
  574.         --end if;
  575.                 --  if(clk4="0011"and K1='0'and k2='0'and k3='1')then
  576.         --STAR<=L3;   
  577.        -- end if;
  578.                 --  if(clk4="0100"and K1='0'and k2='0'and k3='1')then
  579.       --  STAR<=L4;   
  580.      --   end if;                   
  581.    -- end process P3;
  582. end lytlibrary ieee;
  583. use ieee.std_logic_1164.all;
  584. use ieee.std_logic_unsigned.all;

  585. entity shiyan3 is
  586. port (K1,K2,K3:in bit;--控制显示数字
  587.            clk:in std_logic;--时钟信号
  588.            led:out std_logic_vector(7 downto 0);--led灯
  589.                          STAR:out std_logic_vector(7 downto 0);--二极管
  590.         led1_4:out std_logic_vector(3 downto 0));--控制七段译码管
  591. end shiyan3;
  592. architecture lyt of shiyan3 is
  593. signal clk1:std_logic_vector(15 downto 0);
  594. signal clk2:std_logic_vector(2 downto 0);
  595. signal clk3:std_logic_vector(25 downto 0);
  596. signal clk4:std_logic_vector(3 downto 0);
  597. signal clk5:std_logic_vector(2 downto 0);
  598. signal clk6:std_logic_vector(1 downto 0);
  599. signal    A:std_logic_vector(2 downto 0);
  600. signal   m0:std_logic_vector(7 downto 0);
  601. signal   m1:std_logic_vector(7 downto 0);
  602. signal   m2:std_logic_vector(7 downto 0);
  603. signal   m3:std_logic_vector(7 downto 0);
  604. signal   m4:std_logic_vector(7 downto 0);
  605. signal   m5:std_logic_vector(7 downto 0);--保存十个不同数字的信号
  606. signal   m6:std_logic_vector(7 downto 0);
  607. signal   m7:std_logic_vector(7 downto 0);
  608. signal   m8:std_logic_vector(7 downto 0);
  609. signal   m9:std_logic_vector(7 downto 0);
  610. signal   N0:std_logic_vector(7 downto 0);
  611. signal   N1:std_logic_vector(7 downto 0);
  612. signal   N2:std_logic_vector(7 downto 0);
  613. signal   N3:std_logic_vector(7 downto 0);
  614. signal   N4:std_logic_vector(7 downto 0);
  615. signal   N5:std_logic_vector(7 downto 0);
  616. signal   L0:std_logic_vector(7 downto 0);
  617. signal   L1:std_logic_vector(7 downto 0);
  618. signal   L2:std_logic_vector(7 downto 0);
  619. signal   L3:std_logic_vector(7 downto 0);
  620. signal   L4:std_logic_vector(7 downto 0);
  621. signal   T0:std_logic_vector(7 downto 0);
  622. signal   T1:std_logic_vector(7 downto 0);
  623. begin
  624. P1:process(clk,K1)---控制七段显示学号的进程
  625. begin
  626.     if(clk'event and clk='1')then
  627.         clk1<=clk1+1;
  628.                   clk3<=clk3+1;
  629.         if(clk1="1111111111111111")then
  630.             clk1<=(others=>'0');            ---时钟控制
  631.             if(clk2="011")then
  632.                 clk2<=(others=>'0');
  633.             else
  634.                clk2<=clk2+1;
  635.             end if;                       
  636.         end if;
  637.                   if(clk3="10111110101111000010000000")then
  638.             clk3<=(others=>'0');            ---时钟控制
  639.             if(clk4="1010")then
  640.                 clk4<=(others=>'0');
  641.             else
  642.                clk4<=clk4+1;
  643.             end if;
  644.                                 if(clk5="100")then
  645.                 clk5<=(others=>'0');
  646.             else
  647.                clk5<=clk5+1;
  648.             end if;
  649.                                 if(clk6="01")then
  650.                 clk6<=(others=>'0');
  651.             else
  652.                clk6<=clk6+1;
  653.             end if;
  654.         end if;         
  655.         m0<="00000011";
  656.                   m1<="10011110";
  657.                   m2<="00100100";
  658.                   m3<="00001100";
  659.                   m4<="10011000";--储存十个不同led数字
  660.                   m5<="01001000";
  661.                   m6<="01000000";
  662.                   m7<="00011110";
  663.                   m8<="00000000";
  664.                   m9<="00001000";                                    
  665.         if(clk2="0000"and K1='1')then
  666.             led1_4<="0111";
  667.             led<=m5;
  668.         end if;
  669.         if(clk2="0001"and K1='1')then
  670.             led1_4<="1011";
  671.             led<=m0;      --赋值
  672.         end if;
  673.         if(clk2="0010"and K1='1')then
  674.             led1_4<="1101";
  675.             led<=m9;
  676.         end if;
  677.         if(clk2="0011"and K1='1')then
  678.             led1_4<="1110";
  679.             led<=m1;
  680.         end if;
  681.                   if(K1='0')then
  682.             led1_4<="1111";
  683.             led<=m1;
  684.         end if;
  685.              
  686.     end if;
  687.     end process P1;
  688. P2:process(clk4,K1)--控制流水灯的进程
  689. begin   N0<="00011111";
  690.                   N1<="10001111";
  691.                   N2<="11000111";
  692.                   N3<="11100011";
  693.                   N4<="11110001";--储存六个第一模式二极管信号
  694.                   N5<="11111000";
  695.                   L0<="11100111";
  696.                   L1<="11011011";
  697.                   L2<="10111101";
  698.                   L3<="01111110";
  699.                   L4<="11111111";--储存五个第二模式二极管信号   
  700.                   T0<="01010101";
  701.                   T1<="10101010";--储存二个第三模式二极管信号
  702.                   if(k1 and k2 and k3)='1' then
  703.         star<="11111111"        ;
  704. -       end if;
  705.         if(clk4="0001"and K1='0'AND K2='1'AND K3='1')then
  706.         STAR<=N0;   
  707.         end if;
  708.         if(clk4="0010"and K1='0'AND K2='1'AND K3='1')then
  709.         STAR<=N1;   
  710.         end if;
  711.                   if(clk4="0011"and K1='0'AND K2='1'AND K3='1')then
  712.         STAR<=N2;   
  713.         end if;
  714.                   if(clk4="0100"and K1='0'AND K2='1'AND K3='1')then
  715.         STAR<=N3;   
  716.         end if;
  717.                   if(clk4="0101"and K1='0'AND K2='1'AND K3='1')then
  718.         STAR<=N4;   
  719.         end if;
  720.                   if(clk4="0110"and K1='0'AND K2='1'AND K3='1')then
  721.         STAR<=N5;   
  722.         end if;
  723.                   if(clk4="0111"and K1='0'AND K2='1'AND K3='1')then
  724.         STAR<=N4;   
  725.         end if;
  726.                   if(clk4="1000"and K1='0'AND K2='1'AND K3='1')then
  727.         STAR<=N3;   
  728.         end if;
  729.                   if(clk4="1001"and K1='0'AND K2='1'AND K3='1')then
  730.         STAR<=N2;   
  731.         end if;
  732.                   if(clk4="1010"and K1='0'AND K2='1'AND K3='1')then
  733.         STAR<=N1;   
  734.         end if;
  735.                   if(clk5="000"and K1='0'and k2='0'and k3='1')then
  736.         STAR<=L0;   
  737.         end if;
  738.         if(clk5="001"and K1='0'and k2='0'and k3='1')then
  739.         STAR<=L1;   
  740.         end if;
  741.                   if(clk5="010"and K1='0'and k2='0'and k3='1')then
  742.         STAR<=L2;   
  743.         end if;
  744.                   if(clk5="011"and K1='0'and k2='0'and k3='1')then
  745.         STAR<=L3;   
  746.         end if;
  747.                   if(clk5="100"and K1='0'and k2='0'and k3='1')then
  748.         STAR<=L4;   
  749.         end if;
  750.                   if(clk6="00"and K1='0'and k2='1'and k3='0')then
  751.         STAR<=T0;   
  752.         end if;
  753.         if(clk6="01"and K1='0'and k2='1'and k3='0')then
  754.         STAR<=T1;   
  755.         end if;
  756.     end process P2;
  757. end lyt;









  758. library ieee;
  759. use ieee.std_logic_1164.all;
  760. use ieee.std_logic_unsigned.all;

  761. entity shiyan3 is
  762. port (       A:in BIT_VECTOR(1 TO 3);--控制显示数字
  763.            clk:in std_logic;--时钟信号
  764.            led:out std_logic_vector(7 downto 0);--led灯
  765.                          STAR:out std_logic_vector(7 downto 0);--二极管
  766.         led1_4:out std_logic_vector(3 downto 0));--控制七段译码管
  767. end shiyan3;
  768. architecture lyt of shiyan3 is
  769. signal clk1:std_logic_vector(15 downto 0);
  770. signal clk2:std_logic_vector(2 downto 0);
  771. signal clk3:std_logic_vector(25 downto 0);
  772. signal clk4:std_logic_vector(3 downto 0);
  773. signal clk5:std_logic_vector(2 downto 0);
  774. signal clk6:std_logic_vector(1 downto 0);
  775. signal   m0:std_logic_vector(7 downto 0);
  776. signal   m1:std_logic_vector(7 downto 0);
  777. signal   m2:std_logic_vector(7 downto 0);
  778. signal   m3:std_logic_vector(7 downto 0);
  779. signal   m4:std_logic_vector(7 downto 0);
  780. signal   m5:std_logic_vector(7 downto 0);--保存十个不同数字的信号
  781. signal   m6:std_logic_vector(7 downto 0);
  782. signal   m7:std_logic_vector(7 downto 0);
  783. signal   m8:std_logic_vector(7 downto 0);
  784. signal   m9:std_logic_vector(7 downto 0);
  785. signal   N0:std_logic_vector(7 downto 0);
  786. signal   N1:std_logic_vector(7 downto 0);
  787. signal   N2:std_logic_vector(7 downto 0);
  788. signal   N3:std_logic_vector(7 downto 0);
  789. signal   N4:std_logic_vector(7 downto 0);
  790. signal   N5:std_logic_vector(7 downto 0);
  791. signal   L0:std_logic_vector(7 downto 0);
  792. signal   L1:std_logic_vector(7 downto 0);
  793. signal   L2:std_logic_vector(7 downto 0);
  794. signal   L3:std_logic_vector(7 downto 0);
  795. signal   L4:std_logic_vector(7 downto 0);
  796. signal   T0:std_logic_vector(7 downto 0);
  797. signal   T1:std_logic_vector(7 downto 0);
  798. begin
  799. P1:process(clk)---控制七段显示学号的进程
  800. begin
  801.     if(clk'event and clk='1')then
  802.         clk1<=clk1+1;
  803.                   clk3<=clk3+1;
  804.         if(clk1="1111111111111111")then
  805.             clk1<=(others=>'0');            ---时钟控制
  806.             if(clk2="011")then
  807.                 clk2<=(others=>'0');
  808.             else
  809.                clk2<=clk2+1;
  810.             end if;                       
  811.         end if;
  812.                   if(clk3="10111110101111000010000000")then
  813.             clk3<=(others=>'0');            ---时钟控制
  814.             if(clk4="1010")then
  815.                 clk4<="0000";
  816.             else
  817.                clk4<=clk4+1;
  818.             end if;
  819.                                 if(clk5="100")then
  820.                 clk5<=(others=>'0');
  821.             else
  822.                clk5<=clk5+1;
  823.             end if;
  824.                                 if(clk6="01")then
  825.                 clk6<=(others=>'0');
  826.             else
  827.                clk6<=clk6+1;
  828.             end if;
  829.         end if;         
  830.         m0<="00000011";
  831.                   m1<="10011110";
  832.                   m2<="00100100";
  833.                   m3<="00001100";
  834.                   m4<="10011000";--储存十个不同led数字
  835.                   m5<="01001000";
  836.                   m6<="01000000";
  837.                   m7<="00011110";
  838.                   m8<="00000000";
  839.                   m9<="00001000";                                    
  840.         if(clk2="0000"and A(1)='1')then
  841.             led1_4<="0111";
  842.             led<=m5;
  843.         end if;
  844.         if(clk2="0001"and A(1)='1')then
  845.             led1_4<="1011";
  846.             led<=m0;      --赋值
  847.         end if;
  848.         if(clk2="0010"and A(1)='1')then
  849.             led1_4<="1101";
  850.             led<=m9;
  851.         end if;
  852.         if(clk2="0011"and A(1)='1')then
  853.             led1_4<="1110";
  854.             led<=m1;
  855.         end if;
  856.                   if(A(1)='0')then
  857.             led1_4<="1111";
  858.             led<=m1;
  859.         end if;             
  860.     end if;
  861.     end process P1;
  862. P2:process(clk4,CLK5,CLK6)--控制流水灯的进程
  863. begin   
  864.         N0<="00011111";
  865.                   N1<="10001111";
  866.                   N2<="11000111";
  867.                   N3<="11100011";
  868.                   N4<="11110001";--储存六个第一模式二极管信号
  869.                   N5<="11111000";
  870.                   L0<="11100111";
  871.                   L1<="11011011";
  872.                   L2<="10111101";
  873.                   L3<="01111110";
  874.                   L4<="11111111";--储存五个第二模式二极管信号   
  875.                   T0<="01010101";
  876.                   T1<="10101010";--储存二个第三模式二极管信号
  877.                   if  A="111" then
  878.         star<="11111111"        ;
  879.         end if;
  880.         if(clk4="0001"and A="011")then
  881.         STAR<=N0;   
  882.         end if;
  883.         if(clk4="0010"and A="011")then
  884.         STAR<=N1;   
  885.         end if;
  886.                   if(clk4="0011"and A="011")then
  887.         STAR<=N2;   
  888.         end if;
  889.                   if(clk4="0100"and A="011")then
  890.         STAR<=N3;   
  891.         end if;
  892.                   if(clk4="0101"and A="011")then
  893.         STAR<=N4;   
  894.         end if;
  895.                   if(clk4="0110"and A="011")then
  896.         STAR<=N5;   
  897.         end if;
  898.                   if(clk4="0111"and A="011")then
  899.         STAR<=N4;   
  900.         end if;
  901.                   if(clk4="1000"and A="011")then
  902.         STAR<=N3;   
  903.         end if;
  904.                   if(clk4="1001"and A="011")then
  905.         STAR<=N2;   
  906.         end if;
  907.                   if(clk4="1010"and A="011")then
  908.         STAR<=N1;   
  909.         end if;
  910.                   if(clk5="001"and A="001")then
  911.         STAR<=L0;   
  912.         end if;
  913.         if(clk5="010"and A="001")then
  914.         STAR<=L1;   
  915.         end if;
  916.                   if(clk5="011"and A="001")then
  917.         STAR<=L2;   
  918.         end if;
  919.                   if(clk5="100"and A="001")then
  920.         STAR<=L3;   
  921.         end if;
  922.                   if(clk5="101"and A="001")then
  923.         STAR<=L4;   
  924.         end if;
  925.                   if(clk6="00"and A="010")then
  926.         STAR<=T0;   
  927.         end if;
  928.         if(clk6="01"and A="010")then
  929.         STAR<=T1;   
  930.         end if;
  931.     end process P2;
  932. end lyt;








  933. 最完美代码
  934. library ieee;
  935. use ieee.std_logic_1164.all;
  936. use ieee.std_logic_unsigned.all;

  937. entity shiyan5 is
  938. port (       A:in BIT_VECTOR(1 TO 3);--控制显示数字
  939.            clk:in std_logic;--时钟信号
  940.            led:out std_logic_vector(7 downto 0);--led灯
  941.                          STAR:out std_logic_vector(7 downto 0);--二极管
  942.         led1_4:out std_logic_vector(3 downto 0));--控制七段译码管
  943. end shiyan5;
  944. architecture lyt of shiyan5 is
  945. signal clk1:std_logic_vector(15 downto 0);
  946. signal clk2:std_logic_vector(2 downto 0);
  947. signal clk3:std_logic_vector(25 downto 0);
  948. signal clk4:std_logic_vector(3 downto 0);
  949. signal clk5:std_logic_vector(2 downto 0);
  950. signal clk6:std_logic_vector(1 downto 0);
  951. signal   m0:std_logic_vector(7 downto 0);
  952. signal   m1:std_logic_vector(7 downto 0);
  953. signal   m2:std_logic_vector(7 downto 0);
  954. signal   m3:std_logic_vector(7 downto 0);
  955. signal   m4:std_logic_vector(7 downto 0);
  956. signal   m5:std_logic_vector(7 downto 0);--保存十个不同数字的信号
  957. signal   m6:std_logic_vector(7 downto 0);
  958. signal   m7:std_logic_vector(7 downto 0);
  959. signal   m8:std_logic_vector(7 downto 0);
  960. signal   m9:std_logic_vector(7 downto 0);
  961. signal   N0:std_logic_vector(7 downto 0);
  962. signal   N1:std_logic_vector(7 downto 0);
  963. signal   N2:std_logic_vector(7 downto 0);
  964. signal   N3:std_logic_vector(7 downto 0);
  965. signal   N4:std_logic_vector(7 downto 0);
  966. signal   N5:std_logic_vector(7 downto 0);
  967. signal   L0:std_logic_vector(7 downto 0);
  968. signal   L1:std_logic_vector(7 downto 0);
  969. signal   L2:std_logic_vector(7 downto 0);
  970. signal   L3:std_logic_vector(7 downto 0);
  971. signal   L4:std_logic_vector(7 downto 0);
  972. signal   T0:std_logic_vector(7 downto 0);
  973. signal   T1:std_logic_vector(7 downto 0);
  974. begin
  975. P1:process(clk)---控制七段显示学号的进程
  976. begin
  977.     if(clk'event and clk='1')then
  978.         clk1<=clk1+1;
  979.                   clk3<=clk3+1;
  980.         if(clk1="1111111111111111")then
  981.             clk1<=(others=>'0');            ---时钟控制
  982.             if(clk2="011")then
  983.                 clk2<=(others=>'0');
  984.             else
  985.                clk2<=clk2+1;
  986.             end if;                       
  987.         end if;
  988.                   if(clk3="10111110101111000010000000")then
  989.             clk3<=(others=>'0');            ---时钟控制
  990.             if(clk4="1010"and A="011")then
  991.                                 clk4<="0001";
  992.             elsif(A(1)='1') then
  993.                                 clk4<="0000";
  994.                            else
  995.                                 clk4<=clk4+1;
  996.             end if;
  997.                                 if(clk5="101"and A="001")then
  998.             clk5<="001";
  999.             elsif(A(2)='1') THEN  clk5<="000";
  1000.                                 ELSE CLK5<=CLK5+1;
  1001.             end if;
  1002.                                 if(clk6="10"and A="010")then
  1003.             clk6<="01";
  1004.             elsif(A(3)='1') THEN  clk6<="00";
  1005.                                 ELSE CLK6<=CLK6+1;
  1006.             end if;
  1007.         end if;         
  1008.         m0<="00000011";
  1009.                   m1<="10011110";
  1010.                   m2<="00100100";
  1011.                   m3<="00001100";
  1012.                   m4<="10011000";--储存十个不同led数字
  1013.                   m5<="01001000";
  1014.                   m6<="01000000";
  1015.                   m7<="00011110";
  1016.                   m8<="00000000";
  1017.                   m9<="00001000";                                    
  1018.         if(clk2="0000"and A(1)='1')then
  1019.             led1_4<="0111";
  1020.             led<=m5;        
  1021.         elsif(clk2="0001"and A(1)='1')then
  1022.             led1_4<="1011";
  1023.             led<=m0;      --赋值  
  1024.         elsif(clk2="0010"and A(1)='1')then
  1025.             led1_4<="1101";
  1026.             led<=m9;
  1027.         elsif(clk2="0011"and A(1)='1')then
  1028.             led1_4<="1110";
  1029.             led<=m1;
  1030.                   else                led1_4<="1111";  
  1031.                   end if;
  1032.                   if(A(1)='0')then
  1033.             led1_4<="1111";           
  1034.         end if;             
  1035.     end if;
  1036.     end process P1;
  1037. P2:process(clk4,CLK5,CLK6)--控制流水灯的进程
  1038. begin   
  1039.         N0<="00011111";
  1040.                   N1<="10001111";
  1041.                   N2<="11000111";
  1042.                   N3<="11100011";
  1043.                   N4<="11110001";--储存六个第一模式二极管信号
  1044.                   N5<="11111000";
  1045.                   L0<="11100111";
  1046.                   L1<="11011011";
  1047.                   L2<="10111101";
  1048.                   L3<="01111110";
  1049.                   L4<="11111111";--储存五个第二模式二极管信号   
  1050.                   T0<="01010101";
  1051.                   T1<="10101010";--储存二个第三模式二极管信号
  1052.                   if  A="111" then
  1053.         star<="11111111"        ;
  1054.         end if;
  1055.         if(clk4="0001"and A="011")then
  1056.         STAR<=N0;           
  1057.         elsif(clk4="0010"and A="011")then
  1058.         STAR<=N1;   
  1059.                   elsif(clk4="0011"and A="011")then
  1060.         STAR<=N2;   
  1061.                elsif(clk4="0100"and A="011")then
  1062.         STAR<=N3;   
  1063.                   elsif(clk4="0101"and A="011")then
  1064.         STAR<=N4;         
  1065.                   elsif(clk4="0110"and A="011")then
  1066.         STAR<=N5;      
  1067.                   elsif(clk4="0111"and A="011")then
  1068.         STAR<=N4;     
  1069.                   elsif(clk4="1000"and A="011")then
  1070.         STAR<=N3;
  1071.                   elsif(clk4="1001"and A="011")then
  1072.         STAR<=N2;      
  1073.                   elsif(clk4="1010"and A="011")then
  1074.         STAR<=N1;  
  1075.                   elsif(clk5="001"and A="001")then
  1076.         STAR<=L0;  
  1077.         elsif(clk5="010"and A="001")then
  1078.         STAR<=L1;   
  1079.                   elsif(clk5="011"and A="001")then
  1080.         STAR<=L2;   
  1081.                   elsif(clk5="100"and A="001")then
  1082.         STAR<=L3;
  1083.                   elsif(clk5="101"and A="001")then
  1084.         STAR<=L4;     
  1085.                   elsif(clk6="01"and A="010")then
  1086.         STAR<=T0;         
  1087.         elsif(clk6="10"and A="010")then
  1088.         STAR<=T1;
  1089.                   else    star<="11111111"        ;  
  1090.         end if;
  1091.     end process P2;
  1092. end lyt;







  1093. 失败的时钟

  1094. library ieee;
  1095. use ieee.std_logic_1164.all;
  1096. use ieee.std_logic_unsigned.all;
  1097. entity shizhong5091 is
  1098. port (     clk:in std_logic;--时钟信号
  1099.            led:out std_logic_vector(7 downto 0);--led灯                         
  1100.         led1_4:out std_logic_vector(3 downto 0));--控制七段译码管
  1101. end shizhong5091;
  1102. architecture lyt of shizhong5091 is
  1103. signal clk1:std_logic_vector(25 downto 0);
  1104. signal clk2:std_logic_vector(5 downto 0);
  1105. signal clk3:std_logic_vector(3 downto 0);
  1106. signal clk4:std_logic_vector(2 downto 0);
  1107. signal clk5:std_logic_vector(3 downto 0);
  1108. signal clk6:std_logic_vector(1 downto 0);
  1109. signal    A:std_logic_vector(2 downto 0);
  1110. signal   m0:std_logic_vector(7 downto 0);
  1111. signal   m1:std_logic_vector(7 downto 0);
  1112. signal   m2:std_logic_vector(7 downto 0);
  1113. signal   m3:std_logic_vector(7 downto 0);
  1114. signal   m4:std_logic_vector(7 downto 0);
  1115. signal   m5:std_logic_vector(7 downto 0);--保存十个不同数字的信号
  1116. signal   m6:std_logic_vector(7 downto 0);
  1117. signal   m7:std_logic_vector(7 downto 0);
  1118. signal   m8:std_logic_vector(7 downto 0);
  1119. signal   m9:std_logic_vector(7 downto 0);
  1120. begin
  1121. P1:process(clk)---控制七段显示学号的进程
  1122. begin
  1123.     if(clk'event and clk='1')then
  1124.         clk1<=clk1+1;                  
  1125.         if(clk1="10111110101111000010000000")then
  1126.             clk1<=(others=>'0');           ---时钟控制            
  1127.                                          if(clk3="1001")then
  1128.                                          clk3<=(others=>'0');
  1129.                                            if(clk4="100")then
  1130.                                                 clk4<=(others=>'0');
  1131.                                                   if(clk5="1011")then
  1132.                                                   clk5<=(others=>'0');
  1133.                                                    if(clk6="01")then
  1134.                                                    clk6<=(others=>'0');
  1135.                                                    else clk6<=clk6+1;
  1136.                                                         end if;
  1137.                                                   else clk5<=clk5+1;
  1138.                                                   end if;
  1139.                                                 else clk4<=clk4+1;
  1140.                                                 end if;
  1141.                                          else        clk3<=clk3+1;
  1142.                                          end if;            
  1143.         end if;                  
  1144.         m0<="00000011";
  1145.                   m1<="10011110";
  1146.                   m2<="00100100";
  1147.                   m3<="00001100";
  1148.                   m4<="10011000";--储存十个不同led数字
  1149.                   m5<="01001000";
  1150.                   m6<="01000000";
  1151.                   m7<="00011110";
  1152.                   m8<="00000000";
  1153.                   m9<="00001000";                                    
  1154.         if(clk3="0000")then
  1155.             led1_4<="1110";
  1156.             led<=m0;
  1157.         end if ;   
  1158.              if(clk3="0001")then
  1159.             led1_4<="1110";
  1160.             led<=m1;
  1161.         end if ;
  1162.         if(clk3="0010")then
  1163.             led1_4<="1110";
  1164.             led<=m2;
  1165.         end if ;
  1166.         if(clk3="0011")then
  1167.             led1_4<="1110";
  1168.             led<=m3;
  1169.         end if ;   
  1170.              if(clk3="0100")then
  1171.             led1_4<="1110";
  1172.             led<=m4;
  1173.         end if ;
  1174.         if(clk3="0101")then
  1175.             led1_4<="1110";
  1176.             led<=m5;
  1177.         end if ;
  1178.        if(clk3="0110")then
  1179.             led1_4<="1110";
  1180.             led<=m6;
  1181.         end if ;   
  1182.              if(clk3="0111")then
  1183.             led1_4<="1110";
  1184.             led<=m7;
  1185.         end if ;
  1186.         if(clk3="1000")then
  1187.             led1_4<="1110";
  1188.             led<=m8;
  1189.         end if ;
  1190.         if(clk3="1001")then
  1191.             led1_4<="1110";
  1192.             led<=m9;
  1193.         end if ;
  1194.         if(clk4="000")then
  1195.             led1_4<="1101";
  1196.             led<=m0;
  1197.         end if ;   
  1198.              if(clk4="001")then
  1199.             led1_4<="1110";
  1200.             led<=m1;
  1201.         end if ;
  1202.         if(clk4="010")then
  1203.             led1_4<="1101";
  1204.             led<=m2;
  1205.         end if ;
  1206.         if(clk4="011")then
  1207.             led1_4<="1101";
  1208.             led<=m3;
  1209.         end if ;   
  1210.              if(clk4="100")then
  1211.             led1_4<="1101";
  1212.             led<=m4;
  1213.         end if ;
  1214.         if(clk4="101")then
  1215.             led1_4<="1101";
  1216.             led<=m5;
  1217.         end if ;       
  1218.              if(clk5="0000")then
  1219.             led1_4<="1011";
  1220.             led<=m0;
  1221.         end if ;   
  1222.              if(clk5="0001")then
  1223.             led1_4<="1011";
  1224.             led<=m1;
  1225.         end if ;
  1226.         if(clk5="0010")then
  1227.             led1_4<="1011";
  1228.             led<=m2;
  1229.         end if ;
  1230.         if(clk3="0011")then
  1231.             led1_4<="1011";
  1232.             led<=m3;
  1233.         end if ;   
  1234.              if(clk5="0100")then
  1235.             led1_4<="1011";
  1236.             led<=m4;
  1237.         end if ;
  1238.         if(clk5="0101")then
  1239.             led1_4<="1011";
  1240.             led<=m5;
  1241.         end if ;
  1242.        if(clk5="0110")then
  1243.             led1_4<="1011";
  1244.             led<=m6;
  1245.         end if ;   
  1246.              if(clk5="0111")then
  1247.             led1_4<="1011";
  1248.             led<=m7;
  1249.         end if ;
  1250.         if(clk5="1000")then
  1251.             led1_4<="1011";
  1252.             led<=m8;
  1253.         end if ;
  1254.         if(clk5="1001")then
  1255.             led1_4<="1011";
  1256.             led<=m9;
  1257.         end if ;
  1258.         if(clk5="1010")then
  1259.             led1_4<="1011";
  1260.             led<=m0;
  1261.         end if ;   
  1262.              if(clk5="1011")then
  1263.             led1_4<="1011";
  1264.             led<=m1;
  1265.         end if ;  
  1266.         if(clk6="00")then
  1267.             led1_4<="0111";
  1268.             led<=m0;
  1269.         end if ;   
  1270.              if(clk6="01")then
  1271.             led1_4<="0111";
  1272.             led<=m1;
  1273.         end if ;                           
  1274.     end if;
  1275.     end process P1;
  1276. end lyt;
复制代码


eda代码.docx

24.95 KB, 下载次数: 2, 下载积分: 黑币 -5

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏1 分享淘帖 顶 踩
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

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