-
Notifications
You must be signed in to change notification settings - Fork 187
Replace all asserts & assumes with macros from assertions.svh
#233
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
Merged
niwis
merged 25 commits into
pulp-platform:master
from
michael-platzer:michael-platzer/feature/use-assert-macros
Oct 4, 2024
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
1df4e91
assertions: Rename defines for consistency
michael-platzer a4ab123
assertions: Enable in Verilator by default, disable with global ASSER…
michael-platzer b90413c
assertions: Allow overriding any defines that turn asserts off
michael-platzer 6128757
assertions: Undefine helper macros at end of header
michael-platzer c978a9e
assertions: Add optional description msg arg to all assert macros
michael-platzer e55f24d
Include assertions.svh header in all sources using assertions
michael-platzer 3565379
Replace all named concurrent assertions with ASSERT macro
michael-platzer a96c2ad
Replace unnamed concurrent assertions with ASSERT macro
michael-platzer 8a6d004
Replace concurrent assertions without message with ASSERT macro
michael-platzer 1093b48
Replace all concurrent assumes with ASSUME macro
michael-platzer 0a0ec7e
Replace all immediate asserts in initial blocks with ASSERT_INIT macro
michael-platzer 0e1e16c
Replace final assertion with ASSERT_FINAL macro
michael-platzer eeef8fd
Replace initial assertions with ASSERT_INIT macro
michael-platzer b4ecb95
Replace all immediate assumes with ASSUME_I macro
michael-platzer de574b8
Remove unnecessary ifndefs for SYNTHESIS around assertions
michael-platzer eb08c3f
spill_register_flushable: Promote flush+feed warning to error
michael-platzer 8e117dc
Remove obsolete default disables for assertions
michael-platzer 35b6a64
addr_decode_dync: Promote onehot assert warning to error
michael-platzer f543c00
stream_omega_net: Use $sformatf() for assert msg
michael-platzer d7c357d
stream_xbar: Use $sformatf() for assert msg
michael-platzer 0a5647a
Distribute ASSERT macros over multiple lines
michael-platzer 647ec7d
stream_omega_net: Fix typo in assert name
michael-platzer ed55c2a
mem_to_banks_detailed: Check power of 2 in a more sensible way
michael-platzer 5b66e85
stream_intf: Replace non-existing reset with constant in asserts
michael-platzer f69ec8d
stream_inft: Add missing include of assertions.svh
michael-platzer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,8 @@ | |
| // - Michael Rogenmoser <[email protected]> | ||
| // - Thomas Benz <[email protected]> | ||
|
|
||
| `include "common_cells/assertions.svh" | ||
|
|
||
| /// Address Decoder: Maps the input address combinatorially to an index. | ||
| /// DYNamic Configuration (DYNC) version | ||
| /// The address map `addr_map_i` is a packed array of rule_t structs. | ||
|
|
@@ -123,20 +125,16 @@ module addr_decode_dync #( | |
|
|
||
| // Assumptions and assertions | ||
| `ifndef COMMON_CELLS_ASSERTS_OFF | ||
| `ifndef XSIM | ||
| `ifndef SYNTHESIS | ||
| initial begin : proc_check_parameters | ||
| assume ($bits(addr_i) == $bits(addr_map_i[0].start_addr)) else | ||
| $warning($sformatf("Input address has %d bits and address map has %d bits.", | ||
| $bits(addr_i), $bits(addr_map_i[0].start_addr))); | ||
| assume (NoRules > 0) else | ||
| $fatal(1, $sformatf("At least one rule needed")); | ||
| assume (NoIndices > 0) else | ||
| $fatal(1, $sformatf("At least one index needed")); | ||
| `ASSUME_I(addr_width_mismatch, $bits(addr_i) == $bits(addr_map_i[0].start_addr), | ||
| $sformatf("Input address has %d bits and address map has %d bits.", | ||
| $bits(addr_i), $bits(addr_map_i[0].start_addr))) | ||
| `ASSUME_I(norules_0, NoRules > 0, $sformatf("At least one rule needed")) | ||
| `ASSUME_I(noindices_0, NoIndices > 0, $sformatf("At least one index needed")) | ||
| end | ||
|
|
||
| assert final ($onehot0(matched_rules) || config_ongoing_i) else | ||
| $warning("More than one bit set in the one-hot signal, matched_rules"); | ||
| `ASSERT_FINAL(more_than_1_bit_set, $onehot0(matched_rules) || config_ongoing_i, | ||
| "More than one bit set in the one-hot signal, matched_rules") | ||
|
|
||
| // These following assumptions check the validity of the address map. | ||
| // The assumptions gets generated for each distinct pair of rules. | ||
|
|
@@ -149,43 +147,41 @@ module addr_decode_dync #( | |
| always @(addr_map_i or config_ongoing_i) #0 begin : proc_check_addr_map | ||
| if (!$isunknown(addr_map_i) && ~config_ongoing_i) begin | ||
| for (int unsigned i = 0; i < NoRules; i++) begin | ||
| check_start : assume (Napot || addr_map_i[i].start_addr < addr_map_i[i].end_addr || | ||
| addr_map_i[i].end_addr == '0) else | ||
| $fatal(1, $sformatf("This rule has a higher start than end address!!!\n\ | ||
| `ASSUME_I(check_start, Napot || addr_map_i[i].start_addr < addr_map_i[i].end_addr || | ||
| addr_map_i[i].end_addr == '0, | ||
| $sformatf("This rule has a higher start than end address!!!\n\ | ||
| Violating rule %d.\n\ | ||
| Rule> IDX: %h START: %h END: %h\n\ | ||
| #####################################################", | ||
| i ,addr_map_i[i].idx, addr_map_i[i].start_addr, addr_map_i[i].end_addr)); | ||
| i ,addr_map_i[i].idx, addr_map_i[i].start_addr, addr_map_i[i].end_addr)) | ||
| // check the SLV ids | ||
| check_idx : assume (addr_map_i[i].idx < NoIndices) else | ||
| $fatal(1, $sformatf("This rule has a IDX that is not allowed!!!\n\ | ||
| `ASSUME_I(check_idx, addr_map_i[i].idx < NoIndices, | ||
| $sformatf("This rule has a IDX that is not allowed!!!\n\ | ||
| Violating rule %d.\n\ | ||
| Rule> IDX: %h START: %h END: %h\n\ | ||
| Rule> MAX_IDX: %h\n\ | ||
| #####################################################", | ||
| i, addr_map_i[i].idx, addr_map_i[i].start_addr, addr_map_i[i].end_addr, | ||
| (NoIndices-1))); | ||
| (NoIndices-1))) | ||
| for (int unsigned j = i + 1; j < NoRules; j++) begin | ||
| // overlap check | ||
| check_overlap : assume (Napot || | ||
| `ASSUME_I(check_overlap, Napot || | ||
| !((addr_map_i[j].start_addr < addr_map_i[i].end_addr) && | ||
| (addr_map_i[j].end_addr > addr_map_i[i].start_addr)) || | ||
| !((addr_map_i[i].end_addr == '0) && | ||
| (addr_map_i[j].end_addr > addr_map_i[i].start_addr)) || | ||
| !((addr_map_i[j].start_addr < addr_map_i[i].end_addr) && | ||
| (addr_map_i[j].end_addr == '0))) else | ||
| $warning($sformatf("Overlapping address region found!!!\n\ | ||
| (addr_map_i[j].end_addr == '0)), | ||
| $sformatf("Overlapping address region found!!!\n\ | ||
| Rule %d: IDX: %h START: %h END: %h\n\ | ||
| Rule %d: IDX: %h START: %h END: %h\n\ | ||
| #####################################################", | ||
| i, addr_map_i[i].idx, addr_map_i[i].start_addr, addr_map_i[i].end_addr, | ||
| j, addr_map_i[j].idx, addr_map_i[j].start_addr, addr_map_i[j].end_addr)); | ||
| j, addr_map_i[j].idx, addr_map_i[j].start_addr, addr_map_i[j].end_addr)) | ||
| end | ||
| end | ||
| end | ||
| end | ||
| `endif | ||
| `endif | ||
| `endif | ||
|
|
||
| endmodule | ||
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.