From d97c1bc6db6535a6601d12aabb6045f11049f757 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Tue, 29 Nov 2022 20:03:43 -0800 Subject: [PATCH] Insert drivers for undriven nets Trying to add a drive strength or delay to a undriven net will result in an assertion. Make sure that a driver is added to undriven nets. A driver is already added for all NetESignals, which covers most expression that can produce a raw net rvalue. But there are other ways we can end up with just a net as the rvalue, e.g. when applying a sign cast to a net. The following example triggers the issue ``` wire [7:0] a; wire [7:0] b = $signed(a); ``` Signed-off-by: Lars-Peter Clausen --- elaborate.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elaborate.cc b/elaborate.cc index f23e796c4..8a9fb2514 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -185,7 +185,7 @@ void PGAssign::elaborate(Design*des, NetScope*scope) const // expression. In this case, we will need to create a driver // (later) to carry strengths. bool need_driver_flag = false; - if (dynamic_cast(rval_expr)) + if (dynamic_cast(rval_expr) ||!rval->is_linked()) need_driver_flag = true; // expression elaboration should have caused the rval width to