Internals: Pre-elaboration progress towards class parameters.
This commit is contained in:
parent
a68a4fc888
commit
f96d336b97
|
|
@ -123,7 +123,7 @@ private:
|
||||||
V3GraphVertex* vertex(AstNodeModule* nodep) {
|
V3GraphVertex* vertex(AstNodeModule* nodep) {
|
||||||
// Return corresponding vertex for this module
|
// Return corresponding vertex for this module
|
||||||
if (!nodep->user1p()) nodep->user1p(new LinkCellsVertex(&m_graph, nodep));
|
if (!nodep->user1p()) nodep->user1p(new LinkCellsVertex(&m_graph, nodep));
|
||||||
return (nodep->user1u().toGraphVertex());
|
return nodep->user1u().toGraphVertex();
|
||||||
}
|
}
|
||||||
|
|
||||||
AstNodeModule* findModuleSym(const string& modName) {
|
AstNodeModule* findModuleSym(const string& modName) {
|
||||||
|
|
@ -185,6 +185,9 @@ private:
|
||||||
// Module: Pick up modnames, so we can resolve cells later
|
// Module: Pick up modnames, so we can resolve cells later
|
||||||
VL_RESTORER(m_modp);
|
VL_RESTORER(m_modp);
|
||||||
{
|
{
|
||||||
|
// For nested modules/classes, child below parent
|
||||||
|
if (m_modp) new V3GraphEdge{&m_graph, vertex(m_modp), vertex(nodep), 1};
|
||||||
|
//
|
||||||
m_modp = nodep;
|
m_modp = nodep;
|
||||||
UINFO(4, "Link Module: " << nodep << endl);
|
UINFO(4, "Link Module: " << nodep << endl);
|
||||||
if (nodep->fileline()->filebasenameNoExt() != nodep->prettyName()
|
if (nodep->fileline()->filebasenameNoExt() != nodep->prettyName()
|
||||||
|
|
@ -449,6 +452,18 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstRefDType* nodep) override {
|
virtual void visit(AstRefDType* nodep) override {
|
||||||
|
iterateChildren(nodep);
|
||||||
|
for (AstPin* pinp = nodep->paramsp(); pinp; pinp = VN_AS(pinp->nextp(), Pin)) {
|
||||||
|
pinp->param(true);
|
||||||
|
if (pinp->name() == "") pinp->name("__paramNumber" + cvtToStr(pinp->pinNum()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
virtual void visit(AstClassOrPackageRef* nodep) override {
|
||||||
|
iterateChildren(nodep);
|
||||||
|
// Inside a class, an extends or reference to another class
|
||||||
|
// Note we don't add a V3GraphEdge{vertex(m_modp), vertex(nodep->classOrPackagep()}
|
||||||
|
// We could for an extends, but for another reference we cannot, as
|
||||||
|
// it is legal to have classes both with parameters that link to each other
|
||||||
for (AstPin* pinp = nodep->paramsp(); pinp; pinp = VN_AS(pinp->nextp(), Pin)) {
|
for (AstPin* pinp = nodep->paramsp(); pinp; pinp = VN_AS(pinp->nextp(), Pin)) {
|
||||||
pinp->param(true);
|
pinp->param(true);
|
||||||
if (pinp->name() == "") pinp->name("__paramNumber" + cvtToStr(pinp->pinNum()));
|
if (pinp->name() == "") pinp->name("__paramNumber" + cvtToStr(pinp->pinNum()));
|
||||||
|
|
|
||||||
|
|
@ -641,10 +641,11 @@ class ParamProcessor final {
|
||||||
longnamer += "_" + paramSmallName(srcModp, modvarp) + paramValueNumber(exprp);
|
longnamer += "_" + paramSmallName(srcModp, modvarp) + paramValueNumber(exprp);
|
||||||
any_overridesr = true;
|
any_overridesr = true;
|
||||||
} else {
|
} else {
|
||||||
|
V3Const::constifyParamsEdit(pinp->exprp());
|
||||||
AstConst* const exprp = VN_CAST(pinp->exprp(), Const);
|
AstConst* const exprp = VN_CAST(pinp->exprp(), Const);
|
||||||
const AstConst* const origp = VN_CAST(modvarp->valuep(), Const);
|
const AstConst* const origp = VN_CAST(modvarp->valuep(), Const);
|
||||||
if (!exprp) {
|
if (!exprp) {
|
||||||
// if (debug()) pinp->dumpTree(cout, "error:");
|
if (debug()) pinp->dumpTree(cout, "-nodes: ");
|
||||||
pinp->v3error("Can't convert defparam value to constant: Param "
|
pinp->v3error("Can't convert defparam value to constant: Param "
|
||||||
<< pinp->prettyNameQ() << " of " << nodep->prettyNameQ());
|
<< pinp->prettyNameQ() << " of " << nodep->prettyNameQ());
|
||||||
pinp->exprp()->replaceWith(new AstConst(
|
pinp->exprp()->replaceWith(new AstConst(
|
||||||
|
|
|
||||||
|
|
@ -6225,8 +6225,7 @@ class_item<nodep>: // ==IEEE: class_item
|
||||||
| timeunits_declaration { $$ = $1; }
|
| timeunits_declaration { $$ = $1; }
|
||||||
//UNSUP covergroup_declaration { $$ = $1; }
|
//UNSUP covergroup_declaration { $$ = $1; }
|
||||||
// // local_parameter_declaration under parameter_declaration
|
// // local_parameter_declaration under parameter_declaration
|
||||||
| parameter_declaration ';'
|
| parameter_declaration ';' { $$ = $1; }
|
||||||
{ $$ = $1; BBUNSUP($2, "Unsupported: class parameters"); } // 1800-2009
|
|
||||||
| ';' { $$ = nullptr; }
|
| ';' { $$ = nullptr; }
|
||||||
//
|
//
|
||||||
| error ';' { $$ = nullptr; }
|
| error ';' { $$ = nullptr; }
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,30 @@
|
||||||
%Error-UNSUPPORTED: t/t_class_param.v:18:30: Unsupported: class parameters
|
%Error-UNSUPPORTED: t/t_class_param.v:32:11: Unsupported: parameterized classes
|
||||||
18 | localparam P = PMINUS1 + 1;
|
: ... In instance t
|
||||||
|
32 | Cls #(.P(4)) c4;
|
||||||
| ^
|
| ^
|
||||||
... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest
|
... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest
|
||||||
|
%Error-UNSUPPORTED: t/t_class_param.v:34:12: Unsupported: parameterized classes
|
||||||
|
: ... In instance t
|
||||||
|
34 | Wrap #(.PMINUS1(15)) w16;
|
||||||
|
| ^~~~~~~
|
||||||
|
%Error-UNSUPPORTED: t/t_class_param.v:7:23: Unsupported: class parameters
|
||||||
|
: ... In instance t
|
||||||
|
7 | class Cls #(parameter P = 12);
|
||||||
|
| ^
|
||||||
|
%Error-UNSUPPORTED: t/t_class_param.v:17:24: Unsupported: class parameters
|
||||||
|
: ... In instance t
|
||||||
|
17 | class Wrap #(parameter PMINUS1 = 3);
|
||||||
|
| ^~~~~~~
|
||||||
|
%Error-UNSUPPORTED: t/t_class_param.v:18:15: Unsupported: class parameters
|
||||||
|
: ... In instance t
|
||||||
|
18 | localparam P = PMINUS1 + 1;
|
||||||
|
| ^
|
||||||
|
%Error-UNSUPPORTED: t/t_class_param.v:19:9: Unsupported: parameterized classes
|
||||||
|
: ... In instance t
|
||||||
|
19 | Cls#(P) c1;
|
||||||
|
| ^
|
||||||
|
%Error-UNSUPPORTED: t/t_class_param.v:25:14: Unsupported: parameterized classes
|
||||||
|
: ... In instance t
|
||||||
|
25 | typedef Cls#(5) Cls5_t;
|
||||||
|
| ^
|
||||||
%Error: Exiting due to
|
%Error: Exiting due to
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,6 @@
|
||||||
%Error-UNSUPPORTED: t/t_class_unsup_bad.v:8:1: Unsupported: virtual data type
|
%Error-UNSUPPORTED: t/t_class_unsup_bad.v:8:1: Unsupported: virtual data type
|
||||||
8 | virtual vi_t vi2;
|
8 | virtual vi_t vi2;
|
||||||
| ^~~~~~~
|
| ^~~~~~~
|
||||||
%Error-UNSUPPORTED: t/t_class_unsup_bad.v:14:26: Unsupported: class parameters
|
|
||||||
14 | localparam LOCPAR = 10;
|
|
||||||
| ^
|
|
||||||
%Error: t/t_class_unsup_bad.v:29:24: Syntax error: 'const'/'rand'/'randc' not allowed before function/task declaration
|
%Error: t/t_class_unsup_bad.v:29:24: Syntax error: 'const'/'rand'/'randc' not allowed before function/task declaration
|
||||||
29 | const function void func_const; endfunction
|
29 | const function void func_const; endfunction
|
||||||
| ^~~~~~~~~~
|
| ^~~~~~~~~~
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue