2020-04-22 10:31:07 -04:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
2020-08-23 09:00:17 -04:00
|
|
|
#
|
|
|
|
# This file is part of LiteX-Boards.
|
|
|
|
#
|
lambdaconcept_ecpix5: Add initial Video support at 640x480 (with Terminal/Framebuffer).
I2C intialization code adapted from https://github.com/ultraembedded/ecpix-5.
Tested with:
- python3 -m litex_boards.targets.lambdaconcept_ecpix5 --cpu-type=firev --with-video-terminal --build --load
- python3 -m litex_boards.targets.lambdaconcept_ecpix5 --cpu-type=firev --with-video-framebuffer --build --load
__ _ __ _ __
/ / (_) /____ | |/_/
/ /__/ / __/ -_)> <
/____/_/\__/\__/_/|_|
Build your hardware, easily!
(c) Copyright 2012-2022 Enjoy-Digital
(c) Copyright 2007-2015 M-Labs
BIOS built on Mar 8 2022 15:34:22
BIOS CRC passed (c7fe9ecd)
Migen git sha1: ac70301
LiteX git sha1: 7ebc7625
--=============== SoC ==================--
CPU: FireV-STANDARD @ 75MHz
BUS: WISHBONE 32-bit @ 4GiB
CSR: 32-bit data
ROM: 128KiB
SRAM: 8KiB
L2: 8KiB
SDRAM: 524288KiB 16-bit @ 300MT/s (CL-6 CWL-5)
--========== Initialization ============--
Initializing SDRAM @0x40000000...
Switching SDRAM to software control.
Read leveling:
m0, b00: |01110000| delays: 02+-01
m0, b01: |00000000| delays: -
m0, b02: |00000000| delays: -
m0, b03: |00000000| delays: -
best: m0, b00 delays: 02+-01
m1, b00: |01110000| delays: 02+-01
m1, b01: |00000000| delays: -
m1, b02: |00000000| delays: -
m1, b03: |00000000| delays: -
best: m1, b00 delays: 02+-01
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: 13.6MiB/s
Read speed: 23.4MiB/s
--============== Boot ==================--
Booting from serial...
Press Q or ESC to abort boot completely.
sL5DdSMmkekro
Timeout
No boot medium found
--============= Console ================--
litex> ident
Ident: LiteX SoC on ECPIX-5 2022-03-08 15:34:19
2022-03-08 09:40:17 -05:00
|
|
|
# Copyright (c) 2020-2022 Florent Kermarrec <florent@enjoy-digital.fr>
|
2020-08-23 09:00:17 -04:00
|
|
|
# SPDX-License-Identifier: BSD-2-Clause
|
2020-04-22 10:31:07 -04:00
|
|
|
|
|
|
|
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-05-02 06:42:04 -04:00
|
|
|
from litex_boards.platforms import lambdaconcept_ecpix5
|
2020-04-22 10:31:07 -04:00
|
|
|
|
|
|
|
from litex.soc.cores.clock import *
|
|
|
|
from litex.soc.integration.soc_core import *
|
|
|
|
from litex.soc.integration.builder import *
|
2021-01-28 08:27:09 -05:00
|
|
|
from litex.soc.cores.led import LedChaser
|
lambdaconcept_ecpix5: Add initial Video support at 640x480 (with Terminal/Framebuffer).
I2C intialization code adapted from https://github.com/ultraembedded/ecpix-5.
Tested with:
- python3 -m litex_boards.targets.lambdaconcept_ecpix5 --cpu-type=firev --with-video-terminal --build --load
- python3 -m litex_boards.targets.lambdaconcept_ecpix5 --cpu-type=firev --with-video-framebuffer --build --load
__ _ __ _ __
/ / (_) /____ | |/_/
/ /__/ / __/ -_)> <
/____/_/\__/\__/_/|_|
Build your hardware, easily!
(c) Copyright 2012-2022 Enjoy-Digital
(c) Copyright 2007-2015 M-Labs
BIOS built on Mar 8 2022 15:34:22
BIOS CRC passed (c7fe9ecd)
Migen git sha1: ac70301
LiteX git sha1: 7ebc7625
--=============== SoC ==================--
CPU: FireV-STANDARD @ 75MHz
BUS: WISHBONE 32-bit @ 4GiB
CSR: 32-bit data
ROM: 128KiB
SRAM: 8KiB
L2: 8KiB
SDRAM: 524288KiB 16-bit @ 300MT/s (CL-6 CWL-5)
--========== Initialization ============--
Initializing SDRAM @0x40000000...
Switching SDRAM to software control.
Read leveling:
m0, b00: |01110000| delays: 02+-01
m0, b01: |00000000| delays: -
m0, b02: |00000000| delays: -
m0, b03: |00000000| delays: -
best: m0, b00 delays: 02+-01
m1, b00: |01110000| delays: 02+-01
m1, b01: |00000000| delays: -
m1, b02: |00000000| delays: -
m1, b03: |00000000| delays: -
best: m1, b00 delays: 02+-01
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: 13.6MiB/s
Read speed: 23.4MiB/s
--============== Boot ==================--
Booting from serial...
Press Q or ESC to abort boot completely.
sL5DdSMmkekro
Timeout
No boot medium found
--============= Console ================--
litex> ident
Ident: LiteX SoC on ECPIX-5 2022-03-08 15:34:19
2022-03-08 09:40:17 -05:00
|
|
|
from litex.soc.cores.video import VideoDVIPHY
|
|
|
|
from litex.soc.cores.bitbang import I2CMaster
|
2020-04-22 10:31:07 -04:00
|
|
|
|
2020-04-22 11:03:22 -04:00
|
|
|
from litedram.modules import MT41K256M16
|
|
|
|
from litedram.phy import ECP5DDRPHY
|
|
|
|
|
2020-04-22 14:21:59 -04:00
|
|
|
from liteeth.phy.ecp5rgmii import LiteEthPHYRGMII
|
|
|
|
|
2020-04-22 10:31:07 -04:00
|
|
|
# CRG ----------------------------------------------------------------------------------------------
|
|
|
|
|
2022-10-27 10:58:55 -04:00
|
|
|
class _CRG(LiteXModule):
|
2020-04-22 10:31:07 -04:00
|
|
|
def __init__(self, platform, sys_clk_freq):
|
2022-10-27 10:58:55 -04:00
|
|
|
self.rst = Signal()
|
|
|
|
self.cd_init = ClockDomain()
|
|
|
|
self.cd_por = ClockDomain()
|
|
|
|
self.cd_sys = ClockDomain()
|
|
|
|
self.cd_sys2x = ClockDomain()
|
|
|
|
self.cd_sys2x_i = ClockDomain()
|
2020-04-22 10:31:07 -04:00
|
|
|
|
|
|
|
# # #
|
|
|
|
|
2020-06-29 10:28:28 -04:00
|
|
|
self.stop = Signal()
|
|
|
|
self.reset = Signal()
|
2020-04-22 11:03:22 -04:00
|
|
|
|
2020-04-22 10:31:07 -04:00
|
|
|
# Clk / Rst
|
|
|
|
clk100 = platform.request("clk100")
|
|
|
|
rst_n = platform.request("rst_n")
|
|
|
|
|
2020-04-22 11:03:22 -04:00
|
|
|
# Power on reset
|
|
|
|
por_count = Signal(16, reset=2**16-1)
|
|
|
|
por_done = Signal()
|
2020-06-29 10:28:28 -04:00
|
|
|
self.comb += self.cd_por.clk.eq(clk100)
|
2020-04-22 11:03:22 -04:00
|
|
|
self.comb += por_done.eq(por_count == 0)
|
|
|
|
self.sync.por += If(~por_done, por_count.eq(por_count - 1))
|
|
|
|
|
2020-04-22 10:31:07 -04:00
|
|
|
# PLL
|
2022-10-27 10:58:55 -04:00
|
|
|
self.pll = pll = ECP5PLL()
|
2020-11-04 05:09:30 -05:00
|
|
|
self.comb += pll.reset.eq(~por_done | ~rst_n | self.rst)
|
2020-04-22 10:31:07 -04:00
|
|
|
pll.register_clkin(clk100, 100e6)
|
2020-04-22 11:03:22 -04:00
|
|
|
pll.create_clkout(self.cd_sys2x_i, 2*sys_clk_freq)
|
|
|
|
pll.create_clkout(self.cd_init, 25e6)
|
|
|
|
self.specials += [
|
|
|
|
Instance("ECLKSYNCB",
|
|
|
|
i_ECLKI = self.cd_sys2x_i.clk,
|
|
|
|
i_STOP = self.stop,
|
|
|
|
o_ECLKO = self.cd_sys2x.clk),
|
|
|
|
Instance("CLKDIVF",
|
|
|
|
p_DIV = "2.0",
|
|
|
|
i_ALIGNWD = 0,
|
|
|
|
i_CLKI = self.cd_sys2x.clk,
|
2020-06-29 10:28:28 -04:00
|
|
|
i_RST = self.reset,
|
2020-04-22 11:03:22 -04:00
|
|
|
o_CDIVX = self.cd_sys.clk),
|
2022-03-22 12:32:35 -04:00
|
|
|
AsyncResetSynchronizer(self.cd_sys, ~pll.locked | self.reset),
|
2020-04-22 11:03:22 -04:00
|
|
|
]
|
2020-04-22 10:31:07 -04:00
|
|
|
|
|
|
|
# BaseSoC ------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class BaseSoC(SoCCore):
|
2022-11-08 05:54:17 -05:00
|
|
|
def __init__(self, device="85F", sys_clk_freq=75e6, toolchain="trellis",
|
lambdaconcept_ecpix5: Add initial Video support at 640x480 (with Terminal/Framebuffer).
I2C intialization code adapted from https://github.com/ultraembedded/ecpix-5.
Tested with:
- python3 -m litex_boards.targets.lambdaconcept_ecpix5 --cpu-type=firev --with-video-terminal --build --load
- python3 -m litex_boards.targets.lambdaconcept_ecpix5 --cpu-type=firev --with-video-framebuffer --build --load
__ _ __ _ __
/ / (_) /____ | |/_/
/ /__/ / __/ -_)> <
/____/_/\__/\__/_/|_|
Build your hardware, easily!
(c) Copyright 2012-2022 Enjoy-Digital
(c) Copyright 2007-2015 M-Labs
BIOS built on Mar 8 2022 15:34:22
BIOS CRC passed (c7fe9ecd)
Migen git sha1: ac70301
LiteX git sha1: 7ebc7625
--=============== SoC ==================--
CPU: FireV-STANDARD @ 75MHz
BUS: WISHBONE 32-bit @ 4GiB
CSR: 32-bit data
ROM: 128KiB
SRAM: 8KiB
L2: 8KiB
SDRAM: 524288KiB 16-bit @ 300MT/s (CL-6 CWL-5)
--========== Initialization ============--
Initializing SDRAM @0x40000000...
Switching SDRAM to software control.
Read leveling:
m0, b00: |01110000| delays: 02+-01
m0, b01: |00000000| delays: -
m0, b02: |00000000| delays: -
m0, b03: |00000000| delays: -
best: m0, b00 delays: 02+-01
m1, b00: |01110000| delays: 02+-01
m1, b01: |00000000| delays: -
m1, b02: |00000000| delays: -
m1, b03: |00000000| delays: -
best: m1, b00 delays: 02+-01
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: 13.6MiB/s
Read speed: 23.4MiB/s
--============== Boot ==================--
Booting from serial...
Press Q or ESC to abort boot completely.
sL5DdSMmkekro
Timeout
No boot medium found
--============= Console ================--
litex> ident
Ident: LiteX SoC on ECPIX-5 2022-03-08 15:34:19
2022-03-08 09:40:17 -05:00
|
|
|
with_ethernet = False,
|
|
|
|
with_etherbone = False,
|
|
|
|
with_video_terminal = False,
|
|
|
|
with_video_framebuffer = False,
|
|
|
|
with_led_chaser = True,
|
|
|
|
**kwargs):
|
2022-07-05 15:36:02 -04:00
|
|
|
platform = lambdaconcept_ecpix5.Platform(device=device, toolchain=toolchain)
|
2020-04-22 10:31:07 -04:00
|
|
|
|
|
|
|
# CRG --------------------------------------------------------------------------------------
|
2022-10-27 10:58:55 -04:00
|
|
|
self.crg = _CRG(platform, sys_clk_freq)
|
2020-04-22 10:31:07 -04:00
|
|
|
|
2022-04-21 06:17:26 -04:00
|
|
|
# SoCCore ----------------------------------------------------------------------------------
|
|
|
|
SoCCore.__init__(self, platform, sys_clk_freq, ident="LiteX SoC on ECPIX-5", **kwargs)
|
|
|
|
|
2020-04-22 11:03:22 -04:00
|
|
|
# DDR3 SDRAM -------------------------------------------------------------------------------
|
|
|
|
if not self.integrated_main_ram_size:
|
2022-10-27 10:58:55 -04:00
|
|
|
self.ddrphy = ECP5DDRPHY(
|
2020-04-22 11:03:22 -04:00
|
|
|
platform.request("ddram"),
|
|
|
|
sys_clk_freq=sys_clk_freq)
|
|
|
|
self.comb += self.crg.stop.eq(self.ddrphy.init.stop)
|
2020-06-29 10:28:28 -04:00
|
|
|
self.comb += self.crg.reset.eq(self.ddrphy.init.reset)
|
2020-04-22 11:03:22 -04:00
|
|
|
self.add_sdram("sdram",
|
2021-03-29 09:28:04 -04:00
|
|
|
phy = self.ddrphy,
|
|
|
|
module = MT41K256M16(sys_clk_freq, "1:2"),
|
|
|
|
l2_cache_size = kwargs.get("l2_size", 8192)
|
2020-04-22 11:03:22 -04:00
|
|
|
)
|
|
|
|
|
2021-03-08 07:43:50 -05:00
|
|
|
# Ethernet / Etherbone ---------------------------------------------------------------------
|
|
|
|
if with_ethernet or with_etherbone:
|
2022-10-27 10:58:55 -04:00
|
|
|
self.ethphy = LiteEthPHYRGMII(
|
2020-04-22 14:21:59 -04:00
|
|
|
clock_pads = self.platform.request("eth_clocks"),
|
2020-12-29 10:00:59 -05:00
|
|
|
pads = self.platform.request("eth"),
|
|
|
|
rx_delay = 0e-9)
|
2021-03-08 07:43:50 -05:00
|
|
|
if with_ethernet:
|
|
|
|
self.add_ethernet(phy=self.ethphy)
|
|
|
|
if with_etherbone:
|
|
|
|
self.add_etherbone(phy=self.ethphy)
|
2020-04-22 14:21:59 -04:00
|
|
|
|
lambdaconcept_ecpix5: Add initial Video support at 640x480 (with Terminal/Framebuffer).
I2C intialization code adapted from https://github.com/ultraembedded/ecpix-5.
Tested with:
- python3 -m litex_boards.targets.lambdaconcept_ecpix5 --cpu-type=firev --with-video-terminal --build --load
- python3 -m litex_boards.targets.lambdaconcept_ecpix5 --cpu-type=firev --with-video-framebuffer --build --load
__ _ __ _ __
/ / (_) /____ | |/_/
/ /__/ / __/ -_)> <
/____/_/\__/\__/_/|_|
Build your hardware, easily!
(c) Copyright 2012-2022 Enjoy-Digital
(c) Copyright 2007-2015 M-Labs
BIOS built on Mar 8 2022 15:34:22
BIOS CRC passed (c7fe9ecd)
Migen git sha1: ac70301
LiteX git sha1: 7ebc7625
--=============== SoC ==================--
CPU: FireV-STANDARD @ 75MHz
BUS: WISHBONE 32-bit @ 4GiB
CSR: 32-bit data
ROM: 128KiB
SRAM: 8KiB
L2: 8KiB
SDRAM: 524288KiB 16-bit @ 300MT/s (CL-6 CWL-5)
--========== Initialization ============--
Initializing SDRAM @0x40000000...
Switching SDRAM to software control.
Read leveling:
m0, b00: |01110000| delays: 02+-01
m0, b01: |00000000| delays: -
m0, b02: |00000000| delays: -
m0, b03: |00000000| delays: -
best: m0, b00 delays: 02+-01
m1, b00: |01110000| delays: 02+-01
m1, b01: |00000000| delays: -
m1, b02: |00000000| delays: -
m1, b03: |00000000| delays: -
best: m1, b00 delays: 02+-01
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: 13.6MiB/s
Read speed: 23.4MiB/s
--============== Boot ==================--
Booting from serial...
Press Q or ESC to abort boot completely.
sL5DdSMmkekro
Timeout
No boot medium found
--============= Console ================--
litex> ident
Ident: LiteX SoC on ECPIX-5 2022-03-08 15:34:19
2022-03-08 09:40:17 -05:00
|
|
|
# HDMI -------------------------------------------------------------------------------------
|
|
|
|
if with_video_terminal or with_video_framebuffer:
|
|
|
|
# PHY + IT6613 I2C initialization.
|
|
|
|
hdmi_pads = platform.request("hdmi")
|
2022-10-27 10:58:55 -04:00
|
|
|
self.videophy = VideoDVIPHY(hdmi_pads, clock_domain="init")
|
|
|
|
self.videoi2c = I2CMaster(hdmi_pads)
|
lambdaconcept_ecpix5: Add initial Video support at 640x480 (with Terminal/Framebuffer).
I2C intialization code adapted from https://github.com/ultraembedded/ecpix-5.
Tested with:
- python3 -m litex_boards.targets.lambdaconcept_ecpix5 --cpu-type=firev --with-video-terminal --build --load
- python3 -m litex_boards.targets.lambdaconcept_ecpix5 --cpu-type=firev --with-video-framebuffer --build --load
__ _ __ _ __
/ / (_) /____ | |/_/
/ /__/ / __/ -_)> <
/____/_/\__/\__/_/|_|
Build your hardware, easily!
(c) Copyright 2012-2022 Enjoy-Digital
(c) Copyright 2007-2015 M-Labs
BIOS built on Mar 8 2022 15:34:22
BIOS CRC passed (c7fe9ecd)
Migen git sha1: ac70301
LiteX git sha1: 7ebc7625
--=============== SoC ==================--
CPU: FireV-STANDARD @ 75MHz
BUS: WISHBONE 32-bit @ 4GiB
CSR: 32-bit data
ROM: 128KiB
SRAM: 8KiB
L2: 8KiB
SDRAM: 524288KiB 16-bit @ 300MT/s (CL-6 CWL-5)
--========== Initialization ============--
Initializing SDRAM @0x40000000...
Switching SDRAM to software control.
Read leveling:
m0, b00: |01110000| delays: 02+-01
m0, b01: |00000000| delays: -
m0, b02: |00000000| delays: -
m0, b03: |00000000| delays: -
best: m0, b00 delays: 02+-01
m1, b00: |01110000| delays: 02+-01
m1, b01: |00000000| delays: -
m1, b02: |00000000| delays: -
m1, b03: |00000000| delays: -
best: m1, b00 delays: 02+-01
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: 13.6MiB/s
Read speed: 23.4MiB/s
--============== Boot ==================--
Booting from serial...
Press Q or ESC to abort boot completely.
sL5DdSMmkekro
Timeout
No boot medium found
--============= Console ================--
litex> ident
Ident: LiteX SoC on ECPIX-5 2022-03-08 15:34:19
2022-03-08 09:40:17 -05:00
|
|
|
|
|
|
|
# I2C initialization adapted from https://github.com/ultraembedded/ecpix-5
|
|
|
|
# Copyright (c) 2020 https://github.com/ultraembedded
|
|
|
|
# Adapted from C to Python.
|
|
|
|
REG_TX_SW_RST = 0x04
|
|
|
|
B_ENTEST = (1<<7)
|
|
|
|
B_REF_RST = (1<<5)
|
|
|
|
B_AREF_RST = (1<<4)
|
|
|
|
B_VID_RST = (1<<3)
|
|
|
|
B_AUD_RST = (1<<2)
|
|
|
|
B_HDMI_RST = (1<<1)
|
|
|
|
B_HDCP_RST = (1<<0)
|
|
|
|
|
|
|
|
REG_TX_AFE_DRV_CTRL = 0x61
|
|
|
|
B_AFE_DRV_PWD = (1<<5)
|
|
|
|
B_AFE_DRV_RST = (1<<4)
|
|
|
|
B_AFE_DRV_PDRXDET = (1<<2)
|
|
|
|
B_AFE_DRV_TERMON = (1<<1)
|
|
|
|
B_AFE_DRV_ENCAL = (1<<0)
|
|
|
|
|
|
|
|
REG_TX_AFE_XP_CTRL = 0x62
|
|
|
|
B_AFE_XP_GAINBIT = (1<<7)
|
|
|
|
B_AFE_XP_PWDPLL = (1<<6)
|
|
|
|
B_AFE_XP_ENI = (1<<5)
|
|
|
|
B_AFE_XP_ER0 = (1<<4)
|
|
|
|
B_AFE_XP_RESETB = (1<<3)
|
|
|
|
B_AFE_XP_PWDI = (1<<2)
|
|
|
|
B_AFE_XP_DEI = (1<<1)
|
|
|
|
B_AFE_XP_DER = (1<<0)
|
|
|
|
|
|
|
|
REG_TX_AFE_ISW_CTRL = 0x63
|
|
|
|
B_AFE_RTERM_SEL = (1<<7)
|
|
|
|
B_AFE_IP_BYPASS = (1<<6)
|
|
|
|
M_AFE_DRV_ISW = (7<<3)
|
|
|
|
O_AFE_DRV_ISW = 3
|
|
|
|
B_AFE_DRV_ISWK = 7
|
|
|
|
|
|
|
|
REG_TX_AFE_IP_CTRL = 0x64
|
|
|
|
B_AFE_IP_GAINBIT = (1<<7)
|
|
|
|
B_AFE_IP_PWDPLL = (1<<6)
|
|
|
|
M_AFE_IP_CKSEL = (3<<4)
|
|
|
|
O_AFE_IP_CKSEL = 4
|
|
|
|
B_AFE_IP_ER0 = (1<<3)
|
|
|
|
B_AFE_IP_RESETB = (1<<2)
|
|
|
|
B_AFE_IP_ENC = (1<<1)
|
|
|
|
B_AFE_IP_EC1 = (1<<0)
|
|
|
|
|
|
|
|
REG_TX_HDMI_MODE = 0xC0
|
|
|
|
B_TX_HDMI_MODE = 1
|
|
|
|
B_TX_DVI_MODE = 0
|
|
|
|
|
|
|
|
REG_TX_GCP = 0xC1
|
|
|
|
B_CLR_AVMUTE = 0
|
|
|
|
B_SET_AVMUTE = 1
|
|
|
|
B_TX_SETAVMUTE = (1<<0)
|
|
|
|
B_BLUE_SCR_MUTE = (1<<1)
|
|
|
|
B_NODEF_PHASE = (1<<2)
|
|
|
|
B_PHASE_RESYNC = (1<<3)
|
|
|
|
|
|
|
|
self.videoi2c.add_init(addr=0x4c, init=[
|
|
|
|
# Reset.
|
|
|
|
(REG_TX_SW_RST, B_REF_RST | B_VID_RST | B_AUD_RST | B_AREF_RST | B_HDCP_RST),
|
|
|
|
(REG_TX_SW_RST, 0),
|
|
|
|
|
|
|
|
# Select DVI Mode.
|
|
|
|
(REG_TX_HDMI_MODE, B_TX_DVI_MODE),
|
|
|
|
|
|
|
|
# Configure Clks.
|
|
|
|
(REG_TX_SW_RST, B_AUD_RST | B_AREF_RST | B_HDCP_RST),
|
|
|
|
(REG_TX_AFE_DRV_CTRL, B_AFE_DRV_RST),
|
|
|
|
(REG_TX_AFE_XP_CTRL, 0x18),
|
|
|
|
(REG_TX_AFE_ISW_CTRL, 0x10),
|
|
|
|
(REG_TX_AFE_IP_CTRL, 0x0C),
|
|
|
|
|
|
|
|
# Enable Clks.
|
|
|
|
(REG_TX_AFE_DRV_CTRL, 0),
|
|
|
|
|
|
|
|
# Enable Video.
|
|
|
|
(REG_TX_GCP, 0),
|
|
|
|
])
|
|
|
|
# Video Terminal/Framebuffer.
|
|
|
|
if with_video_terminal:
|
|
|
|
self.add_video_terminal(phy=self.videophy, timings="640x480@75Hz", clock_domain="init")
|
|
|
|
if with_video_framebuffer:
|
|
|
|
self.add_video_framebuffer(phy=self.videophy, timings="640x480@75Hz", clock_domain="init")
|
|
|
|
|
2021-01-28 08:27:09 -05:00
|
|
|
# Leds -------------------------------------------------------------------------------------
|
2021-07-06 17:39:37 -04:00
|
|
|
if with_led_chaser:
|
|
|
|
leds_pads = []
|
|
|
|
for i in range(4):
|
|
|
|
rgb_led_pads = platform.request("rgb_led", i)
|
|
|
|
self.comb += [getattr(rgb_led_pads, n).eq(1) for n in "gb"] # Disable Green/Blue Leds.
|
|
|
|
leds_pads += [getattr(rgb_led_pads, n) for n in "r"]
|
2022-10-27 10:58:55 -04:00
|
|
|
self.leds = LedChaser(
|
2021-07-06 17:39:37 -04:00
|
|
|
pads = Cat(leds_pads),
|
|
|
|
sys_clk_freq = sys_clk_freq)
|
2020-04-22 11:03:22 -04:00
|
|
|
|
2020-04-22 10:31:07 -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=lambdaconcept_ecpix5.Platform, description="LiteX SoC on ECPIX-5.")
|
|
|
|
parser.add_target_argument("--flash", action="store_true", help="Flash bitstream to SPI Flash.")
|
|
|
|
parser.add_target_argument("--device", default="85F", help="ECP5 device (45F or 85F).")
|
|
|
|
parser.add_target_argument("--sys-clk-freq", default=75e6, type=float, help="System clock frequency.")
|
|
|
|
parser.add_target_argument("--with-sdcard", action="store_true", help="Enable SDCard support.")
|
2022-11-05 03:07:14 -04:00
|
|
|
ethopts = parser.target_group.add_mutually_exclusive_group()
|
2022-01-05 11:06:22 -05:00
|
|
|
ethopts.add_argument("--with-ethernet", action="store_true", help="Enable Ethernet support.")
|
|
|
|
ethopts.add_argument("--with-etherbone", action="store_true", help="Enable Etherbone support.")
|
2022-11-05 03:07:14 -04:00
|
|
|
viopts = parser.target_group.add_mutually_exclusive_group()
|
lambdaconcept_ecpix5: Add initial Video support at 640x480 (with Terminal/Framebuffer).
I2C intialization code adapted from https://github.com/ultraembedded/ecpix-5.
Tested with:
- python3 -m litex_boards.targets.lambdaconcept_ecpix5 --cpu-type=firev --with-video-terminal --build --load
- python3 -m litex_boards.targets.lambdaconcept_ecpix5 --cpu-type=firev --with-video-framebuffer --build --load
__ _ __ _ __
/ / (_) /____ | |/_/
/ /__/ / __/ -_)> <
/____/_/\__/\__/_/|_|
Build your hardware, easily!
(c) Copyright 2012-2022 Enjoy-Digital
(c) Copyright 2007-2015 M-Labs
BIOS built on Mar 8 2022 15:34:22
BIOS CRC passed (c7fe9ecd)
Migen git sha1: ac70301
LiteX git sha1: 7ebc7625
--=============== SoC ==================--
CPU: FireV-STANDARD @ 75MHz
BUS: WISHBONE 32-bit @ 4GiB
CSR: 32-bit data
ROM: 128KiB
SRAM: 8KiB
L2: 8KiB
SDRAM: 524288KiB 16-bit @ 300MT/s (CL-6 CWL-5)
--========== Initialization ============--
Initializing SDRAM @0x40000000...
Switching SDRAM to software control.
Read leveling:
m0, b00: |01110000| delays: 02+-01
m0, b01: |00000000| delays: -
m0, b02: |00000000| delays: -
m0, b03: |00000000| delays: -
best: m0, b00 delays: 02+-01
m1, b00: |01110000| delays: 02+-01
m1, b01: |00000000| delays: -
m1, b02: |00000000| delays: -
m1, b03: |00000000| delays: -
best: m1, b00 delays: 02+-01
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: 13.6MiB/s
Read speed: 23.4MiB/s
--============== Boot ==================--
Booting from serial...
Press Q or ESC to abort boot completely.
sL5DdSMmkekro
Timeout
No boot medium found
--============= Console ================--
litex> ident
Ident: LiteX SoC on ECPIX-5 2022-03-08 15:34:19
2022-03-08 09:40:17 -05:00
|
|
|
viopts.add_argument("--with-video-terminal", action="store_true", help="Enable Video Terminal (HDMI).")
|
|
|
|
viopts.add_argument("--with-video-framebuffer", action="store_true", help="Enable Video Framebuffer (HDMI).")
|
2021-03-08 07:43:50 -05:00
|
|
|
|
2020-04-22 10:31:07 -04:00
|
|
|
args = parser.parse_args()
|
|
|
|
|
2020-11-12 12:07:28 -05:00
|
|
|
soc = BaseSoC(
|
lambdaconcept_ecpix5: Add initial Video support at 640x480 (with Terminal/Framebuffer).
I2C intialization code adapted from https://github.com/ultraembedded/ecpix-5.
Tested with:
- python3 -m litex_boards.targets.lambdaconcept_ecpix5 --cpu-type=firev --with-video-terminal --build --load
- python3 -m litex_boards.targets.lambdaconcept_ecpix5 --cpu-type=firev --with-video-framebuffer --build --load
__ _ __ _ __
/ / (_) /____ | |/_/
/ /__/ / __/ -_)> <
/____/_/\__/\__/_/|_|
Build your hardware, easily!
(c) Copyright 2012-2022 Enjoy-Digital
(c) Copyright 2007-2015 M-Labs
BIOS built on Mar 8 2022 15:34:22
BIOS CRC passed (c7fe9ecd)
Migen git sha1: ac70301
LiteX git sha1: 7ebc7625
--=============== SoC ==================--
CPU: FireV-STANDARD @ 75MHz
BUS: WISHBONE 32-bit @ 4GiB
CSR: 32-bit data
ROM: 128KiB
SRAM: 8KiB
L2: 8KiB
SDRAM: 524288KiB 16-bit @ 300MT/s (CL-6 CWL-5)
--========== Initialization ============--
Initializing SDRAM @0x40000000...
Switching SDRAM to software control.
Read leveling:
m0, b00: |01110000| delays: 02+-01
m0, b01: |00000000| delays: -
m0, b02: |00000000| delays: -
m0, b03: |00000000| delays: -
best: m0, b00 delays: 02+-01
m1, b00: |01110000| delays: 02+-01
m1, b01: |00000000| delays: -
m1, b02: |00000000| delays: -
m1, b03: |00000000| delays: -
best: m1, b00 delays: 02+-01
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: 13.6MiB/s
Read speed: 23.4MiB/s
--============== Boot ==================--
Booting from serial...
Press Q or ESC to abort boot completely.
sL5DdSMmkekro
Timeout
No boot medium found
--============= Console ================--
litex> ident
Ident: LiteX SoC on ECPIX-5 2022-03-08 15:34:19
2022-03-08 09:40:17 -05:00
|
|
|
device = args.device,
|
2022-11-08 04:41:35 -05:00
|
|
|
sys_clk_freq = args.sys_clk_freq,
|
2022-07-05 15:36:02 -04:00
|
|
|
toolchain = args.toolchain,
|
lambdaconcept_ecpix5: Add initial Video support at 640x480 (with Terminal/Framebuffer).
I2C intialization code adapted from https://github.com/ultraembedded/ecpix-5.
Tested with:
- python3 -m litex_boards.targets.lambdaconcept_ecpix5 --cpu-type=firev --with-video-terminal --build --load
- python3 -m litex_boards.targets.lambdaconcept_ecpix5 --cpu-type=firev --with-video-framebuffer --build --load
__ _ __ _ __
/ / (_) /____ | |/_/
/ /__/ / __/ -_)> <
/____/_/\__/\__/_/|_|
Build your hardware, easily!
(c) Copyright 2012-2022 Enjoy-Digital
(c) Copyright 2007-2015 M-Labs
BIOS built on Mar 8 2022 15:34:22
BIOS CRC passed (c7fe9ecd)
Migen git sha1: ac70301
LiteX git sha1: 7ebc7625
--=============== SoC ==================--
CPU: FireV-STANDARD @ 75MHz
BUS: WISHBONE 32-bit @ 4GiB
CSR: 32-bit data
ROM: 128KiB
SRAM: 8KiB
L2: 8KiB
SDRAM: 524288KiB 16-bit @ 300MT/s (CL-6 CWL-5)
--========== Initialization ============--
Initializing SDRAM @0x40000000...
Switching SDRAM to software control.
Read leveling:
m0, b00: |01110000| delays: 02+-01
m0, b01: |00000000| delays: -
m0, b02: |00000000| delays: -
m0, b03: |00000000| delays: -
best: m0, b00 delays: 02+-01
m1, b00: |01110000| delays: 02+-01
m1, b01: |00000000| delays: -
m1, b02: |00000000| delays: -
m1, b03: |00000000| delays: -
best: m1, b00 delays: 02+-01
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: 13.6MiB/s
Read speed: 23.4MiB/s
--============== Boot ==================--
Booting from serial...
Press Q or ESC to abort boot completely.
sL5DdSMmkekro
Timeout
No boot medium found
--============= Console ================--
litex> ident
Ident: LiteX SoC on ECPIX-5 2022-03-08 15:34:19
2022-03-08 09:40:17 -05:00
|
|
|
with_ethernet = args.with_ethernet,
|
|
|
|
with_etherbone = args.with_etherbone,
|
|
|
|
with_video_terminal = args.with_video_terminal,
|
|
|
|
with_video_framebuffer = args.with_video_framebuffer,
|
2022-11-07 02:43:26 -05:00
|
|
|
**parser.soc_argdict
|
2020-11-12 12:07:28 -05:00
|
|
|
)
|
2020-07-28 11:45:49 -04:00
|
|
|
if args.with_sdcard:
|
|
|
|
soc.add_sdcard()
|
2022-11-05 03:07:14 -04:00
|
|
|
builder = Builder(soc, **parser.builder_argdict)
|
2022-05-06 09:14:32 -04:00
|
|
|
if args.build:
|
2022-11-05 03:07:14 -04:00
|
|
|
builder.build(**parser.toolchain_argdict)
|
2020-05-05 09:11:38 -04:00
|
|
|
|
|
|
|
if args.load:
|
|
|
|
prog = soc.platform.create_programmer()
|
2022-03-17 04:21:05 -04:00
|
|
|
prog.load_bitstream(builder.get_bitstream_filename(mode="sram"))
|
2021-01-30 07:19:08 -05:00
|
|
|
|
|
|
|
if args.flash:
|
|
|
|
prog = soc.platform.create_programmer()
|
2022-07-05 12:03:06 -04:00
|
|
|
prog.flash(None, builder.get_bitstream_filename(mode="flash", ext=".svf")) # FIXME
|
2020-04-22 10:31:07 -04:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|