[Seq] Introduce seq.initial, !seq.immutable and replace powerOn value with initial value in compreg #7553
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.
This PR extends compreg's powerOnValue operand to be able to capture more complicated initialization such as firreg's randomized initialization or DPI calls. This change should make register initialization more modular and a step forward towards #7213.
While ASICs might not have explicit initial values, they are crucial for simulation
and FPGA implementation. FPGA designs often require constant initial values, while
simulation allows for more complex initialization using expressions like function calls
$random
,$readmem
, and$fopen
.seq.compreg has a (optional) powerOn operand that is lowered into inlined assignment in SV which allows users to initialize registers with user-specified values. However this representation is not sufficient for initialization with function calls.
In order to represent various kinds of initialization,
seq.initial
op and!seq.immutable
typeare introduced. The
seq.initial
operation produces values with types wrapped in!seq.immutable
.The
!seq.immutable
type wrapper prevents initial values from depending on time-variant values.Stateful operations typically require corresponding initial values with the
!seq.immutable
type.This ensures that the initial state of the operation is well-defined and independent of time-variant factors.
Example Input:
Output Verilog: