Skip to content

Commit 6da9298

Browse files
committed
altera_agilex5e_065b_premium_devkit: Add Agilex 5 HPS (agilex_hps) CPU support.
Allow building with --cpu-type=agilex_hps: the Agilex 5 HPS becomes the SoC's CPU through the H2F LW bridge (CSRs at 0x2000_0000), the LiteX UART is disabled (console is on HPS UART0 under U-Boot/Linux) and no fabric SRAM/main-RAM is integrated. The HPS DDR (LPDDR4) is wired through an HPS-EMIF on the board's lpddr4 pins via cpu.add_emif(); --with-h2f-bridge exposes the LiteX bus to the ARM at 0x8000_0000. HPS DDR linker regions (BIOS-in-DDR) are left commented as they require an aarch64-none-elf-gcc toolchain; LiteX CSRs are otherwise reachable from HPS Linux via devmem / litex_server --devmem.
1 parent 5c22d4a commit 6da9298

1 file changed

Lines changed: 30 additions & 2 deletions

File tree

litex_boards/targets/altera_agilex5e_065b_premium_devkit.py

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from litex_boards.platforms import altera_agilex5e_065b_premium_devkit
1818

1919
from litex.soc.integration.soc import *
20-
from litex.soc.integration.soc import *
20+
from litex.soc.integration.soc import SoCRegion
2121
from litex.soc.integration.builder import *
2222

2323
from litex.soc.cores.clock import Agilex5PLL
@@ -84,8 +84,17 @@ def __init__(self, sys_clk_freq=100e6,
8484
with_sdcard = False,
8585
with_spi_sdcard = False,
8686
with_led_chaser = True,
87+
with_h2f_bridge = False,
8788
**kwargs):
88-
kwargs.setdefault("integrated_main_ram_size", 64*KILOBYTE)
89+
with_hps = (kwargs.get("cpu_type", None) == "agilex_hps")
90+
if with_hps:
91+
# The Agilex 5 HPS is the SoC's CPU: no fabric main RAM/SRAM, console on HPS UART0.
92+
kwargs["cpu_variant"] = kwargs.get("cpu_variant") or "agilex5"
93+
kwargs["with_uart"] = False
94+
kwargs["integrated_sram_size"] = 0
95+
kwargs["integrated_main_ram_size"] = 0
96+
else:
97+
kwargs.setdefault("integrated_main_ram_size", 64*KILOBYTE)
8998

9099
platform = altera_agilex5e_065b_premium_devkit.Platform(variant=variant)
91100
with_eth = with_ethernet or with_etherbone
@@ -98,6 +107,22 @@ def __init__(self, sys_clk_freq=100e6,
98107
ident = "LiteX SoC on Altera Agilex 5E 065B Premium Development Kit",
99108
**kwargs)
100109

110+
# Agilex 5 HPS Integration -----------------------------------------------------------------
111+
if with_hps:
112+
# HPS-EMIF (LPDDR4, pins located by the platform, IO owned by the EMIF IP).
113+
self.cpu.add_emif(
114+
pads = platform.request("lpddr4"),
115+
refclk_pads = platform.request("lpddr_refclk"),
116+
)
117+
# HPS DDR linker regions are intentionally NOT added here: they would trigger BIOS
118+
# compilation, which needs aarch64-none-elf-gcc. To run a LiteX BIOS from HPS DDR,
119+
# install the toolchain and uncomment:
120+
# self.bus.add_region("sram", SoCRegion(origin=self.cpu.mem_map["sram"], size=15*MEGABYTE))
121+
# self.bus.add_region("rom", SoCRegion(origin=self.cpu.mem_map["rom"], size=8*MEGABYTE, linker=True))
122+
# H2F Bridge (LiteX bus visible to the ARM at mem_map["main_ram"], 0x8000_0000).
123+
if with_h2f_bridge:
124+
self.bus.add_master(name="h2f", master=self.cpu.add_axi_h2f_master())
125+
101126
# SDCard -----------------------------------------------------------------------------------
102127
if with_sdcard or with_spi_sdcard:
103128
platform.add_extension(altera_agilex5e_065b_premium_devkit._sdcard_io)
@@ -161,6 +186,8 @@ def main():
161186
sdopts.add_argument("--with-sdcard", action="store_true", help="Enable SDCard support on J9 adapter.")
162187
sdopts.add_argument("--with-spi-sdcard", action="store_true", help="Enable SPI-mode SDCard support on J9 adapter.")
163188

189+
parser.add_target_argument("--with-h2f-bridge", action="store_true", help="Enable H2F bridge (with agilex_hps CPU).")
190+
164191
# Overrides defaults synth/conv tools.
165192
parser.set_defaults(synth_tool="quartus_syn")
166193
parser.set_defaults(conv_tool="quartus_pfg")
@@ -178,6 +205,7 @@ def main():
178205
eth_dynamic_ip = args.eth_dynamic_ip,
179206
with_sdcard = args.with_sdcard,
180207
with_spi_sdcard = args.with_spi_sdcard,
208+
with_h2f_bridge = args.with_h2f_bridge,
181209
**parser.soc_argdict)
182210

183211
builder = Builder(soc, **parser.builder_argdict)

0 commit comments

Comments
 (0)