Advertisement
AdrianMadajewski

Untitled

Dec 7th, 2020
831
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 5.69 KB | None | 0 0
  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.     HEX0, HEX1, HEX2, HEX3, HEX4, HEX5, HEX6, HEX7 : 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 I 8 wektorów INFORMACYJNYCH
  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
  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. SIGNAL M0, M1, M2, M3, M4, M5, M6, M7 : STD_LOGIC_VECTOR(2 DOWNTO 0);
  36.  
  37. BEGIN
  38. -- KONKRETYZACJA UŻYCIA KOMPONENTÓW
  39.  
  40. -- KONKRETYZACJE KOLEJNYCH MULTIPLEKSERÓW UKŁADU
  41. MUX0 : mux3bit8to1 PORT MAP
  42. (
  43.     SW(17 DOWNTO 15),
  44.     SW(14 DOWNTO 12),
  45.     SW(11 DOWNTO 9),
  46.     SW(8 DOWNTO 6),
  47.     SW(5 DOWNTO 3),
  48.     SW(2 DOWNTO 0),
  49.     SPACJA,
  50.     SPACJA,
  51.     SPACJA,
  52.     M0
  53. );
  54.  
  55. MUX1 : mux3bit8to1 PORT MAP
  56. (
  57.     SW(17 DOWNTO 15),
  58.     SW(11 DOWNTO 9),
  59.     SW(8 DOWNTO 6),
  60.     SW(5 DOWNTO 3),
  61.     SW(2 DOWNTO 0),
  62.     SPACJA,
  63.     SPACJA,
  64.     SPACJA,
  65.     SW(14 DOWNTO 12),
  66.     M1
  67. );
  68.  
  69. MUX2 : mux3bit8to1 PORT MAP
  70. (
  71.     SW(17 DOWNTO 15),
  72.     SW(8 DOWNTO 6),
  73.     SW(5 DOWNTO 3),
  74.     SW(2 DOWNTO 0),
  75.     SPACJA,
  76.     SPACJA,
  77.     SPACJA,
  78.     SW(14 DOWNTO 12),
  79.     SW(11 DOWNTO 9),  
  80.     M2
  81. );
  82.  
  83. MUX3 : mux3bit8to1 PORT MAP
  84. (
  85.     SW(17 DOWNTO 15),
  86.     SW(5 DOWNTO 3),
  87.     SW(2 DOWNTO 0),
  88.     SPACJA,
  89.     SPACJA,
  90.     SPACJA,
  91.     SW(14 DOWNTO 12),
  92.     SW(11 DOWNTO 9),
  93.     SW(8 DOWNTO 6),  
  94.     M3
  95. );
  96.  
  97. MUX4 : mux3bit8to1 PORT MAP
  98. (
  99.     SW(17 DOWNTO 15),
  100.     SW(2 DOWNTO 0),
  101.     SPACJA,
  102.     SPACJA,
  103.     SPACJA,
  104.     SW(14 DOWNTO 12),
  105.     SW(11 DOWNTO 9),
  106.     SW(8 DOWNTO 6),
  107.     SW(5 DOWNTO 3),  
  108.     M4
  109. );
  110.  
  111. MUX5 : mux3bit8to1 PORT MAP
  112. (
  113.     SW(17 DOWNTO 15),
  114.     SPACJA,
  115.     SPACJA,
  116.     SPACJA,
  117.     SW(14 DOWNTO 12),
  118.     SW(11 DOWNTO 9),
  119.     SW(8 DOWNTO 6),
  120.     SW(5 DOWNTO 3),
  121.     SW(2 DOWNTO 0),
  122.     M5
  123. );
  124.  
  125. MUX6 : mux3bit8to1 PORT MAP
  126. (
  127.     SW(17 DOWNTO 15),
  128.     SPACJA,
  129.     SPACJA,
  130.     SW(14 DOWNTO 12),
  131.     SW(11 DOWNTO 9),
  132.     SW(8 DOWNTO 6),
  133.     SW(5 DOWNTO 3),
  134.     SW(2 DOWNTO 0),
  135.     SPACJA,
  136.     M6
  137. );
  138.  
  139. MUX7 : mux3bit8to1 PORT MAP
  140. (
  141.     SW(17 DOWNTO 15),
  142.     SPACJA,
  143.     SW(14 DOWNTO 12),
  144.     SW(11 DOWNTO 9),
  145.     SW(8 DOWNTO 6),
  146.     SW(5 DOWNTO 3),
  147.     SW(2 DOWNTO 0),
  148.     SPACJA,
  149.     SPACJA,
  150.     M7
  151. );
  152.  
  153. -- KONKRETYZACJE KOLEJNYCH TRANSKODERÓW
  154. H0: char7seg PORT MAP (M0, HEX0);
  155. H1: char7seg PORT MAP (M1, HEX1);
  156. H2: char7seg PORT MAP (M2, HEX2);
  157. H3: char7seg PORT MAP (M3, HEX3);
  158. H4: char7seg PORT MAP (M4, HEX4);
  159. H5: char7seg PORT MAP (M5, HEX5);
  160. H6: char7seg PORT MAP (M6, HEX6);
  161. H7: char7seg PORT MAP (M7, HEX7);
  162.  
  163. END strukturalna;
  164.  
  165.  
  166. -- IMPLEMENTACJA MULTIPLEKSERA 8 do 1 (WEKTOR 3 BITOWY)
  167. LIBRARY ieee;
  168. USE ieee.std_logic_1164.all;
  169. ENTITY mux3bit8to1 IS
  170.  PORT ( S, U0, U1, U2, U3, U4, U5,U6,U7: IN STD_LOGIC_VECTOR(2 DOWNTO 0);
  171.  M : OUT STD_LOGIC_VECTOR(2 DOWNTO 0));
  172. END mux3bit8to1;
  173. ARCHITECTURE strukturalna OF mux3bit8to1 IS
  174. BEGIN      
  175.         M <= (
  176.         ((not S(2) and not S(1) and not S(0) and U0(2)) or (not S(2) and not S(1) and S(0) and U1(2))
  177.         or (not S(2) and S(1) and S(0) and U2(2)) or (not S(2) and S(1) and not S(0) and U3(2))
  178.         or (S(2) and S(1) and not S(0) and U4(2)) or (S(2) and S(1) and S(0) and U5(2))
  179.         or (S(2) and not S(1) and S(0) and U6(2)) or (S(2) and not S(1) and not S(0) and U7(2)))   
  180.         &
  181.         ((not S(2) and not S(1) and not S(0) and U0(1)) or (not S(2) and not S(1) and S(0) and U1(1))
  182.         or (not S(2) and S(1) and S(0) and U2(1)) or (not S(2) and S(1) and not S(0) and U3(1))
  183.         or (S(2) and S(1) and not S(0) and U4(1)) or (S(2) and S(1) and S(0) and U5(1))
  184.         or (S(2) and not S(1) and S(0) and U6(1)) or (S(2) and not S(1) and not S(0) and U7(1)))
  185.         &
  186.         ((not S(2) and not S(1) and not S(0) and U0(0)) or (not S(2) and not S(1) and S(0) and U1(0))
  187.         or (not S(2) and S(1) and S(0) and U2(0)) or (not S(2) and S(1) and not S(0) and U3(0))
  188.         or (S(2) and S(1) and not S(0) and U4(0)) or (S(2) and S(1) and S(0) and U5(0))
  189.         or (S(2) and not S(1) and S(0) and U6(0)) or (S(2) and not S(1) and not S(0) and U7(0)))       
  190.         );
  191.        
  192. END strukturalna;
  193.  
  194.     -- IMPLEMENTACJA TRANSKODERA
  195. LIBRARY ieee;
  196. USE ieee.std_logic_1164.all;
  197. ENTITY char7seg IS
  198.  PORT ( C : IN STD_LOGIC_VECTOR(2 DOWNTO 0);
  199.  Display : OUT STD_LOGIC_VECTOR(0 TO 6));
  200. END char7seg;
  201. ARCHITECTURE strukturalna OF char7seg IS
  202. BEGIN
  203.     --with C select
  204.     --Display <=    "1111111" when "000", -- spacja
  205.     --              "0111000" when "001", -- F
  206.     --              "0100001" when "010", -- G
  207.     --              "1001000" when "011", -- H
  208.     --              "1001111" when "100", -- I
  209.     --              "1000011" when "101", -- J
  210.     --              "-------" when others;
  211.    
  212.     Display <= ((not C(2) and not C(1) and not C(0)) or
  213.                     (not C(2) and C(1) and C(0)) or
  214.                     (C(2) and not C(1) and not C(0)) or
  215.                     (C(2) and not C(1) and C(0)))
  216.                     &
  217.                     ((not C(2) and not C(1) and not C(0)) or
  218.                      (not C(2) and not C(1) and C(0)) or
  219.                     (not C(2) and C(1) and not C(0)))
  220.                     &
  221.                     ((not C(2) and not C(1) and not C(0)) or
  222.                     (not C(2) and not C(1) and C(0)))
  223.                     &
  224.                     ((not C(2) and not C(1) and not C(0)) or
  225.                      (not C(2) and not C(1) and C(0)) or
  226.                     (not C(2) and C(1) and C(0)) or
  227.                     (C(2) and not C(1) and not C(0)))
  228.                     &
  229.                     ((not C(2) and not C(1) and not C(0)) or
  230.                     (C(2) and not C(1) and not C(0)))
  231.                     &
  232.                     ((not C(2) and not C(1) and not C(0)) or
  233.                      (C(2) and not C(1) and not C(0)) or
  234.                     (C(2) and not C(1) and C(0)))
  235.                     &
  236.                     ((not C(2) and not C(1) and not C(0)) or
  237.                     (not C(2) and C(1) and not C(0)) or
  238.                     (C(2) and not C(1) and not C(0)) or
  239.                     (C(2) and not C(1) and C(0))
  240.                     );
  241. END strukturalna;
  242.  
  243.  
  244.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement