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
81 lines
2.5 KiB
C
81 lines
2.5 KiB
C
/* SPDX-License-Identifier: LicenseRef-Starship-1.0
|
|
* Copyright (c) 2023-2026 Robert A. James
|
|
*/
|
|
/* test_physics_l2.c -- v3/src/physics_execution_hooks.c on the host (#188): the rolling window
|
|
* records a word's execution only while the live config's L2 (rolling window) is on -- L8's toggle,
|
|
* as L4 is -- and, with no config yet, records it. It recorded whatever the card said (Captain Bob,
|
|
* 2026-11-12: "Wire L2, keep L7 on").
|
|
*
|
|
* What the hook calls outside itself is defined here: the rolling window's recorder counts.
|
|
*/
|
|
#include "harness.h"
|
|
#include "vm.h"
|
|
#include "physics_execution_hooks.h"
|
|
#include "physics_metadata.h"
|
|
#include "platform_time.h"
|
|
#include "profiler.h"
|
|
#include "rolling_window_of_truth.h"
|
|
#include "ssm_jacquard.h"
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
static unsigned recorded;
|
|
int rolling_window_record_execution(RollingWindowOfTruth *window, uint32_t word_id)
|
|
{
|
|
(void)window; (void)word_id; recorded++; return 0;
|
|
}
|
|
void physics_metadata_apply_linear_decay(DictEntry *entry, uint64_t elapsed_ticks, VM *vm)
|
|
{
|
|
(void)entry; (void)elapsed_ticks; (void)vm;
|
|
}
|
|
void physics_metadata_touch(DictEntry *entry, cell_t execution_heat, uint64_t now_ns)
|
|
{
|
|
(void)entry; (void)execution_heat; (void)now_ns;
|
|
}
|
|
void profiler_word_exit(const DictEntry *entry) { (void)entry; }
|
|
void sf_mutex_lock(sf_mutex_t *mutex) { (void)mutex; }
|
|
void sf_mutex_unlock(sf_mutex_t *mutex) { (void)mutex; }
|
|
void vm_heartbeat_run_cycle(VM *vm) { (void)vm; }
|
|
|
|
static sf_time_ns_t clock_ns(void) { return 1000u; }
|
|
static sf_time_backend_t backend;
|
|
const sf_time_backend_t *sf_time_backend = &backend;
|
|
|
|
static unsigned run(VM *vm, DictEntry *w) /* one execution of w: how many times was it recorded */
|
|
{
|
|
recorded = 0;
|
|
physics_pre_execute(vm, w, NULL);
|
|
return recorded;
|
|
}
|
|
|
|
int main(void)
|
|
{
|
|
VM *vm = calloc(1, sizeof *vm);
|
|
DictEntry w;
|
|
ssm_config_t cfg;
|
|
unsigned n;
|
|
|
|
backend.get_monotonic_ns = clock_ns;
|
|
CHECK(vm != 0, "a VM");
|
|
if (!vm) return DONE();
|
|
memset(&w, 0, sizeof w);
|
|
w.word_id = 7;
|
|
memset(&cfg, 0, sizeof cfg);
|
|
|
|
vm->ssm_config = NULL;
|
|
n = run(vm, &w);
|
|
CHECK(n == 1u, "no config yet: the execution is recorded (%u)", n);
|
|
|
|
vm->ssm_config = &cfg;
|
|
cfg.L2_rolling_window = 1;
|
|
n = run(vm, &w);
|
|
CHECK(n == 1u, "L2 on: the execution is recorded (%u)", n);
|
|
|
|
cfg.L2_rolling_window = 0;
|
|
n = run(vm, &w);
|
|
CHECK(n == 0u, "#188: L2 off: the execution is not recorded (%u times)", n);
|
|
|
|
free(vm);
|
|
return DONE();
|
|
}
|