clock_mod.vhd 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. ----------------------------------------------------------------------------------
  2. -- Company: The Hong Kong Polytechnic University
  3. -- Engineer: Alexandr Melnikov
  4. --
  5. -- Create Date: 14:56:38 02/16/2017
  6. -- Design Name:
  7. -- Module Name: clock_mod - Behavioral
  8. -- Project Name:
  9. -- Target Devices:
  10. -- Tool versions:
  11. -- Description:
  12. --
  13. -- Dependencies:
  14. --
  15. -- Revision:
  16. -- Revision 0.01 - File Created
  17. -- Additional Comments:
  18. -- This module provides Transceiver design with 2 clocks:
  19. -- - 50mhz clock, which is reference clock for the ethernet chip and
  20. -- - 50mhz_shifted clock, which is used for write Tx operations.
  21. -- 50mhz_shift clock is shifted by -pi/2 with respect to 50mhz clock
  22. ----------------------------------------------------------------------------------
  23. library IEEE;
  24. use IEEE.STD_LOGIC_1164.ALL;
  25. -- Uncomment the following library declaration if using
  26. -- arithmetic functions with Signed or Unsigned values
  27. --use IEEE.NUMERIC_STD.ALL;
  28. -- Uncomment the following library declaration if instantiating
  29. -- any Xilinx primitives in this code.
  30. --library UNISIM;
  31. --use UNISIM.VComponents.all;
  32. entity clock_mod is
  33. -- Generic ( M_clk : integer);
  34. Port ( clk100mhz : in STD_LOGIC;
  35. clk_out : out STD_LOGIC;
  36. clk_out_shift: out STD_LOGIC);
  37. end clock_mod;
  38. architecture Behavioral of clock_mod is
  39. signal temp_clk : std_logic := '0';
  40. signal temp_clk_shift : std_logic := '1';
  41. --signal count : integer range 0 to M_clk-1 :=0;
  42. begin
  43. clock: process (clk100mhz)
  44. begin
  45. if (rising_edge(clk100mhz)) then
  46. temp_clk <= not(temp_clk);
  47. end if;
  48. end process clock;
  49. shift_clock: process (clk100mhz)
  50. begin
  51. if (falling_edge(clk100mhz)) then
  52. temp_clk_shift <= not(temp_clk_shift);
  53. end if;
  54. end process shift_clock;
  55. clk_out <= temp_clk;
  56. clk_out_shift <= temp_clk_shift;
  57. end Behavioral;