Open growly opened 11 months ago
Some more commentary to follow, but in short:
More generally: the Vlsir + Xyce combo hasn’t seen much action of late; I won’t be surprised if we find some trouble with other recent changes.
... But yeah, even if those _importpaths
are right, qualname
should be more like
if getattr(mod, "_importpath", None) is not None:
return mod._importpath + [mod.name] # <= don't forget that!
Related notes:
The paths we export, which eventually (can) become _importpath
s, could get smarter.
Example:
import hdl21 as h
m = h.Module(name="MyName")
print(m._importpath)
pkg = h.to_proto(m)
ns = h.from_proto(pkg)
print(ns.__main__.MyName._importpath)
Yields
None
['__main__']
The __main__
in that namespace-path is, well, pretty lame.
I recall thinking we should special-case that out (and maybe __init__.py
as well).
I do not recall whether I ever tried, or hit any roadblocks.
Re:
@sim.sim
class Sky130MuxSim:
@h.module
class Tb: # required to be named 'Tb'?
The Sim
type has an attribute named tb
(the testbench), lowercase.
https://github.com/dan-fritchman/Hdl21/blob/cf31f94e186cf28ffaf2078d1175ebfd0d9f6dc2/hdl21/sim/data.py#L373
It also has an alias Tb
with the upper-case T.
https://github.com/dan-fritchman/Hdl21/blob/cf31f94e186cf28ffaf2078d1175ebfd0d9f6dc2/hdl21/sim/data.py#L395
You can name your testbench Module whatever you like - just assign it to either tb
or Tb
in the Sim
. And in Python, declaring a nested class is similar to:
class WhateverNameYouLike:
...
class MySim:
Tb = WhateverNameYouLike
There are quite a few examples of how to set those testbench attributes on the readme page:
https://github.com/dan-fritchman/Hdl21#spice-class-simulation
If they're not clear, it'd be great to add to those docs.
Re:
class Tb:
# Seems to be a requirement of a 'Tb' to have a "single, scalar port".
VSS = h.Port()
That fact, in contrast, looks like it could be more clear in the docs.
In short:
vlsir.spice
hooks it up to that global groundAnother thing that woulda helped is https://github.com/Vlsir/Vlsir/issues/82
I import a Vlsir package to test it:
The generated netlist for Xyce is missing the subcircuit name for
sky130_mux
:I tracked the problem down to this if branch in
qualpath
. The problem seems to be that, on import,_importpath
is set to[]
(empty list). Seems this should instead be interepted and stored asNone
. Anyway then this ends up so that theSimInput
message contains aPackage
where the subcircuit has an empty name.Am I missing something? Fix seems pretty straightforward.