-
Notifications
You must be signed in to change notification settings - Fork 895
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
cxxrtl: Implement $assert
checks
#3964
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CXXRTL_ASSERT
is for internal constraint violations. User assertions need to be collected similar to $display
cells into a buffer that can be read via the C API.
(The $display
cell needs changes too, but the current situation there is very useful. Here I do not think it is appropriate to merge.)
Sure, and what do you think of adding the extra |
Not a fan either. The pure eval/commit based simulation model is quite elegant and I don't think having |
Well, but do you see a way to reasonably implement the user assertions checks within the eval/commit model when there are feedback arcs? As I see it the assertions should only be checked once the circuit converges. |
Why is the same not true about |
I assume you mean |
Oh. I for some reason thought |
I will raise that at the next Yosys dev meeting. |
Thanks! Note that I am also making an effort towards implementing CXXRTL 2. It will have a different evaluation model not based on a eval/commit loop the way CXXRTL 1 is. So (Once CXXRTL 2 lands, the plan is to fully deprecate CXXRTL 1.) |
So we have discussed this on today’s dev JF. The consensus was that we are fine with having assertion cells with the semantics being that the cell inputs are only sampled once the circuit converges, so that there’s no need for a new version of an assertion cell. What would be the argument against that? Why shouldn’t CXXRTL, even in version 2, bend to that requirement? |
Does "because I lead the design of CXXRTL and I veto that choice" work for you? |
Uh, not really, I was interested in a technical argument. So that I understand why the “once the circuit converges” sampling semantics is broken so that it warrants a new cell, which I understand is your position. |
Well, you were requesting someone else "bends" to your instructions, which isn't a technical argument either. |
I don’t think I was. I am really only trying to find out why the definition of the assertion cell as it is now is something unreasonable, so that CXXRTL 2 will have hard time “bending” to it. Though maybe I assumed wrong what you meant when you say the check step from this PR wouldn’t work there. |
Ah yeah. Let me elaborate on that. The CXXRTL simulation model is fundamentally resting on the pillars of its two actions: eval and commit. This isn't an artifact of the current implementation but is something that is both of theoretical importance (it is how CXXRTL avoids races) and it is also exported in every API (the C++ API, the C API, etc). Adding a new action, if it was ever done, would have to be reflected everywhere, and it is a breaking change to the C API (for example it would mean assertions do not work when Amaranth is driving the simulation through cxxsim). While the If you are adding support for a new cell, even in CXXRTL 1, it needs to fit into the In addition to that, I'm not actually sure the notion of "whenever comb signals settle" is especially well defined, particularly when an external simulator harness is involved rather than just repeated calls to the |
OK, so the gist of the matter seems to be that the simulation model that exposes evaluation of combinational cells to transitionary glitch states is so ingrained into the design, and maybe what's more important into the interface of CXXRTL, that the cost of implementing the "converged sampling" semantics directly is too high to bear. On a more general level,
Thinking out loud: if you have an |
This is an accurate summary, thank you.
I actually want physical implementation of CXXRTL itself, as you've realized already, is a synthesis target at its heart, not a simulation target, hence all these difficulties. Once again thank you for an accurate summary.
Yes.
Yes. In case of the
Yep, sounds good to me.
As far as I recall (it's been a while since I looked) for |
Is obsoleted by #4128. |
This is the result of piecing something together for my downstream needs. I am curious to hear how it fits into @whitequark's plans with CXXRTL.
Related: #2431