From b982ab4f59298946021186403e6415ba79e59200 Mon Sep 17 00:00:00 2001 From: Jannis Harder Date: Thu, 10 Nov 2022 16:17:54 +0100 Subject: satgen, simlib: Consistent x-propagation for `$pmux` cells This updates satgen and simlib to use a `$pmux` model where the output is fully X when the S input is not all zero or one-hot with no x bits. --- techlibs/common/simlib.v | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'techlibs') diff --git a/techlibs/common/simlib.v b/techlibs/common/simlib.v index e64697efb..b5e437d90 100644 --- a/techlibs/common/simlib.v +++ b/techlibs/common/simlib.v @@ -1331,10 +1331,17 @@ always @* begin Y = A; found_active_sel_bit = 0; for (i = 0; i < S_WIDTH; i = i+1) - if (S[i]) begin - Y = found_active_sel_bit ? 'bx : B >> (WIDTH*i); - found_active_sel_bit = 1; - end + case (S[i]) + 1'b1: begin + Y = found_active_sel_bit ? 'bx : B >> (WIDTH*i); + found_active_sel_bit = 1; + end + 1'b0: ; + 1'bx: begin + Y = 'bx; + found_active_sel_bit = 'bx; + end + endcase end endmodule -- cgit v1.2.3