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

Add width and binary point to fixed point names #555

Closed
wants to merge 3 commits into from

Conversation

grebe
Copy link
Contributor

@grebe grebe commented May 1, 2017

@shunshou mentioned in ucb-bar/dsptools#94 that it can be tricky to debug a circuit with fixed point signals in a verilog simulator.

Ideally, there would be some way to communicate to the waveform viewer that a particular signal is fixed point with a certain binary point, but support for this seems to be very lacking. GTKWave has a very barebones ability to set a binary point, but I don't see a way to use it programmatically. It doesn't look like simvision has any support for this. I'm not sure about DVE.

One idea is to embed the binary point information in the names of variables in the emitted verilog. For example "node x" might become "node x_q3", where q3 means binaryPoint=3. The q is in reference to this common way of writing fixed point numbers.

Having the binary point information embedded in the name prevents you from having to look between waveform outputs and firrtl to figure out what the binary point is supposed to be (in some cases it may be inferred, so you'll have the added annoyance of needing to run firrtl on your firrtl another time).

As written, this code is doing some dumb things. One obvious one to me is that it will rename port names on blackboxes- it shouldn't do that. I'm not really sure how to special case that out. I'm also not sure what signals get added by firrtl after this pass is run and if it is worth trying to add _qXXX suffixes to them too. I'm sure there are other consequences I'm not thinking of.

@shunshou @chick @azidar what do you think?

@grebe grebe requested a review from azidar May 1, 2017 21:16
@azidar
Copy link
Contributor

azidar commented May 1, 2017

I'd recommend making this a separate pass from ConvertFixedToSInt, so that you can easily turn it off and on. It would also make it easier to special case the black boxes when it isn't tied up in the logic of the conversion.

If you make it a transform, you can make an annotation to turn it on (like InlineInstances) and set a commandline option to turn it on.

Otherwise, I'm happy with the idea, if this will ease debugging.

@shunshou
Copy link
Contributor

shunshou commented May 1, 2017

It would significantly ease debugging.

@azidar
Copy link
Contributor

azidar commented Nov 21, 2018

Now that the annotations are more fleshed out, perhaps this is worth another visit with a chisel API?

@grebe grebe requested a review from a team as a code owner February 26, 2019 19:39
@grebe
Copy link
Contributor Author

grebe commented Mar 3, 2019

Close in favor of #1036

@grebe grebe closed this Mar 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants