Skip to content
This repository has been archived by the owner on Aug 19, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants