Skip to content
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

[slang-netlist] Refactor handling of variable references with selectors #826

Merged
merged 37 commits into from
Sep 24, 2023

Conversation

jameshanlon
Copy link
Contributor

@jameshanlon jameshanlon commented Sep 23, 2023

This patch refactors slang-netlist's handling of variable references with selectors. This handling is used to determine if two distinct variable references have data dependencies. Previously, a simplistic scheme was used that only handled array element selects and struct member selects. The new scheme calculates the bit range for any combination of selectors by recursively inspecting the data types. One omission is that it does not (yet) handle descending ranges, eg [0:3].

Fixes #792.

* master:
  [slang-netlist] Exclude unused modules from netlist (MikePopoloski#807)
  Fix spurious errors when constraining elaboration due to hitting error limits
  Add checking for recursive library maps and command file includes
  Support library map syntax trees being added to Compilations
  Support incdirs in library map directives
  Update CHANGELOG.md
  Tweak command line arg docs
* master:
  Bump version for v4.0
  Remove done TODO
- Handle non-zero array indexing
- Handle all arrays with array logic
- Add SelectionKind to range select to prepare for handling of different
  range operators
- Prepare for handling of non-constant elment and range selects.
* master: (24 commits)
  Move SFormat to ast namespace
  Implement %t format specifier in constant eval
  Resolve TODO about dotted access of types
  Add test for interface-based typedefs
  New slang-tidy checks (MikePopoloski#816)
  Add Wsign-conversion
  Fixes for slang-tidy (MikePopoloski#814)
  Fix spurious errors reported when speculative eval of an expression subtree fails
  Fix clang sanitizer warnings
  Add ignore doc entry for unimplemented Wsign-conversion warning
  Fix counting of suppressed warnings-as-errors
  Fix crash when $static_assert condition is parenthesized
  Fix spurious error about multi-driven modport members when access through an interface array
  Suppress Wimplicit-conv for identical but otherwise non-matching structs
  Add Wconstant-conversion
  Refactor EvalContext to depend on an ASTContext member instead of taking it in various methods
  Handle modports in top-level interface port connections
  Add option to allow top-level modules to have interface ports
  Fix python bindings
  Additional test for interface array modport connections
  ...
Refactor expression
Start adding logic for non-constant selects
* master:
  Fix inference of parameters from large based integer literals
  Fix Wvector-overflow to work correctly with signed literals
  Fix cases where constant conversions were not being checked due to missing tryEval calls
* master:
  Add checking for streaming operators that produce values larger than the maximum object size
  Type::getBitstreamWidth can now return a uint32_t, no possibility for overflow
  Rename bitstreamWidth -> getBitstreamWidth
  Enforce bitstream width limits for classes inside structs, unpacked arrays
  SmallVector.h: avoid casting away constness (MikePopoloski#821)
  Win32: add missing manifest to tool unittest executables
  Fix gcc + clang warnings
  chore: update pre-commit hooks (MikePopoloski#820)
  Tweak message for ObjectTooLarge diagnostic
  Error if a declared class type is too large
  Remove unreachable diagnostic path for bits of dynamic type
  Remove wchar special cases for Windows now that it can use UTF-8 as the active code page
  Win32: add a manifest to set the active code page to utf-8
@codecov
Copy link

codecov bot commented Sep 23, 2023

Codecov Report

Merging #826 (a3aac22) into master (71f9f70) will increase coverage by 0.00%.
Report is 4 commits behind head on master.
The diff coverage is 50.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #826   +/-   ##
=======================================
  Coverage   93.67%   93.68%           
=======================================
  Files         191      191           
  Lines       46248    46254    +6     
=======================================
+ Hits        43323    43332    +9     
+ Misses       2925     2922    -3     
Files Changed Coverage
source/numeric/ConstantValue.cpp 0.00%
include/slang/numeric/ConstantValue.h 100.00%

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 71f9f70...a3aac22. Read the comment docs.

@MikePopoloski
Copy link
Owner

Some of this logic seems to mirror what slang does for detecting overlapping / duplicate drivers of bits. I wonder if it could be refactored to make use of the existing logic (see the code in ValueSymbol.cpp / all of the longest static prefix stuff) which would let you get rid of a lot of this code. What you have here is fine though so I'm going to merge it.

@MikePopoloski MikePopoloski merged commit c910a85 into MikePopoloski:master Sep 24, 2023
17 checks passed
@jameshanlon
Copy link
Contributor Author

Thanks @MikePopoloski. I hadn't seen the similar code in ValueSymbol.cpp, but I'll take a look at refactoring what I've got.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

slang-netlist assertion on bus expression in ports
2 participants