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

Fix netlist creation when code contains concurrent assertions #1005

Merged
merged 5 commits into from
Jun 16, 2024

Conversation

udif
Copy link
Contributor

@udif udif commented May 22, 2024

This is the beginning of a PR to fix #1002 .
It works for a simple testcase that fails otherwise, but I still see different failures (DirectedGraph issue, might be unrelated) when reading larger examples such as those provided in #1002, so I don't think it is ready yet, but it's a start and it can be reviewed.

Copy link

codecov bot commented May 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.70%. Comparing base (07b7d65) to head (36bea5a).
Report is 3 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1005   +/-   ##
=======================================
  Coverage   94.70%   94.70%           
=======================================
  Files         191      191           
  Lines       47569    47593   +24     
=======================================
+ Hits        45048    45071   +23     
- Misses       2521     2522    +1     

see 4 files with indirect coverage changes


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 07b7d65...36bea5a. Read the comment docs.

tools/netlist/include/NetlistVisitor.h Outdated Show resolved Hide resolved
@@ -605,6 +605,14 @@ class NetlistVisitor : public ast::ASTVisitor<NetlistVisitor, true, false> {
ast::EdgeKind edgeKind = ast::EdgeKind::None;
if (symbol.procedureKind == ast::ProceduralBlockKind::AlwaysFF ||
symbol.procedureKind == ast::ProceduralBlockKind::Always) {
// auto& body = symbol.getBody();
if (symbol.getBody().kind == ast::StatementKind::Block) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to just ignore all statements that aren't a TimedStatement? Otherwise you'll still crash below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I'm not sure what elements can be nested in the AST, I would rather get a fault during debugging rather than silently skipping netlist elements by mistake.
At the moment, I'm explicitly checking for those AST elements I know I need to skip, in this case a concurrent assertion under a sequential block.
Can concurrent assertions be found elsewhere?

@@ -55,3 +55,40 @@ endmodule
auto netlist = createNetlist(compilation);
CHECK(netlist.numNodes() > 0);
}

TEST_CASE("Ignore concurrent assertions") {
// Test that unused modules are not visited by the netlist builder.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment is copy pasta from the previous test case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed locally, will be pushed when I have more meaningful changes later.

@MikePopoloski
Copy link
Owner

What's the status of this PR?

@udif
Copy link
Contributor Author

udif commented Jun 11, 2024

I apologize, after being blocked by #1007 I forgot about this, thanks for reminding me.
I will have to rebase it on the new Netlist code. It will take me a few more days.

Also fixed test in NameTest.cpp due to more strict slang errors.
@udif
Copy link
Contributor Author

udif commented Jun 15, 2024

I think it is OK now.

@MikePopoloski MikePopoloski merged commit f38d6a0 into MikePopoloski:master Jun 16, 2024
15 checks passed
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.

Assertion 'T::isKind(kind)' failed
2 participants