Repository navigation
Declare field storage before the write buffers - #218
Open
davekeeshan wants to merge 2 commits into
Open
davekeeshan wants to merge 2 commits into
davekeeshan wants to merge 2 commits into
Conversation
A wbuffer_trigger may name a field (singlepulse) or a propref such as anded, which dereferences to field_storage.<path>.value. The module template emitted the write-buffer implementation before the field storage struct, so generated RTL used field_storage before declaring it. IEEE 1800 requires data to be declared before use; strict elaborators (Icarus, xezim) reject the output. Emit field storage ahead of the write-buffer section when the design has buffered write regs. Designs without them render byte-identically. Reproduced with tests/test_write_buffer/regblock.rdl, which already takes triggers from a singlepulse field and from trig_vec->anded.
Exports tests/test_write_buffer against the passthrough CPUIF and checks that field_storage_t field_storage; appears before its first read. That RDL takes a write-buffer trigger from a singlepulse field and from trig_vec->anded, so the write-buffer always_ff blocks dereference field_storage. Needs no simulator; runs under --sim-tool skip.
This branch has not been deployed
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.
Summary
Fixes #217.
A
wbuffer_triggerthat names a field (asinglepulsefield) or a propref(
trig_vec->anded) is dereferenced byWriteBuffering.get_raw_trigger()tofield_storage.<path>.value. The module template emitted the write-bufferimplementation before the field storage struct, so the generated RTL read
field_storagebefore declaring it.IEEE 1800 requires data to be declared before use, so strict tools reject the
output:
Unable to bind wire/reg/memory 'field_storage'Undefined variable 'field_storage': referenced before its declarationChange
src/peakrdl_regblock/module_tmpl.sv: emitfield_logic.get_storage_struct()ahead of the write-buffer section when the design has buffered write registers.
The field storage struct does not depend on write buffering, so the field logic
section keeps the declaration for designs without them.
Designs without buffered write registers render byte-identically (verified by
diffing the
tests/test_basicoutput before and after).Test
tests/test_write_buffer/test_declaration_order.pyexportstests/test_write_buffer/regblock.rdlwith the passthrough CPUIF and assertsthat
field_storage_t field_storage;precedes its first read. That RDL alreadycovers both trigger forms, so no RDL change is needed. The test needs no
simulator and runs under
--sim-tool skip.Verified:
ed07496(declaration at offset 26615,first use at offset 18829)tests/test_write_bufferstill passes on Verilator and on xezim