Fix backwards array interface error message

This commit is contained in:
Wilson Snyder 2017-04-27 06:36:14 -04:00
parent bdeee35669
commit d693065afb
2 changed files with 14 additions and 14 deletions

View File

@ -2178,22 +2178,22 @@ private:
}
// TODO Simple dtype checking, should be a more general check
AstNodeArrayDType* loArrayp = exprDTypep->skipRefp()->castUnpackArrayDType();
AstNodeArrayDType* hiArrayp = modDTypep->skipRefp()->castUnpackArrayDType();
if (loArrayp && hiArrayp && loArrayp->subDTypep()->skipRefp()->castIfaceRefDType()
&& loArrayp->declRange().elements() != hiArrayp->declRange().elements()) {
int loSize = loArrayp->declRange().elements();
int hiSize = hiArrayp->declRange().elements();
AstNodeArrayDType* exprArrayp = exprDTypep->skipRefp()->castUnpackArrayDType();
AstNodeArrayDType* modArrayp = modDTypep->skipRefp()->castUnpackArrayDType();
if (exprArrayp && modArrayp && exprArrayp->subDTypep()->skipRefp()->castIfaceRefDType()
&& exprArrayp->declRange().elements() != modArrayp->declRange().elements()) {
int exprSize = exprArrayp->declRange().elements();
int modSize = modArrayp->declRange().elements();
nodep->v3error("Illegal "<<nodep->prettyOperatorName()<<","
<<" mismatch between port which is an interface array of size "<<loSize<<","
<<" and expression which is an interface array of size "<<hiSize<<".");
<<" mismatch between port which is an interface array of size "<<modSize<<","
<<" and expression which is an interface array of size "<<exprSize<<".");
UINFO(1," Related lo: "<<modDTypep->skipRefp()<<endl);
UINFO(1," Related hi: "<<exprDTypep->skipRefp()<<endl);
} else if ((loArrayp && !hiArrayp && pinwidth != conwidth)
|| (!loArrayp && hiArrayp && pinwidth != conwidth)) {
} else if ((exprArrayp && !modArrayp && pinwidth != conwidth)
|| (!exprArrayp && modArrayp && pinwidth != conwidth)) {
nodep->v3error("Illegal "<<nodep->prettyOperatorName()<<","
<<" mismatch between port which is"<<(loArrayp?"":" not")<<" an array,"
<<" and expression which is"<<(hiArrayp?"":" not")<<" an array.");
<<" mismatch between port which is"<<(modArrayp?"":" not")<<" an array,"
<<" and expression which is"<<(exprArrayp?"":" not")<<" an array.");
UINFO(1," Related lo: "<<modDTypep->skipRefp()<<endl);
UINFO(1," Related hi: "<<exprDTypep->skipRefp()<<endl);
}

View File

@ -10,8 +10,8 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
compile (
fails=>1,
expect=>
q{%Error: t/t_interface_size_bad.v:\d+: Illegal IFACEREF port connection 'foo', mismatch between port which is an interface array of size 4, and expression which is an interface array of size 5.
%Error: t/t_interface_size_bad.v:\d+: Illegal IFACEREF port connection 'foo', mismatch between port which is an interface array of size 6, and expression which is an interface array of size 5.
q{%Error: t/t_interface_size_bad.v:\d+: Illegal IFACEREF port connection 'foo', mismatch between port which is an interface array of size 5, and expression which is an interface array of size 4.
%Error: t/t_interface_size_bad.v:\d+: Illegal IFACEREF port connection 'foo', mismatch between port which is an interface array of size 5, and expression which is an interface array of size 6.
%Error: Exiting due to.*},
);