Fix #1267: Allow wire logic connected to uwire port to have multiple drivers
TODO: Decide how resolved net types (tri0/tri1/triand/trior) should interact with uwire in a shared nexus.
This commit is contained in:
parent
d540260a20
commit
a03033e743
|
|
@ -0,0 +1,23 @@
|
|||
// Test for GitHub issue #1267
|
||||
// Wire logic connected to uwire port should not trigger multi-driver error
|
||||
// The uwire semantics apply only to the uwire signal, not to wires connected to it.
|
||||
|
||||
module a(input uwire logic a1);
|
||||
endmodule
|
||||
|
||||
module b();
|
||||
wire logic b1;
|
||||
|
||||
a b_inst(.a1(b1));
|
||||
not not_inst(b1, b1);
|
||||
|
||||
assign b1 = 'b0;
|
||||
|
||||
initial begin
|
||||
#1;
|
||||
// b1 has multiple drivers, which is allowed for wire types
|
||||
// The value will be X due to conflicting drivers
|
||||
$display("b1 = %b (expected X due to conflicting drivers)", b1);
|
||||
$display("PASSED");
|
||||
end
|
||||
endmodule
|
||||
|
|
@ -991,3 +991,4 @@ ipsupsel_real_idx CE,-g2012 ivltests gold=ipsupsel_real_idx.gold
|
|||
real_edges CE,-g2012 ivltests gold=real_edges.gold
|
||||
br_gh1112 CE,-g2009 ivltests gold=br_gh1112.gold
|
||||
br_gh670 normal,-g2009 ivltests
|
||||
br_gh1267 normal,-g2012 ivltests
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ static ivl_signal_type_t signal_type_of_nexus(ivl_nexus_t nex)
|
|||
{
|
||||
unsigned idx;
|
||||
ivl_signal_type_t out = IVL_SIT_TRI;
|
||||
int has_tri = 0;
|
||||
int has_uwire = 0;
|
||||
|
||||
for (idx = 0 ; idx < ivl_nexus_ptrs(nex) ; idx += 1) {
|
||||
ivl_signal_type_t stype;
|
||||
|
|
@ -41,14 +43,29 @@ static ivl_signal_type_t signal_type_of_nexus(ivl_nexus_t nex)
|
|||
stype = ivl_signal_type(sig);
|
||||
if (stype == IVL_SIT_REG)
|
||||
continue;
|
||||
if (stype == IVL_SIT_TRI)
|
||||
if (stype == IVL_SIT_TRI) {
|
||||
has_tri = 1;
|
||||
continue;
|
||||
}
|
||||
if (stype == IVL_SIT_NONE)
|
||||
continue;
|
||||
if (stype == IVL_SIT_UWIRE) return IVL_SIT_UWIRE;
|
||||
if (stype == IVL_SIT_UWIRE) {
|
||||
has_uwire = 1;
|
||||
continue;
|
||||
}
|
||||
out = stype;
|
||||
}
|
||||
|
||||
/* If both TRI (wire) and UWIRE are in the nexus, return TRI
|
||||
because wire semantics allow multiple drivers. Only return
|
||||
UWIRE if no TRI signals are present. This fixes GitHub #1267
|
||||
where wire logic connected to uwire ports was incorrectly
|
||||
treated as requiring single-driver semantics.
|
||||
TODO: Decide how resolved net types (tri0/tri1/triand/trior)
|
||||
should interact with uwire in a shared nexus. */
|
||||
if (has_uwire && !has_tri)
|
||||
return IVL_SIT_UWIRE;
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue