Hdl21
Hdl21 copied to clipboard
Have `hdl21.pdk.compile()` return the stuff it compiled
hdl21.pdk.compile()
has this call-signature:
def compile(src: Elaboratables) -> None
In other words, "take some Module
(s) ("Elaboratables") and modify them inline; return nothing".
This signature is enforced for any compatible PDK-package.
It's pretty frequent we want to nest this among other manipulations, such as:
@hs.sim
class MySim:
tb = h.pdk.compile(MyTbGenerator(my_params)) # <= here
The issue: make compile
return the stuff it's input, in "the same shape" that it came in.
The Walker
each PDK uses internally already does this, and should serve as a fine example. In fact, I expect all PDK-packages will just return via a Walker
method directly.
The most hassle here is just updating the existing PDK packages. The in-source ones (sample, sky130, asap7) are easy enough; others that live in private places need a heads-up. I believe @aviralpandey has a few of these that would be effected, and is welcome to weigh in - especially if such a change wouldn't be welcome.