more work on cxxrtl simulator, start outputting things
Some checks failed
Unit Tests / Test (push) Failing after 2m22s

This commit is contained in:
saji 2024-11-02 08:14:15 -05:00
parent 300e8192fe
commit 09485a9753
5 changed files with 49 additions and 6 deletions

View file

@ -5,7 +5,7 @@
groups = ["default", "dev"]
strategy = ["inherit_metadata"]
lock_version = "4.5.0"
content_hash = "sha256:fbfe1db54d73aa2641413610d5e62d87b02de247293e2af3cd53ee0c283318db"
content_hash = "sha256:70036fd7ee1fe6910ed441a5419d9194d1abc592cbf2f39deb1d7a8e77501d03"
[[metadata.targets]]
requires_python = "==3.12.*"
@ -39,6 +39,18 @@ dependencies = [
"amaranth<0.7,>=0.4",
]
[[package]]
name = "amaranth-soc"
version = "0.1a1.dev24"
requires_python = "~=3.9"
git = "https://github.com/amaranth-lang/amaranth-soc.git"
revision = "5c43cf58f15d9cd9c69ff83c97997708d386b2dc"
summary = "System on Chip toolkit for Amaranth HDL"
groups = ["default"]
dependencies = [
"amaranth<0.6,>=0.5",
]
[[package]]
name = "basedpyright"
version = "1.18.0"

View file

@ -8,6 +8,7 @@ authors = [
dependencies = [
"amaranth>=0.5.1",
"amaranth-boards @ git+https://github.com/amaranth-lang/amaranth-boards.git",
"amaranth-soc @ git+https://github.com/amaranth-lang/amaranth-soc.git",
]
requires-python = "==3.12.*"
readme = "README.md"

View file

@ -316,11 +316,13 @@ class Hub75DataDriver(wiring.Component):
return m
class Hub75Coordinator(wiring.Component):
"""A shared-control hub75 driver"""
def __init__(self, geom: DisplayGeometry):
def __init__(self, geom: DisplayGeometry, *, double_fetch=True):
self.geom = geom
self.double_fetch = double_fetch
super().__init__(
{
"hub75": Out(Hub75Ctrl(self.geom.n_strings)),
@ -340,12 +342,18 @@ class Hub75Coordinator(wiring.Component):
donearr = []
startStrings = Signal(1)
stringsDone = Signal(1)
bram_shape = Rgb888Layout if self.double_fetch else data.ArrayLayout(Rgb888Layout, 2)
for idx, string in enumerate(self.geom.strings):
sb = SwapBuffer(depth=128, shape=data.ArrayLayout(Rgb888Layout, 2))
mdepth = string.dimensions.length
if self.double_fetch:
mdepth = mdepth * 2
sb = SwapBuffer(depth=mdepth, shape=bram_shape)
bufs.append(sb)
stringdriver = Hub75DataDriver(
string.dimensions.length, data_shape=Rgb888Layout, double_fetch=False
string.dimensions.length,
data_shape=Rgb888Layout,
double_fetch=self.double_fetch,
)
strings.append(stringdriver)
wiring.connect(m, sb.read_port, stringdriver.bram)

View file

@ -1,6 +1,7 @@
# main entry point for CLI applications.
import logging
import os
import argparse
from groovylight.config import Config
from groovylight.platforms.cxxrtl_sim import emit_cxxrtl
@ -19,9 +20,21 @@ def setup_logger(args):
handler.setFormatter(formatter)
root_logger.addHandler(handler)
if args.log_file is not None:
hdlr = logging.FileHandler(args.log_file)
hdlr.setFormatter(formatter)
root_logger.addHandler(formatter)
root_logger.setLevel(args.loglevel)
def dir_path(string):
if os.path.isdir(string):
return string
else:
raise NotADirectoryError(string)
def main():
parser = argparse.ArgumentParser()
@ -42,6 +55,9 @@ def main():
type=argparse.FileType("w"),
metavar="FILE",
)
parser.add_argument(
"-D", "--dump", help="Dump verilog to folder", type=dir_path, metavar="FOLDER"
)
parser.add_argument(
"config",
@ -62,6 +78,10 @@ def main():
logger.info("Generating CXXRTL based graphical simulator.")
emit_cxxrtl(conf)
elif conf.conf["hardware"]["type"] == "colorlight":
logger.debug("Generating colorlight code")
if args.dump:
logger.info(f"Dumping verilog to {args.dump}")
if __name__ == "__main__":

View file

@ -10,11 +10,13 @@
from amaranth.back import cxxrtl
from amaranth import Module
from groovylight import hub75
def emit_cxxrtl(config):
m = Module()
cxxrtl.convert(m)
m.submodules.coordinator = crd = hub75.Hub75Coordinator(config.geom)
cxxrtl.convert(m, ports=[])