You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
1.7 KiB

  1. -- This design should display incrementing binary numbers
  2. -- at LED1-LED8 of the GateMate FPGA Starter Kit.
  3. library ieee ;
  4. use ieee.std_logic_1164.all;
  5. use ieee.numeric_std.all;
  6. library gatemate;
  7. use gatemate.components.all;
  8. entity blink is
  9. port (
  10. clk_i : in std_logic; -- 10 MHz clock
  11. rst_n_i : in std_logic; -- SW3 button
  12. led_n_o : out std_logic_vector(7 downto 0) -- LED1..LED8
  13. );
  14. end entity blink;
  15. architecture rtl of blink is
  16. signal s_pll_clk : std_logic;
  17. signal s_pll_lock : std_logic;
  18. signal s_clk_cnt : unsigned(19 downto 0);
  19. signal s_clk_en : boolean;
  20. signal s_led : unsigned(led_n_o'range);
  21. begin
  22. pll : CC_PLL
  23. generic map (
  24. REF_CLK => "10",
  25. OUT_CLK => "1",
  26. PERF_MD => "SPEED"
  27. )
  28. port map (
  29. CLK_REF => clk_i,
  30. CLK_FEEDBACK => '0',
  31. USR_CLK_REF => '0',
  32. USR_LOCKED_STDY_RST => not rst_n_i,
  33. USR_PLL_LOCKED_STDY => open,
  34. USR_PLL_LOCKED => s_pll_lock,
  35. CLK270 => open,
  36. CLK180 => open,
  37. CLK0 => open,
  38. CLK90 => open,
  39. CLK_REF_OUT => s_pll_clk
  40. );
  41. process (s_pll_clk, rst_n_i) is
  42. begin
  43. if (not rst_n_i) then
  44. s_clk_cnt <= (others => '0');
  45. elsif (rising_edge(clk_i)) then
  46. s_clk_cnt <= s_clk_cnt + 1;
  47. end if;
  48. end process;
  49. s_clk_en <= s_clk_cnt = (s_clk_cnt'range => '1');
  50. process (s_pll_clk, rst_n_i) is
  51. begin
  52. if (not rst_n_i) then
  53. s_led <= (others => '0');
  54. elsif (rising_edge(clk_i)) then
  55. if (s_clk_en) then
  56. s_led <= s_led + 1;
  57. end if;
  58. end if;
  59. end process;
  60. led_n_o <= not std_logic_vector(s_led);
  61. end architecture;