2022-06-02 12:24:20 -04:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
#
|
|
|
|
# This file is part of LiteX-Boards.
|
|
|
|
#
|
|
|
|
# Copyright (c) 2022 Icenowy Zheng <icenowy@aosc.io>
|
2022-08-04 10:32:21 -04:00
|
|
|
# Copyright (c) 2022 Florent Kermarrec <florent@enjoy-digital.fr>
|
2022-06-02 12:24:20 -04:00
|
|
|
# SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
|
|
|
from migen import *
|
|
|
|
from migen.genlib.resetsync import AsyncResetSynchronizer
|
|
|
|
|
2023-02-23 03:09:33 -05:00
|
|
|
from litex.gen import *
|
2022-10-27 10:58:55 -04:00
|
|
|
|
2022-06-03 06:01:49 -04:00
|
|
|
from litex.soc.cores.clock.gowin_gw2a import GW2APLL
|
2022-06-02 12:24:20 -04:00
|
|
|
from litex.soc.integration.soc_core import *
|
|
|
|
from litex.soc.integration.soc import SoCRegion
|
|
|
|
from litex.soc.integration.builder import *
|
2022-08-04 10:32:21 -04:00
|
|
|
from litex.soc.cores.led import LedChaser, WS2812
|
|
|
|
from litex.soc.cores.gpio import GPIOIn
|
2022-07-26 06:25:10 -04:00
|
|
|
from litex.soc.cores.video import *
|
2022-06-02 12:24:20 -04:00
|
|
|
|
2022-07-26 06:53:42 -04:00
|
|
|
from liteeth.phy.rmii import LiteEthPHYRMII
|
|
|
|
|
2022-06-03 05:40:10 -04:00
|
|
|
from litex_boards.platforms import sipeed_tang_primer_20k
|
2022-06-02 12:24:20 -04:00
|
|
|
|
2022-09-07 06:06:22 -04:00
|
|
|
from litedram.common import PHYPadsReducer
|
sipeed_tang_primer_20k: Fix DDR3 module, SoC reset and remove DDR3 debug code.
Now passing memtest with valid reported memory size:
__ _ __ _ __
/ / (_) /____ | |/_/
/ /__/ / __/ -_)> <
/____/_/\__/\__/_/|_|
Build your hardware, easily!
(c) Copyright 2012-2023 Enjoy-Digital
(c) Copyright 2007-2015 M-Labs
BIOS CRC passed (d32a9529)
LiteX git sha1: 85dadb82
--=============== SoC ==================--
CPU: VexRiscv SMP-LINUX @ 48MHz
BUS: WISHBONE 32-bit @ 4GiB
CSR: 32-bit data
ROM: 64.0KiB
SRAM: 6.0KiB
L2: 512B
SDRAM: 128.0MiB 16-bit @ 192MT/s (CL-6 CWL-5)
MAIN-RAM: 128.0MiB
--========== Initialization ============--
Initializing SDRAM @0x40000000...
Switching SDRAM to software control.
Read leveling:
m0, b00: |00000000| delays: -
m0, b01: |00000000| delays: -
m0, b02: |01100000| delays: 01+-00
m0, b03: |00000000| delays: -
best: m0, b02 delays: 01+-00
m1, b00: |00000000| delays: -
m1, b01: |00000000| delays: -
m1, b02: |01100000| delays: 01+-00
m1, b03: |00000000| delays: -
best: m1, b02 delays: 01+-00
Switching SDRAM to hardware control.
Memtest at 0x40000000 (2.0MiB)...
Write: 0x40000000-0x40200000 2.0MiB
Read: 0x40000000-0x40200000 2.0MiB
Memtest OK
Memspeed at 0x40000000 (Sequential, 2.0MiB)...
Write speed: 11.7MiB/s
Read speed: 17.4MiB/s
2023-08-29 10:50:17 -04:00
|
|
|
from litedram.modules import MT41K64M16
|
2022-09-07 05:51:58 -04:00
|
|
|
from litedram.phy import GW2DDRPHY
|
2022-06-02 12:24:20 -04:00
|
|
|
|
|
|
|
# CRG ----------------------------------------------------------------------------------------------
|
|
|
|
|
2022-10-27 10:58:55 -04:00
|
|
|
class _CRG(LiteXModule):
|
2024-08-16 08:52:08 -04:00
|
|
|
def __init__(self, platform, sys_clk_freq, with_video_pll=False, with_dram=False):
|
2022-10-27 10:58:55 -04:00
|
|
|
self.rst = Signal()
|
|
|
|
self.cd_sys = ClockDomain()
|
|
|
|
self.cd_por = ClockDomain()
|
2024-08-16 08:52:08 -04:00
|
|
|
if with_dram:
|
|
|
|
self.cd_init = ClockDomain()
|
|
|
|
self.cd_sys2x = ClockDomain()
|
|
|
|
self.cd_sys2x_i = ClockDomain()
|
2022-06-02 12:24:20 -04:00
|
|
|
|
|
|
|
# # #
|
|
|
|
|
2022-09-07 05:51:58 -04:00
|
|
|
self.stop = Signal()
|
|
|
|
self.reset = Signal()
|
|
|
|
|
2022-06-02 12:24:20 -04:00
|
|
|
# Clk
|
|
|
|
clk27 = platform.request("clk27")
|
|
|
|
|
2022-09-08 11:27:41 -04:00
|
|
|
# Power on reset (the onboard POR is not aware of reprogramming)
|
|
|
|
por_count = Signal(16, reset=2**16-1)
|
|
|
|
por_done = Signal()
|
|
|
|
self.comb += self.cd_por.clk.eq(clk27)
|
|
|
|
self.comb += por_done.eq(por_count == 0)
|
|
|
|
self.sync.por += If(~por_done, por_count.eq(por_count - 1))
|
|
|
|
|
2022-06-02 12:24:20 -04:00
|
|
|
# PLL
|
2022-10-27 10:58:55 -04:00
|
|
|
self.pll = pll = GW2APLL(devicename=platform.devicename, device=platform.device)
|
sipeed_tang_primer_20k: Fix DDR3 module, SoC reset and remove DDR3 debug code.
Now passing memtest with valid reported memory size:
__ _ __ _ __
/ / (_) /____ | |/_/
/ /__/ / __/ -_)> <
/____/_/\__/\__/_/|_|
Build your hardware, easily!
(c) Copyright 2012-2023 Enjoy-Digital
(c) Copyright 2007-2015 M-Labs
BIOS CRC passed (d32a9529)
LiteX git sha1: 85dadb82
--=============== SoC ==================--
CPU: VexRiscv SMP-LINUX @ 48MHz
BUS: WISHBONE 32-bit @ 4GiB
CSR: 32-bit data
ROM: 64.0KiB
SRAM: 6.0KiB
L2: 512B
SDRAM: 128.0MiB 16-bit @ 192MT/s (CL-6 CWL-5)
MAIN-RAM: 128.0MiB
--========== Initialization ============--
Initializing SDRAM @0x40000000...
Switching SDRAM to software control.
Read leveling:
m0, b00: |00000000| delays: -
m0, b01: |00000000| delays: -
m0, b02: |01100000| delays: 01+-00
m0, b03: |00000000| delays: -
best: m0, b02 delays: 01+-00
m1, b00: |00000000| delays: -
m1, b01: |00000000| delays: -
m1, b02: |01100000| delays: 01+-00
m1, b03: |00000000| delays: -
best: m1, b02 delays: 01+-00
Switching SDRAM to hardware control.
Memtest at 0x40000000 (2.0MiB)...
Write: 0x40000000-0x40200000 2.0MiB
Read: 0x40000000-0x40200000 2.0MiB
Memtest OK
Memspeed at 0x40000000 (Sequential, 2.0MiB)...
Write speed: 11.7MiB/s
Read speed: 17.4MiB/s
2023-08-29 10:50:17 -04:00
|
|
|
self.comb += pll.reset.eq(~por_done)
|
2022-06-02 12:24:20 -04:00
|
|
|
pll.register_clkin(clk27, 27e6)
|
2024-08-16 08:52:08 -04:00
|
|
|
if with_dram:
|
|
|
|
# 2:1 clock needed for DDR
|
|
|
|
pll.create_clkout(self.cd_sys2x_i, 2*sys_clk_freq)
|
|
|
|
self.specials += [
|
|
|
|
Instance("DHCEN",
|
|
|
|
i_CLKIN = self.cd_sys2x_i.clk,
|
|
|
|
i_CE = self.stop,
|
|
|
|
o_CLKOUT = self.cd_sys2x.clk),
|
|
|
|
Instance("CLKDIV",
|
|
|
|
p_DIV_MODE = "2",
|
|
|
|
i_CALIB = 0,
|
|
|
|
i_HCLKIN = self.cd_sys2x.clk,
|
|
|
|
i_RESETN = ~self.reset,
|
|
|
|
o_CLKOUT = self.cd_sys.clk),
|
|
|
|
]
|
|
|
|
|
|
|
|
# Init clock domain
|
|
|
|
self.comb += self.cd_init.clk.eq(clk27)
|
|
|
|
self.comb += self.cd_init.rst.eq(pll.reset)
|
|
|
|
else:
|
|
|
|
pll.create_clkout(self.cd_sys, sys_clk_freq)
|
|
|
|
|
|
|
|
self.specials += AsyncResetSynchronizer(self.cd_sys, ~pll.locked | self.rst | self.reset)
|
2022-09-07 05:51:58 -04:00
|
|
|
|
2022-07-26 06:25:10 -04:00
|
|
|
# Video PLL
|
|
|
|
if with_video_pll:
|
2022-10-27 10:58:55 -04:00
|
|
|
self.video_pll = video_pll = GW2APLL(devicename=platform.devicename, device=platform.device)
|
2022-07-26 06:25:10 -04:00
|
|
|
video_pll.register_clkin(clk27, 27e6)
|
2022-10-27 10:58:55 -04:00
|
|
|
self.cd_hdmi = ClockDomain()
|
|
|
|
self.cd_hdmi5x = ClockDomain()
|
2022-09-07 04:56:17 -04:00
|
|
|
video_pll.create_clkout(self.cd_hdmi5x, 125e6, margin=1e-3)
|
2022-07-26 06:25:10 -04:00
|
|
|
self.specials += Instance("CLKDIV",
|
2022-09-07 04:56:17 -04:00
|
|
|
p_DIV_MODE = "5",
|
|
|
|
i_RESETN = 1, # Disable reset signal.
|
|
|
|
i_CALIB = 0, # No calibration.
|
|
|
|
i_HCLKIN = self.cd_hdmi5x.clk,
|
|
|
|
o_CLKOUT = self.cd_hdmi.clk
|
2022-07-26 06:25:10 -04:00
|
|
|
)
|
|
|
|
|
2022-06-02 12:24:20 -04:00
|
|
|
# BaseSoC ------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class BaseSoC(SoCCore):
|
2024-08-16 08:52:08 -04:00
|
|
|
def __init__(self, toolchain="gowin", sys_clk_freq=48e6,
|
2022-08-04 10:32:21 -04:00
|
|
|
with_spi_flash = False,
|
|
|
|
with_led_chaser = True,
|
|
|
|
with_rgb_led = False,
|
|
|
|
with_buttons = True,
|
2022-07-26 06:53:42 -04:00
|
|
|
with_video_terminal = False,
|
|
|
|
with_ethernet = False,
|
|
|
|
with_etherbone = False,
|
|
|
|
eth_ip = "192.168.1.50",
|
|
|
|
eth_dynamic_ip = False,
|
2022-09-07 04:56:17 -04:00
|
|
|
dock = "standard",
|
2022-07-26 06:53:42 -04:00
|
|
|
**kwargs):
|
2022-08-26 02:17:57 -04:00
|
|
|
|
2022-09-07 04:56:17 -04:00
|
|
|
assert dock in ["standard", "lite"]
|
2022-08-26 02:17:57 -04:00
|
|
|
|
2024-08-16 08:52:08 -04:00
|
|
|
platform = sipeed_tang_primer_20k.Platform(dock, toolchain=toolchain)
|
2022-08-26 02:17:57 -04:00
|
|
|
|
|
|
|
if dock == "lite":
|
2022-09-07 04:56:17 -04:00
|
|
|
with_led_chaser = False # No leds on core board nor on dock lite.
|
2022-06-02 12:24:20 -04:00
|
|
|
|
|
|
|
# CRG --------------------------------------------------------------------------------------
|
2024-08-16 08:52:08 -04:00
|
|
|
with_dram = (kwargs.get("integrated_main_ram_size", 0) == 0)
|
|
|
|
assert not (toolchain == "apicula" and with_dram)
|
|
|
|
self.crg = _CRG(platform, sys_clk_freq, with_video_pll=with_video_terminal, with_dram=with_dram)
|
2022-06-02 12:24:20 -04:00
|
|
|
|
|
|
|
# SoCCore ----------------------------------------------------------------------------------
|
2022-06-03 05:40:10 -04:00
|
|
|
SoCCore.__init__(self, platform, sys_clk_freq, ident="LiteX SoC on Tang Primer 20K", **kwargs)
|
2022-06-02 12:24:20 -04:00
|
|
|
|
2022-09-07 05:51:58 -04:00
|
|
|
# DDR3 SDRAM -------------------------------------------------------------------------------
|
2024-08-16 08:52:08 -04:00
|
|
|
if with_dram:
|
2022-10-27 10:58:55 -04:00
|
|
|
self.ddrphy = GW2DDRPHY(
|
sipeed_tang_primer_20k: Fix DDR3 module, SoC reset and remove DDR3 debug code.
Now passing memtest with valid reported memory size:
__ _ __ _ __
/ / (_) /____ | |/_/
/ /__/ / __/ -_)> <
/____/_/\__/\__/_/|_|
Build your hardware, easily!
(c) Copyright 2012-2023 Enjoy-Digital
(c) Copyright 2007-2015 M-Labs
BIOS CRC passed (d32a9529)
LiteX git sha1: 85dadb82
--=============== SoC ==================--
CPU: VexRiscv SMP-LINUX @ 48MHz
BUS: WISHBONE 32-bit @ 4GiB
CSR: 32-bit data
ROM: 64.0KiB
SRAM: 6.0KiB
L2: 512B
SDRAM: 128.0MiB 16-bit @ 192MT/s (CL-6 CWL-5)
MAIN-RAM: 128.0MiB
--========== Initialization ============--
Initializing SDRAM @0x40000000...
Switching SDRAM to software control.
Read leveling:
m0, b00: |00000000| delays: -
m0, b01: |00000000| delays: -
m0, b02: |01100000| delays: 01+-00
m0, b03: |00000000| delays: -
best: m0, b02 delays: 01+-00
m1, b00: |00000000| delays: -
m1, b01: |00000000| delays: -
m1, b02: |01100000| delays: 01+-00
m1, b03: |00000000| delays: -
best: m1, b02 delays: 01+-00
Switching SDRAM to hardware control.
Memtest at 0x40000000 (2.0MiB)...
Write: 0x40000000-0x40200000 2.0MiB
Read: 0x40000000-0x40200000 2.0MiB
Memtest OK
Memspeed at 0x40000000 (Sequential, 2.0MiB)...
Write speed: 11.7MiB/s
Read speed: 17.4MiB/s
2023-08-29 10:50:17 -04:00
|
|
|
pads = platform.request("ddram"),
|
2022-09-07 06:06:22 -04:00
|
|
|
sys_clk_freq = sys_clk_freq
|
|
|
|
)
|
2022-09-07 05:51:58 -04:00
|
|
|
self.ddrphy.settings.rtt_nom = "disabled"
|
|
|
|
self.comb += self.crg.stop.eq(self.ddrphy.init.stop)
|
|
|
|
self.comb += self.crg.reset.eq(self.ddrphy.init.reset)
|
|
|
|
self.add_sdram("sdram",
|
|
|
|
phy = self.ddrphy,
|
sipeed_tang_primer_20k: Fix DDR3 module, SoC reset and remove DDR3 debug code.
Now passing memtest with valid reported memory size:
__ _ __ _ __
/ / (_) /____ | |/_/
/ /__/ / __/ -_)> <
/____/_/\__/\__/_/|_|
Build your hardware, easily!
(c) Copyright 2012-2023 Enjoy-Digital
(c) Copyright 2007-2015 M-Labs
BIOS CRC passed (d32a9529)
LiteX git sha1: 85dadb82
--=============== SoC ==================--
CPU: VexRiscv SMP-LINUX @ 48MHz
BUS: WISHBONE 32-bit @ 4GiB
CSR: 32-bit data
ROM: 64.0KiB
SRAM: 6.0KiB
L2: 512B
SDRAM: 128.0MiB 16-bit @ 192MT/s (CL-6 CWL-5)
MAIN-RAM: 128.0MiB
--========== Initialization ============--
Initializing SDRAM @0x40000000...
Switching SDRAM to software control.
Read leveling:
m0, b00: |00000000| delays: -
m0, b01: |00000000| delays: -
m0, b02: |01100000| delays: 01+-00
m0, b03: |00000000| delays: -
best: m0, b02 delays: 01+-00
m1, b00: |00000000| delays: -
m1, b01: |00000000| delays: -
m1, b02: |01100000| delays: 01+-00
m1, b03: |00000000| delays: -
best: m1, b02 delays: 01+-00
Switching SDRAM to hardware control.
Memtest at 0x40000000 (2.0MiB)...
Write: 0x40000000-0x40200000 2.0MiB
Read: 0x40000000-0x40200000 2.0MiB
Memtest OK
Memspeed at 0x40000000 (Sequential, 2.0MiB)...
Write speed: 11.7MiB/s
Read speed: 17.4MiB/s
2023-08-29 10:50:17 -04:00
|
|
|
module = MT41K64M16(sys_clk_freq, "1:2"),
|
|
|
|
l2_cache_size = kwargs.get("l2_size", 8192)
|
2022-09-07 05:51:58 -04:00
|
|
|
)
|
|
|
|
|
2022-07-26 04:35:44 -04:00
|
|
|
# SPI Flash --------------------------------------------------------------------------------
|
|
|
|
if with_spi_flash:
|
|
|
|
from litespi.modules import W25Q32JV as SpiFlashModule
|
|
|
|
from litespi.opcodes import SpiNorFlashOpCodes as Codes
|
|
|
|
self.add_spi_flash(mode="1x", module=SpiFlashModule(Codes.READ_1_1_1))
|
|
|
|
|
2022-08-04 10:32:21 -04:00
|
|
|
# Ethernet / Etherbone ---------------------------------------------------------------------
|
|
|
|
if with_ethernet or with_etherbone:
|
|
|
|
from liteeth.phy.rmii import LiteEthPHYRMII
|
2022-10-27 10:58:55 -04:00
|
|
|
self.ethphy = LiteEthPHYRMII(
|
2022-08-04 10:32:21 -04:00
|
|
|
clock_pads = self.platform.request("eth_clocks"),
|
|
|
|
pads = self.platform.request("eth"),
|
|
|
|
refclk_cd = None
|
|
|
|
)
|
|
|
|
if with_ethernet:
|
|
|
|
self.add_ethernet(phy=self.ethphy, dynamic_ip=eth_dynamic_ip, with_timing_constraints=False)
|
|
|
|
if with_etherbone:
|
|
|
|
self.add_etherbone(phy=self.ethphy, ip_address=eth_ip, with_timing_constraints=False)
|
|
|
|
|
2022-07-26 06:25:10 -04:00
|
|
|
# Video ------------------------------------------------------------------------------------
|
|
|
|
if with_video_terminal:
|
2022-09-07 05:22:02 -04:00
|
|
|
hdmi_pads = platform.request("hdmi")
|
|
|
|
self.comb += hdmi_pads.hdp.eq(1)
|
2023-03-02 05:44:14 -05:00
|
|
|
self.videophy = VideoHDMIPHY(hdmi_pads, clock_domain="hdmi")
|
2023-03-02 05:36:38 -05:00
|
|
|
#self.add_video_colorbars(phy=self.videophy, timings="640x480@60Hz", clock_domain="hdmi")
|
|
|
|
self.add_video_terminal(phy=self.videophy, timings="640x480@75Hz", clock_domain="hdmi")
|
2022-07-26 06:25:10 -04:00
|
|
|
|
2022-07-26 05:44:03 -04:00
|
|
|
# Leds -------------------------------------------------------------------------------------
|
|
|
|
if with_led_chaser:
|
2022-10-27 10:58:55 -04:00
|
|
|
self.leds = LedChaser(
|
2022-08-04 10:32:21 -04:00
|
|
|
pads = platform.request_all("led"),
|
2022-07-26 05:44:03 -04:00
|
|
|
sys_clk_freq = sys_clk_freq
|
|
|
|
)
|
|
|
|
|
2022-08-04 10:32:21 -04:00
|
|
|
# RGB Led ----------------------------------------------------------------------------------
|
|
|
|
if with_rgb_led:
|
2022-10-27 10:58:55 -04:00
|
|
|
self.rgb_led = WS2812(
|
2022-08-04 10:32:21 -04:00
|
|
|
pad = platform.request("rgb_led"),
|
|
|
|
nleds = 1,
|
|
|
|
sys_clk_freq = sys_clk_freq
|
2022-07-26 06:53:42 -04:00
|
|
|
)
|
2022-08-04 10:32:21 -04:00
|
|
|
self.bus.add_slave(name="rgb_led", slave=self.rgb_led.bus, region=SoCRegion(
|
|
|
|
origin = 0x2000_0000,
|
|
|
|
size = 4,
|
|
|
|
))
|
|
|
|
|
|
|
|
# Buttons ----------------------------------------------------------------------------------
|
|
|
|
if with_buttons:
|
2022-10-27 10:58:55 -04:00
|
|
|
self.buttons = GPIOIn(pads=~platform.request_all("btn_n"))
|
2022-08-04 10:32:21 -04:00
|
|
|
|
2022-07-26 06:53:42 -04:00
|
|
|
|
2022-06-02 12:24:20 -04:00
|
|
|
# Build --------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
def main():
|
2022-11-06 15:39:52 -05:00
|
|
|
from litex.build.parser import LiteXArgumentParser
|
2022-11-08 04:41:35 -05:00
|
|
|
parser = LiteXArgumentParser(platform=sipeed_tang_primer_20k.Platform, description="LiteX SoC on Tang Primer 20K.")
|
|
|
|
parser.add_target_argument("--dock", default="standard", help="Dock version (standard (default) or lite.")
|
|
|
|
parser.add_target_argument("--flash", action="store_true", help="Flash Bitstream.")
|
|
|
|
parser.add_target_argument("--sys-clk-freq", default=48e6, type=float, help="System clock frequency.")
|
2022-11-05 03:07:14 -04:00
|
|
|
sdopts = parser.target_group.add_mutually_exclusive_group()
|
2022-11-08 04:41:35 -05:00
|
|
|
sdopts.add_argument("--with-spi-sdcard", action="store_true", help="Enable SPI-mode SDCard support.")
|
|
|
|
sdopts.add_argument("--with-sdcard", action="store_true", help="Enable SDCard support.")
|
|
|
|
parser.add_target_argument("--with-spi-flash", action="store_true", help="Enable SPI Flash (MMAPed).")
|
2022-11-05 03:07:14 -04:00
|
|
|
parser.add_target_argument("--with-video-terminal", action="store_true", help="Enable Video Terminal (HDMI).")
|
|
|
|
ethopts = parser.target_group.add_mutually_exclusive_group()
|
2022-11-08 04:41:35 -05:00
|
|
|
ethopts.add_argument("--with-ethernet", action="store_true", help="Add Ethernet.")
|
|
|
|
ethopts.add_argument("--with-etherbone", action="store_true", help="Add EtherBone.")
|
2022-11-05 03:07:14 -04:00
|
|
|
parser.add_target_argument("--eth-ip", default="192.168.1.50", help="Etherbone IP address.")
|
|
|
|
parser.add_target_argument("--eth-dynamic-ip", action="store_true", help="Enable dynamic Ethernet IP addresses setting.")
|
2022-06-02 12:24:20 -04:00
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
soc = BaseSoC(
|
2024-08-16 08:52:08 -04:00
|
|
|
toolchain = args.toolchain,
|
2022-11-08 04:41:35 -05:00
|
|
|
sys_clk_freq = args.sys_clk_freq,
|
2022-07-26 06:25:10 -04:00
|
|
|
with_spi_flash = args.with_spi_flash,
|
|
|
|
with_video_terminal = args.with_video_terminal,
|
2022-07-26 06:53:42 -04:00
|
|
|
with_ethernet = args.with_ethernet,
|
|
|
|
with_etherbone = args.with_etherbone,
|
|
|
|
eth_ip = args.eth_ip,
|
|
|
|
eth_dynamic_ip = args.eth_dynamic_ip,
|
2022-08-26 02:17:57 -04:00
|
|
|
dock = args.dock,
|
2022-11-07 02:43:26 -05:00
|
|
|
**parser.soc_argdict
|
2022-06-02 12:24:20 -04:00
|
|
|
)
|
2022-07-26 04:27:19 -04:00
|
|
|
if args.with_spi_sdcard:
|
|
|
|
soc.add_spi_sdcard()
|
|
|
|
if args.with_sdcard:
|
|
|
|
soc.add_sdcard()
|
2022-06-02 12:24:20 -04:00
|
|
|
|
2022-11-05 03:07:14 -04:00
|
|
|
builder = Builder(soc, **parser.builder_argdict)
|
2022-06-29 04:00:47 -04:00
|
|
|
if args.build:
|
2022-11-05 03:07:14 -04:00
|
|
|
builder.build(**parser.toolchain_argdict)
|
2022-06-02 12:24:20 -04:00
|
|
|
|
|
|
|
if args.load:
|
|
|
|
prog = soc.platform.create_programmer()
|
|
|
|
prog.load_bitstream(builder.get_bitstream_filename(mode="sram"))
|
|
|
|
|
|
|
|
if args.flash:
|
|
|
|
prog = soc.platform.create_programmer()
|
|
|
|
prog.flash(0, builder.get_bitstream_filename(mode="flash", ext=".fs"), external=True)
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|