mdabkow

Untitled

Nov 28th, 2018
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.36 KB | None | 0 0
  1. -- Copyright (C) 1991-2009 Altera Corporation
  2. -- Your use of Altera Corporation's design tools, logic functions
  3. -- and other software and tools, and its AMPP partner logic
  4. -- functions, and any output files from any of the foregoing
  5. -- (including device programming or simulation files), and any
  6. -- associated documentation or information are expressly subject
  7. -- to the terms and conditions of the Altera Program License
  8. -- Subscription Agreement, Altera MegaCore Function License
  9. -- Agreement, or other applicable license agreement, including,
  10. -- without limitation, that your use is for the sole purpose of
  11. -- programming logic devices manufactured by Altera and sold by
  12. -- Altera or its authorized distributors. Please refer to the
  13. -- applicable agreement for further details.
  14.  
  15. -- PROGRAM "Quartus II"
  16. -- VERSION "Version 9.0 Build 235 06/17/2009 Service Pack 2 SJ Web Edition"
  17. -- CREATED ON "Tue Apr 10 13:36:47 2012"
  18.  
  19. LIBRARY ieee;
  20. USE ieee.std_logic_1164.all;
  21.  
  22. LIBRARY work;
  23.  
  24. ENTITY cw2 IS
  25. PORT
  26. (
  27. clk : IN STD_LOGIC;
  28. clrn : IN STD_LOGIC;
  29. sclr : IN STD_LOGIC;
  30. x1 : IN STD_LOGIC;
  31. x2 : IN STD_LOGIC;
  32. ld : IN STD_LOGIC;
  33. mo1 : OUT STD_LOGIC;
  34. mo0 : OUT STD_LOGIC;
  35. L : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
  36. me : OUT STD_LOGIC_VECTOR(1 DOWNTO 0);
  37. R : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
  38. ST : OUT STD_LOGIC_VECTOR(2 DOWNTO 0)
  39. );
  40. END cw2;
  41.  
  42. ARCHITECTURE bdf_type OF cw2 IS
  43.  
  44. COMPONENT automat
  45. PORT(clk : IN STD_LOGIC;
  46. clrn : IN STD_LOGIC;
  47. sclr : IN STD_LOGIC;
  48. x1 : IN STD_LOGIC;
  49. x2 : IN STD_LOGIC;
  50. c : OUT STD_LOGIC;
  51. mo1 : OUT STD_LOGIC;
  52. mo0 : OUT STD_LOGIC;
  53. me : OUT STD_LOGIC_VECTOR(1 DOWNTO 0);
  54. ST : OUT STD_LOGIC_VECTOR(2 DOWNTO 0)
  55. );
  56. END COMPONENT;
  57.  
  58. COMPONENT licz_rej
  59. PORT(clk : IN STD_LOGIC;
  60. clrn : IN STD_LOGIC;
  61. sclr : IN STD_LOGIC;
  62. cnt : IN STD_LOGIC;
  63. ld : IN STD_LOGIC;
  64. L : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
  65. R : OUT STD_LOGIC_VECTOR(3 DOWNTO 0)
  66. );
  67. END COMPONENT;
  68.  
  69. SIGNAL SYNTHESIZED_WIRE_0 : STD_LOGIC;
  70.  
  71.  
  72. BEGIN
  73.  
  74.  
  75.  
  76. b2v_inst : automat
  77. PORT MAP(clk => clk,
  78. clrn => clrn,
  79. sclr => sclr,
  80. x1 => x1,
  81. x2 => x2,
  82. c => SYNTHESIZED_WIRE_0,
  83. mo1 => mo1,
  84. mo0 => mo0,
  85. me => me,
  86. ST => ST);
  87.  
  88.  
  89. b2v_inst1 : licz_rej
  90. PORT MAP(clk => clk,
  91. clrn => clrn,
  92. sclr => sclr,
  93. cnt => SYNTHESIZED_WIRE_0,
  94. ld => ld,
  95. L => L,
  96. R => R);
  97.  
  98.  
  99. END bdf_type;
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108. -------------------------------------------------
  109. -- Uruchomienie na płytce DE1: dodanie komponentu do jednostki zawierającej przypisanie wyprowadzeń do
  110. -- sygnałów z przełączników i diod.
  111. -- Set As Top-Level Entity na plik za_de1.vhd.
  112. -- W komentarzach znajduje się opis przypisania sygnałów do przełączników, diod i wyświetlaczy.
  113. -- // KONKRETYZACJA/PRZYTOCZENIE KOMPONENTU //
  114. -------------------------------------------------
  115.  
  116. library ieee;
  117. use ieee.std_logic_1164.all;
  118. use ieee.numeric_std.all;
  119.  
  120. entity za_de1 is
  121. port(
  122. SW : in std_logic_vector(9 downto 0); --sygnaly z przycisków SW[9],...,SW[0] płytki DE1
  123. KEY : in std_logic_vector(3 downto 0); -- sygnaly z przyciskow KEY[3],...,KEY[0]
  124. -------------------------------------------------------------
  125. -- deklaracja wyprowadzen do podłączenia z diodami
  126. -- LEDR oraz wyświetlaczami siedmiosegmentowymi.
  127. -------------------------------------------------------------
  128. LEDG : out std_logic_vector(7 downto 0); -- sterowanie diodami zielonymi
  129. LEDR : out std_logic_vector(9 downto 0); -- sterowanie diodami czerwonymi
  130. HEX0, HEX1, HEX2, HEX3 : out std_logic_vector(0 to 6); -- serowanie wy�wietlaczami siedmiosegmentowymi
  131. -----------------------------------------------------------------
  132. -- Przypisanie pozostałych sygnałów
  133. -----------------------------------------------------------------
  134. JP10: out std_logic_vector(7 downto 0)
  135.  
  136. );
  137. end entity;
  138.  
  139. architecture arch of za_de1 is
  140. -----------------------------------------
  141. -- DOMYŚLNE PRZYPISANIA WYPROWADZEŃ
  142. -----------------------------------------
  143. attribute chip_pin : string;
  144. -------------------------------------
  145. -- SYGNAŁY WEJŚCIOWE
  146. -------------------------------------
  147. attribute chip_pin of SW : signal is "L2, M1, M2, U11, U12, W12, V12, M22, L21, L22"; --SW[9]-SW[0] -------------------------------------
  148. attribute chip_pin of KEY : signal is "T21, T22, R21, R22";
  149. -- SYGNAŁY WYJSCIOWE:
  150. -- NIE MODYFIKOWAĆ PRZYPISAN!
  151. -------------------------------------
  152. attribute chip_pin of LEDG : signal is "Y21, Y22, W21, W22, V21, V22, U21, U22";
  153. attribute chip_pin of LEDR : signal is "R17, R18, U18, Y18, V19, T18, Y19, U19, R19, R20"; --diody LED czerwone
  154. attribute chip_pin of HEX0 : signal is "J2, J1, H2, H1, F2, F1, E2";--HEX0
  155. attribute chip_pin of HEX1 : signal is "E1, H6, H5, H4, G3, D2, D1";--HEX1
  156. attribute chip_pin of HEX2 : signal is "G5, G6, C2, C1, E3, E4, D3 ";--HEX2
  157. attribute chip_pin of HEX3 : signal is "F4, D5, D6, J4, L8, F3, D4";--HEX3
  158. attribute chip_pin of JP10 : signal is "A13, B13, A14, B14, A15, B15, A16, B16"; --z��cze JP1
  159. --deklaracja sygna��w sterowania wej�ciowych dekodera HEX -> 7segment
  160. signal sigHEX3, sigHEX2, sigHEX1, sigHEX0: std_logic_vector(3 downto 0);
  161. type HEXit is array(3 downto 0) of std_logic_vector(3 downto 0);
  162. signal sigHEXai: HEXit;
  163. type HEXot is array(3 downto 0) of std_logic_vector(0 to 6);
  164. signal sigHEXao: HEXot;
  165. -----------------------------------------
  166. -- DODANIE TESTOWANEGO KOMPONENTU
  167. -----------------------------------------
  168. component automat
  169. port(
  170. clk, clrn : in std_logic;
  171. sclr : in std_logic;
  172. x1, x2 : in std_logic;
  173. c : out std_logic;
  174. me : out std_logic_vector(1 downto 0);
  175. mo1, mo0: out std_logic;
  176. ST : out std_logic_vector(2 downto 0)
  177. );
  178. end component;
  179.  
  180. begin
  181. ------------------------------------------
  182. -- Domyślne przypisania sygnałów
  183. ------------------------------------------
  184.  
  185. ------------------------------------------
  186. -- KONKRETYZACJA/PRZYTOCZENIE KOMPONENTU
  187. ------------------------------------------
  188. test_inst_de1:
  189. automat
  190. port map(
  191. --sygnaly z przycisków SW[9],...,SW[0] i KEY[3],...,0 płytki DE1
  192. clk => KEY(0) , --sygnaďż˝ zegaral KEY[0]
  193. clrn => KEY(1), -- zerowanie asynchr.
  194. sclr => SW(0), --SW[0]
  195. x1 => SW(8), --SW[8]
  196. x2 => SW(9), --SW[9]
  197. c => LEDR(0),
  198. me => LEDR(2 downto 1),
  199. mo1 => LEDR(3), mo0 => LEDR(4),
  200. ST => LEDR(7 downto 5)
  201. );
  202.  
  203. LEDR(9 downto 8) <= "00";
  204. LEDG <= (others => '0');
  205. sigHEX0 <= (others => '0');
  206. sigHEX1 <= (others => '0');
  207. sigHEX2 <= (others => '0');
  208. sigHEX3 <= (others => '0');
  209. ------------------------------------------
  210. -- Kod obslugi wyswietlaczy siedmosegmentowych
  211. ------------------------------------------
  212. sigHEXai(0) <= sigHEX0;
  213. sigHEXai(1) <= sigHEX1;
  214. sigHEXai(2) <= sigHEX2;
  215. sigHEXai(3) <= sigHEX3;
  216. HEX0 <= not sigHEXao(0);
  217. HEX1 <= not sigHEXao(1);
  218. HEX2 <= not sigHEXao(2);
  219. HEX3 <= not sigHEXao(3);
  220. gen_i1:
  221. for I IN 0 to 3 GENERATE
  222. with sigHEXai(I) select
  223. sigHEXao(I) <= "1111110" when "0000",
  224. "0110000" when "0001",
  225. "1101101" when "0010",
  226. "1111001" when "0011",
  227. "0110011" when "0100",
  228. "1011011" when "0101",
  229. "1011111" when "0110",
  230. "1110000" when "0111",
  231. "1111111" when "1000",
  232. "1111011" when "1001",
  233. "1110111" when "1010",
  234. "0011111" when "1011",
  235. "1001110" when "1100",
  236. "0111101" when "1101",
  237. "1001111" when "1110",
  238. "1000111" when "1111",
  239. "-------" when others;
  240. END GENERATE;
  241. end arch;
Add Comment
Please, Sign In to add comment