Verilog: fold Verilog-specific constructs when propagating constants in synthesis - #2053
Draft
kroening wants to merge 1 commit into
Draft
Verilog: fold Verilog-specific constructs when propagating constants in synthesis#2053kroening wants to merge 1 commit into
kroening wants to merge 1 commit into
Conversation
…in synthesis
When synthesising a blocking assignment, synth_assign tries to simplify the
right-hand side to a constant so the value can be propagated (needed, among
other things, to unroll for/while loops by evaluating their guard each
iteration). It used the plain simplifier, which does not know how to reduce
Verilog-specific constructs such as replication ({n{x}}) to a constant.
As a result a loop whose bit-vector loop variable is initialised with a
replication, e.g.
for(data_mask = {1'b1, {DW-1{1'b0}}}; data_mask != 0;
data_mask = data_mask >> 1)
left data_mask non-constant, so synthesis reported "synthesis failed to
evaluate loop guard". Use the Verilog-aware simplifier instead, which lowers
replication to a concatenation before folding. The result is only used when
it is constant, so non-constant right-hand sides are unaffected.
This is the root cause of the loop-guard failures for the LogikBench
blocks/ethmac (rtl/eth_lfsr.v:235) and blocks/lfsr (rtl/lfsr.v:235)
benchmarks.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When synthesising a blocking assignment,
synth_assigntries to simplifythe right-hand side to a constant so the value can be propagated (needed,
among other things, to unroll for/while loops by evaluating their guard
each iteration). It used the plain simplifier, which does not know how to
reduce Verilog-specific constructs such as replication (
{n{x}}) to aconstant.
As a result a loop whose bit-vector loop variable is initialised with a
replication, e.g.
left
data_masknon-constant, so synthesis reported "synthesis failed toevaluate loop guard". Uses the Verilog-aware simplifier instead, which
lowers replication to a concatenation before folding. The result is only
used when it is constant, so non-constant right-hand sides are unaffected.
This is the root cause of the loop-guard failures for the LogikBench
blocks/ethmac(rtl/eth_lfsr.v:235) andblocks/lfsr(rtl/lfsr.v:235)benchmarks.
New regression test:
regression/verilog/synth_loop_guard_bitvector1.