Skip to content

Commit 6025474

Browse files
kdaneckiRRozak
authored andcommitted
[#94012] Handle covergroups
1 parent d0addab commit 6025474

5 files changed

Lines changed: 35 additions & 0 deletions

File tree

source/DeclRemover.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ class DeclRemover : public IncrementalRewriter<DeclRemover> {
6262
removeNode(node, isNodeRemovable);
6363
return VISIT_CHILDREN;
6464
}
65+
66+
ShouldVisitChildren handle(const CovergroupDeclarationSyntax& node, bool isNodeRemovable) {
67+
removeNode(node, isNodeRemovable);
68+
return DONT_VISIT_CHILDREN;
69+
}
6570
};
6671

6772
template bool rewriteLoop<DeclRemover>(std::shared_ptr<SyntaxTree>& tree,

tests/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,7 @@ test_caliptra_grep: test_caliptra_grep_default test_caliptra_grep_1_at_once
130130
.PHONY: test_disable_line_remover
131131
test_disable_line_remover:
132132
@./run_test disable_line_remover checkgrep.sh ${INPUT_DIR}/disable_line_remover.sv --fno-line-remover
133+
134+
.PHONY: test_remove_covergroup
135+
test_remove_covergroup:
136+
@./run_test remove_covergroup checkgrepfinish.sh ${INPUT_DIR}/remove_covergroup.sv

tests/checkgrepfinish.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# assert that certain part of input wasn't removed
5+
6+
grep "finish" "$@" -q && exit 0 # for remove_covergroups.sv
7+
8+
exit 1
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module t;
2+
initial begin
3+
$finish;
4+
end;
5+
endmodule
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module t;
2+
logic a, b;
3+
covergroup cg @ (posedge a);
4+
coverpoint b;
5+
endgroup
6+
cg cg_inst;
7+
int c;
8+
bit d;
9+
initial begin;
10+
d = c;
11+
$finish;
12+
end;
13+
endmodule

0 commit comments

Comments
 (0)