Reject non-assignable unpacked array output port expressions

Output port expressions must support continuous assignment. Assignment
patterns for unpacked array output ports are currently elaborated as
temporary arrays and the connection is silently discarded.

Report an error instead.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2026-05-02 16:58:14 -07:00
parent be3be03fec
commit d39e81e1d1
1 changed files with 11 additions and 0 deletions

View File

@ -1202,6 +1202,17 @@ void elaborate_unpacked_port(Design *des, NetScope *scope, NetNet *port_net,
PExpr *expr, NetNet::PortType port_type,
const Module *mod, unsigned int port_idx)
{
if (port_type == NetNet::POUTPUT && !dynamic_cast<PEIdent*> (expr)) {
perm_string port_name = mod->get_port_name(port_idx);
cerr << expr->get_fileline() << ": error: Output port expression"
" must support a continuous assignment." << endl;
cerr << expr->get_fileline() << ": : Port "
<< port_idx + 1 << " (" << port_name << ") of "
<< mod->mod_name() << " is connected to " << *expr << endl;
des->errors += 1;
return;
}
NetNet *expr_net = elaborate_unpacked_array(des, scope, *expr, port_net,
expr);
if (!expr_net) {