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