From 262555fd36e6fa8e5bc9a8e085c12b257c630f44 Mon Sep 17 00:00:00 2001 From: Torin Walker Date: Sat, 12 Sep 2026 12:21:51 -0400 Subject: [PATCH 1/2] Fix EX source segment resolution --- src/reporting.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/reporting.c b/src/reporting.c index 2eebf08..a9c0020 100644 --- a/src/reporting.c +++ b/src/reporting.c @@ -880,11 +880,17 @@ static int process_ex_card(context_t *ctx, const card_t *card, card_state_t *sta if (cabs(voltage) < 1e-20) { voltage = 1.0 + 0.0*I; /* Default to 1 volt */ } - + + /* + * EX specifies a segment relative to its tag, but the queued source is + * subsequently processed using an absolute/global segment number. + */ + int global_seg = segment_number(ctx, tag, seg); + if (extype == 0) { - return add_voltage_source(ctx, tag, seg, voltage); + return add_voltage_source(ctx, tag, global_seg, voltage); } else { - return add_current_source(ctx, tag, seg, voltage); + return add_current_source(ctx, tag, global_seg, voltage); } } else if (extype >= 1 && extype <= 4) { From ef4f56c967e98d7ee894980bc2f8d41bc2fd0b3b Mon Sep 17 00:00:00 2001 From: Torin Walker Date: Sat, 12 Sep 2026 12:33:51 -0400 Subject: [PATCH 2/2] Fix patch connection namespace collision --- src/internals.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/internals.h b/src/internals.h index 8effe1d..73770f9 100644 --- a/src/internals.h +++ b/src/internals.h @@ -39,8 +39,12 @@ #define NTS 4 #define SMIN 1.e-3 -/* Replaces the "10000" limit used to identiy segment/patch connections */ -#define PCHCON 10000 +/* + * Keep the patch-connection namespace above practical wire-segment counts. + * PCHCON is used to distinguish patch connections from ordinary segment + * connections, so it must not overlap valid generated segment numbers. + */ +#define PCHCON 1000000000 /* carriage return and line feed */ #define CR 0x0d