Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Peeking zero-width I/Os #35

Closed
edwardcwang opened this issue Apr 30, 2019 · 7 comments
Closed

Peeking zero-width I/Os #35

edwardcwang opened this issue Apr 30, 2019 · 7 comments
Labels
enhancement New feature or request

Comments

@edwardcwang
Copy link
Member

While I know that zero-width I/Os don't really exist, it might be nice as syntactic sugar to be able to peek (or even dummy poke?) zero-width wires and have it return 0. This is especially useful in generators where parameters might be set in a way such that some wires end up with zero-width.

This might also be a treadle issue... @chick ?

Not super high priority since it can be worked around with some if statements.

Currently it fails with a slightly cryptic message:

java.lang.AssertionError: assertion failed: Error: getValue("zero_width_io_name") : argument is not an element of this circuit
  at scala.Predef$.assert(Predef.scala:219)
  at treadle.executable.ExecutionEngine.getValue(ExecutionEngine.scala:165)
  at treadle.TreadleTester.peek(TreadleTester.scala:245)
  at chisel3.tester.TreadleBackend.peekBits(TreadleBackend.scala:90)
  at chisel3.tester.TreadleBackend.expectBits(TreadleBackend.scala:99)
  at chisel3.tester.package$testableData.expectWithStale(package.scala:72)
  at chisel3.tester.package$testableData.expect(package.scala:91)
@edwardcwang edwardcwang added the enhancement New feature or request label Apr 30, 2019
@chick
Copy link
Contributor

chick commented Apr 30, 2019

Hmm. This would be easy to do, perhaps as a mode where you can poke or peek anything you want without erroring. But treadle only has symbols for things that have survived all the way to low firrtl. so it would not otherwise know that the signal is zero length, it just simply isn't there, right?

@edwardcwang
Copy link
Member Author

edwardcwang commented Apr 30, 2019

Yeah, that's the tricky part methinks... Zero-width signals do indeed disappear in low-FIRRTL. I guess this is the inverse of #2.

@ducky64
Copy link
Member

ducky64 commented Apr 30, 2019

Perhaps zero-width signals shouldn't disappear in low-FIRRTL? Even in Chisel frontend we kind of have a distinction between zero-width signals and optional Bundle fields, and zero width signals could be considered to be a form of design intent?

@edwardcwang
Copy link
Member Author

Well, zero-width wires are also a Chisel/Chirrtl thing and don't actually exist in hardware...

@chick
Copy link
Contributor

chick commented Apr 30, 2019

Annotations

@edwardcwang
Copy link
Member Author

anno

kammoh added a commit to kammoh/chiseltest that referenced this issue Aug 16, 2022
Addresses a similar to ucb-bar#35, specifically for Decoupled and Valid
interfaces. Decoupled interfaces with zero-width data can also be used
as a control/synchronization handshake where no data payload exists.
Here we take an explicit approach: the designer knows the
with of data at instatiation and can accordingly utilize appropriate
Option[Data] values.
ekiwi pushed a commit to kammoh/chiseltest that referenced this issue Jan 11, 2023
Addresses a similar to ucb-bar#35, specifically for Decoupled and Valid
interfaces. Decoupled interfaces with zero-width data can also be used
as a control/synchronization handshake where no data payload exists.
Here we take an explicit approach: the designer knows the
with of data at instatiation and can accordingly utilize appropriate
Option[Data] values.
@ekiwi
Copy link
Collaborator

ekiwi commented Jan 11, 2023

This should be fixed by: 7d98ab5

@ekiwi ekiwi closed this as completed Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants