--- /dev/null
+# https://packaging.python.org/guides/packaging-namespace-packages/#pkgutil-style-namespace-packages
+__path__ = __import__('pkgutil').extend_path(__path__, __name__)
--- /dev/null
+def find_data(data_type, data_name):
+ imp = "from litex.data.{} import {} as dm".format(data_type, data_name)
+ try:
+ exec(imp)
+ return dm.data_location
+ except ImportError as e:
+ raise ImportError("""\
+litex-data-{dt}-{dn} module not install! Unable to use {dn} {dt}.
+{e}
+
+You can install this by running;
+ pip install git+https://github.com/litex-hub/litex-data-{dt}-{dn}.git
+""".format(dt=data_type, dn=data_name, e=e))
from migen import *
+from litex.data.find import find_data
from litex.soc.interconnect import axi
from litex.soc.interconnect import wishbone
from litex.soc.cores.cpu import CPU
@staticmethod
def add_sources(platform, variant="standard"):
- filename = os.path.join(os.path.abspath(os.path.dirname(__file__)), "flist_litex.verilator")
+ filename = os.path.join(find_data("cpu", "blackparrot"), "flist_litex.verilator")
with open(filename) as openfileobject:
for line in openfileobject:
temp = line
from migen import *
+from litex.data.find import find_data
from litex.soc.interconnect import wishbone
from litex.soc.cores.cpu import CPU
@staticmethod
def add_sources(platform, variant):
- vdir = os.path.join(
- os.path.abspath(os.path.dirname(__file__)), "verilog")
- platform.add_sources(os.path.join(vdir, "submodule", "rtl"),
+ vdir = find_data("cpu", "lm32")
+ platform.add_sources(os.path.join(vdir, "rtl"),
"lm32_cpu.v",
"lm32_instruction_unit.v",
"lm32_decoder.v",
"lm32_debug.v",
"lm32_itlb.v",
"lm32_dtlb.v")
- platform.add_verilog_include_path(os.path.join(vdir, "submodule", "rtl"))
+ platform.add_verilog_include_path(os.path.join(vdir, "rtl"))
if variant == "minimal":
platform.add_verilog_include_path(os.path.join(vdir, "config_minimal"))
elif variant == "lite":
from migen import *
+from litex.data.find import find_data
from litex.soc.interconnect import wishbone
from litex.soc.cores.cpu import CPU
@staticmethod
def add_sources(platform):
- sdir = os.path.join(os.path.abspath(os.path.dirname(__file__)), "sources")
+ sdir = os.path.join(find_data("cpu", "microwatt"), "sources")
platform.add_sources(sdir,
# Common / Types / Helpers
"decode_types.vhdl",
from migen import *
+from litex.data.find import find_data
from litex.soc.interconnect import wishbone
from litex.soc.cores.cpu import CPU
from migen import *
+from litex.data.find import find_data
from litex.soc.interconnect import wishbone
from litex.soc.cores.cpu import CPU
@staticmethod
def add_sources(platform):
- vdir = os.path.join(
- os.path.abspath(os.path.dirname(__file__)), "verilog")
+ vdir = find_data("cpu", "picorv32")
platform.add_source(os.path.join(vdir, "picorv32.v"))
def do_finalize(self):
from migen import *
+from litex.data.find import find_data
from litex.soc.interconnect import axi
from litex.soc.interconnect import wishbone
from litex.soc.cores.cpu import CPU
@staticmethod
def add_sources(platform, variant="standard"):
- vdir = os.path.join(
- os.path.abspath(os.path.dirname(__file__)), "verilog")
+ vdir = find_data("cpu", "rocket")
platform.add_sources(
os.path.join(vdir, "generated-src"),
CPU_VARIANTS[variant] + ".v",
from migen import *
+from litex.data.find import find_data
from litex.soc.interconnect import wishbone
from litex.soc.interconnect.csr import *
from litex.soc.cores.cpu import CPU
@staticmethod
def add_sources(platform, variant="standard"):
cpu_filename = CPU_VARIANTS[variant] + ".v"
- vdir = os.path.join(os.path.abspath(os.path.dirname(__file__)), "verilog")
+ vdir = find_data("cpu", "vexriscv")
platform.add_source(os.path.join(vdir, cpu_filename))
def use_external_variant(self, variant_filename):
("migen", ("https://github.com/m-labs/", True, True)),
# LiteX SoC builder
- ("litex", ("https://github.com/enjoy-digital/", True, True)),
+ ('litex-data-software-compiler_rt', ("https://github.com/litex-hub/", False, True))
+ ("litex", ("https://github.com/enjoy-digital/", False, True)),
# LiteX cores ecosystem
("liteeth", ("https://github.com/enjoy-digital/", False, True)),
# LiteX boards support
("litex-boards", ("https://github.com/litex-hub/", False, True)),
+
+ # Optional LiteX data
+ ('litex-data-cpu-blackparrot', ("https://github.com/litex-hub/", False, True))
+ ('litex-data-cpu-mor1kx', ("https://github.com/litex-hub/", False, True))
+ ('litex-data-cpu-lm32', ("https://github.com/litex-hub/", False, True))
+ ('litex-data-cpu-microwatt', ("https://github.com/litex-hub/", False, True))
+ ('litex-data-cpu-picorv32', ("https://github.com/litex-hub/", False, True))
+ ('litex-data-cpu-rocket', ("https://github.com/litex-hub/", False, True))
+ ('litex-data-misc-tapcfg', ("https://github.com/litex-hub/", False, True))
]
repos = OrderedDict(repos)