This repository has been archived by the owner on Aug 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 177
Add memory initialization options for synthesis #2166
Merged
Merged
Conversation
This file contains 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
I'd like some feedback on this approach and if it's the correct way to do it. I successfully got the results by changing the parameter on Also would be great to have a way to use this until the FPGA target is done. I thought about something like an annotation: annotate(new ChiselAnnotation {
override def toFirrtl =
firrtl.MemoryInitEmissionOption = firrtl.MemorySynthInit
}) But can't figure out how :) |
carlosedp
force-pushed
the
readmem-synth
branch
from
March 31, 2021 17:18
8c0b6d5
to
dbea7d0
Compare
jackkoenig
reviewed
Mar 31, 2021
This PR adds options for memory initialization inside or outside the `ifndef SYNTHESIS` block.
I think is is much cleaner and allows defining the behaviour by using an annotation in the Chisel code. annotate(new ChiselAnnotation {
override def toFirrtl =
firrtl.annotations.MemorySynthInit
// or
// firrtl.annotations.MemoryNoSynthInit
})
val mem = SyncReadMem(words, UInt(bitWidth.W))
if (memoryFile.trim().nonEmpty) {
println(s" Load memory file: " + memoryFile)
loadMemoryFromFileInline(mem, memoryFile)
} |
jackkoenig
reviewed
Apr 1, 2021
jackkoenig
reviewed
Apr 1, 2021
jackkoenig
reviewed
Apr 1, 2021
carlosedp
force-pushed
the
readmem-synth
branch
2 times, most recently
from
April 1, 2021 01:28
52596d8
to
55b3167
Compare
jackkoenig
reviewed
Apr 1, 2021
ekiwi
previously requested changes
Apr 1, 2021
Also I tested that the |
jackkoenig
approved these changes
Apr 1, 2021
mergify bot
pushed a commit
that referenced
this pull request
Apr 1, 2021
This PR adds options for memory initialization inside or outside the `ifndef SYNTHESIS` block. (cherry picked from commit d0d3cd4)
mergify
bot
added
the
Backported
This PR has been backported to marked stable branch
label
Apr 1, 2021
mergify bot
added a commit
that referenced
this pull request
Apr 8, 2021
This PR adds options for memory initialization inside or outside the `ifndef SYNTHESIS` block. (cherry picked from commit d0d3cd4) Co-authored-by: Carlos Eduardo <[email protected]> Co-authored-by: Jack Koenig <[email protected]>
johnsbrew
added a commit
to johnsbrew/firrtl
that referenced
this pull request
Jan 21, 2022
- Fix & test MemorySynthInit behavior with MemoryArrayInitAnnotation and MemoryScalarInitAnnotation. Add test case for MemoryRandomInitAnnotation which is, on the contrary, expected not to leak any randomization statement in synthesis context. - Refactor MemoryInitSpec for improved results readability Context: PR chipsalliance#2166 (commit: 4530152) introduced MemorySynthInit annotation to control whether statement generated with Memory*InitAnnotation (emitted within initial begin block in verilog) should be guarded with ifndef SYNTHESIS or not. Unfortunately only one configuration (MemoryFileInlineAnnotation) has been tested while the others have been generating incorrect verilog statements (MemoryArrayInitAnnotation and MemoryScalarInitAnnotation). Signed-off-by: Jean Bruant <[email protected]>
14 tasks
johnsbrew
added a commit
to johnsbrew/firrtl
that referenced
this pull request
Jan 21, 2022
- Fix & test MemorySynthInit behavior with MemoryArrayInitAnnotation and MemoryScalarInitAnnotation. Add test case for MemoryRandomInitAnnotation which is, on the contrary, expected not to leak any randomization statement in synthesis context. - Refactor MemoryInitSpec for improved results readability Context: PR chipsalliance#2166 (commit: 4530152) introduced MemorySynthInit annotation to control whether statement generated with Memory*InitAnnotation (emitted within initial begin block in verilog) should be guarded with ifndef SYNTHESIS or not. Unfortunately only one configuration (MemoryFileInlineAnnotation) has been tested while the others have been generating incorrect verilog statements (MemoryArrayInitAnnotation and MemoryScalarInitAnnotation). Signed-off-by: Jean Bruant <[email protected]>
jackkoenig
pushed a commit
that referenced
this pull request
Jan 27, 2022
- Fix & test MemorySynthInit behavior with MemoryArrayInitAnnotation and MemoryScalarInitAnnotation. Add test case for MemoryRandomInitAnnotation which is, on the contrary, expected not to leak any randomization statement in synthesis context. - Refactor MemoryInitSpec for improved results readability Context: PR #2166 (commit: 4530152) introduced MemorySynthInit annotation to control whether statement generated with Memory*InitAnnotation (emitted within initial begin block in verilog) should be guarded with ifndef SYNTHESIS or not. Unfortunately only one configuration (MemoryFileInlineAnnotation) has been tested while the others have been generating incorrect verilog statements (MemoryArrayInitAnnotation and MemoryScalarInitAnnotation). Signed-off-by: Jean Bruant <[email protected]>
mergify bot
pushed a commit
that referenced
this pull request
Jan 27, 2022
- Fix & test MemorySynthInit behavior with MemoryArrayInitAnnotation and MemoryScalarInitAnnotation. Add test case for MemoryRandomInitAnnotation which is, on the contrary, expected not to leak any randomization statement in synthesis context. - Refactor MemoryInitSpec for improved results readability Context: PR #2166 (commit: 4530152) introduced MemorySynthInit annotation to control whether statement generated with Memory*InitAnnotation (emitted within initial begin block in verilog) should be guarded with ifndef SYNTHESIS or not. Unfortunately only one configuration (MemoryFileInlineAnnotation) has been tested while the others have been generating incorrect verilog statements (MemoryArrayInitAnnotation and MemoryScalarInitAnnotation). Signed-off-by: Jean Bruant <[email protected]> (cherry picked from commit 475c165) # Conflicts: # src/main/scala/firrtl/backends/verilog/VerilogEmitter.scala
mergify bot
pushed a commit
that referenced
this pull request
Jan 27, 2022
- Fix & test MemorySynthInit behavior with MemoryArrayInitAnnotation and MemoryScalarInitAnnotation. Add test case for MemoryRandomInitAnnotation which is, on the contrary, expected not to leak any randomization statement in synthesis context. - Refactor MemoryInitSpec for improved results readability Context: PR #2166 (commit: 4530152) introduced MemorySynthInit annotation to control whether statement generated with Memory*InitAnnotation (emitted within initial begin block in verilog) should be guarded with ifndef SYNTHESIS or not. Unfortunately only one configuration (MemoryFileInlineAnnotation) has been tested while the others have been generating incorrect verilog statements (MemoryArrayInitAnnotation and MemoryScalarInitAnnotation). Signed-off-by: Jean Bruant <[email protected]> (cherry picked from commit 475c165)
mergify bot
added a commit
that referenced
this pull request
Jan 27, 2022
- Fix & test MemorySynthInit behavior with MemoryArrayInitAnnotation and MemoryScalarInitAnnotation. Add test case for MemoryRandomInitAnnotation which is, on the contrary, expected not to leak any randomization statement in synthesis context. - Refactor MemoryInitSpec for improved results readability Context: PR #2166 (commit: 4530152) introduced MemorySynthInit annotation to control whether statement generated with Memory*InitAnnotation (emitted within initial begin block in verilog) should be guarded with ifndef SYNTHESIS or not. Unfortunately only one configuration (MemoryFileInlineAnnotation) has been tested while the others have been generating incorrect verilog statements (MemoryArrayInitAnnotation and MemoryScalarInitAnnotation). Signed-off-by: Jean Bruant <[email protected]> (cherry picked from commit 475c165) Co-authored-by: John's Brew <[email protected]>
mergify bot
added a commit
that referenced
this pull request
Jan 27, 2022
* Fix faulty MemorySynthInit behavior (#2468) - Fix & test MemorySynthInit behavior with MemoryArrayInitAnnotation and MemoryScalarInitAnnotation. Add test case for MemoryRandomInitAnnotation which is, on the contrary, expected not to leak any randomization statement in synthesis context. - Refactor MemoryInitSpec for improved results readability Context: PR #2166 (commit: 4530152) introduced MemorySynthInit annotation to control whether statement generated with Memory*InitAnnotation (emitted within initial begin block in verilog) should be guarded with ifndef SYNTHESIS or not. Unfortunately only one configuration (MemoryFileInlineAnnotation) has been tested while the others have been generating incorrect verilog statements (MemoryArrayInitAnnotation and MemoryScalarInitAnnotation). Signed-off-by: Jean Bruant <[email protected]> (cherry picked from commit 475c165) # Conflicts: # src/main/scala/firrtl/backends/verilog/VerilogEmitter.scala * Fix conflict Co-authored-by: John's Brew <[email protected]> Co-authored-by: Jean Bruant <[email protected]>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 adds options for memory initialization inside or outside the
ifndef SYNTHESIS
block.Fixes #2114.
Contributor Checklist
Type of Improvement
API Impact
This new feature adds memory initialization options for having the
readmem
blocks inside or outside the existingifndef SYNTHESIS
.In the future, this parameter can be used by the
-target:fpga
PR (#2111) that is in development.Backend Code Generation Impact
This changes the generated Verilog code based on the parameters:
If using
MemoryNoSynthInit
(current default):If using
MemorySynthInit
:Desired Merge Strategy
Release Notes
This PR adds two annotations to determine how
readmem
statements are generated in Verilog code.By default, it is placed inside the
ifndef SYNTHESIS
block which gets ignored by some FPGA tools.One can add either
MemorySynthInit
orMemoryNoSynthInit
(which is the default if not defined) annotation to change the behaviour and have thereadmem
outside thisifndef
block.In the future, MemorySynthInit could be set as default for FPGA targets (
-target:FPGA
).TBD
Reviewer Checklist (only modified by reviewer)
Please Merge
?