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

Resolve assignments with equal strengths #3637

Merged
merged 1 commit into from
Sep 27, 2022

Conversation

RRozak
Copy link
Member

@RRozak RRozak commented Sep 23, 2022

Adds step of dynamic signal strengths resolution.
When the strength is symmetric (the same strength is related to both 0 and 1 values), the exact value of the RHS doesn't matter. It only matters if it equals z or not.
Such assignments are handled by changing the values to z of these bits that are overwritten by stronger assignments. Then all assignments can be aggregated as they would have equal strengths (by | on them and their __en expressions). To change the value to z, the RHS should be & with negation of __en expression of stronger assignments. Changing RHS's __en expression is not needed, because it will be then aggregated with __en expression of stronger assignments using |, so & with the negation can be safely skipped.
So the values of overwritten bits are actually changed to 0, which doesn't affect stronger assignments, because | operation was used.
This handling is implemented in the following way:

  • group the assignments by their strengths,
  • handle assignments of the same strength as they are handled now
  • assign results to var__strength and var__strength__en variables
  • aggregate the results:
    orp = orp | (var__strength & ~enp)
    enp = enp | var__strength__en,
    where orp is aggregated value and enp is aggregated __en value.

src/V3Tristate.cpp Outdated Show resolved Hide resolved
src/V3Tristate.cpp Outdated Show resolved Hide resolved
src/V3Tristate.cpp Outdated Show resolved Hide resolved
src/V3Tristate.cpp Outdated Show resolved Hide resolved
src/V3Tristate.cpp Outdated Show resolved Hide resolved
src/V3Tristate.cpp Outdated Show resolved Hide resolved
src/V3Tristate.cpp Outdated Show resolved Hide resolved
src/V3Tristate.cpp Outdated Show resolved Hide resolved
src/V3Tristate.cpp Outdated Show resolved Hide resolved
@RRozak RRozak force-pushed the signal-strengths-equal-strengths branch from b09d7bd to 3b7b721 Compare September 26, 2022 08:30
Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
@RRozak RRozak force-pushed the signal-strengths-equal-strengths branch from 3b7b721 to 16da9ed Compare September 26, 2022 08:33
@RRozak RRozak requested a review from wsnyder September 26, 2022 08:59
@wsnyder wsnyder merged commit 4931e48 into verilator:master Sep 27, 2022
@RRozak RRozak deleted the signal-strengths-equal-strengths branch October 6, 2022 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants