Internals: Minor refactoring of checker parsing/tests. No functional change.

This commit is contained in:
Wilson Snyder 2025-04-06 23:13:24 -04:00
parent c7ff82f06b
commit c8a945f363
8 changed files with 72 additions and 54 deletions

View File

@ -114,7 +114,7 @@ public:
callp->argTypes("vlSymsp");
} else {
if (m_type.isCoverage()) callp->argTypes("first");
callp->selfPointer(VSelfPointerText{VSelfPointerText::This()});
callp->selfPointer(VSelfPointerText{VSelfPointerText::This{}});
}
rootFuncp->addStmtsp(callp->makeStmt());
}
@ -235,7 +235,7 @@ void V3CCtors::evalAsserts() {
// if (signal & CONST(upper_non_clean_mask)) { fail; }
AstVarRef* const vrefp
= new AstVarRef{varp->fileline(), varp, VAccess::READ};
vrefp->selfPointer(VSelfPointerText{VSelfPointerText::This()});
vrefp->selfPointer(VSelfPointerText{VSelfPointerText::This{}});
AstNodeExpr* newp = vrefp;
if (varp->isWide()) {
newp = new AstWordSel{

View File

@ -74,7 +74,7 @@ class DescopeVisitor final : public VNVisitor {
string name = scopep->name();
string::size_type pos;
if ((pos = name.rfind('.')) != string::npos) name.erase(0, pos + 1);
ret.thisPtr = VSelfPointerText{VSelfPointerText::This(), name};
ret.thisPtr = VSelfPointerText{VSelfPointerText::This{}, name};
}
return ret.thisPtr;
}
@ -104,9 +104,9 @@ class DescopeVisitor final : public VNVisitor {
if (VN_IS(scopep->modp(), Class)) {
// Direct reference to class members are from within the class itself, references from
// outside the class must go via AstMemberSel
return VSelfPointerText{VSelfPointerText::This()};
return VSelfPointerText{VSelfPointerText::This{}};
} else if (relativeRefOk && scopep == m_scopep) {
return VSelfPointerText{VSelfPointerText::This()};
return VSelfPointerText{VSelfPointerText::This{}};
} else if (relativeRefOk && !m_modSingleton && scopep->aboveScopep() == m_scopep
&& VN_IS(scopep->modp(), Module)) {
// Reference to scope of instance directly under this module, can just "this->cell",

View File

@ -1496,7 +1496,7 @@ list_of_ports<nodep>: // IEEE: list_of_ports + list_of_port_declaratio
portAndTagE<nodep>:
/* empty */
{ int p = PINNUMINC();
{ const int p = PINNUMINC();
const string name = "__pinNumber" + cvtToStr(p);
$$ = new AstPort{CRELINE(), p, name};
AstVar* varp = new AstVar{CRELINE(), VVarType::WIRE, name, VFlagChildDType{},
@ -6304,22 +6304,26 @@ property_port_item<nodep>: // IEEE: property_port_item/sequence_port_item
// // id {variable_dimension} [ '=' property_actual_arg ]
// // seq IEEE: [ yLOCAL [ sequence_lvar_port_direction ] ] sequence_formal_type
// // id {variable_dimension} [ '=' sequence_actual_arg ]
property_port_itemFront property_port_itemAssignment { $$ = $2; }
property_port_itemFront property_port_itemAssignment { $$ = $2; }
;
property_port_itemFront: // IEEE: part of property_port_item/sequence_port_item
property_port_itemDirE property_formal_typeNoDt { VARDTYPE($2); }
property_port_itemDirE property_formal_typeNoDt
{ VARDTYPE($2); }
// // data_type_or_implicit
| property_port_itemDirE data_type
{ VARDTYPE($2); GRAMMARP->m_typedPropertyPort = true; }
| property_port_itemDirE yVAR data_type
{ VARDTYPE($3); GRAMMARP->m_typedPropertyPort = true; }
| property_port_itemDirE yVAR implicit_typeE { VARDTYPE($3); }
| property_port_itemDirE implicit_typeE { VARDTYPE($2); }
| property_port_itemDirE yVAR implicit_typeE
{ VARDTYPE($3); }
| property_port_itemDirE implicit_typeE
{ VARDTYPE($2); }
;
property_port_itemAssignment<nodep>: // IEEE: part of property_port_item/sequence_port_item/checker_port_direction
id variable_dimensionListE { $$ = VARDONEA($<fl>1, *$1, $2, nullptr); }
id variable_dimensionListE
{ $$ = VARDONEA($<fl>1, *$1, $2, nullptr); }
| id variable_dimensionListE '=' property_actual_arg
{ $$ = VARDONEA($<fl>1, *$1, $2, $4);
BBUNSUP($3, "Unsupported: property variable default value"); }
@ -7128,7 +7132,7 @@ rs_case_item<nodep>: // ==IEEE: rs_case_item
//**********************************************************************
// Checker
checker_declaration<nodep>: // ==IEEE: part of checker_declaration
checker_declaration<nodeModulep>: // ==IEEE: part of checker_declaration
checkerFront checker_port_listE ';'
checker_or_generate_itemListE yENDCHECKER endLabelE
{ $$ = $1;

View File

@ -1,38 +0,0 @@
%Error-UNSUPPORTED: t/t_checker.v:33:1: Unsupported: checker
33 | checker Chk
| ^~~~~~~
... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest
%Error-UNSUPPORTED: t/t_checker.v:36:8: Unsupported: checker data declaration
36 | bit clk;
| ^~~
%Error-UNSUPPORTED: t/t_checker.v:37:8: Unsupported: checker data declaration
37 | bit in;
| ^~
%Error-UNSUPPORTED: t/t_checker.v:38:8: Unsupported: checker data declaration
38 | bit rst;
| ^~~
%Error-UNSUPPORTED: t/t_checker.v:39:4: Unsupported: checker rand
39 | rand bit randed;
| ^~~~
%Error-UNSUPPORTED: t/t_checker.v:41:8: Unsupported: checker data declaration
41 | int counter = 0;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_checker.v:43:8: Unsupported: checker data declaration
43 | int ival;
| ^~~~
%Error-UNSUPPORTED: t/t_checker.v:53:8: Unsupported: checker data declaration
53 | int ival2;
| ^~~~~
%Error-UNSUPPORTED: t/t_checker.v:61:4: Unsupported: checker default clocking
61 | default clocking clk;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_checker.v:62:4: Unsupported: checker default disable iff
62 | default disable iff rst;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_checker.v:64:4: Unsupported: checker
64 | checker ChkChk;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_checker.v:64:12: Unsupported: recursive checker
64 | checker ChkChk;
| ^~~~~~
%Error: Exiting due to

View File

@ -0,0 +1,44 @@
%Error-UNSUPPORTED: t/t_checker_unsup.v:31:4: Unsupported: checker
31 | checker checker_in_module;
| ^~~~~~~
... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest
%Error-UNSUPPORTED: t/t_checker_unsup.v:37:4: Unsupported: checker
37 | checker checker_in_pkg;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_checker_unsup.v:41:1: Unsupported: checker
41 | checker Chk
| ^~~~~~~
%Error-UNSUPPORTED: t/t_checker_unsup.v:44:8: Unsupported: checker data declaration
44 | bit clk;
| ^~~
%Error-UNSUPPORTED: t/t_checker_unsup.v:45:8: Unsupported: checker data declaration
45 | bit in;
| ^~
%Error-UNSUPPORTED: t/t_checker_unsup.v:46:8: Unsupported: checker data declaration
46 | bit rst;
| ^~~
%Error-UNSUPPORTED: t/t_checker_unsup.v:47:4: Unsupported: checker rand
47 | rand bit randed;
| ^~~~
%Error-UNSUPPORTED: t/t_checker_unsup.v:49:8: Unsupported: checker data declaration
49 | int counter = 0;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_checker_unsup.v:51:8: Unsupported: checker data declaration
51 | int ival;
| ^~~~
%Error-UNSUPPORTED: t/t_checker_unsup.v:61:8: Unsupported: checker data declaration
61 | int ival2;
| ^~~~~
%Error-UNSUPPORTED: t/t_checker_unsup.v:69:4: Unsupported: checker default clocking
69 | default clocking clk;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_checker_unsup.v:70:4: Unsupported: checker default disable iff
70 | default disable iff rst;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_checker_unsup.v:72:4: Unsupported: checker
72 | checker ChkChk;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_checker_unsup.v:72:12: Unsupported: recursive checker
72 | checker ChkChk;
| ^~~~~~
%Error: Exiting due to

View File

@ -28,8 +28,16 @@ module t(/*AUTOARG*/
Chk check(clk, cyc);
checker checker_in_module;
endchecker
endmodule
package Pkg;
checker checker_in_pkg;
endchecker
endpackage
checker Chk
// UNSUP (input clk, int in)
;

View File

@ -19,17 +19,17 @@ test.compile(v_flags2=['--no-json-edit-nums', '+define+ATTRIBUTES', '+define+NOU
if test.vlt_all:
test.file_grep(
out_filename,
r'{"type":"MODULE","name":"ma",.*"loc":"\w,84:[^"]*","origName":"ma",.*,"modPublic":true')
r'{"type":"MODULE","name":"ma",.*"loc":"\w,84:[^"]*",.*"origName":"ma",.*,"modPublic":true')
test.file_grep(
out_filename,
r'{"type":"MODULE","name":"mb",.*"loc":"\w,99:[^"]*","origName":"mb",.*"modPublic":true')
r'{"type":"MODULE","name":"mb",.*"loc":"\w,99:[^"]*",.*"origName":"mb",.*"modPublic":true')
test.file_grep(
out_filename,
r'{"type":"MODULE","name":"mc","addr":"[^"]*","loc":"\w,127:[^"]*","origName":"mc",.*"modPublic":true'
r'{"type":"MODULE","name":"mc","addr":"[^"]*","loc":"\w,127:[^"]*",.*"origName":"mc",.*"modPublic":true'
)
test.file_grep(
out_filename,
r'{"type":"MODULE","name":"mc__PB1","addr":"[^"]*","loc":"\w,127:[^"]*","origName":"mc",.*"modPublic":true'
r'{"type":"MODULE","name":"mc__PB1","addr":"[^"]*","loc":"\w,127:[^"]*",.*"origName":"mc",.*"modPublic":true'
)
test.execute()