Show IEEE reference in array port message, plus internal cleanups.

This commit is contained in:
Wilson Snyder 2020-11-17 21:10:29 -05:00
parent 899e7bacb2
commit 2f718b9ea0
3 changed files with 11 additions and 14 deletions

View File

@ -532,7 +532,7 @@ private:
}
return newmodp;
}
void visitCell(AstCell* nodep, const string& hierName);
void visitCellDeparam(AstCell* nodep, const string& hierName);
void visitModules() {
// Loop on all modules left to process
// Hitting a cell adds to the appropriate level of this level-sorted list,
@ -558,7 +558,7 @@ private:
if (string* genHierNamep = (string*)cellp->user5p()) {
fullName += *genHierNamep;
}
visitCell(cellp, fullName);
visitCellDeparam(cellp, fullName);
}
}
}
@ -887,7 +887,7 @@ public:
//----------------------------------------------------------------------
// VISITs
void ParamVisitor::visitCell(AstCell* nodep, const string& hierName) {
void ParamVisitor::visitCellDeparam(AstCell* nodep, const string& hierName) {
// Cell: Check for parameters in the instantiation.
iterateChildren(nodep);
UASSERT_OBJ(nodep->modp(), nodep, "Not linked?");

View File

@ -198,8 +198,7 @@ private:
// STATE
WidthVP* m_vup = nullptr; // Current node state
bool m_paramsOnly; // Computing parameter value; limit operation
AstRange* m_cellRangep
= nullptr; // Range for arrayed instantiations, nullptr for normal instantiations
AstCell* m_cellp = nullptr; // Current cell for arrayed instantiations
AstNodeFTask* m_ftaskp = nullptr; // Current function/task
AstNodeProcedure* m_procedurep = nullptr; // Current final/always
AstLambdaArgRef* m_lambdaArgRefp = nullptr; // Argument to above lambda
@ -4052,8 +4051,8 @@ private:
if (conDTypep == pinDTypep // If match, we're golden
|| similarDTypeRecurse(conDTypep, pinDTypep)) {
userIterateAndNext(nodep->exprp(), WidthVP(subDTypep, FINAL).p());
} else if (m_cellRangep) {
int numInsts = m_cellRangep->elementsConst();
} else if (m_cellp->rangep()) {
int numInsts = m_cellp->rangep()->elementsConst();
if (conwidth == pinwidth) {
// Arrayed instants: widths match so connect to each instance
subDTypep = conDTypep; // = same expr dtype
@ -4069,7 +4068,7 @@ private:
<< " requires " << pinwidth << " or " << pinwidth * numInsts
<< " bits, but connection's "
<< nodep->exprp()->prettyTypeName() << " generates " << conwidth
<< " bits.");
<< " bits. (IEEE 1800-2017 23.3.3)");
subDTypep = conDTypep; // = same expr dtype
}
userIterateAndNext(nodep->exprp(), WidthVP(subDTypep, FINAL).p());
@ -4138,6 +4137,8 @@ private:
// if (debug()) nodep->dumpTree(cout, "- PinOut: ");
}
virtual void visit(AstCell* nodep) override {
VL_RESTORER(m_cellp);
m_cellp = nodep;
if (!m_paramsOnly) {
if (VN_IS(nodep->modp(), NotFoundModule)) {
// We've resolved parameters and hit a module that we couldn't resolve. It's
@ -4147,14 +4148,10 @@ private:
<< nodep->modName() << "'");
v3Global.opt.filePathLookedMsg(nodep->modNameFileline(), nodep->modName());
}
if (nodep->rangep()) {
m_cellRangep = nodep->rangep();
userIterateAndNext(nodep->rangep(), WidthVP(SELF, BOTH).p());
}
if (nodep->rangep()) userIterateAndNext(nodep->rangep(), WidthVP(SELF, BOTH).p());
userIterateAndNext(nodep->pinsp(), nullptr);
}
userIterateAndNext(nodep->paramsp(), nullptr);
m_cellRangep = nullptr;
}
virtual void visit(AstGatePin* nodep) override {
if (m_vup->prelim()) {

View File

@ -1,4 +1,4 @@
%Error: t/t_inst_array_bad.v:19:28: Input port connection 'onebit' as part of a module instance array requires 1 or 8 bits, but connection's VARREF 'onebitbad' generates 9 bits.
%Error: t/t_inst_array_bad.v:19:28: Input port connection 'onebit' as part of a module instance array requires 1 or 8 bits, but connection's VARREF 'onebitbad' generates 9 bits. (IEEE 1800-2017 23.3.3)
: ... In instance t
19 | sub sub [7:0] (allbits, onebitbad, bitout);
| ^~~~~~~~~