Hdl21 icon indicating copy to clipboard operation
Hdl21 copied to clipboard

What should `NoConn`s be able to do?

Open dan-fritchman opened this issue 2 years ago • 10 comments

"Policy" questions on what the no-connect Signal-type should and should not allow.

The initial implementation from #7 has:

  • (a) "Strict" single-port, no other connection to anything requirements
  • (b) Connects to Signals, not Bundles

Questions and proposals:

  • Should they be allowed to connect non-unity-width ports?
    • Propose yes. This is part of #33.
  • Should they be allowed to connect to Bundle valued ports?
    • Propose yes. This is part of #33.
  • Should they be allowed in Concat?
    • Propose yes
    • I suppose the weird part would be the inference of widths, given the answers above. The most clear, I guess, would be inferring each NoConn as unit-width(?).
    • This may be a "no for now", just make a Signal instead, especially for non-unit widths.
  • Should they be allowed in AnonymousBundle?
    • Propose yes
  • Should they be Slice-able?
    • Propose no
  • Should stuff like the test in #7 work, or fail:
@h.module 
class Inner:
  p = h.Port()

@h.module
class Bad:
  # Create two instances of `Inner`
  i1 = Inner() 
  i2 = Inner()

  # Connect the first to a `NoConn`
  i1.p = h.NoConn()
  # And then connect the second to the first. 
  # Herein lies the "problem"
  i2.p = i1.p 

Currently this fails.
The rationale: NoConn as compared to an otherwise unconnected Signal is really just a marker, saying "I intend for this to connect nowhere". Hdl21's port-to-port connection semantics can then override this intent.

I think this should continue to fail.

dan-fritchman avatar Jul 31 '22 22:07 dan-fritchman