fix xschem simulator "mux" operator (M) to handle unknown selector state

This commit is contained in:
stefan schippers 2023-10-08 11:45:22 +02:00
parent 58af2567e6
commit 6b00a88f28
3 changed files with 4 additions and 4 deletions

View File

@ -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;

View File

@ -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 {}

View File

@ -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"
}