dan-fritchman / Hdl21

Hardware Description Library
BSD 3-Clause "New" or "Revised" License
64 stars 15 forks source link

Take port-references to `Pair`, and any other `InstanceBundle` #128

Open dan-fritchman opened 1 year ago

dan-fritchman commented 1 year ago
@h.module 
class M:
  inp = h.Diff()
  out = h.Diff()
  bias, VSS = 2 * h.Input()

  pair = h.Pair(h.Nmos())(d=out, g=inp, b=VSS)
  nbias = h.Nmos()(g=bias, s=VSS, b=VSS, d=FIXME) # <= FIXME here the problem

It would be nice if this could say

  nbias = h.Nmos()(g=bias, s=VSS, b=VSS, d=pair.s) # <= Connect into a port-reference of the `Pair`

But that doesn't quite work yet.

dan-fritchman commented 1 year ago

Notably "the opposite" (order) does work.

  nbias = h.Nmos()(g=bias, s=VSS, b=VSS) 
  pair = h.Pair(h.Nmos())(d=out, g=inp, b=VSS, s=nbias.d) # Connect by reference to `nbias`

So there's a perfectly available workaround.
But you've gotta know about it.