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"] groups = ["default", "dev"]
strategy = ["inherit_metadata"] strategy = ["inherit_metadata"]
lock_version = "4.5.0" lock_version = "4.5.0"
content_hash = "sha256:fbfe1db54d73aa2641413610d5e62d87b02de247293e2af3cd53ee0c283318db" content_hash = "sha256:70036fd7ee1fe6910ed441a5419d9194d1abc592cbf2f39deb1d7a8e77501d03"
[[metadata.targets]] [[metadata.targets]]
requires_python = "==3.12.*" requires_python = "==3.12.*"
@ -39,6 +39,18 @@ dependencies = [
"amaranth<0.7,>=0.4", "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]] [[package]]
name = "basedpyright" name = "basedpyright"
version = "1.18.0" version = "1.18.0"

View file

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

View file

@ -316,11 +316,13 @@ class Hub75DataDriver(wiring.Component):
return m return m
class Hub75Coordinator(wiring.Component): class Hub75Coordinator(wiring.Component):
"""A shared-control hub75 driver""" """A shared-control hub75 driver"""
def __init__(self, geom: DisplayGeometry): def __init__(self, geom: DisplayGeometry, *, double_fetch=True):
self.geom = geom self.geom = geom
self.double_fetch = double_fetch
super().__init__( super().__init__(
{ {
"hub75": Out(Hub75Ctrl(self.geom.n_strings)), "hub75": Out(Hub75Ctrl(self.geom.n_strings)),
@ -340,12 +342,18 @@ class Hub75Coordinator(wiring.Component):
donearr = [] donearr = []
startStrings = Signal(1) startStrings = Signal(1)
stringsDone = 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): 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) bufs.append(sb)
stringdriver = Hub75DataDriver( 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) strings.append(stringdriver)
wiring.connect(m, sb.read_port, stringdriver.bram) wiring.connect(m, sb.read_port, stringdriver.bram)

View file

@ -1,6 +1,7 @@
# main entry point for CLI applications. # main entry point for CLI applications.
import logging import logging
import os
import argparse import argparse
from groovylight.config import Config from groovylight.config import Config
from groovylight.platforms.cxxrtl_sim import emit_cxxrtl from groovylight.platforms.cxxrtl_sim import emit_cxxrtl
@ -19,9 +20,21 @@ def setup_logger(args):
handler.setFormatter(formatter) handler.setFormatter(formatter)
root_logger.addHandler(handler) 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) root_logger.setLevel(args.loglevel)
def dir_path(string):
if os.path.isdir(string):
return string
else:
raise NotADirectoryError(string)
def main(): def main():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
@ -42,6 +55,9 @@ def main():
type=argparse.FileType("w"), type=argparse.FileType("w"),
metavar="FILE", metavar="FILE",
) )
parser.add_argument(
"-D", "--dump", help="Dump verilog to folder", type=dir_path, metavar="FOLDER"
)
parser.add_argument( parser.add_argument(
"config", "config",
@ -62,6 +78,10 @@ def main():
logger.info("Generating CXXRTL based graphical simulator.") logger.info("Generating CXXRTL based graphical simulator.")
emit_cxxrtl(conf) 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__": if __name__ == "__main__":

View file

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