Fix #1220: Allow uwire arrays as input ports

Uwire arrays were triggering assertion failures because they were
kept virtualized (pins array NULL) like reg arrays. However, unlike
reg arrays, uwire arrays used as input ports need their nexuses
initialized for the target code generation to work properly.

Two changes:
1. elab_sig.cc: Devirtualize pins for UNRESOLVED_WIRE (uwire) type,
   same as regular WIRE type.
2. t-dll-api.cc: Update assertion in ivl_signal_nex to also accept
   IVL_SIT_UWIRE when pins array is NULL.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Andrew Pullin 2026-01-23 15:22:36 -08:00
parent e00e89d8f8
commit 73cd6fa0c7
4 changed files with 24 additions and 3 deletions

View File

@ -1210,7 +1210,8 @@ NetNet* PWire::elaborate_sig(Design*des, NetScope*scope)
NetNet*sig = new NetNet(scope, name_, wtype, unpacked_dimensions, type);
if (wtype == NetNet::WIRE) sig->devirtualize_pins();
if (wtype == NetNet::WIRE || wtype == NetNet::UNRESOLVED_WIRE)
sig->devirtualize_pins();
sig->set_line(*this);
sig->port_type(port_type_);
sig->lexical_pos(lexical_pos_);

View File

@ -0,0 +1,19 @@
// Test for GitHub issue #1220
// Assertion failed with uwire multi-dimensional input port
module sub(input uwire data [1:0]);
initial begin
#1;
if (data[0] === 1'b0 && data[1] === 1'b1)
$display("PASSED");
else
$display("FAILED: data[0]=%0b data[1]=%0b", data[0], data[1]);
end
endmodule
module test;
wire w [1:0];
assign w[0] = 1'b0;
assign w[1] = 1'b1;
sub dut(.data(w));
endmodule

View File

@ -229,6 +229,7 @@ br_gh782b normal,-g2009 ivltests gold=br_gh782b.gold
br_gh800 normal,-g2009 ivltests
br_gh801 normal,-g2012 ivltests
br_gh801b normal,-g2012 ivltests
br_gh1220 normal,-g2012 ivltests
br_gh1222 CE,-g2009 ivltests gold=br_gh1222.gold
br_gh1223a normal,-g2009 ivltests
br_gh1223b normal,-g2009 ivltests

View File

@ -2496,8 +2496,8 @@ extern "C" ivl_nexus_t ivl_signal_nex(ivl_signal_t net, unsigned word)
if (net->pins) {
return net->pins[word];
} else {
// net->pins can be NULL for a virtualized reg array.
assert(net->type_ == IVL_SIT_REG);
// net->pins can be NULL for a virtualized reg or uwire array.
assert(net->type_ == IVL_SIT_REG || net->type_ == IVL_SIT_UWIRE);
return NULL;
}
} else {