Skip to content

Commit

Permalink
bench/nexys_video: add --pll-reclk argument to test with RefClk from …
Browse files Browse the repository at this point in the history
…PLL.
  • Loading branch information
enjoy-digital committed Nov 3, 2020
1 parent b7f1bcf commit 1b64eda
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions bench/nexys_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
# SATATestSoC --------------------------------------------------------------------------------------

class SATATestSoC(SoCMini):
def __init__(self, platform, gen="gen2", with_analyzer=False):
def __init__(self, platform, gen="gen2", with_pll_refclk=True, with_analyzer=False):
assert gen in ["gen1", "gen2"]
sys_clk_freq = int(100e6)
sata_clk_freq = {"gen1": 75e6, "gen2": 150e6}[gen]
Expand All @@ -60,8 +60,15 @@ def __init__(self, platform, gen="gen2", with_analyzer=False):
uart_name = "bridge")

# SATA -------------------------------------------------------------------------------------
if with_pll_refclk:
# RefClk, Generate 150MHz from PLL.
self.clock_domains.cd_sata_refclk = ClockDomain()
self.crg.pll.create_clkout(self.cd_sata_refclk, 150e6)
platform.add_platform_command("set_property SEVERITY {{Warning}} [get_drc_checks REQP-49]")

# PHY
self.submodules.sata_phy = LiteSATAPHY(platform.device,
refclk = None if not with_pll_refclk else self.cd_sata_refclk.clk,
pads = platform.request("fmc2sata"),
gen = gen,
clk_freq = sys_clk_freq,
Expand Down Expand Up @@ -133,12 +140,13 @@ def main():
parser.add_argument("--build", action="store_true", help="Build bitstream")
parser.add_argument("--load", action="store_true", help="Load bitstream (to SRAM)")
parser.add_argument("--gen", default="2", help="SATA Gen: 1 or 2 (default)")
parser.add_argument("--pll-refclk", action="store_true", help="Generate RefClk from PLL")
parser.add_argument("--with-analyzer", action="store_true", help="Add LiteScope Analyzer")
args = parser.parse_args()

platform = nexys_video.Platform()
platform.add_extension(_sata_io)
soc = SATATestSoC(platform, "gen" + args.gen, with_analyzer=args.with_analyzer)
soc = SATATestSoC(platform, "gen" + args.gen, with_pll_refclk=args.pll_refclk, with_analyzer=args.with_analyzer)
builder = Builder(soc, csr_csv="csr.csv")
builder.build(run=args.build)

Expand Down

0 comments on commit 1b64eda

Please sign in to comment.