Files
LithosAnanke/capsules/v4/physics.4th
T
Claude a9a8687fa5
Build / Image RASPI (push) Successful in 6m16s
Build / Image PC (push) Successful in 6m19s
Build / Image MILKV (push) Successful in 8m30s
Build / v4 tests (32- and 64-bit cells) (push) Successful in 16m7s
v4: acceptance asserts the loops -- L1, L3, L2 with L5, L8 -- and WORD_PHYSICS (#189, Phase 7 Task 9)
The acceptance session's loops(), at every v4 boot's prompt: a word's
heat (L1), its decay from a set heat (L3), INFER-RUN's variance and
width with L8 held on card 18 (L2, L5), and L8's changes. L8-HOLD
( card -- ), request -42, beside L8-CARD@, with its POST case: POST 992.
WORD_PHYSICS (Kconfig.physics, default y) turns the word loops off: a
boot with it off fails acceptance at POST (ruled 3a). Measured on amd64:
heat 6, 1000 cooled to 0 in 40 s, width 455, 66 changes. L8 unheld
settles on card 11, with the window off, so L2/L5 hold a card (ruled).
test_mesh_boot: L8-HOLD failed first, 144 checks now. V3-PARITY.md 2.2
corrected, dated. Gates pass, POST 992/992.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
2026-11-20 18:06:09 +00:00

74 lines
3.0 KiB
Forth

Block 3972
( physics.4th -- the words of the loops, v3's physics-freeze )
( and inference words, on a node the kernel keeps records )
( for: each asks its kernel, which keeps every word's and )
( opcode's physics and does the arithmetic -- compudynamics )
( is the Stadium/fabric's: #189 Phase 7, Task 4, Captain Bob )
( 2026-11-14. The requests, by their numbers in v4/mesh.h: )
-21 KERNEL-WORD FREEZE-WORD ( baddr u -- )
-22 KERNEL-WORD UNFREEZE-WORD ( baddr u -- )
-23 KERNEL-WORD FROZEN? ( baddr u -- flag )
-24 KERNEL-WORD HEAT! ( n baddr u -- )
-25 KERNEL-WORD HEAT@ ( baddr u -- n )
-26 KERNEL-WORD Q.VARIANCE ( addr u -- d )
-27 KERNEL-WORD INFER-DECAY-SLOPE ( addr u -- d )
-28 KERNEL-WORD INFER-WINDOW-WIDTH ( addr u -- n )
-29 KERNEL-WORD INFER-RUN ( -- )
-->
Block 3973
( and what the last INFER-RUN, or the heartbeat's, found; )
( a q is a Q48.16 double, as qmath.f18's )
-30 KERNEL-WORD INFER-WINDOW@ ( -- u )
-31 KERNEL-WORD INFER-DECAY@ ( -- d )
-32 KERNEL-WORD INFER-VARIANCE@ ( -- d )
-33 KERNEL-WORD INFER-FIT@ ( -- d )
-34 KERNEL-WORD INFER-EARLY-EXIT@ ( -- flag )
-41 KERNEL-WORD L8-CARD@ ( -- card changes )
-42 KERNEL-WORD L8-HOLD ( card -- ; -1: L8 chooses )
( v3's DECAY_RATE_PER_US_Q16, its compile-time constant )
1 CONSTANT DECAY-RATE@
-->
Block 3974
( v3's StarForth module: a word's execution heat, by the )
( address ' leaves; and the hottest -- the kernel's records )
-35 KERNEL-WORD ENTROPY@ ( addr -- n )
-36 KERNEL-WORD ENTROPY! ( n addr -- )
-37 KERNEL-WORD RESET-ENTROPY ( -- )
-38 KERNEL-WORD (HOT#) ( -- n )
-39 KERNEL-WORD (HOT) ( i -- xt heat )
-40 KERNEL-WORD (XT-HEAT) ( xt -- n )
( TOP-WORDS n: the n hottest, in v3's form )
: TOP-WORDS ( n -- )
DUP 1 < IF ." TOP-WORDS: invalid count " 0 .R CR EXIT THEN
." Top " DUP 0 .R ." most frequently used words:" CR
." ==================================" CR
(HOT#) MIN 0 ?DO I (HOT) SWAP I 1+ 0 .R ." . "
>NAME COUNT TYPE ." : " 0 .R CR LOOP ;
-->
Block 3975
( WORD-ENTROPY: every word with heat, then the totals, as v3 )
VARIABLE (WE-T) VARIABLE (WE-N)
: WORD-ENTROPY ( -- )
." Word Usage Statistics (Execution Heat Counts):" CR
." =============================================" CR
0 (WE-T) ! 0 (WE-N) ! LATEST
BEGIN DUP WHILE 1 (WE-N) +!
DUP (XT-HEAT) ?DUP IF OVER >NAME COUNT TYPE ." : "
DUP 0 .R CR (WE-T) +! THEN >LINK @
REPEAT DROP
." -------------------------------------" CR
." Total executions: " (WE-T) @ 0 .R CR
." Total words: " (WE-N) @ 0 .R CR
(WE-T) @ IF ." Average executions per word: "
(WE-T) @ (WE-N) @ / 0 .R CR THEN ;
-->
Block 3976
( (- skips its input to the matching close paren, nesting, )
( as v3's code does -- its documentation says to the line end )
: (- ( -- ) 1
BEGIN DUP 0= IF DROP EXIT THEN
>IN @ SOURCE SWAP DROP < 0= IF DROP EXIT THEN
SOURCE DROP >IN @ + C@ 1 >IN +!
DUP 40 = IF DROP 1+ ELSE 41 = IF 1- THEN THEN
AGAIN ;