Support 'with' into elaboration (only).

This commit is contained in:
Wilson Snyder 2020-10-31 10:00:55 -04:00
parent 85b05366bc
commit 085e8454b8
11 changed files with 602 additions and 159 deletions

View File

@ -696,7 +696,8 @@ public:
STMTTEMP,
XTEMP,
IFACEREF, // Used to link Interfaces between modules
MEMBER
MEMBER,
WITH
};
enum en m_e;
inline AstVarType()
@ -711,7 +712,7 @@ public:
static const char* const names[] = {
"?", "GPARAM", "LPARAM", "GENVAR", "VAR", "SUPPLY0", "SUPPLY1",
"WIRE", "WREAL", "IMPLICITWIRE", "TRIWIRE", "TRI0", "TRI1", "PORT",
"BLOCKTEMP", "MODULETEMP", "STMTTEMP", "XTEMP", "IFACEREF", "MEMBER"};
"BLOCKTEMP", "MODULETEMP", "STMTTEMP", "XTEMP", "IFACEREF", "MEMBER", "WITH"};
return names[m_e];
}
bool isSignal() const {
@ -727,7 +728,7 @@ public:
bool isProcAssignable() const {
return (m_e == GPARAM || m_e == LPARAM || m_e == GENVAR || m_e == VAR || m_e == BLOCKTEMP
|| m_e == MODULETEMP || m_e == STMTTEMP || m_e == XTEMP || m_e == IFACEREF
|| m_e == MEMBER);
|| m_e == MEMBER || m_e == WITH);
}
bool isTemp() const {
return (m_e == BLOCKTEMP || m_e == MODULETEMP || m_e == STMTTEMP || m_e == XTEMP);

View File

@ -3091,6 +3091,27 @@ public:
AstNode* exprp() const { return op2p(); }
};
class AstWith : public AstNodeStmt {
// Used as argument to method, then to AstCMethodHard
// dtypep() contains the with lambda's return dtype
// Parents: funcref (similar to AstArg)
// Children: VAR that declares the index variable
// Children: math (equation establishing the with)
public:
AstWith(FileLine* fl, AstVar* varp, AstNode* exprp)
: ASTGEN_SUPER(fl) {
addOp1p(varp);
addNOp2p(exprp);
}
ASTNODE_NODE_FUNCS(With)
virtual V3Hash sameHash() const override { return V3Hash(); }
virtual bool same(const AstNode* samep) const override { return true; }
virtual bool hasDType() const override { return true; }
//
AstVar* varp() const { return VN_CAST(op1p(), Var); }
AstNode* exprp() const { return op2p(); }
};
//######################################################################
class AstSenItem : public AstNode {

View File

@ -713,6 +713,7 @@ class LinkDotFindVisitor : public AstNVisitor {
int m_blockNum = 0; // Begin block number, 0=none seen
bool m_explicitNew = false; // Hit a "new" function
int m_modBlockNum = 0; // Begin block number in module, 0=none seen
int m_modWithNum = 0; // With block number, 0=none seen
// METHODS
static int debug() { return LinkDotState::debug(); }
@ -775,6 +776,7 @@ class LinkDotFindVisitor : public AstNVisitor {
VL_RESTORER(m_paramNum);
VL_RESTORER(m_blockNum);
VL_RESTORER(m_modBlockNum);
VL_RESTORER(m_modWithNum);
if (doit && nodep->user2()) {
nodep->v3warn(E_UNSUPPORTED,
"Unsupported: Identically recursive module (module instantiates "
@ -801,6 +803,7 @@ class LinkDotFindVisitor : public AstNVisitor {
m_paramNum = 0;
m_blockNum = 0;
m_modBlockNum = 0;
m_modWithNum = 0;
// m_modSymp/m_curSymp for non-packages set by AstCell above this module
// Iterate
nodep->user2(true);
@ -836,6 +839,7 @@ class LinkDotFindVisitor : public AstNVisitor {
VL_RESTORER(m_paramNum);
VL_RESTORER(m_blockNum);
VL_RESTORER(m_modBlockNum);
VL_RESTORER(m_modWithNum);
{
UINFO(4, " Link Class: " << nodep << endl);
VSymEnt* upperSymp = m_curSymp;
@ -848,6 +852,7 @@ class LinkDotFindVisitor : public AstNVisitor {
m_paramNum = 0;
m_blockNum = 0;
m_modBlockNum = 0;
m_modWithNum = 0;
m_explicitNew = false;
// m_modSymp/m_curSymp for non-packages set by AstCell above this module
// Iterate
@ -1247,6 +1252,44 @@ class LinkDotFindVisitor : public AstNVisitor {
m_curSymp->exportStarStar(m_statep->symsp());
// No longer needed, but can't delete until any multi-instantiated modules are expanded
}
virtual void visit(AstWithParse* nodep) override {
// Change WITHPARSE(FUNCREF, equation) to FUNCREF(WITH(equation))
auto funcrefp = VN_CAST(nodep->funcrefp(), NodeFTaskRef);
UASSERT_OBJ(funcrefp, nodep, "'with' only can operate on a function/task");
string name = "item";
FileLine* argFl = nodep->fileline();
if (auto argp = VN_CAST(funcrefp->pinsp(), Arg)) {
if (auto parserefp = VN_CAST(argp->exprp(), ParseRef)) {
name = parserefp->name();
argFl = parserefp->fileline();
} else {
argp->v3error("'with' function expects simple variable name");
}
if (argp->nextp())
argp->nextp()->v3error("'with' function expects only up to one argument");
VL_DO_DANGLING(argp->unlinkFrBack()->deleteTree(), argp);
}
// Type depends on the method used, let V3Width figure it out later
auto* varp = new AstVar(argFl, AstVarType::WITH, name, VFlagChildDType(),
new AstParseTypeDType(nodep->fileline()));
auto* newp = new AstWith(nodep->fileline(), varp, nodep->exprp()->unlinkFrBackWithNext());
funcrefp->addPinsp(newp);
nodep->replaceWith(funcrefp->unlinkFrBack());
VL_DO_DANGLING(nodep->deleteTree(), nodep);
}
virtual void visit(AstWith* nodep) override {
// Symbol table needs nodep->name() as the index variable's name
// Iteration will pickup the AstVar we made under AstWith
VL_RESTORER(m_curSymp);
VSymEnt* const oldCurSymp = m_curSymp;
{
++m_modWithNum;
m_curSymp = m_statep->insertBlock(m_curSymp, "__Vwith" + cvtToStr(m_modWithNum), nodep,
m_packagep);
m_curSymp->fallbackp(oldCurSymp);
iterateChildren(nodep);
}
}
virtual void visit(AstNode* nodep) override { iterateChildren(nodep); }
@ -2400,11 +2443,6 @@ private:
iterateChildren(nodep);
}
}
virtual void visit(AstWithParse* nodep) override {
nodep->v3warn(E_UNSUPPORTED, "Unsupported: with statements");
nodep->replaceWith(nodep->funcrefp()->unlinkFrBack());
VL_DO_DANGLING(nodep->deleteTree(), nodep);
}
virtual void visit(AstVar* nodep) override {
checkNoDot(nodep);
iterateChildren(nodep);
@ -2658,6 +2696,16 @@ private:
m_ds.m_dotSymp = m_curSymp = oldCurSymp;
m_ftaskp = nullptr;
}
virtual void visit(AstWith* nodep) override {
UINFO(5, " " << nodep << endl);
checkNoDot(nodep);
VSymEnt* oldCurSymp = m_curSymp;
{
m_ds.m_dotSymp = m_curSymp = m_statep->getNodeSym(nodep);
iterateChildren(nodep);
}
m_ds.m_dotSymp = m_curSymp = oldCurSymp;
}
virtual void visit(AstClass* nodep) override {
UINFO(5, " " << nodep << endl);
checkNoDot(nodep);

View File

@ -2267,6 +2267,7 @@ private:
if (debug() >= 9) nodep->dumpTree("-mts-in: ");
// Should check types the method requires, but at present we don't do much
userIterate(nodep->fromp(), WidthVP(SELF, BOTH).p());
// Any AstWith is checked later when know types, in methodWithArgument
for (AstArg* argp = VN_CAST(nodep->pinsp(), Arg); argp;
argp = VN_CAST(argp->nextp(), Arg)) {
if (argp->exprp()) userIterate(argp->exprp(), WidthVP(SELF, BOTH).p());
@ -2302,6 +2303,12 @@ private:
void methodOkArguments(AstMethodCall* nodep, int minArg, int maxArg) {
int narg = 0;
for (AstNode* argp = nodep->pinsp(); argp; argp = argp->nextp()) {
if (VN_IS(argp, With)) {
argp->v3error("'with' not legal on this method");
// Delete all arguments as nextp() otherwise dangling
VL_DO_DANGLING(pushDeletep(argp->unlinkFrBackWithNext()), argp);
break;
}
++narg;
UASSERT_OBJ(VN_IS(argp, Arg), nodep, "Method arg without Arg type");
}
@ -2483,6 +2490,7 @@ private:
<< " not legal on associative arrays");
} else {
nodep->v3error("Unknown built-in associative array method " << nodep->prettyNameQ());
nodep->dtypeFrom(adtypep->subDTypep()); // Best guess
}
if (newp) {
newp->didWidth(true);
@ -2536,6 +2544,7 @@ private:
} else {
nodep->v3warn(E_UNSUPPORTED, "Unsupported/unknown built-in dynamic array method "
<< nodep->prettyNameQ());
nodep->dtypeFrom(adtypep->subDTypep()); // Best guess
}
if (newp) {
newp->didWidth(true);
@ -2623,8 +2632,9 @@ private:
newp->protect(false);
newp->makeStatement();
} else {
nodep->v3warn(E_UNSUPPORTED, "Unsupported/unknown built-in associative array method "
<< nodep->prettyNameQ());
nodep->v3warn(E_UNSUPPORTED,
"Unsupported/unknown built-in queue method " << nodep->prettyNameQ());
nodep->dtypeFrom(adtypep->subDTypep()); // Best guess
}
if (newp) {
newp->didWidth(true);
@ -2715,6 +2725,7 @@ private:
VL_DO_DANGLING(nodep->deleteTree(), nodep);
} else {
nodep->v3error("Unknown built-in array method " << nodep->prettyNameQ());
nodep->dtypeFrom(adtypep->subDTypep()); // Best guess
}
}
void methodCallEvent(AstMethodCall* nodep, AstBasicDType* adtypep) {
@ -4103,6 +4114,11 @@ private:
userIterateChildren(nodep, nullptr);
m_procedurep = nullptr;
}
virtual void visit(AstWith* nodep) override {
// Should otherwise be underneath a method call
nodep->v3warn(E_UNSUPPORTED, "Unsupported: with statements in this context");
VL_DO_DANGLING(nodep->deleteTree(), nodep);
}
virtual void visit(AstNetlist* nodep) override {
// Iterate modules backwards, in bottom-up order. That's faster
userIterateChildrenBackwards(nodep, nullptr);

View File

@ -1,64 +1,129 @@
%Error-UNSUPPORTED: t/t_array_method.v:26:14: Unsupported: with statements
%Error: t/t_array_method.v:24:9: Unknown built-in array method 'sort'
: ... In instance t
24 | q.sort;
| ^~~~
%Error: t/t_array_method.v:26:9: Unknown built-in array method 'sort'
: ... In instance t
26 | q.sort with (item == 2);
| ^~~~
%Error-UNSUPPORTED: t/t_array_method.v:28:17: Unsupported: with statements
| ^~~~
%Error: t/t_array_method.v:28:9: Unknown built-in array method 'sort'
: ... In instance t
28 | q.sort(x) with (x == 3);
| ^~~~
%Error: t/t_array_method.v:28:14: Can't find definition of variable: 'x'
28 | q.sort(x) with (x == 3);
| ^
%Error-UNSUPPORTED: t/t_array_method.v:33:15: Unsupported: with statements
| ^~~~
%Error: t/t_array_method.v:31:9: Unknown built-in array method 'rsort'
: ... In instance t
31 | q.rsort;
| ^~~~~
%Error: t/t_array_method.v:33:9: Unknown built-in array method 'rsort'
: ... In instance t
33 | q.rsort with (item == 2);
| ^~~~
%Error-UNSUPPORTED: t/t_array_method.v:47:19: Unsupported: with statements
| ^~~~~
%Error: t/t_array_method.v:36:14: Unknown built-in array method 'unique'
: ... In instance t
36 | qv = q.unique;
| ^~~~~~
%Error: t/t_array_method.v:38:14: Unknown built-in array method 'unique_index'
: ... In instance t
38 | qi = q.unique_index; qi.sort;
| ^~~~~~~~~~~~
%Error-UNSUPPORTED: t/t_array_method.v:38:31: Unsupported/unknown built-in queue method 'sort'
: ... In instance t
38 | qi = q.unique_index; qi.sort;
| ^~~~
%Error: t/t_array_method.v:40:9: Unknown built-in array method 'reverse'
: ... In instance t
40 | q.reverse;
| ^~~~~~~
%Error: t/t_array_method.v:42:9: Unknown built-in array method 'shuffle'
: ... In instance t
42 | q.shuffle(); q.sort;
| ^~~~~~~
%Error: t/t_array_method.v:42:22: Unknown built-in array method 'sort'
: ... In instance t
42 | q.shuffle(); q.sort;
| ^~~~
%Error: t/t_array_method.v:47:14: Unknown built-in array method 'find'
: ... In instance t
47 | qv = q.find with (item == 2);
| ^~~~
%Error-UNSUPPORTED: t/t_array_method.v:49:25: Unsupported: with statements
| ^~~~
%Error: t/t_array_method.v:49:14: Unknown built-in array method 'find_first'
: ... In instance t
49 | qv = q.find_first with (item == 2);
| ^~~~
%Error-UNSUPPORTED: t/t_array_method.v:51:24: Unsupported: with statements
| ^~~~~~~~~~
%Error: t/t_array_method.v:51:14: Unknown built-in array method 'find_last'
: ... In instance t
51 | qv = q.find_last with (item == 2);
| ^~~~
%Error-UNSUPPORTED: t/t_array_method.v:54:19: Unsupported: with statements
| ^~~~~~~~~
%Error: t/t_array_method.v:54:14: Unknown built-in array method 'find'
: ... In instance t
54 | qv = q.find with (item == 20);
| ^~~~
%Error-UNSUPPORTED: t/t_array_method.v:56:25: Unsupported: with statements
| ^~~~
%Error: t/t_array_method.v:56:14: Unknown built-in array method 'find_first'
: ... In instance t
56 | qv = q.find_first with (item == 20);
| ^~~~
%Error-UNSUPPORTED: t/t_array_method.v:58:24: Unsupported: with statements
| ^~~~~~~~~~
%Error: t/t_array_method.v:58:14: Unknown built-in array method 'find_last'
: ... In instance t
58 | qv = q.find_last with (item == 20);
| ^~~~
%Error-UNSUPPORTED: t/t_array_method.v:61:25: Unsupported: with statements
| ^~~~~~~~~
%Error: t/t_array_method.v:61:14: Unknown built-in array method 'find_index'
: ... In instance t
61 | qi = q.find_index with (item == 2); qi.sort;
| ^~~~
%Error-UNSUPPORTED: t/t_array_method.v:63:31: Unsupported: with statements
| ^~~~~~~~~~
%Error-UNSUPPORTED: t/t_array_method.v:61:46: Unsupported/unknown built-in queue method 'sort'
: ... In instance t
61 | qi = q.find_index with (item == 2); qi.sort;
| ^~~~
%Error: t/t_array_method.v:63:14: Unknown built-in array method 'find_first_index'
: ... In instance t
63 | qi = q.find_first_index with (item == 2);
| ^~~~
%Error-UNSUPPORTED: t/t_array_method.v:65:30: Unsupported: with statements
| ^~~~~~~~~~~~~~~~
%Error: t/t_array_method.v:65:14: Unknown built-in array method 'find_last_index'
: ... In instance t
65 | qi = q.find_last_index with (item == 2);
| ^~~~
%Error-UNSUPPORTED: t/t_array_method.v:68:25: Unsupported: with statements
| ^~~~~~~~~~~~~~~
%Error: t/t_array_method.v:68:14: Unknown built-in array method 'find_index'
: ... In instance t
68 | qi = q.find_index with (item == 20); qi.sort;
| ^~~~
%Error-UNSUPPORTED: t/t_array_method.v:70:31: Unsupported: with statements
| ^~~~~~~~~~
%Error-UNSUPPORTED: t/t_array_method.v:68:47: Unsupported/unknown built-in queue method 'sort'
: ... In instance t
68 | qi = q.find_index with (item == 20); qi.sort;
| ^~~~
%Error: t/t_array_method.v:70:14: Unknown built-in array method 'find_first_index'
: ... In instance t
70 | qi = q.find_first_index with (item == 20);
| ^~~~
%Error-UNSUPPORTED: t/t_array_method.v:72:30: Unsupported: with statements
| ^~~~~~~~~~~~~~~~
%Error: t/t_array_method.v:72:14: Unknown built-in array method 'find_last_index'
: ... In instance t
72 | qi = q.find_last_index with (item == 20);
| ^~~~
%Error-UNSUPPORTED: t/t_array_method.v:83:17: Unsupported: with statements
| ^~~~~~~~~~~~~~~
%Error: t/t_array_method.v:75:14: Unknown built-in array method 'min'
: ... In instance t
75 | qv = q.min;
| ^~~
%Error: t/t_array_method.v:77:14: Unknown built-in array method 'max'
: ... In instance t
77 | qv = q.max;
| ^~~
%Error: t/t_array_method.v:83:17: 'with' not legal on this method
: ... In instance t
83 | i = q.sum with (item + 1); do if ((i) !== (32'h11)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", "t/t_array_method.v",83, (i), (32'h11)); $stop; end while(0);;
| ^~~~
%Error-UNSUPPORTED: t/t_array_method.v:85:21: Unsupported: with statements
%Error: t/t_array_method.v:85:21: 'with' not legal on this method
: ... In instance t
85 | i = q.product with (item + 1); do if ((i) !== (32'h168)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", "t/t_array_method.v",85, (i), (32'h168)); $stop; end while(0);;
| ^~~~
%Error-UNSUPPORTED: t/t_array_method.v:89:17: Unsupported: with statements
%Error: t/t_array_method.v:89:17: 'with' not legal on this method
: ... In instance t
89 | i = q.and with (item + 1); do if ((i) !== (32'b1001)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", "t/t_array_method.v",89, (i), (32'b1001)); $stop; end while(0);;
| ^~~~
%Error-UNSUPPORTED: t/t_array_method.v:91:16: Unsupported: with statements
%Error: t/t_array_method.v:91:16: 'with' not legal on this method
: ... In instance t
91 | i = q.or with (item + 1); do if ((i) !== (32'b1111)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", "t/t_array_method.v",91, (i), (32'b1111)); $stop; end while(0);;
| ^~~~
%Error-UNSUPPORTED: t/t_array_method.v:93:17: Unsupported: with statements
%Error: t/t_array_method.v:93:17: 'with' not legal on this method
: ... In instance t
93 | i = q.xor with (item + 1); do if ((i) !== (32'hb)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", "t/t_array_method.v",93, (i), (32'hb)); $stop; end while(0);;
| ^~~~
%Error: Exiting due to

View File

@ -1,52 +1,153 @@
%Error-UNSUPPORTED: t/t_assoc_method.v:42:19: Unsupported: with statements
%Error: t/t_assoc_method.v:31:14: Unknown built-in associative array method 'unique'
: ... In instance t
31 | qv = q.unique;
| ^~~~~~
%Error: t/t_assoc_method.v:33:15: Unknown built-in associative array method 'unique'
: ... In instance t
33 | qv = qe.unique;
| ^~~~~~
%Error: t/t_assoc_method.v:35:14: Unknown built-in associative array method 'unique_index'
: ... In instance t
35 | qi = q.unique_index; qi.sort;
| ^~~~~~~~~~~~
%Error-UNSUPPORTED: t/t_assoc_method.v:35:31: Unsupported/unknown built-in queue method 'sort'
: ... In instance t
35 | qi = q.unique_index; qi.sort;
| ^~~~
%Error: t/t_assoc_method.v:37:15: Unknown built-in associative array method 'unique_index'
: ... In instance t
37 | qv = qe.unique_index;
| ^~~~~~~~~~~~
%Error: t/t_assoc_method.v:42:14: Unknown built-in associative array method 'find'
: ... In instance t
42 | qv = q.find with (item == 2);
| ^~~~
%Error-UNSUPPORTED: t/t_assoc_method.v:44:25: Unsupported: with statements
| ^~~~
%Error: t/t_assoc_method.v:44:14: Unknown built-in associative array method 'find_first'
: ... In instance t
44 | qv = q.find_first with (item == 2);
| ^~~~
%Error-UNSUPPORTED: t/t_assoc_method.v:46:24: Unsupported: with statements
| ^~~~~~~~~~
%Error: t/t_assoc_method.v:46:14: Unknown built-in associative array method 'find_last'
: ... In instance t
46 | qv = q.find_last with (item == 2);
| ^~~~
%Error-UNSUPPORTED: t/t_assoc_method.v:49:19: Unsupported: with statements
| ^~~~~~~~~
%Error: t/t_assoc_method.v:49:14: Unknown built-in associative array method 'find'
: ... In instance t
49 | qv = q.find with (item == 20);
| ^~~~
%Error-UNSUPPORTED: t/t_assoc_method.v:51:25: Unsupported: with statements
| ^~~~
%Error: t/t_assoc_method.v:51:14: Unknown built-in associative array method 'find_first'
: ... In instance t
51 | qv = q.find_first with (item == 20);
| ^~~~
%Error-UNSUPPORTED: t/t_assoc_method.v:53:24: Unsupported: with statements
| ^~~~~~~~~~
%Error: t/t_assoc_method.v:53:14: Unknown built-in associative array method 'find_last'
: ... In instance t
53 | qv = q.find_last with (item == 20);
| ^~~~
%Error-UNSUPPORTED: t/t_assoc_method.v:56:25: Unsupported: with statements
| ^~~~~~~~~
%Error: t/t_assoc_method.v:56:14: Unknown built-in associative array method 'find_index'
: ... In instance t
56 | qi = q.find_index with (item == 2); qi.sort;
| ^~~~
%Error-UNSUPPORTED: t/t_assoc_method.v:58:31: Unsupported: with statements
| ^~~~~~~~~~
%Error-UNSUPPORTED: t/t_assoc_method.v:56:46: Unsupported/unknown built-in queue method 'sort'
: ... In instance t
56 | qi = q.find_index with (item == 2); qi.sort;
| ^~~~
%Error: t/t_assoc_method.v:58:14: Unknown built-in associative array method 'find_first_index'
: ... In instance t
58 | qi = q.find_first_index with (item == 2);
| ^~~~
%Error-UNSUPPORTED: t/t_assoc_method.v:60:30: Unsupported: with statements
| ^~~~~~~~~~~~~~~~
%Error: t/t_assoc_method.v:60:14: Unknown built-in associative array method 'find_last_index'
: ... In instance t
60 | qi = q.find_last_index with (item == 2);
| ^~~~
%Error-UNSUPPORTED: t/t_assoc_method.v:63:25: Unsupported: with statements
| ^~~~~~~~~~~~~~~
%Error: t/t_assoc_method.v:63:14: Unknown built-in associative array method 'find_index'
: ... In instance t
63 | qi = q.find_index with (item == 20); qi.sort;
| ^~~~
%Error-UNSUPPORTED: t/t_assoc_method.v:65:31: Unsupported: with statements
| ^~~~~~~~~~
%Error-UNSUPPORTED: t/t_assoc_method.v:63:47: Unsupported/unknown built-in queue method 'sort'
: ... In instance t
63 | qi = q.find_index with (item == 20); qi.sort;
| ^~~~
%Error: t/t_assoc_method.v:65:14: Unknown built-in associative array method 'find_first_index'
: ... In instance t
65 | qi = q.find_first_index with (item == 20);
| ^~~~
%Error-UNSUPPORTED: t/t_assoc_method.v:67:30: Unsupported: with statements
| ^~~~~~~~~~~~~~~~
%Error: t/t_assoc_method.v:67:14: Unknown built-in associative array method 'find_last_index'
: ... In instance t
67 | qi = q.find_last_index with (item == 20);
| ^~~~
%Error-UNSUPPORTED: t/t_assoc_method.v:83:17: Unsupported: with statements
| ^~~~~~~~~~~~~~~
%Error: t/t_assoc_method.v:70:14: Unknown built-in associative array method 'min'
: ... In instance t
70 | qv = q.min;
| ^~~
%Error: t/t_assoc_method.v:72:14: Unknown built-in associative array method 'max'
: ... In instance t
72 | qv = q.max;
| ^~~
%Error: t/t_assoc_method.v:75:15: Unknown built-in associative array method 'min'
: ... In instance t
75 | qv = qe.min;
| ^~~
%Error: t/t_assoc_method.v:77:15: Unknown built-in associative array method 'max'
: ... In instance t
77 | qv = qe.max;
| ^~~
%Error: t/t_assoc_method.v:82:13: Unknown built-in associative array method 'sum'
: ... In instance t
82 | i = q.sum; do if ((i) !== (32'hc)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", "t/t_assoc_method.v",82, (i), (32'hc)); $stop; end while(0);;
| ^~~
%Error: t/t_assoc_method.v:83:13: Unknown built-in associative array method 'sum'
: ... In instance t
83 | i = q.sum with (item + 1); do if ((i) !== (32'h11)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", "t/t_assoc_method.v",83, (i), (32'h11)); $stop; end while(0);;
| ^~~~
%Error-UNSUPPORTED: t/t_assoc_method.v:85:21: Unsupported: with statements
| ^~~
%Error: t/t_assoc_method.v:84:13: Unknown built-in associative array method 'product'
: ... In instance t
84 | i = q.product; do if ((i) !== (32'h30)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", "t/t_assoc_method.v",84, (i), (32'h30)); $stop; end while(0);;
| ^~~~~~~
%Error: t/t_assoc_method.v:85:13: Unknown built-in associative array method 'product'
: ... In instance t
85 | i = q.product with (item + 1); do if ((i) !== (32'h168)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", "t/t_assoc_method.v",85, (i), (32'h168)); $stop; end while(0);;
| ^~~~
%Error-UNSUPPORTED: t/t_assoc_method.v:92:17: Unsupported: with statements
| ^~~~~~~
%Error: t/t_assoc_method.v:87:14: Unknown built-in associative array method 'sum'
: ... In instance t
87 | i = qe.sum; do if ((i) !== (32'h0)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", "t/t_assoc_method.v",87, (i), (32'h0)); $stop; end while(0);;
| ^~~
%Error: t/t_assoc_method.v:88:14: Unknown built-in associative array method 'product'
: ... In instance t
88 | i = qe.product; do if ((i) !== (32'h0)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", "t/t_assoc_method.v",88, (i), (32'h0)); $stop; end while(0);;
| ^~~~~~~
%Error: t/t_assoc_method.v:91:13: Unknown built-in associative array method 'and'
: ... In instance t
91 | i = q.and; do if ((i) !== (32'b1000)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", "t/t_assoc_method.v",91, (i), (32'b1000)); $stop; end while(0);;
| ^~~
%Error: t/t_assoc_method.v:92:13: Unknown built-in associative array method 'and'
: ... In instance t
92 | i = q.and with (item + 1); do if ((i) !== (32'b1001)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", "t/t_assoc_method.v",92, (i), (32'b1001)); $stop; end while(0);;
| ^~~~
%Error-UNSUPPORTED: t/t_assoc_method.v:94:16: Unsupported: with statements
| ^~~
%Error: t/t_assoc_method.v:93:13: Unknown built-in associative array method 'or'
: ... In instance t
93 | i = q.or; do if ((i) !== (32'b1110)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", "t/t_assoc_method.v",93, (i), (32'b1110)); $stop; end while(0);;
| ^~
%Error: t/t_assoc_method.v:94:13: Unknown built-in associative array method 'or'
: ... In instance t
94 | i = q.or with (item + 1); do if ((i) !== (32'b1111)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", "t/t_assoc_method.v",94, (i), (32'b1111)); $stop; end while(0);;
| ^~~~
%Error-UNSUPPORTED: t/t_assoc_method.v:96:17: Unsupported: with statements
| ^~
%Error: t/t_assoc_method.v:95:13: Unknown built-in associative array method 'xor'
: ... In instance t
95 | i = q.xor; do if ((i) !== (32'b0110)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", "t/t_assoc_method.v",95, (i), (32'b0110)); $stop; end while(0);;
| ^~~
%Error: t/t_assoc_method.v:96:13: Unknown built-in associative array method 'xor'
: ... In instance t
96 | i = q.xor with (item + 1); do if ((i) !== (32'b0110)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", "t/t_assoc_method.v",96, (i), (32'b0110)); $stop; end while(0);;
| ^~~~
| ^~~
%Error: t/t_assoc_method.v:98:14: Unknown built-in associative array method 'and'
: ... In instance t
98 | i = qe.and; do if ((i) !== (32'b0)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", "t/t_assoc_method.v",98, (i), (32'b0)); $stop; end while(0);;
| ^~~
%Error: t/t_assoc_method.v:99:14: Unknown built-in associative array method 'or'
: ... In instance t
99 | i = qe.or; do if ((i) !== (32'b0)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", "t/t_assoc_method.v",99, (i), (32'b0)); $stop; end while(0);;
| ^~
%Error: t/t_assoc_method.v:100:14: Unknown built-in associative array method 'xor'
: ... In instance t
100 | i = qe.xor; do if ((i) !== (32'b0)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", "t/t_assoc_method.v",100, (i), (32'b0)); $stop; end while(0);;
| ^~~
%Error: Exiting due to

View File

@ -1,70 +1,201 @@
%Error-UNSUPPORTED: t/t_queue_method.v:28:14: Unsupported: with statements
%Error-UNSUPPORTED: t/t_queue_method.v:26:9: Unsupported/unknown built-in queue method 'sort'
: ... In instance t
26 | q.sort;
| ^~~~
%Error-UNSUPPORTED: t/t_queue_method.v:28:9: Unsupported/unknown built-in queue method 'sort'
: ... In instance t
28 | q.sort with (10 - item);
| ^~~~
%Error-UNSUPPORTED: t/t_queue_method.v:30:17: Unsupported: with statements
| ^~~~
%Error-UNSUPPORTED: t/t_queue_method.v:30:9: Unsupported/unknown built-in queue method 'sort'
: ... In instance t
30 | q.sort(x) with (10 - x);
| ^~~~
%Error: t/t_queue_method.v:30:14: Can't find definition of variable: 'x'
30 | q.sort(x) with (10 - x);
| ^
%Error-UNSUPPORTED: t/t_queue_method.v:32:18: Unsupported: with statements
| ^~~~
%Error-UNSUPPORTED: t/t_queue_method.v:32:10: Unsupported/unknown built-in queue method 'sort'
: ... In instance t
32 | qe.sort(x) with (10 - x);
| ^~~~
%Error-UNSUPPORTED: t/t_queue_method.v:36:15: Unsupported: with statements
| ^~~~
%Error-UNSUPPORTED: t/t_queue_method.v:34:9: Unsupported/unknown built-in queue method 'rsort'
: ... In instance t
34 | q.rsort;
| ^~~~~
%Error-UNSUPPORTED: t/t_queue_method.v:36:9: Unsupported/unknown built-in queue method 'rsort'
: ... In instance t
36 | q.rsort with (10 - item);
| ^~~~
%Error-UNSUPPORTED: t/t_queue_method.v:38:19: Unsupported: with statements
| ^~~~~
%Error-UNSUPPORTED: t/t_queue_method.v:38:10: Unsupported/unknown built-in queue method 'rsort'
: ... In instance t
38 | qe.rsort(x) with (10 - x);
| ^~~~
%Error-UNSUPPORTED: t/t_queue_method.v:62:19: Unsupported: with statements
| ^~~~~
%Error-UNSUPPORTED: t/t_queue_method.v:42:14: Unsupported/unknown built-in queue method 'unique'
: ... In instance t
42 | qv = q.unique;
| ^~~~~~
%Error-UNSUPPORTED: t/t_queue_method.v:44:15: Unsupported/unknown built-in queue method 'unique'
: ... In instance t
44 | qv = qe.unique;
| ^~~~~~
%Error-UNSUPPORTED: t/t_queue_method.v:46:14: Unsupported/unknown built-in queue method 'unique_index'
: ... In instance t
46 | qi = q.unique_index; qv.sort;
| ^~~~~~~~~~~~
%Error-UNSUPPORTED: t/t_queue_method.v:46:31: Unsupported/unknown built-in queue method 'sort'
: ... In instance t
46 | qi = q.unique_index; qv.sort;
| ^~~~
%Error-UNSUPPORTED: t/t_queue_method.v:48:15: Unsupported/unknown built-in queue method 'unique_index'
: ... In instance t
48 | qi = qe.unique_index;
| ^~~~~~~~~~~~
%Error-UNSUPPORTED: t/t_queue_method.v:51:9: Unsupported/unknown built-in queue method 'reverse'
: ... In instance t
51 | q.reverse;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_queue_method.v:53:10: Unsupported/unknown built-in queue method 'reverse'
: ... In instance t
53 | qe.reverse;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_queue_method.v:55:9: Unsupported/unknown built-in queue method 'shuffle'
: ... In instance t
55 | q.shuffle(); q.sort;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_queue_method.v:55:22: Unsupported/unknown built-in queue method 'sort'
: ... In instance t
55 | q.shuffle(); q.sort;
| ^~~~
%Error-UNSUPPORTED: t/t_queue_method.v:57:10: Unsupported/unknown built-in queue method 'shuffle'
: ... In instance t
57 | qe.shuffle();
| ^~~~~~~
%Error-UNSUPPORTED: t/t_queue_method.v:62:14: Unsupported/unknown built-in queue method 'find'
: ... In instance t
62 | qv = q.find with (item == 2);
| ^~~~
%Error-UNSUPPORTED: t/t_queue_method.v:64:25: Unsupported: with statements
| ^~~~
%Error-UNSUPPORTED: t/t_queue_method.v:64:14: Unsupported/unknown built-in queue method 'find_first'
: ... In instance t
64 | qv = q.find_first with (item == 2);
| ^~~~
%Error-UNSUPPORTED: t/t_queue_method.v:66:24: Unsupported: with statements
| ^~~~~~~~~~
%Error-UNSUPPORTED: t/t_queue_method.v:66:14: Unsupported/unknown built-in queue method 'find_last'
: ... In instance t
66 | qv = q.find_last with (item == 2);
| ^~~~
%Error-UNSUPPORTED: t/t_queue_method.v:69:19: Unsupported: with statements
| ^~~~~~~~~
%Error-UNSUPPORTED: t/t_queue_method.v:69:14: Unsupported/unknown built-in queue method 'find'
: ... In instance t
69 | qv = q.find with (item == 20);
| ^~~~
%Error-UNSUPPORTED: t/t_queue_method.v:71:25: Unsupported: with statements
| ^~~~
%Error-UNSUPPORTED: t/t_queue_method.v:71:14: Unsupported/unknown built-in queue method 'find_first'
: ... In instance t
71 | qv = q.find_first with (item == 20);
| ^~~~
%Error-UNSUPPORTED: t/t_queue_method.v:73:24: Unsupported: with statements
| ^~~~~~~~~~
%Error-UNSUPPORTED: t/t_queue_method.v:73:14: Unsupported/unknown built-in queue method 'find_last'
: ... In instance t
73 | qv = q.find_last with (item == 20);
| ^~~~
%Error-UNSUPPORTED: t/t_queue_method.v:76:25: Unsupported: with statements
| ^~~~~~~~~
%Error-UNSUPPORTED: t/t_queue_method.v:76:14: Unsupported/unknown built-in queue method 'find_index'
: ... In instance t
76 | qi = q.find_index with (item == 2);
| ^~~~
%Error-UNSUPPORTED: t/t_queue_method.v:78:31: Unsupported: with statements
| ^~~~~~~~~~
%Error-UNSUPPORTED: t/t_queue_method.v:77:10: Unsupported/unknown built-in queue method 'sort'
: ... In instance t
77 | qi.sort; v = $sformatf("%p", qi); do if ((v) !== ("'{'h1, 'h2} ")) begin $write("%%Error: %s:%0d: got='%s' exp='%s'\n", "t/t_queue_method.v",77, (v), ("'{'h1, 'h2} ")); $stop; end while(0);;
| ^~~~
%Error-UNSUPPORTED: t/t_queue_method.v:78:14: Unsupported/unknown built-in queue method 'find_first_index'
: ... In instance t
78 | qi = q.find_first_index with (item == 2);
| ^~~~
%Error-UNSUPPORTED: t/t_queue_method.v:80:30: Unsupported: with statements
| ^~~~~~~~~~~~~~~~
%Error-UNSUPPORTED: t/t_queue_method.v:80:14: Unsupported/unknown built-in queue method 'find_last_index'
: ... In instance t
80 | qi = q.find_last_index with (item == 2);
| ^~~~
%Error-UNSUPPORTED: t/t_queue_method.v:83:25: Unsupported: with statements
| ^~~~~~~~~~~~~~~
%Error-UNSUPPORTED: t/t_queue_method.v:83:14: Unsupported/unknown built-in queue method 'find_index'
: ... In instance t
83 | qi = q.find_index with (item == 20); qi.sort;
| ^~~~
%Error-UNSUPPORTED: t/t_queue_method.v:85:31: Unsupported: with statements
| ^~~~~~~~~~
%Error-UNSUPPORTED: t/t_queue_method.v:83:47: Unsupported/unknown built-in queue method 'sort'
: ... In instance t
83 | qi = q.find_index with (item == 20); qi.sort;
| ^~~~
%Error-UNSUPPORTED: t/t_queue_method.v:85:14: Unsupported/unknown built-in queue method 'find_first_index'
: ... In instance t
85 | qi = q.find_first_index with (item == 20);
| ^~~~
%Error-UNSUPPORTED: t/t_queue_method.v:87:30: Unsupported: with statements
| ^~~~~~~~~~~~~~~~
%Error-UNSUPPORTED: t/t_queue_method.v:87:14: Unsupported/unknown built-in queue method 'find_last_index'
: ... In instance t
87 | qi = q.find_last_index with (item == 20);
| ^~~~
%Error-UNSUPPORTED: t/t_queue_method.v:102:17: Unsupported: with statements
| ^~~~~~~~~~~~~~~
%Error-UNSUPPORTED: t/t_queue_method.v:90:14: Unsupported/unknown built-in queue method 'min'
: ... In instance t
90 | qv = q.min;
| ^~~
%Error-UNSUPPORTED: t/t_queue_method.v:92:14: Unsupported/unknown built-in queue method 'max'
: ... In instance t
92 | qv = q.max;
| ^~~
%Error-UNSUPPORTED: t/t_queue_method.v:94:15: Unsupported/unknown built-in queue method 'min'
: ... In instance t
94 | qv = qe.min;
| ^~~
%Error-UNSUPPORTED: t/t_queue_method.v:96:15: Unsupported/unknown built-in queue method 'max'
: ... In instance t
96 | qv = qe.max;
| ^~~
%Error-UNSUPPORTED: t/t_queue_method.v:100:13: Unsupported/unknown built-in queue method 'sum'
: ... In instance t
100 | i = q.sum;
| ^~~
%Error-UNSUPPORTED: t/t_queue_method.v:102:13: Unsupported/unknown built-in queue method 'sum'
: ... In instance t
102 | i = q.sum with (item + 1);
| ^~~~
%Error-UNSUPPORTED: t/t_queue_method.v:106:21: Unsupported: with statements
| ^~~
%Error-UNSUPPORTED: t/t_queue_method.v:104:13: Unsupported/unknown built-in queue method 'product'
: ... In instance t
104 | i = q.product;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_queue_method.v:106:13: Unsupported/unknown built-in queue method 'product'
: ... In instance t
106 | i = q.product with (item + 1);
| ^~~~
%Error-UNSUPPORTED: t/t_queue_method.v:117:17: Unsupported: with statements
| ^~~~~~~
%Error-UNSUPPORTED: t/t_queue_method.v:109:14: Unsupported/unknown built-in queue method 'sum'
: ... In instance t
109 | i = qe.sum;
| ^~~
%Error-UNSUPPORTED: t/t_queue_method.v:111:14: Unsupported/unknown built-in queue method 'product'
: ... In instance t
111 | i = qe.product;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_queue_method.v:115:13: Unsupported/unknown built-in queue method 'and'
: ... In instance t
115 | i = q.and;
| ^~~
%Error-UNSUPPORTED: t/t_queue_method.v:117:13: Unsupported/unknown built-in queue method 'and'
: ... In instance t
117 | i = q.and with (item + 1);
| ^~~~
%Error-UNSUPPORTED: t/t_queue_method.v:121:16: Unsupported: with statements
| ^~~
%Error-UNSUPPORTED: t/t_queue_method.v:119:13: Unsupported/unknown built-in queue method 'or'
: ... In instance t
119 | i = q.or;
| ^~
%Error-UNSUPPORTED: t/t_queue_method.v:121:13: Unsupported/unknown built-in queue method 'or'
: ... In instance t
121 | i = q.or with (item + 1);
| ^~~~
%Error-UNSUPPORTED: t/t_queue_method.v:125:17: Unsupported: with statements
| ^~
%Error-UNSUPPORTED: t/t_queue_method.v:123:13: Unsupported/unknown built-in queue method 'xor'
: ... In instance t
123 | i = q.xor;
| ^~~
%Error-UNSUPPORTED: t/t_queue_method.v:125:13: Unsupported/unknown built-in queue method 'xor'
: ... In instance t
125 | i = q.xor with (item + 1);
| ^~~~
| ^~~
%Error-UNSUPPORTED: t/t_queue_method.v:128:14: Unsupported/unknown built-in queue method 'and'
: ... In instance t
128 | i = qe.and;
| ^~~
%Error-UNSUPPORTED: t/t_queue_method.v:130:14: Unsupported/unknown built-in queue method 'or'
: ... In instance t
130 | i = qe.or;
| ^~
%Error-UNSUPPORTED: t/t_queue_method.v:132:14: Unsupported/unknown built-in queue method 'xor'
: ... In instance t
132 | i = qe.xor;
| ^~~
%Error: Exiting due to

View File

@ -0,0 +1,41 @@
%Error-UNSUPPORTED: t/t_queue_method_bad.v:15:14: Unsupported/unknown built-in queue method 'unique'
: ... In instance t
15 | qv = q.unique with (1);
| ^~~~~~
%Error-UNSUPPORTED: t/t_queue_method_bad.v:16:9: Unsupported/unknown built-in queue method 'reverse'
: ... In instance t
16 | q.reverse(1);
| ^~~~~~~
%Error-UNSUPPORTED: t/t_queue_method_bad.v:17:9: Unsupported/unknown built-in queue method 'shuffle'
: ... In instance t
17 | q.shuffle(1);
| ^~~~~~~
%Error-UNSUPPORTED: t/t_queue_method_bad.v:18:14: Unsupported/unknown built-in queue method 'find'
: ... In instance t
18 | qv = q.find;
| ^~~~
%Error-UNSUPPORTED: t/t_queue_method_bad.v:19:14: Unsupported/unknown built-in queue method 'find_first'
: ... In instance t
19 | qv = q.find_first;
| ^~~~~~~~~~
%Error-UNSUPPORTED: t/t_queue_method_bad.v:20:14: Unsupported/unknown built-in queue method 'find_last'
: ... In instance t
20 | qv = q.find_last;
| ^~~~~~~~~
%Error-UNSUPPORTED: t/t_queue_method_bad.v:21:14: Unsupported/unknown built-in queue method 'find_index'
: ... In instance t
21 | qi = q.find_index;
| ^~~~~~~~~~
%Error-UNSUPPORTED: t/t_queue_method_bad.v:22:14: Unsupported/unknown built-in queue method 'find_first_index'
: ... In instance t
22 | qi = q.find_first_index;
| ^~~~~~~~~~~~~~~~
%Error-UNSUPPORTED: t/t_queue_method_bad.v:23:14: Unsupported/unknown built-in queue method 'find_last_index'
: ... In instance t
23 | qi = q.find_last_index;
| ^~~~~~~~~~~~~~~
%Error: t/t_queue_method_bad.v:25:19: 'with' not legal on this method
: ... In instance t
25 | qi = q.size with (1);
| ^~~~
%Error: Exiting due to

View File

@ -0,0 +1,19 @@
#!/usr/bin/env perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2003 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
scenarios(vlt => 1);
lint(
fails => 1,
expect_filename => $Self->{golden_filename},
);
ok(1);
1;

View File

@ -0,0 +1,30 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2019 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/);
initial begin
int q[$];
int qe[$]; // Empty
int qv[$]; // Value returns
int qi[$]; // Index returns
q = '{2, 2, 4, 1, 3};
qv = q.unique with (1); // Bad no with allowed
q.reverse(1); // Bad no args allowed
q.shuffle(1); // Bad no args allowed
qv = q.find; // Bad missing with
qv = q.find_first; // Bad missing with
qv = q.find_last; // Bad missing with
qi = q.find_index; // Bad missing with
qi = q.find_first_index; // Bad missing with
qi = q.find_last_index; // Bad missing with
qi = q.size with (1); // with not allowed
$write("*-* All Finished *-*\n");
$finish;
end
endmodule

View File

@ -1,34 +1,4 @@
%Error-UNSUPPORTED: t/t_with.v:19:31: Unsupported: with statements
19 | found = aliases.find(i) with (i == tofind);
| ^~~~
%Error-UNSUPPORTED: t/t_with.v:21:23: Unsupported: with statements
21 | aliases.find(i) with (i == tofind);
| ^~~~
%Error-UNSUPPORTED: t/t_with.v:24:28: Unsupported: with statements
24 | found = aliases.find with (item == i);
| ^~~~
%Error-UNSUPPORTED: t/t_with.v:25:20: Unsupported: with statements
25 | aliases.find with (item == i);
| ^~~~
%Error-UNSUPPORTED: t/t_with.v:29:30: Unsupported: with statements
29 | found = aliases.unique with (id);
| ^~~~
%Error-UNSUPPORTED: t/t_with.v:30:32: Unsupported: with statements
30 | found = aliases.unique() with (id);
| ^~~~
%Error-UNSUPPORTED: t/t_with.v:31:33: Unsupported: with statements
31 | found = aliases.unique(i) with (id);
| ^~~~
%Error-UNSUPPORTED: t/t_with.v:32:25: Unsupported: with statements
32 | i = aliases.or(v) with (v);
| ^~~~
%Error: t/t_with.v:32:22: Can't find definition of variable: 'v'
32 | i = aliases.or(v) with (v);
| ^
%Error-UNSUPPORTED: t/t_with.v:33:26: Unsupported: with statements
33 | i = aliases.and(v) with (v);
| ^~~~
%Error-UNSUPPORTED: t/t_with.v:34:26: Unsupported: with statements
34 | i = aliases.xor(v) with (v);
| ^~~~
%Error: Exiting due to