From 6b00a88f286b75b67ff78b5406152164c4b17e62 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Sun, 8 Oct 2023 11:45:22 +0200 Subject: [PATCH] fix xschem simulator "mux" operator (M) to handle unknown selector state --- src/hilight.c | 2 +- xschem_library/xschem_simulator/dev-1.sym | 4 ++-- xschem_library/xschem_simulator/dev-2.sym | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hilight.c b/src/hilight.c index 4c96e8d3..49f5f8c1 100644 --- a/src/hilight.c +++ b/src/hilight.c @@ -1380,7 +1380,7 @@ static int eval_logic_expr(int inst, int output) if(sp > 2) { s = stack[sp - 1]; if(s < 2) { - stack[sp - 3] = (s == 0) ? stack[sp - 3] : stack[sp - 2]; + stack[sp - 3] = (s == 0) ? stack[sp - 3] : (s == 1) ? stack[sp - 2] : 2; } else stack[sp - 3] = 2; /* setting to 2 (X) may lead to simulation deadlocks */ sp -=2; diff --git a/xschem_library/xschem_simulator/dev-1.sym b/xschem_library/xschem_simulator/dev-1.sym index 91cc2026..b21e1a2c 100644 --- a/xschem_library/xschem_simulator/dev-1.sym +++ b/xschem_library/xschem_simulator/dev-1.sym @@ -2,8 +2,8 @@ v {xschem version=3.4.5 file_version=1.2 } G {} K {type=switch -function1="0 Z 3 m" -function2="Z 0 3 m" +function1="0 Z 3 M" +function2="Z 0 3 M" template="name=s1" } V {} diff --git a/xschem_library/xschem_simulator/dev-2.sym b/xschem_library/xschem_simulator/dev-2.sym index 56342996..4ab53e33 100644 --- a/xschem_library/xschem_simulator/dev-2.sym +++ b/xschem_library/xschem_simulator/dev-2.sym @@ -2,7 +2,7 @@ v {xschem version=3.4.5 file_version=1.2 } G {} K {type=switch -function0="1 2 3 m" +function0="1 2 3 M" template="name=s1" format="* @name @pinlist @symname" }