Correct timing of transitions to UNKNOWN.

This commit is contained in:
Giles Atkinson 2023-03-14 10:30:11 +00:00 committed by Holger Vogt
parent 240a2b9406
commit db38d4ad54
4 changed files with 35 additions and 3 deletions

View File

@ -168,7 +168,7 @@ void cm_d_and(ARGS)
if (val == *out) { /* output value is not changing */
OUTPUT_CHANGED(out) = FALSE;
} else { /* output value not changing */
} else {
switch (val) {
/* fall to zero value */
@ -209,6 +209,14 @@ void cm_d_and(ARGS)
/* Third value: cancel earlier change and output as usual. */
cm_schedule_output(1, 0, (idp->when - TIME) / 2.0, &ov);
if (val == UNKNOWN) {
/* Delay based in idp->prev, not *out. */
if (idp->prev == ZERO)
OUTPUT_DELAY(out) = PARAM(rise_delay);
else
OUTPUT_DELAY(out) = PARAM(fall_delay);
}
idp->when = TIME + OUTPUT_DELAY(out); // Actual output time
} else {
/* Changing back: override pending change. */

View File

@ -176,6 +176,14 @@ void cm_d_buffer(ARGS)
/* Third value: cancel earlier change and output as usual. */
cm_schedule_output(1, 0, (idp->when - TIME) / 2.0, &ov);
if (val == UNKNOWN) {
/* Delay based in idp->prev, not *out. */
if (idp->prev == ZERO)
OUTPUT_DELAY(out) = PARAM(rise_delay);
else
OUTPUT_DELAY(out) = PARAM(fall_delay);
}
idp->when = TIME + OUTPUT_DELAY(out); // Actual output time
} else {
/* Changing back: override pending change. */

View File

@ -147,7 +147,7 @@ void cm_d_inverter(ARGS)
if (val == *out) { /* output value is changing */
OUTPUT_CHANGED(out) = FALSE;
} else { /* output value not changing */
} else {
switch (val) {
/* fall to zero value */
@ -186,6 +186,14 @@ void cm_d_inverter(ARGS)
/* Third value: cancel earlier change and output as usual. */
cm_schedule_output(1, 0, (idp->when - TIME) / 2.0, &ov);
if (val == UNKNOWN) {
/* Delay based in idp->prev, not *out. */
if (idp->prev == ZERO)
OUTPUT_DELAY(out) = PARAM(rise_delay);
else
OUTPUT_DELAY(out) = PARAM(fall_delay);
}
idp->when = TIME + OUTPUT_DELAY(out); // Actual output time
} else {
/* Changing back: override pending change. */

View File

@ -175,7 +175,7 @@ void cm_d_nor(ARGS)
if (val == *out) { /* output value is not changing */
OUTPUT_CHANGED(out) = FALSE;
} else { /* output value not changing */
} else {
switch (val) {
/* fall to zero value */
@ -214,6 +214,14 @@ void cm_d_nor(ARGS)
/* Third value: cancel earlier change and output as usual. */
cm_schedule_output(1, 0, (idp->when - TIME) / 2.0, &ov);
if (val == UNKNOWN) {
/* Delay based in idp->prev, not *out. */
if (idp->prev == ZERO)
OUTPUT_DELAY(out) = PARAM(rise_delay);
else
OUTPUT_DELAY(out) = PARAM(fall_delay);
}
idp->when = TIME + OUTPUT_DELAY(out); // Actual output time
} else {
/* Changing back: override pending change. */