Skip to content

Commit

Permalink
xilinx_zc706: Add PCIe Gen2 X4 support (Untested on hardware).
Browse files Browse the repository at this point in the history
  • Loading branch information
enjoy-digital committed Mar 26, 2024
1 parent fdd4edb commit a29532b
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions litex_boards/targets/xilinx_zc706.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
from litex.soc.integration.builder import *
from litex.soc.cores.led import LedChaser

from litepcie.phy.s7pciephy import S7PCIEPHY
from litepcie.software import generate_litepcie_software

# CRG ----------------------------------------------------------------------------------------------

class _CRG(LiteXModule):
Expand All @@ -52,7 +55,7 @@ def __init__(self, platform, sys_clk_freq):
# BaseSoC ------------------------------------------------------------------------------------------

class BaseSoC(SoCCore):
def __init__(self, sys_clk_freq=100e6, with_led_chaser=True, **kwargs):
def __init__(self, sys_clk_freq=100e6, with_led_chaser=True, with_pcie=False, **kwargs):
platform = xilinx_zc706.Platform()
kwargs["uart_name"] = "crossover"
kwargs["with_jtagbone"] = True
Expand All @@ -63,6 +66,13 @@ def __init__(self, sys_clk_freq=100e6, with_led_chaser=True, **kwargs):
# SoCCore ----------------------------------------------------------------------------------
SoCCore.__init__(self, platform, sys_clk_freq, ident="LiteX SoC on ZCU706", **kwargs)

# PCIe -------------------------------------------------------------------------------------
if with_pcie:
self.pcie_phy = S7PCIEPHY(platform, platform.request("pcie_x4"),
data_width = 128,
bar0_size = 0x20000)
self.add_pcie(phy=self.pcie_phy, ndmas=1)

# Leds -------------------------------------------------------------------------------------
if with_led_chaser:
self.leds = LedChaser(
Expand All @@ -75,9 +85,15 @@ def main():
from litex.build.parser import LiteXArgumentParser
parser = LiteXArgumentParser(platform=xilinx_zc706.Platform, description="LiteX SoC on ZC706.")
parser.add_target_argument("--sys-clk-freq", default=100e6, type=float, help="System clock frequency.")
parser.add_target_argument("--with-pcie", action="store_true", help="Enable PCIe support.")
parser.add_target_argument("--driver", action="store_true", help="Generate PCIe driver.")
args = parser.parse_args()

soc = BaseSoC(sys_clk_freq=args.sys_clk_freq, **parser.soc_argdict)
soc = BaseSoC(
sys_clk_freq = args.sys_clk_freq,
with_pcie = args.with_pcie,
**parser.soc_argdict
)
builder = Builder(soc, **parser.builder_argdict)
if args.build:
builder.build(**parser.toolchain_argdict)
Expand Down

0 comments on commit a29532b

Please sign in to comment.