Improve error message on assignment to an array or array slice (issue #562).
This is valid SystemVerilog, but not something we support yet.
This commit is contained in:
parent
61aed6882c
commit
71c36d1289
16
elab_lval.cc
16
elab_lval.cc
|
|
@ -259,12 +259,18 @@ NetAssign_* PEIdent::elaborate_lval(Design*des,
|
|||
use_sel = name_tail.index.back().sel;
|
||||
|
||||
// Special case: The l-value is an entire memory, or array
|
||||
// slice. This is, in fact, an error in l-values. Detect the
|
||||
// situation by noting if the index count is less than the
|
||||
// array dimensions (unpacked).
|
||||
// slice. Detect the situation by noting if the index count
|
||||
// is less than the array dimensions (unpacked).
|
||||
if (reg->unpacked_dimensions() > name_tail.index.size()) {
|
||||
cerr << get_fileline() << ": error: Cannot assign to array "
|
||||
<< path_ << ". Did you forget a word index?" << endl;
|
||||
if (gn_system_verilog()) {
|
||||
cerr << get_fileline() << ": sorry: Assignment to an entire"
|
||||
" array or to an array slice is not yet supported."
|
||||
<< endl;
|
||||
} else {
|
||||
cerr << get_fileline() << ": error: Assignment to an entire"
|
||||
" array or to an array slice requires SystemVerilog."
|
||||
<< endl;
|
||||
}
|
||||
des->errors += 1;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue