-
Notifications
You must be signed in to change notification settings - Fork 177
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
Export Past, Rose, Fell, etc from nmigen.hdl.ast #356
Comments
They are glob-exported from |
Do you mean "expose them from the prelude"? |
I guess that's what I mean. They're not in the all list, I have to specifically go get them. I'm bad at Python import rules... |
Ok, so, that was actually intentional, because I didn't consider that they would be useful in normal code. (In SVA you can't use them in synthesis--in Yosys implementation of SVA you can, just like in nMigen.) And if they aren't useful in synthesis, then putting them in the prelude would have just polluted the namespace. Do I understand it correctly that you found them useful? In things like edge detectors or FSMs, I assume? I'm essentially on board with adding them to the prelude already, but I'd still like to see the use cases you have to understand how broad their usefulness is. |
Edge detectors exactly. It's not difficult to write one manually, of course, but why bother when Also in my current state machine prototyping work I'm using |
Let's do this. Would you prepare a PR? When moving them to the prelude, you should add wrappers to nmigen.asserts to indicate that this module is deprecated. Then we can remove it once 0.3 is released. |
Sounds good, will do. |
It also creates a more compact netlist (you get exactly one chain of registers per signal no matter how many of these operators you use). However, there is a caveat. All of these implicitly created registers are reset_less. Do you foresee this being a problem? For example I'm not sure if this is the right thing for FSMs. |
Actually, I think that caveat is important enough we should pause and think if this is really the right path. I'm worried about introducing a feature that will turn out to be a footgun. The main argument in favor of |
Good question. My intuition would be that e.g. Is there a reason they must be reset-less in the formal use case? |
I remember that I made them reset-less deliberately while writing testbenches for AsyncFIFO. I think that before I did so, I had an issue where the reset-ful nature of those implicit registers was hiding a bug in the reset logic by virtue of, well, resetting the testbench with the design. |
Hm. I wonder if we could just add the reset_less parameter to the Another thought is to add something like EDIT: on further thought the above probably doesn't literally work, but perhaps something in that spirit would. |
We could of course do that, but it seems like it would impact ergonomics either in the formal case, the synthesis case, or both, since I think the defaults for these are different.
Sure, we could do it in principle, but it seems like special-casing some fairly boring functionality in a way that is too specific. I thought it's OK to special-case for SVA because, well, I'm not about to invent a whole new verification sub-language and SVA seems really well-designed, so we might as well do whatever is needed to import SVA constructs wholesale. But if we're generalizing them, it seems like an issue. |
We could always just not do this at all. It's really not that big of a deal to write my own edge detectors. |
Let's not do this for now, and reconsider it if someone makes a good case for the usefulness of these operations in the prelude, and puts in work to determine the exact semantics. I think these operations is something that would be nice to have in principle, but more work is necessary to make sure we won't regret adding them. |
Nothing about Past, Rose, Fell, etc is formal-specific but currently these utility functions are only exported (well, glob-exported or whatever Python calls this) from nmigen.asserts. It would be convenient if they were available directly from nmigen.hdl.ast.
The text was updated successfully, but these errors were encountered: