GitHub issue #60 (part 2) - warn about excessive array/vector dimensions.
This commit is contained in:
parent
c6e618350d
commit
e78205eacf
16
elab_sig.cc
16
elab_sig.cc
|
|
@ -909,6 +909,11 @@ bool test_ranges_eeq(const vector<netrange_t>&lef, const vector<netrange_t>&rig)
|
||||||
*/
|
*/
|
||||||
NetNet* PWire::elaborate_sig(Design*des, NetScope*scope) const
|
NetNet* PWire::elaborate_sig(Design*des, NetScope*scope) const
|
||||||
{
|
{
|
||||||
|
// This sets the vector or array dimension size that will
|
||||||
|
// cause a warning. For now, these warnings are permanently
|
||||||
|
// enabled.
|
||||||
|
const long warn_dimension_size = 1 << 30;
|
||||||
|
|
||||||
NetNet::Type wtype = type_;
|
NetNet::Type wtype = type_;
|
||||||
bool is_implicit_scalar = false;
|
bool is_implicit_scalar = false;
|
||||||
if (wtype == NetNet::IMPLICIT) {
|
if (wtype == NetNet::IMPLICIT) {
|
||||||
|
|
@ -1042,7 +1047,11 @@ NetNet* PWire::elaborate_sig(Design*des, NetScope*scope) const
|
||||||
|
|
||||||
packed_dimensions = nlist;
|
packed_dimensions = nlist;
|
||||||
wid = netrange_width(packed_dimensions);
|
wid = netrange_width(packed_dimensions);
|
||||||
|
if (wid > warn_dimension_size) {
|
||||||
|
cerr << get_fileline() << ": warning: Vector size "
|
||||||
|
"is greater than " << warn_dimension_size
|
||||||
|
<< "." << endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned nattrib = 0;
|
unsigned nattrib = 0;
|
||||||
|
|
@ -1116,6 +1125,11 @@ NetNet* PWire::elaborate_sig(Design*des, NetScope*scope) const
|
||||||
index_l = lval.as_long();
|
index_l = lval.as_long();
|
||||||
index_r = rval.as_long();
|
index_r = rval.as_long();
|
||||||
}
|
}
|
||||||
|
if (abs(index_r - index_l) > warn_dimension_size) {
|
||||||
|
cerr << get_fileline() << ": warning: Array dimension "
|
||||||
|
"is greater than " << warn_dimension_size
|
||||||
|
<< "." << endl;
|
||||||
|
}
|
||||||
|
|
||||||
unpacked_dimensions.push_back(netrange_t(index_l, index_r));
|
unpacked_dimensions.push_back(netrange_t(index_l, index_r));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue