Advertisement
Guest User

Untitled

a guest
Dec 10th, 2015
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.58 KB | None | 0 0
  1.  
  2. •••
  3.  
  4.  
  5. ---------- Forwarded message ---------
  6. From: Ionescu Gabriel <igabriel1993@gmail.com>
  7. Date: Thu, Dec 10, 2015, 11:23
  8. Subject: cheat sheet
  9. To: Adrian Tanasie <tanasieadrian93@gmail.com>, Diaconeasa Stefan <stefan.diaconeasa@gmail.com>, Radu Galbenu <radugalbenu@gmail.com>
  10.  
  11.  
  12. ----------------------------------------------------------------------------------
  13. -- Company:
  14. -- Engineer:
  15. --
  16. -- Create Date: 10:09:28 12/03/2015
  17. -- Design Name:
  18. -- Module Name: ceas - Behavioral
  19. -- Project Name:
  20. -- Target Devices:
  21. -- Tool versions:
  22. -- Description:
  23. --
  24. -- Dependencies:
  25. --
  26. -- Revision:
  27. -- Revision 0.01 - File Created
  28. -- Additional Comments:
  29. --
  30. ----------------------------------------------------------------------------------
  31. library IEEE;
  32. use IEEE.STD_LOGIC_1164.ALL;
  33. use IEEE.STD_LOGIC_ARITH.ALL;
  34. use IEEE.STD_LOGIC_UNSIGNED.ALL;
  35.  
  36. ---- Uncomment the following library declaration if instantiating
  37. ---- any Xilinx primitives in this code.
  38. --library UNISIM;
  39. --use UNISIM.VComponents.all;
  40.  
  41. entity ceas is
  42. Port
  43. (
  44. iCLK : IN std_logic;
  45.  
  46. oaAN : OUT std_logic_vector(3 downto 0); --Anozi
  47. oaSEG : OUT std_logic_vector(6 downto 0) --Segmente
  48. );
  49. end ceas;
  50.  
  51. architecture Behavioral of ceas is
  52. signal saDat : std_logic_vector(15 downto 0);
  53. signal saQ_Cnt : std_logic_vector(19 downto 1):=(others =>'0');
  54. signal saDgt : std_logic_vector(3 downto 0);
  55.  
  56.  
  57. signal saQ_div : std_logic_vector(25 downto 0):=(others =>'0');
  58. signal sD_CES : std_logic;
  59.  
  60. -- pentru secunde
  61. signal saQ_sec : std_logic_vector(3 downto 0):=(others =>'0');
  62. signal sTCS_CEZS : std_logic;
  63.  
  64. -- pentru zeci de secunde
  65. signal saQ_zsec : std_logic_vector(2 downto 0):="000";
  66.  
  67. begin
  68.  
  69.  
  70. --saDat <=iaK & iaK;
  71.  
  72. process (iCLK)
  73. begin
  74. if(rising_edge(iCLK)) then
  75. saQ_Cnt <= saQ_Cnt + 1;
  76.  
  77. if saQ_div = 8 then --a modulo 6 counter
  78. saQ_div <= (others => '0');
  79. else
  80. saQ_div <= saQ_div+1;
  81.  
  82. end if;
  83.  
  84. if sD_CES = '1' then
  85. if saQ_sec = 9 then --a modulo 10 counter
  86. saQ_sec <= "0000";
  87. else
  88. saQ_sec <= saQ_sec + 1;
  89. end if;
  90. end if;
  91.  
  92.  
  93. if (sTCS_CEZS ='1' ) then
  94. if (saQ_zsec = 5) then --a modulo 6 counter
  95. saQ_zsec <= "000";
  96. else
  97. saQ_zsec <= saQ_zsec + 1;
  98. end if;
  99. end if;
  100.  
  101.  
  102. end if;
  103. end process;
  104. sD_CES <= '1' when saQ_div = 1 else '0';
  105. sTCS_CEZS <= '1' when sD_CES='1' and saQ_sec = 9 else '0';
  106.  
  107. saDat <= "000000000" & saQ_zsec & saQ_sec;
  108.  
  109. WITH saQ_Cnt(19 downto 18) select
  110. oaAN <= "1110" WHEN "00",
  111. "1101" WHEN "01",
  112. "1011" WHEN "10",
  113. "0111" WHEN "11",
  114. "1111" WHEN others;
  115.  
  116. with saQ_Cnt(19 downto 18) select
  117. saDgt <= saDat(3 downto 0) when "00",
  118. saDat(7 downto 4) when "01",
  119. saDat(11 downto 8) when "10",
  120. saDat(15 downto 12) when "11",
  121. "0000" when others;
  122.  
  123. with saDgt SELect
  124. oaSEG <=
  125. "1000000" when "0000", --0
  126. "1111001" when x"1", --1
  127. "0100100" when x"2", --2
  128. "0110000" when "0011", --3
  129. "0011001" when "0100", --4
  130. "0010010" when "0101", --5
  131. "0000010" when "0110", --6
  132. "1111000" when "0111", --7
  133. "0000000" when "1000", --8
  134. "0010000" when "1001", --9
  135. "0001000" when "1010", --A
  136. "0000011" when "1011", --b
  137. "1000110" when "1100", --C
  138. "0100001" when "1101", --d
  139. "0000110" when "1110", --E
  140. "0001110" when others; --F
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149. end Behavioral;
  150.  
  151.  
  152. --
  153. Ionescu Gabriel
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement