mirror of
https://github.com/saymrwulf/litex-boards.git
synced 2026-11-18 09:41:45 +00:00
antmicro_datacenter: add HDMI output
Signed-off-by: Alessandro Comodi <acomodi@antmicro.com>
This commit is contained in:
parent
c081177d77
commit
77cb866233
2 changed files with 76 additions and 38 deletions
|
|
@ -98,13 +98,12 @@ _io = [
|
||||||
|
|
||||||
# HyperRAM
|
# HyperRAM
|
||||||
("hyperram", 0,
|
("hyperram", 0,
|
||||||
Subsignal("clk_n", Pins("AE26")),
|
Subsignal("clk_n", Pins("AE26"), IOStandard("TMDS_33")),
|
||||||
Subsignal("clk_p", Pins("AD26")),
|
Subsignal("clk_p", Pins("AD26"), IOStandard("TMDS_33")),
|
||||||
Subsignal("rst_n", Pins("AC24")),
|
Subsignal("rst_n", Pins("AC24"), IOStandard("LVCMOS33")),
|
||||||
Subsignal("cs_n", Pins("AC26")),
|
Subsignal("cs_n", Pins("AC26"), IOStandard("LVCMOS33")),
|
||||||
Subsignal("dq", Pins("AE23 AD25 AF24 AE22 AF23 AF25 AE25 AD24")),
|
Subsignal("dq", Pins("AE23 AD25 AF24 AE22 AF23 AF25 AE25 AD24"), IOStandard("LVCMOS33")),
|
||||||
Subsignal("rwds", Pins("AD23")),
|
Subsignal("rwds", Pins("AD23"), IOStandard("LVCMOS33")),
|
||||||
IOStandard("LVCMOS33")
|
|
||||||
),
|
),
|
||||||
|
|
||||||
# SD Card
|
# SD Card
|
||||||
|
|
@ -123,6 +122,18 @@ _io = [
|
||||||
Subsignal("sda", Pins("Y6")),
|
Subsignal("sda", Pins("Y6")),
|
||||||
IOStandard("SSTL12_T_DCI"),
|
IOStandard("SSTL12_T_DCI"),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
# HDMI Out
|
||||||
|
("hdmi_out", 0,
|
||||||
|
Subsignal("clk_p", Pins("B15"), IOStandard("TMDS_33")),
|
||||||
|
Subsignal("clk_n", Pins("A15"), IOStandard("TMDS_33")),
|
||||||
|
Subsignal("data0_p", Pins("B14"), IOStandard("TMDS_33")),
|
||||||
|
Subsignal("data0_n", Pins("A14"), IOStandard("TMDS_33")),
|
||||||
|
Subsignal("data1_p", Pins("A13"), IOStandard("TMDS_33")),
|
||||||
|
Subsignal("data1_n", Pins("A12"), IOStandard("TMDS_33")),
|
||||||
|
Subsignal("data2_p", Pins("B10"), IOStandard("TMDS_33")),
|
||||||
|
Subsignal("data2_n", Pins("A10"), IOStandard("TMDS_33")),
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
# Platform -----------------------------------------------------------------------------------------
|
# Platform -----------------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ from litex.soc.integration.soc import SoCRegion
|
||||||
from litex.soc.integration.builder import *
|
from litex.soc.integration.builder import *
|
||||||
from litex.soc.cores.led import LedChaser
|
from litex.soc.cores.led import LedChaser
|
||||||
from litex.soc.cores.bitbang import I2CMaster
|
from litex.soc.cores.bitbang import I2CMaster
|
||||||
|
from litex.soc.cores.video import VideoS7HDMIPHY
|
||||||
|
|
||||||
from litedram.modules import MTA18ASF2G72PZ
|
from litedram.modules import MTA18ASF2G72PZ
|
||||||
from litedram.phy.s7ddrphy import A7DDRPHY
|
from litedram.phy.s7ddrphy import A7DDRPHY
|
||||||
|
|
@ -33,17 +34,23 @@ from litex.soc.cores.hyperbus import HyperRAM
|
||||||
# CRG ----------------------------------------------------------------------------------------------
|
# CRG ----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
class _CRG(Module):
|
class _CRG(Module):
|
||||||
def __init__(self, platform, sys_clk_freq, iodelay_clk_freq):
|
def __init__(self, platform, sys_clk_freq, iodelay_clk_freq, with_video_pll=False):
|
||||||
self.clock_domains.cd_sys = ClockDomain()
|
self.clock_domains.cd_sys = ClockDomain()
|
||||||
self.clock_domains.cd_sys2x = ClockDomain(reset_less=True)
|
self.clock_domains.cd_sys2x = ClockDomain(reset_less=True)
|
||||||
self.clock_domains.cd_sys4x = ClockDomain(reset_less=True)
|
self.clock_domains.cd_sys4x = ClockDomain(reset_less=True)
|
||||||
self.clock_domains.cd_sys4x_dqs = ClockDomain(reset_less=True)
|
self.clock_domains.cd_sys4x_dqs = ClockDomain(reset_less=True)
|
||||||
self.clock_domains.cd_idelay = ClockDomain()
|
self.clock_domains.cd_idelay = ClockDomain()
|
||||||
|
|
||||||
|
self.clock_domains.cd_hdmi = ClockDomain()
|
||||||
|
self.clock_domains.cd_hdmi5x = ClockDomain()
|
||||||
|
|
||||||
# # #
|
# # #
|
||||||
|
|
||||||
|
# Clk.
|
||||||
|
clk100 = platform.request("clk100")
|
||||||
|
|
||||||
self.submodules.pll = pll = S7PLL(speedgrade=-1)
|
self.submodules.pll = pll = S7PLL(speedgrade=-1)
|
||||||
pll.register_clkin(platform.request("clk100"), 100e6)
|
pll.register_clkin(clk100, 100e6)
|
||||||
pll.create_clkout(self.cd_sys, sys_clk_freq)
|
pll.create_clkout(self.cd_sys, sys_clk_freq)
|
||||||
pll.create_clkout(self.cd_sys2x, 2 * sys_clk_freq)
|
pll.create_clkout(self.cd_sys2x, 2 * sys_clk_freq)
|
||||||
pll.create_clkout(self.cd_sys4x, 4 * sys_clk_freq)
|
pll.create_clkout(self.cd_sys4x, 4 * sys_clk_freq)
|
||||||
|
|
@ -52,13 +59,21 @@ class _CRG(Module):
|
||||||
|
|
||||||
self.submodules.idelayctrl = S7IDELAYCTRL(self.cd_idelay)
|
self.submodules.idelayctrl = S7IDELAYCTRL(self.cd_idelay)
|
||||||
|
|
||||||
|
# Video PLL.
|
||||||
|
if with_video_pll:
|
||||||
|
self.submodules.video_pll = video_pll = S7MMCM(speedgrade=-1)
|
||||||
|
video_pll.register_clkin(clk100, 100e6)
|
||||||
|
video_pll.create_clkout(self.cd_hdmi, 40e6)
|
||||||
|
video_pll.create_clkout(self.cd_hdmi5x, 5*40e6)
|
||||||
|
|
||||||
|
|
||||||
# BaseSoC ------------------------------------------------------------------------------------------
|
# BaseSoC ------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
class BaseSoC(SoCCore):
|
class BaseSoC(SoCCore):
|
||||||
def __init__(self, *, sys_clk_freq=int(100e6), iodelay_clk_freq=200e6,
|
def __init__(self, *, sys_clk_freq=int(100e6), iodelay_clk_freq=200e6,
|
||||||
with_ethernet=False, with_etherbone=False, eth_ip="192.168.1.50", eth_dynamic_ip=False,
|
with_ethernet=False, with_etherbone=False, eth_ip="192.168.1.50", eth_dynamic_ip=False,
|
||||||
with_hyperram=False, with_sdcard=False, with_jtagbone=True, with_uartbone=False,
|
with_hyperram=False, with_sdcard=False, with_jtagbone=True, with_uartbone=False,
|
||||||
with_led_chaser=True, eth_reset_time, **kwargs):
|
with_led_chaser=True, with_video_terminal=False, with_video_framebuffer=False, **kwargs):
|
||||||
platform = datacenter_ddr4_test_board.Platform()
|
platform = datacenter_ddr4_test_board.Platform()
|
||||||
|
|
||||||
# SoCCore ----------------------------------------------------------------------------------
|
# SoCCore ----------------------------------------------------------------------------------
|
||||||
|
|
@ -67,7 +82,8 @@ class BaseSoC(SoCCore):
|
||||||
**kwargs)
|
**kwargs)
|
||||||
|
|
||||||
# CRG --------------------------------------------------------------------------------------
|
# CRG --------------------------------------------------------------------------------------
|
||||||
self.submodules.crg = _CRG(platform, sys_clk_freq, iodelay_clk_freq=iodelay_clk_freq)
|
with_video_pll = (with_video_terminal or with_video_framebuffer)
|
||||||
|
self.submodules.crg = _CRG(platform, sys_clk_freq, iodelay_clk_freq=iodelay_clk_freq, with_video_pll=with_video_pll)
|
||||||
|
|
||||||
# DDR4 SDRAM RDIMM -------------------------------------------------------------------------
|
# DDR4 SDRAM RDIMM -------------------------------------------------------------------------
|
||||||
if not self.integrated_main_ram_size:
|
if not self.integrated_main_ram_size:
|
||||||
|
|
@ -120,6 +136,14 @@ class BaseSoC(SoCCore):
|
||||||
pads = platform.request_all("user_led"),
|
pads = platform.request_all("user_led"),
|
||||||
sys_clk_freq = sys_clk_freq)
|
sys_clk_freq = sys_clk_freq)
|
||||||
|
|
||||||
|
# Video ------------------------------------------------------------------------------------
|
||||||
|
if with_video_terminal or with_video_framebuffer:
|
||||||
|
self.submodules.videophy = VideoS7HDMIPHY(platform.request("hdmi_out"), clock_domain="hdmi")
|
||||||
|
if with_video_terminal:
|
||||||
|
self.add_video_terminal(phy=self.videophy, timings="800x600@60Hz", clock_domain="hdmi")
|
||||||
|
if with_video_framebuffer:
|
||||||
|
self.add_video_framebuffer(phy=self.videophy, timings="800x600@60Hz", clock_domain="hdmi")
|
||||||
|
|
||||||
# System I2C (behing multiplexer) ----------------------------------------------------------
|
# System I2C (behing multiplexer) ----------------------------------------------------------
|
||||||
i2c_pads = platform.request('i2c')
|
i2c_pads = platform.request('i2c')
|
||||||
self.submodules.i2c = I2CMaster(i2c_pads)
|
self.submodules.i2c = I2CMaster(i2c_pads)
|
||||||
|
|
@ -149,23 +173,25 @@ class LiteDRAMSettingsEncoder(json.JSONEncoder):
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
from litex.soc.integration.soc import LiteXSoCArgumentParser
|
from litex.soc.integration.soc import LiteXSoCArgumentParser
|
||||||
parser = LiteXSoCArgumentParser(description="LiteX SoC on LPDDR4 Test Board")
|
parser = LiteXSoCArgumentParser(description="LiteX SoC on DDR4 Datacenter Test Board")
|
||||||
target_group = parser.add_argument_group(title="Target options")
|
target_group = parser.add_argument_group(title="Target options")
|
||||||
target_group.add_argument("--build", action="store_true", help="Build bitstream.")
|
target_group.add_argument("--build", action="store_true", help="Build bitstream")
|
||||||
target_group.add_argument("--load", action="store_true", help="Load bitstream.")
|
target_group.add_argument("--load", action="store_true", help="Load bitstream")
|
||||||
target_group.add_argument("--flash", action="store_true", help="Flash bitstream.")
|
target_group.add_argument("--flash", action="store_true", help="Flash bitstream")
|
||||||
target_group.add_argument("--sys-clk-freq", default=100e6, help="System clock frequency.")
|
target_group.add_argument("--sys-clk-freq", default=100e6, help="System clock frequency")
|
||||||
target_group.add_argument("--iodelay-clk-freq", default=200e6, help="IODELAYCTRL frequency.")
|
target_group.add_argument("--iodelay-clk-freq", default=200e6, help="IODELAYCTRL frequency")
|
||||||
ethopts = target_group.add_mutually_exclusive_group()
|
ethopts = target.add_mutually_exclusive_group()
|
||||||
ethopts.add_argument("--with-ethernet", action="store_true", help="Add Ethernet.")
|
ethopts.add_argument("--with-ethernet", action="store_true", help="Add Ethernet")
|
||||||
ethopts.add_argument("--with-etherbone", action="store_true", help="Add EtherBone.")
|
ethopts.add_argument("--with-etherbone", action="store_true", help="Add EtherBone")
|
||||||
target_group.add_argument("--eth-ip", default="192.168.1.50", help="Ethernet/Etherbone IP address.")
|
target_group.add_argument("--eth-ip", default="192.168.1.50", help="Ethernet/Etherbone IP address")
|
||||||
target_group.add_argument("--eth-dynamic-ip", action="store_true", help="Enable dynamic Ethernet IP addresses setting.")
|
target_group.add_argument("--eth-dynamic-ip", action="store_true", help="Enable dynamic Ethernet IP addresses setting")
|
||||||
target_group.add_argument("--eth-reset-time", default="10e-3", help="Duration of Ethernet PHY reset")
|
target_group.add_argument("--eth-reset-time", default="10e-3", help="Duration of Ethernet PHY reset")
|
||||||
target_group.add_argument("--with-hyperram", action="store_true", help="Add HyperRAM.")
|
target_group.add_argument("--with-hyperram", action="store_true", help="Add HyperRAM")
|
||||||
target_group.add_argument("--with-sdcard", action="store_true", help="Add SDCard.")
|
target_group.add_argument("--with-sdcard", action="store_true", help="Add SDCard")
|
||||||
target_group.add_argument("--with-jtagbone", action="store_true", help="Add JTAGBone.")
|
target_group.add_argument("--with-jtagbone", action="store_true", help="Add JTAGBone")
|
||||||
target_group.add_argument("--with-uartbone", action="store_true", help="Add UartBone on 2nd serial.")
|
target_group.add_argument("--with-uartbone", action="store_true", help="Add UartBone on 2nd serial")
|
||||||
|
target_group.add_argument("--with-video-terminal", action="store_true", help="Enable Video Terminal (HDMI)")
|
||||||
|
target_group.add_argument("--with-video-framebuffer", action="store_true", help="Enable Video Framebuffer (HDMI)")
|
||||||
builder_args(parser)
|
builder_args(parser)
|
||||||
soc_core_args(parser)
|
soc_core_args(parser)
|
||||||
vivado_build_args(parser)
|
vivado_build_args(parser)
|
||||||
|
|
@ -174,17 +200,18 @@ def main():
|
||||||
assert not (args.with_etherbone and args.eth_dynamic_ip)
|
assert not (args.with_etherbone and args.eth_dynamic_ip)
|
||||||
|
|
||||||
soc = BaseSoC(
|
soc = BaseSoC(
|
||||||
sys_clk_freq = int(float(args.sys_clk_freq)),
|
sys_clk_freq = int(float(args.sys_clk_freq)),
|
||||||
iodelay_clk_freq = int(float(args.iodelay_clk_freq)),
|
iodelay_clk_freq = int(float(args.iodelay_clk_freq)),
|
||||||
with_ethernet = args.with_ethernet,
|
with_ethernet = args.with_ethernet,
|
||||||
with_etherbone = args.with_etherbone,
|
with_etherbone = args.with_etherbone,
|
||||||
eth_ip = args.eth_ip,
|
eth_ip = args.eth_ip,
|
||||||
eth_dynamic_ip = args.eth_dynamic_ip,
|
eth_dynamic_ip = args.eth_dynamic_ip,
|
||||||
eth_reset_time = args.eth_reset_time,
|
with_hyperram = args.with_hyperram,
|
||||||
with_hyperram = args.with_hyperram,
|
with_sdcard = args.with_sdcard,
|
||||||
with_sdcard = args.with_sdcard,
|
with_jtagbone = args.with_jtagbone,
|
||||||
with_jtagbone = args.with_jtagbone,
|
with_uartbone = args.with_uartbone,
|
||||||
with_uartbone = args.with_uartbone,
|
with_video_terminal = args.with_video_terminal,
|
||||||
|
with_video_framebuffer = args.with_video_framebuffer,
|
||||||
**soc_core_argdict(args))
|
**soc_core_argdict(args))
|
||||||
builder = Builder(soc, **builder_argdict(args))
|
builder = Builder(soc, **builder_argdict(args))
|
||||||
vns = builder.build(**vivado_build_argdict(args), run=args.build)
|
vns = builder.build(**vivado_build_argdict(args), run=args.build)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue