Skip to content

Commit

Permalink
phy/a7_gtp: Allow using GTGREFCLK0/1 input as reference clocks.
Browse files Browse the repository at this point in the history
Useful when reference clock is generated from a PLL or MMCM.
  • Loading branch information
enjoy-digital committed Apr 4, 2024
1 parent c1dc020 commit 3c1f4db
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions liteeth/phy/a7_gtp.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ def __init__(self, index):


class QPLL(Module):
def __init__(self, gtrefclk0, qpllsettings0, gtrefclk1=0, qpllsettings1=None):
def __init__(self,
gtrefclk0=0, qpllsettings0=None, gtgrefclk0=0,
gtrefclk1=0, qpllsettings1=None, gtgrefclk1=1):
self.channels = []

channel_settings = dict()
Expand All @@ -52,17 +54,18 @@ def add_setting(k, v):
add_setting("o_PLLXOUTCLK", channel.clk)
add_setting("o_PLLXOUTREFCLK", channel.refclk)

self.specials += \
Instance("GTPE2_COMMON",
i_GTREFCLK0 = gtrefclk0,
i_GTREFCLK1 = gtrefclk1,
i_BGBYPASSB = 1,
i_BGMONITORENB = 1,
i_BGPDB = 1,
i_BGRCALOVRD = 0b11111,
i_RCALENB = 1,
**channel_settings
)
self.specials += Instance("GTPE2_COMMON",
i_GTREFCLK0 = gtrefclk0,
i_GTREFCLK1 = gtrefclk1,
i_GTGREFCLK0 = gtgrefclk0,
i_GTGREFCLK1 = gtgrefclk1,
i_BGBYPASSB = 1,
i_BGMONITORENB = 1,
i_BGPDB = 1,
i_BGRCALOVRD = 0b11111,
i_RCALENB = 1,
**channel_settings
)


class GTPTxInit(Module):
Expand Down

0 comments on commit 3c1f4db

Please sign in to comment.