2024-06-12 20:03:04 +02:00
|
|
|
-- -------------------------------------------------------------------------- --
|
|
|
|
-- TRASHERNET SoC - A Trashy Ethernet SoC for FPGAs --
|
|
|
|
-- -------------------------------------------------------------------------- --
|
|
|
|
-- TODO
|
|
|
|
-- -------------------------------------------------------------------------- --
|
|
|
|
-- Author : Markus Koch <markus@notsyncing.net>
|
|
|
|
-- Contributors : None
|
|
|
|
-- License : Mozilla Public License (MPL) Version 2
|
|
|
|
-- -------------------------------------------------------------------------- --
|
|
|
|
|
|
|
|
library IEEE;
|
|
|
|
use IEEE.std_logic_1164.all;
|
|
|
|
|
2024-07-06 19:14:39 +02:00
|
|
|
library generics;
|
|
|
|
use generics.ice40_components.all;
|
|
|
|
|
2024-06-12 20:03:04 +02:00
|
|
|
entity pll0 is
|
2024-07-06 19:14:39 +02:00
|
|
|
generic(
|
2024-08-09 13:43:35 +02:00
|
|
|
F_IN : in integer;
|
2024-07-06 19:14:39 +02:00
|
|
|
F_CLK : in integer;
|
|
|
|
F_CLK_PHY : in integer
|
|
|
|
);
|
2024-06-12 20:03:04 +02:00
|
|
|
port(
|
2024-07-06 19:14:39 +02:00
|
|
|
clk_in : in std_logic;
|
|
|
|
clk_out : out std_logic;
|
|
|
|
clk_out_phy : out std_logic;
|
|
|
|
locked : out std_logic
|
|
|
|
);
|
2024-06-12 20:03:04 +02:00
|
|
|
end pll0;
|
|
|
|
|
|
|
|
architecture Structure of pll0 is
|
2024-07-06 19:14:39 +02:00
|
|
|
signal clk_int_osc : std_logic;
|
2024-08-09 13:43:35 +02:00
|
|
|
signal clk_out_i : std_logic;
|
2024-06-12 20:03:04 +02:00
|
|
|
begin
|
2024-07-06 19:14:39 +02:00
|
|
|
-- Not clean, but it works...
|
|
|
|
ckdiv2 : process(clk_out_phy) is
|
|
|
|
begin
|
|
|
|
if rising_edge(clk_out_phy) then
|
2024-08-09 13:43:35 +02:00
|
|
|
clk_out_i <= not clk_out_i;
|
2024-07-06 19:14:39 +02:00
|
|
|
end if;
|
|
|
|
end process ckdiv2;
|
|
|
|
|
2024-08-09 13:43:35 +02:00
|
|
|
SB_GB_inst : component SB_GB
|
|
|
|
port map(
|
|
|
|
USER_SIGNAL_TO_GLOBAL_BUFFER => clk_out_i,
|
|
|
|
GLOBAL_BUFFER_OUTPUT => clk_out
|
|
|
|
);
|
|
|
|
|
|
|
|
assert F_IN = 50000000 report "clk_in: PLL expects clock different from specified." severity failure;
|
2024-07-06 19:14:39 +02:00
|
|
|
assert F_CLK = 25000000 report "clk: PLL generates clock different from specified." severity failure;
|
|
|
|
assert F_CLK_PHY = 50000000 report "clk_phy: PLL generates clock different from specified." severity failure;
|
2024-06-12 20:03:04 +02:00
|
|
|
end Structure;
|