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.

76 lines
2.1 KiB

  1. library ieee ;
  2. use ieee.std_logic_1164.all;
  3. use ieee.math_real.all;
  4. entity CC_PLL is
  5. generic (
  6. REF_CLK : string := "0"; -- reference clk in MHz
  7. OUT_CLK : string := "0"; -- output clk in MHz
  8. PERF_MD : string := "UNDEFINED"; -- LOWPOWER, ECONOMY, SPEED (optional, global, setting of Place&Route can be used instead)
  9. LOW_JITTER : natural := 1; -- 0: disable, 1: enable low jitter mode
  10. CI_FILTER_CONST : natural := 2; -- optional CI filter constant
  11. CP_FILTER_CONST : natural := 4 -- optional CP filter constant
  12. );
  13. port (
  14. CLK_REF : in std_logic;
  15. CLK_FEEDBACK : in std_logic;
  16. USR_CLK_REF : in std_logic;
  17. USR_LOCKED_STDY_RST : in std_logic;
  18. USR_PLL_LOCKED_STDY : out std_logic;
  19. USR_PLL_LOCKED : out std_logic;
  20. CLK270 : out std_logic := '0';
  21. CLK180 : out std_logic := '0';
  22. CLK0 : out std_logic := '0';
  23. CLK90 : out std_logic := '0';
  24. CLK_REF_OUT : out std_logic
  25. );
  26. end entity;
  27. architecture sim of CC_PLL is
  28. signal s_pll_clk_2 : std_logic := '1';
  29. signal s_pll_clk_pos : std_logic := '0';
  30. signal s_pll_clk_neg : std_logic := '0';
  31. begin
  32. -- First create a clock with freq = 2 * OUT_CLK;
  33. s_pll_clk_2 <= not s_pll_clk_2 after (250.0 / real'value(OUT_CLK)) * ns;
  34. -- Then create clocks with freq = OUT_CLK and shifted by 180 degree
  35. s_pll_clk_pos <= not s_pll_clk_pos when rising_edge(s_pll_clk_2);
  36. s_pll_clk_neg <= not s_pll_clk_pos when falling_edge(s_pll_clk_2);
  37. -- Finally assign the clock outputs to avoid delta cycle delay problems
  38. -- All these clocks should by phase aligned
  39. CLK0 <= s_pll_clk_pos;
  40. CLK90 <= s_pll_clk_neg;
  41. CLK180 <= not s_pll_clk_pos;
  42. CLK270 <= not s_pll_clk_neg;
  43. CLK_REF_OUT <= CLK_REF or USR_CLK_REF;
  44. USR_PLL_LOCKED <= '1';
  45. end architecture;
  46. library ieee ;
  47. use ieee.std_logic_1164.all;
  48. entity CC_CFG_END is
  49. port (
  50. CFG_END : out std_logic
  51. );
  52. end entity;
  53. architecture sim of CC_CFG_END is
  54. begin
  55. CFG_END <= '1';
  56. end architecture;