AdrianMadajewski

Untitled

Dec 9th, 2020
662
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. LIBRARY ieee;
  2. USE ieee.std_logic_1164.all;
  3.  
  4. ENTITY reklama IS
  5. PORT
  6. (
  7.     SW : IN STD_LOGIC_VECTOR(17 DOWNTO 0);
  8.     HEX7, HEX6, HEX5, HEX4, HEX3, HEX2, HEX1, HEX0 : OUT STD_LOGIC_VECTOR(0 TO 6)
  9. );
  10. END reklama;
  11.  
  12. ARCHITECTURE strukturalna OF reklama IS
  13.  
  14. CONSTANT SPACJA : STD_LOGIC_VECTOR(2 DOWNTO 0) := "000";
  15.  
  16. -- DEKLARACJA KOMPONENTÓW
  17.  
  18. COMPONENT mux3bit8to1 -- MULTIPLEKSER
  19. PORT
  20. (
  21.     -- WEKTOR STERUJĄCY 3 (bitowy) i 8 wektorów INFORMACYJNYCH (3 bitowy)
  22.     S, U0, U1, U2, U3, U4, U5, U6, U7: IN STD_LOGIC_VECTOR(2 DOWNTO 0);
  23.     M : OUT STD_LOGIC_VECTOR(2 DOWNTO 0)
  24. );
  25. END COMPONENT;
  26.  
  27. COMPONENT char7seg -- TRANSKODER (zamiana kodu 3 bitowego na kod 7 bitowy wyjsc reklamy)
  28. PORT
  29. (
  30.     C : IN STD_LOGIC_VECTOR(2 DOWNTO 0);
  31.     Display : OUT STD_LOGIC_VECTOR(0 TO 6)
  32. );
  33. END COMPONENT;
  34.  
  35. -- 3 bitowe sygnaly
  36. SIGNAL M0, M1, M2, M3, M4, M5, M6, M7 : STD_LOGIC_VECTOR(2 DOWNTO 0);
  37.  
  38. BEGIN
  39. -- KONKRETYZACJA UŻYCIA KOMPONENTÓW
  40.  
  41. -- KONKRETYZACJE KOLEJNYCH MULTIPLEKSERÓW UKŁADU
  42. MUX0: mux3bit8to1 PORT MAP (SW(17 DOWNTO 15), SPACJA, SW(14 DOWNTO 12), SW(11 DOWNTO 9), SW(8 DOWNTO 6), SW(5 DOWNTO 3), SW(2 DOWNTO 0), SPACJA, SPACJA, M0);
  43.  
  44. MUX1: mux3bit8to1 PORT MAP (SW(17 DOWNTO 15), SPACJA, SPACJA, SW(14 DOWNTO 12), SW(11 DOWNTO 9), SW(8 DOWNTO 6), SW(5 DOWNTO 3), SW(2 DOWNTO 0), SPACJA, M1);
  45.  
  46. MUX2: mux3bit8to1 PORT MAP (SW(17 DOWNTO 15), SPACJA, SPACJA, SPACJA, SW(14 DOWNTO 12), SW(11 DOWNTO 9), SW(8 DOWNTO 6), SW(5 DOWNTO 3), SW(2 DOWNTO 0), M2);
  47.  
  48. MUX3: mux3bit8to1 PORT MAP (SW(17 DOWNTO 15), SW(2 DOWNTO 0), SPACJA, SPACJA, SPACJA, SW(14 DOWNTO 12), SW(11 DOWNTO 9), SW(8 DOWNTO 6), SW(5 DOWNTO 3), M3);
  49.  
  50. MUX4: mux3bit8to1 PORT MAP (SW(17 DOWNTO 15), SW(5 DOWNTO 3), SW(2 DOWNTO 0), SPACJA, SPACJA, SPACJA,SW(14 DOWNTO 12), SW(11 DOWNTO 9), SW(8 DOWNTO 6),  M4);
  51.  
  52. MUX5: mux3bit8to1 PORT MAP (SW(17 DOWNTO 15), SW(8 DOWNTO 6), SW(5 DOWNTO 3), SW(2 DOWNTO 0), SPACJA, SPACJA, SPACJA,SW(14 DOWNTO 12), SW(11 DOWNTO 9),  M5);
  53.  
  54. MUX6: mux3bit8to1 PORT MAP (SW(17 DOWNTO 15), SW(11 DOWNTO 9), SW(8 DOWNTO 6), SW(5 DOWNTO 3), SW(2 DOWNTO 0), SPACJA, SPACJA, SPACJA, SW(14 DOWNTO 12), M6);
  55.  
  56. MUX7: mux3bit8to1 PORT MAP (SW(17 DOWNTO 15), SW(14 DOWNTO 12), SW(11 DOWNTO 9), SW(8 DOWNTO 6), SW(5 DOWNTO 3), SW(2 DOWNTO 0), SPACJA, SPACJA, SPACJA, M7);
  57.  
  58.  
  59. -- KONKRETYZACJE KOLEJNYCH TRANSKODERÓW
  60. H0: char7seg PORT MAP (M0, HEX0);   -- zamiana sygnalu 0 na kod wyswietlacza [0]
  61. H1: char7seg PORT MAP (M1, HEX1);   -- zamiana sygnalu 1 na kod wyswietlacza [1]
  62. H2: char7seg PORT MAP (M2, HEX2);   -- zamiana sygnalu 2 na kod wyswietlacza [2]
  63. H3: char7seg PORT MAP (M3, HEX3);   -- zamiana sygnalu 3 na kod wyswietlacza [3]
  64. H4: char7seg PORT MAP (M4, HEX4);   -- zamiana sygnalu 4 na kod wyswietlacza [4]
  65. H5: char7seg PORT MAP (M5, HEX5);   -- zamiana sygnalu 5 na kod wyswietlacza [5]
  66. H6: char7seg PORT MAP (M6, HEX6);   -- zamiana sygnalu 6 na kod wyswietlacza [6]
  67. H7: char7seg PORT MAP (M7, HEX7);   -- zamiana sygnalu 7 na kod wyswietlacza [7]
  68.  
  69. END strukturalna;
  70.  
  71.  
  72. -- IMPLEMENTACJA MULTIPLEKSERA 8 DO 1 (WEKTOR 3 BITOWY)
  73. LIBRARY ieee;
  74. USE ieee.std_logic_1164.all;
  75.  
  76. ENTITY mux3bit8to1 IS
  77. PORT
  78. (
  79.     S, U0, U1, U2, U3, U4, U5, U6, U7: IN STD_LOGIC_VECTOR(2 DOWNTO 0);
  80.     M : OUT STD_LOGIC_VECTOR(2 DOWNTO 0)
  81. );
  82. END mux3bit8to1;
  83.  
  84. ARCHITECTURE strukturalna OF mux3bit8to1 IS
  85. BEGIN      
  86.        
  87.     M(2) <= (U7(2) and     S(2) and not S(1) and not S(0)) or
  88.                 (U6(2) and     S(2) and not S(1) and     S(0)) or
  89.                 (U5(2) and     S(2) and      S(1) and     S(0)) or
  90.                 (U4(2) and     S(2) and     S(1) and not S(0)) or
  91.                 (U3(2) and not S(2) and     S(1) and not S(0)) or
  92.                 (U2(2) and not S(2) and     S(1) and     S(0)) or
  93.                 (U1(2) and not S(2) and not S(1) and     S(0)) or
  94.                 (U0(2) and not S(2) and not S(1) and not S(0));
  95.                    
  96.     M(1) <= (U7(1) and      S(2) and not S(1) and not S(0)) or
  97.                 (U6(1) and      S(2) and not S(1) and     S(0)) or
  98.                 (U5(1) and      S(2) and     S(1) and     S(0)) or
  99.                 (U4(1) and      S(2) and     S(1) and not S(0)) or
  100.                 (U3(1) and not S(2) and     S(1) and not S(0)) or
  101.                 (U2(1) and not S(2) and     S(1) and     S(0)) or
  102.                 (U1(1) and not S(2) and not S(1) and     S(0)) or
  103.                 (U0(1) and not S(2) and not S(1) and not S(0));
  104.                
  105.     M(0) <= (U7(0) and     S(2) and not S(1) and not S(0)) or
  106.                 (U6(0) and     S(2) and not S(1) and     S(0)) or
  107.                 (U5(0) and     S(2) and     S(1) and     S(0)) or
  108.                 (U4(0) and     S(2) and     S(1) and not S(0)) or
  109.                 (U3(0) and not S(2) and     S(1) and not S(0)) or
  110.                 (U2(0) and not S(2) and     S(1) and     S(0)) or
  111.                 (U1(0) and not S(2) and not S(1) and     S(0)) or
  112.                 (U0(0) and not S(2) and not S(1) and not S(0));
  113.        
  114. END strukturalna;
  115.  
  116. -- IMPLEMENTACJA TRANSKODERA
  117. LIBRARY ieee;
  118. USE ieee.std_logic_1164.all;
  119.  
  120. ENTITY char7seg IS
  121. PORT
  122. (
  123.     C : IN STD_LOGIC_VECTOR(2 DOWNTO 0);
  124.     Display : OUT STD_LOGIC_VECTOR(6 DOWNTO 0)
  125. );
  126. END char7seg;
  127.  
  128. ARCHITECTURE strukturalna OF char7seg IS
  129. BEGIN
  130.     -- with C select           --C(210)
  131.     -- Display <=   "1111111" when "000", -- spacja
  132.     --              "1100000" when "001", -- B
  133.     --              "0110001" when "010", -- C
  134.     --              "0110000" when "011", -- E // zle kodowanie wyswietla sie 6 zamiast E
  135.     --                  "0111000" when "100", -- F
  136.     --                  "0100001" when "101", -- G
  137.     --                  "-------" when others;
  138.    
  139.     Display(6) <= (not C(2) and not C(1) and not C(0)) or
  140.                       (not C(2) and not C(1) and     C(0));
  141.                      
  142.     Display(5) <= '1';
  143.    
  144.     Display(4) <= (not C(2) and not C(1) and not C(0)) or
  145.                       (not C(2) and     C(1) and not C(0)) or
  146.                       (not C(2) and     C(1) and     C(0)) or
  147.                       (    C(2) and not C(1) and not C(0));
  148.                      
  149.     Display(3) <= (not C(2) and not C(1) and not C(0)) or
  150.                       (    C(2) and not C(1) and not C(0));
  151.                      
  152.     Display(2) <=  not C(2) and not C(1) and not C(0);
  153.    
  154.     Display(1) <=  not C(2) and not C(1) and not C(0);
  155.    
  156.     Display(0) <= (not C(2) and not C(1) and not C(0)) or
  157.                       (not C(2) and     C(1) and not C(0)) or
  158.                       (    C(2) and not C(1) and     C(0));
  159.                    
  160. END strukturalna;
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×