Files
LithosAnanke/kernel/tests/test_ssm_jacquard.c
T
Claude c76a742f2b #188: the Jacquard selector's 64 cards, L7 permanently on, L2 a real gate
Captain Bob, 2026-11-12: "Wire L2, keep L7 on". The table held the 128
cards of the 7-bit L1-L7 space; nothing read L7, and the rolling window
recorded whatever the card said, so the 128 were 32 behaviours.

- compudynamics.c: cd_tuning_word() sizes the table to 64 (L1-L6).
- ssm_jacquard.c: card_bits() makes a card's 7-bit mask, L7 set, where a
  card is read, seeded and started (C4: 17 -> card 8);
  ssm_l8_force_config() still takes the 7-bit index, its L7 bit implied.
- physics_execution_hooks.c, kernel vm_core.c: the rolling window records
  only while L2 is on (or before there is a config).
- ssm_jacquard.h says what is wired, bit by bit (it said L7 was);
  v3/CLAUDE.md and the L8 reference corrected in place; FABRIC-3 XLVIII.21.

Tests first, seen to fail against HEAD (logs/20261112-210510/kernel-tests):
test_ssm_jacquard 4 of 7, test_physics_l2 1 of 4; all pass now. v4 reads
no rolling window: acceptance is unchanged; the protocol runs next.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
2026-11-12 21:05:24 +00:00

62 lines
2.7 KiB
C

/* SPDX-License-Identifier: LicenseRef-Starship-1.0
* Copyright (c) 2023-2026 Robert A. James
*/
/* test_ssm_jacquard.c -- v3/src/ssm_jacquard.c and compudynamics.c on the host (#188): the L8
* selector's cards are 64, every one different, L7 (adaptive heartrate) on in all of them -- it is
* permanently on (docs/reference/L8_ADAPTIVE_CONFIG_TABLE.md; Captain Bob, 2026-11-12: "Wire L2,
* keep L7 on") -- instead of 128 cards of which those differing only in L7 (or L2) acted alike.
*/
#include "harness.h"
#include "ssm_jacquard.h"
#include "compudynamics.h"
#include <string.h>
static unsigned tuple(const ssm_config_t *c) /* L1..L6 as six bits */
{
return (unsigned)(c->L1_heat_tracking << 5 | c->L2_rolling_window << 4 | c->L3_linear_decay << 3 |
c->L4_pipelining << 2 | c->L5_window_inference << 1 | c->L6_decay_inference);
}
int main(void)
{
ssm_l8_state_t st;
ssm_config_t cfg;
unsigned seen[64], c, n, distinct = 0, all_l7 = 1;
memset(&st, 0, sizeof st);
ssm_l8_init(&st, SSM_MODE_C4);
ssm_l8_init_table(&st);
CHECK(st.table != 0, "the adaptive table is allocated");
if (!st.table) return DONE();
n = st.table->num_configs;
CHECK(n == 64u, "#188: 64 cards -- L7 is not the selector's to choose (%u)", n);
memset(&cfg, 0, sizeof cfg);
ssm_apply_mode_from_table(&st, &cfg);
CHECK(cfg.L3_linear_decay == 1 && cfg.L7_adaptive_heartrate == 1 && tuple(&cfg) == 0x08u,
"the starting card is still C4: L3 and L7 only (L1-L6 bits %#x, L7 %d)", tuple(&cfg), cfg.L7_adaptive_heartrate);
memset(seen, 0, sizeof seen);
for (c = 0; c < n && c < 128u; c++) {
st.table->current_config = c;
memset(&cfg, 0, sizeof cfg);
ssm_apply_mode_from_table(&st, &cfg);
if (!cfg.L7_adaptive_heartrate) all_l7 = 0;
if (tuple(&cfg) < 64u && !seen[tuple(&cfg)]++) distinct++;
}
CHECK(all_l7, "#188: L7 on in every card");
CHECK(distinct == 64u && distinct == n, "#188: every card a different L1-L6 setting, all 64 of them (%u distinct of %u)", distinct, n);
/* forcing a card by its 7-bit index (inference_words.c): the L7 bit is implied on */
memset(&cfg, 0, sizeof cfg);
ssm_l8_force_config(&st, &cfg, 0x31u); /* 49: L2+L3+L7 -- C12 */
CHECK(tuple(&cfg) == 0x18u && cfg.L7_adaptive_heartrate == 1, "forced 0x31: L2, L3 and L7 (L1-L6 %#x)", tuple(&cfg));
memset(&cfg, 0, sizeof cfg);
ssm_l8_force_config(&st, &cfg, 0x30u); /* the same without its L7 bit */
CHECK(tuple(&cfg) == 0x18u && cfg.L7_adaptive_heartrate == 1, "forced 0x30: the same card, L7 still on (L1-L6 %#x, L7 %d)",
tuple(&cfg), cfg.L7_adaptive_heartrate);
ssm_l8_free_table(&st);
return DONE();
}