From 5d6a053f986d0c4346285d40c2d517efc29d853a Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sun, 20 Jan 2013 12:59:27 -0500 Subject: [PATCH] Fix internal error on array pin mismatch, bug393. --- src/V3Width.cpp | 8 ++++++++ test_regress/t/t_inst_misarray_bad.pl | 4 +--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/V3Width.cpp b/src/V3Width.cpp index 7db54293e..d9915df0e 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -1499,6 +1499,14 @@ private: // otherwise would need some mess to force both sides to proper size } } + // Simple dtype checking, should be a more general check + bool hiArray = nodep->exprp()->dtypep()->skipRefp()->castUnpackArrayDType(); + bool loArray = nodep->modVarp()->dtypep()->skipRefp()->castUnpackArrayDType(); + if (loArray != hiArray) { + nodep->v3error("Illegal port connection "<prettyName()<<"," + <<" port is"<<(hiArray?"":" not")<<" an array" + <<" expression is"<<(loArray?"":" not")<<" an array."); + } if (inputPin) { // input pin is lhs, expr is rhs; resize expr to match awidth = pinwidth; diff --git a/test_regress/t/t_inst_misarray_bad.pl b/test_regress/t/t_inst_misarray_bad.pl index e8a995652..0e42a8435 100755 --- a/test_regress/t/t_inst_misarray_bad.pl +++ b/test_regress/t/t_inst_misarray_bad.pl @@ -7,13 +7,11 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di # Lesser General Public License Version 3 or the Perl Artistic License # Version 2.0. -$Self->{vlt} and $Self->unsupported("Verilator unsupported, bug595"); - compile ( verilator_flags2 => ["--lint-only"], fails=>1, expect=> -'TBD +'%Error: t/t_inst_misarray_bad.v:\d+: Illegal port connection foo, port is not an array expression is an array. %Error: Exiting due to.*', );