terasic_de2_115: Cosmetic cleanup.

This commit is contained in:
Florent Kermarrec 2023-11-06 19:21:53 +01:00
parent d8228c2c0f
commit c7ad9adacb
2 changed files with 59 additions and 61 deletions

View file

@ -51,16 +51,14 @@ class _CRG(LiteXModule):
# BaseSoC ------------------------------------------------------------------------------------------ # BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCCore): class BaseSoC(SoCCore):
def __init__( def __init__(self, sys_clk_freq=50e6,
self, with_ethernet = False,
sys_clk_freq=50e6, with_etherbone = False,
with_ethernet=False, with_sdcard = False,
with_etherbone=False, with_led_chaser = True,
with_sdcard=False, ethernet_phy = 0,
with_led_chaser=True, etherbone_ip = "192.168.1.50",
ethernet_phy=0, etherbone_phy = 1,
etherbone_ip="192.168.1.50",
etherbone_phy=1,
**kwargs, **kwargs,
): ):
platform = terasic_de2_115.Platform() platform = terasic_de2_115.Platform()
@ -83,16 +81,16 @@ class BaseSoC(SoCCore):
# Add debug interface if the CPU has one --------------------------------------------------- # Add debug interface if the CPU has one ---------------------------------------------------
if hasattr(self.cpu, "debug_bus"): if hasattr(self.cpu, "debug_bus"):
self.register_mem( self.register_mem(
name="vexriscv_debug", name = "vexriscv_debug",
address=0xF00F0000, address = 0xF00F0000,
interface=self.cpu.debug_bus, interface = self.cpu.debug_bus,
size=0x100, size = 0x100,
) )
# Leds ------------------------------------------------------------------------------------- # Leds -------------------------------------------------------------------------------------
if with_led_chaser: if with_led_chaser:
self.leds = LedChaser( self.leds = LedChaser(
pads=platform.request_all("user_led"), sys_clk_freq=sys_clk_freq pads = platform.request_all("user_led"), sys_clk_freq=sys_clk_freq
) )
self.leds.add_pwm() self.leds.add_pwm()
@ -104,24 +102,24 @@ class BaseSoC(SoCCore):
if with_ethernet: if with_ethernet:
# Ethernet PHY # Ethernet PHY
self.submodules.ethphy = LiteEthPHYMII( self.submodules.ethphy = LiteEthPHYMII(
clock_pads=platform.request("eth_clocks", ethernet_phy), clock_pads = platform.request("eth_clocks", ethernet_phy),
pads=platform.request("eth", ethernet_phy), pads = platform.request("eth", ethernet_phy),
) )
self.add_ethernet( self.add_ethernet(
phy=self.ethphy, phy = self.ethphy,
phy_cd="ethphy_eth" if with_etherbone else "eth", phy_cd = "ethphy_eth" if with_etherbone else "eth",
dynamic_ip=True, dynamic_ip = True,
) )
if with_etherbone: if with_etherbone:
# Ethernet PHY # Ethernet PHY
self.submodules.ethbphy = LiteEthPHYMII( self.submodules.ethbphy = LiteEthPHYMII(
clock_pads=platform.request("eth_clocks", etherbone_phy), clock_pads = platform.request("eth_clocks", etherbone_phy),
pads=platform.request("eth", etherbone_phy), pads = platform.request("eth", etherbone_phy),
) )
self.add_etherbone( self.add_etherbone(
phy=self.ethbphy, phy = self.ethbphy,
phy_cd="ethbphy_eth" if with_ethernet else "eth", phy_cd = "ethbphy_eth" if with_ethernet else "eth",
ip_address=etherbone_ip, ip_address = etherbone_ip,
) )
# Build -------------------------------------------------------------------------------------------- # Build --------------------------------------------------------------------------------------------
@ -141,14 +139,14 @@ def main():
args = parser.parse_args() args = parser.parse_args()
soc = BaseSoC( soc = BaseSoC(
sys_clk_freq=args.sys_clk_freq, sys_clk_freq = args.sys_clk_freq,
with_sdcard=args.with_sdcard, with_sdcard = args.with_sdcard,
with_ethernet=args.with_ethernet, with_ethernet = args.with_ethernet,
with_etherbone=args.with_etherbone, with_etherbone = args.with_etherbone,
with_led_chaser=args.with_led_chaser, with_led_chaser = args.with_led_chaser,
etherbone_ip=args.etherbone_ip, etherbone_ip = args.etherbone_ip,
etherbone_phy=args.etherbone_phy, etherbone_phy = args.etherbone_phy,
ethernet_phy=args.ethernet_phy, ethernet_phy = args.ethernet_phy,
**parser.soc_argdict, **parser.soc_argdict,
) )