Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. library IEEE;
  2. use IEEE.std_logic_1164.all;
  3. use ieee.std_logic_unsigned.all;
  4. entity hex_1sec is
  5. port (
  6. clock_50 : in BIT;
  7. LEDR_9 : out BIT;
  8. display0 : OUT STD_LOGIC_VECTOR(0 TO 6);
  9. display1 : OUT STD_LOGIC_VECTOR(0 TO 6);
  10. display2 : OUT STD_LOGIC_VECTOR(0 TO 6);
  11. display3 : OUT STD_LOGIC_VECTOR(0 TO 6);
  12. display4 : OUT STD_LOGIC_VECTOR(0 TO 6);
  13. display5 : OUT STD_LOGIC_VECTOR(0 TO 6)
  14. );
  15.  
  16. end hex_1sec;
  17.  
  18. ARCHITECTURE behavior of hex_1sec is
  19.  
  20. component hex7seg is
  21. port (
  22. hex : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
  23. display : OUT STD_LOGIC_VECTOR(0 TO 6)
  24. );
  25. end component;
  26.  
  27. signal trrr: integer :=0;
  28. signal tik_tok: bit :='0';
  29. signal tmp: integer:=0;
  30. signal ogranicznik: integer :=50000000;
  31. signal war_0: STD_LOGIC_VECTOR (3 DOWNTO 0);
  32. signal tik_0: integer:=0;
  33.  
  34.  
  35. begin
  36.  
  37. process (CLOCK_50)
  38. begin
  39. if (clock_50'event AND clock_50='1') then
  40. trrr <= trrr + 1;
  41. end if;
  42. if (trrr>ogranicznik) then
  43. trrr<=0;
  44. tmp<=tmp+1;
  45. if (tmp=1) then tmp<=0; end if;
  46. if (tik_tok='1') then tik_tok<='0';
  47. elsif(tik_tok='0') then tik_tok<='1';
  48. end if;
  49. end if;
  50. end process;
  51.  
  52. process (tik_tok, clock_50)
  53. begin
  54. if (tik_tok='1') then ledr_9 <='0';
  55. elsif (tik_tok='0') then ledr_9 <='1';
  56.  
  57. end if;
  58. end process;
  59.  
  60.  
  61. process (tik_tok, clock_50)
  62. begin
  63. if (tmp=1) then
  64. if (war_0="0000") then war_0<="0001";
  65. elsif (war_0="0001") then war_0<="0010";
  66. elsif (war_0="0010") then war_0<="0011";
  67. elsif (war_0="0011") then war_0<="1111";
  68. elsif (war_0="1111") then
  69. if (tik_0=5) then tik_0<=0;
  70. war_0<="0000";
  71. end if;
  72. tik_0<=tik_0+1;
  73. end if;
  74. end if;
  75. end process;
  76.  
  77.  
  78. HEX_5_d: hex7seg port map ("0001",display5);
  79. HEX_4_d: hex7seg port map ("0010",display4);
  80. HEX_3_d: hex7seg port map ("0011",display3);
  81. HEX_2_d: hex7seg port map ("1111",display2);
  82. HEX_1_d: hex7seg port map ("1111",display1);
  83. HEX_0_d: hex7seg port map (war_0,display0);
  84.  
  85.  
  86. end behavior;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement