litescope/examples/targets/core.py

50 lines
1.3 KiB
Python
Raw Normal View History

# This file is Copyright (c) 2015-2018 Florent Kermarrec <florent@enjoy-digital.fr>
# License: BSD
from migen import *
2015-09-12 12:19:30 -04:00
from targets import *
2015-11-11 18:56:49 -05:00
from litex.build.generic_platform import *
from litex.build.xilinx.platform import XilinxPlatform
2020-02-26 16:02:14 -05:00
from litex.soc.integration.soc_core import SoCMini
from litescope import LiteScopeAnalyzer
2015-09-12 12:19:30 -04:00
_io = [
("sys_clock", 0, Pins(1)),
("sys_reset", 1, Pins(1)),
2015-09-12 12:19:30 -04:00
("serial", 0,
Subsignal("tx", Pins(1)),
Subsignal("rx", Pins(1)),
2015-09-12 12:19:30 -04:00
),
("bus", 0, Pins(128))
2015-09-12 12:19:30 -04:00
]
2020-02-26 16:02:14 -05:00
2015-09-12 12:19:30 -04:00
class CorePlatform(XilinxPlatform):
name = "core"
def __init__(self):
XilinxPlatform.__init__(self, "", _io)
2020-02-26 16:02:14 -05:00
class Core(SoCMini):
2015-09-12 12:19:30 -04:00
platform = CorePlatform()
def __init__(self, platform, clk_freq=100*1000000):
self.clock_domains.cd_sys = ClockDomain("sys")
self.comb += [
self.cd_sys.clk.eq(platform.request("sys_clock")),
self.cd_sys.rst.eq(platform.request("sys_reset"))
]
2020-02-26 16:02:14 -05:00
SoCMini.__init__(self, platform, clk_freq, csr_data_width=32,
with_uart=True, uart_name="bridge",
ident="Litescope example design", ident_version=True,
2015-09-12 12:19:30 -04:00
)
2020-02-26 16:02:14 -05:00
self.submodules.analyzer = LiteScopeAnalyzer(platform.request("bus"), 512)
self.add_csr("analyzer")
2015-09-12 12:19:30 -04:00
default_subtarget = Core