From d39e81e1d1205fb364bb4213cff7f11fb7b9e355 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sat, 2 May 2026 16:58:14 -0700 Subject: [PATCH] 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 --- elaborate.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/elaborate.cc b/elaborate.cc index 6839156da..ca06c018c 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -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 (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) {