Merge pull request #367 from ggangliu/zynq_xc7z010
Add ALINX AX7010 board support
This commit is contained in:
commit
3aa1042f5f
|
@ -0,0 +1,104 @@
|
|||
#
|
||||
# This file is part of LiteX-Boards.
|
||||
#
|
||||
# Copyright (c) 2022 Yonggang Liu <ggang.liu@gmail.com>
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
|
||||
from litex.build.generic_platform import *
|
||||
from litex.build.xilinx import XilinxPlatform, VivadoProgrammer
|
||||
|
||||
#DDR3 SDRAM, QSPI, UART, IIC,
|
||||
# IOs ----------------------------------------------------------------------------------------------
|
||||
|
||||
_io = [
|
||||
# Clk / Rst
|
||||
("clk100", 0, Pins("U18"), IOStandard("LVCMOS33")),
|
||||
#("sys_clk", 0, Pins("V15"), IOStandard("LVCMOS33")),
|
||||
#("cpu_reset", 0, Pins("U18"), IOStandard("LVCMOS33")),
|
||||
|
||||
# Leds Done
|
||||
("user_led", 0, Pins("M14"), IOStandard("LVCMOS33")),
|
||||
("user_led", 1, Pins("M15"), IOStandard("LVCMOS33")),
|
||||
("user_led", 2, Pins("K16"), IOStandard("LVCMOS33")),
|
||||
("user_led", 3, Pins("J18"), IOStandard("LVCMOS33")),
|
||||
|
||||
# Buttons Done
|
||||
("user_btn", 0, Pins("N15"), IOStandard("LVCMOS33")),
|
||||
("user_btn", 1, Pins("N16"), IOStandard("LVCMOS33")),
|
||||
("user_btn", 2, Pins("R17"), IOStandard("LVCMOS33")),
|
||||
("user_btn", 3, Pins("T17"), IOStandard("LVCMOS33")),
|
||||
|
||||
# Serial Done
|
||||
("serial", 0,
|
||||
Subsignal("tx", Pins("W19"), IOStandard("LVCMOS33")),
|
||||
Subsignal("rx", Pins("W18"), IOStandard("LVCMOS33")),
|
||||
),
|
||||
]
|
||||
|
||||
_ps7_io = [
|
||||
# PS7
|
||||
("ps7_clk", 0, Pins("E7")),
|
||||
("ps7_porb", 0, Pins(1)),
|
||||
("ps7_srstb", 0, Pins(1)),
|
||||
("ps7_mio", 0, Pins(54)),
|
||||
("ps7_ddram", 0,
|
||||
Subsignal("addr", Pins(15)),
|
||||
Subsignal("ba", Pins(3)),
|
||||
Subsignal("cas_n", Pins(1)),
|
||||
Subsignal("ck_n", Pins(1)),
|
||||
Subsignal("ck_p", Pins(1)),
|
||||
Subsignal("cke", Pins(1)),
|
||||
Subsignal("cs_n", Pins(1)),
|
||||
Subsignal("dm", Pins(4)),
|
||||
Subsignal("dq", Pins(32)),
|
||||
Subsignal("dqs_n", Pins(4)),
|
||||
Subsignal("dqs_p", Pins(4)),
|
||||
Subsignal("odt", Pins(1)),
|
||||
Subsignal("ras_n", Pins(1)),
|
||||
Subsignal("reset_n", Pins(1)),
|
||||
Subsignal("we_n", Pins(1)),
|
||||
Subsignal("vrn", Pins(1)),
|
||||
Subsignal("vrp", Pins(1)),
|
||||
),
|
||||
]
|
||||
|
||||
# Connectors ---------------------------------------------------------------------------------------
|
||||
|
||||
_connectors = [
|
||||
("pmodb", "B12 B12 C12"),
|
||||
("pmodhdmi", "N18 P19 V20 W20 T20 U20 N20 P20 R18 R16 Y18 Y19 V16"),
|
||||
("pmodj10", "W19 W18 R14 P14 Y17 Y16 W15 V15 Y14 W14 P18 N17 U15 U14 P16 P15 U17 T16 V18 V17 T15 T14 V13 U13 W13 V12 U12 T12 T10 T11 A20 B19 B20 C20"),
|
||||
("pmodj11", "F17 F16 F20 F19 G20 G19 H18 J18 L20 L19 M20 M19 K18 K17 J19 K19 H20 J20 L17 L16 M18 M17 D20 D19 E19 E18 G18 G17 H17 H16 G15 H15 J14 K14"),
|
||||
]
|
||||
|
||||
# PMODS --------------------------------------------------------------------------------------------
|
||||
|
||||
_usb_uart_pmod_io = [
|
||||
# USB-UART PMOD on JB:
|
||||
# - https://store.digilentinc.com/pmod-usbuart-usb-to-uart-interface/
|
||||
("serial", 0,
|
||||
Subsignal("tx", Pins("pmodj10:0")),
|
||||
Subsignal("rx", Pins("pmodj10:1")),
|
||||
IOStandard("LVCMOS33")
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
|
||||
# Platform -----------------------------------------------------------------------------------------
|
||||
|
||||
class Platform(XilinxPlatform):
|
||||
default_clk_name = "clk100"
|
||||
default_clk_period = 1e9/100e6
|
||||
|
||||
def __init__(self):
|
||||
XilinxPlatform.__init__(self, "xc7z010clg400-1", _io, _connectors, toolchain="vivado")
|
||||
#self.add_extension(_ps7_io)
|
||||
#self.add_extension(_usb_uart_pmod_io)
|
||||
|
||||
def create_programmer(self):
|
||||
return VivadoProgrammer()
|
||||
|
||||
def do_finalize(self, fragment):
|
||||
XilinxPlatform.do_finalize(self, fragment)
|
||||
self.add_period_constraint(self.lookup_request("clk100", loose=True), 1e9/100e6)
|
|
@ -0,0 +1,85 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
#
|
||||
# This file is part of LiteX-Boards.
|
||||
#
|
||||
# Copyright (c) 2022 Yonggang Liu <ggang.liu@gmail.com>,
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
|
||||
import os
|
||||
import argparse
|
||||
|
||||
from migen import *
|
||||
|
||||
from litex_boards.platforms import zynq_xc7z010
|
||||
from litex.build.xilinx.vivado import vivado_build_args, vivado_build_argdict
|
||||
|
||||
from litex.soc.interconnect import axi
|
||||
from litex.soc.interconnect import wishbone
|
||||
|
||||
from litex.soc.cores.clock import *
|
||||
from litex.soc.integration.soc_core import *
|
||||
from litex.soc.integration.builder import *
|
||||
from litex.soc.cores.led import LedChaser
|
||||
|
||||
# CRG ----------------------------------------------------------------------------------------------
|
||||
|
||||
class _CRG(Module):
|
||||
def __init__(self, platform, sys_clk_freq):
|
||||
self.rst = Signal()
|
||||
self.clock_domains.cd_sys = ClockDomain()
|
||||
|
||||
self.submodules.pll = pll = S7PLL(speedgrade=-1)
|
||||
self.comb += pll.reset.eq(self.rst)# | platform.request("cpu_reset"))
|
||||
pll.register_clkin(platform.request("clk100"), 100e6)
|
||||
pll.create_clkout(self.cd_sys, sys_clk_freq)
|
||||
platform.add_false_path_constraints(self.cd_sys.clk, pll.clkin) # Ignore sys_clk to pll.clkin path created by SoC's rst.
|
||||
|
||||
# BaseSoC ------------------------------------------------------------------------------------------
|
||||
|
||||
class BaseSoC(SoCCore):
|
||||
def __init__(self, sys_clk_freq=int(100e6), with_led_chaser=True, **kwargs):
|
||||
platform = zynq_xc7z010.Platform()
|
||||
|
||||
#if kwargs["uart_name"] == "serial": kwargs["uart_name"] = "usb_uart" # Use USB-UART Pmod on JB.
|
||||
kwargs["uart_name"] = "serial"
|
||||
|
||||
# SoCCore ----------------------------------------------------------------------------------
|
||||
SoCCore.__init__(self, platform, sys_clk_freq,
|
||||
ident = "LiteX SoC on alinx ax7010",
|
||||
**kwargs)
|
||||
|
||||
# CRG --------------------------------------------------------------------------------------
|
||||
self.submodules.crg = _CRG(platform, sys_clk_freq)
|
||||
|
||||
# Leds -------------------------------------------------------------------------------------
|
||||
if with_led_chaser:
|
||||
self.submodules.leds = LedChaser(
|
||||
pads = platform.request_all("user_led"),
|
||||
sys_clk_freq = sys_clk_freq)
|
||||
|
||||
# Build --------------------------------------------------------------------------------------------
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="LiteX SoC on zynq xc7z010")
|
||||
parser.add_argument("--build", action="store_true", help="Build bitstream")
|
||||
parser.add_argument("--load", action="store_true", help="Load bitstream")
|
||||
parser.add_argument("--sys-clk-freq", default=100e6, help="System clock frequency (default: 100MHz)")
|
||||
builder_args(parser)
|
||||
soc_core_args(parser)
|
||||
vivado_build_args(parser)
|
||||
args = parser.parse_args()
|
||||
|
||||
soc = BaseSoC(
|
||||
sys_clk_freq = int(float(args.sys_clk_freq)),
|
||||
**soc_core_argdict(args)
|
||||
)
|
||||
builder = Builder(soc, **builder_argdict(args))
|
||||
builder.build(**vivado_build_argdict(args), run=args.build)
|
||||
|
||||
if args.load:
|
||||
prog = soc.platform.create_programmer()
|
||||
prog.load_bitstream(os.path.join(builder.gateware_dir, soc.build_name + ".bit"), device=1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Loading…
Reference in New Issue