feat(v4.0.0): nodes that talk -- ports, a node born empty, and the fabric

MESH.md step 1, in the engine, which knows nothing of StarForth or of any
kernel.

- node: V4_PORTS ports (8), a build parameter; "any port" and the port the
  last such read came from; a read blocks until the neighbour writes, as a
  write blocks until the neighbour reads; v4_node_born: empty, P at "any
  port"
- exec: a fetch from a port -- @ @b @+ @p, or of an instruction word when P
  is a port -- waits for a word; a node executes what arrives at a port
  without advancing P; a blocked node goes on from the slot it stopped at
- fabric: the nodes there are and the table of how their ports are wired,
  both changed while the nodes run; devices on a port; asleep and awake; a
  step is every unblocked node executing one instruction word, then every
  write with a reader waiting being handed over
- DECOMPOSITION.md section 6: four named ports withdrawn for V4_PORTS
  numbered ones and wiring as data, as ruled

Verified: tests/test_fabric.c, 53 checks at both widths: two nodes exchange
words; an empty node is filled through its port by a device, and by another
node, and runs what it was sent; a word is passed on by a node in between;
a waiting node executes nothing; the wiring is changed while they run; a
node is put to sleep, woken and removed while looping; a node is born while
others run; the fabric is given more room.  make -C v4 test and make -C v4
sanitize pass.  The single-node products are unchanged: hosted-check on
three ISAs, and clean qemu with STARFORTH_V4=1 on amd64, aarch64 and
riscv64 with lines typed at each prompt (logs/20261006-074907, -075150,
-075532).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rajames
2026-10-06 07:58:00 -04:00
co-authored by Claude Opus 5.5
parent 2c5427d9c1
commit 9af442f793
17 changed files with 1170 additions and 39 deletions
+13 -3
View File
@@ -1049,9 +1049,19 @@ The runtime governor moves into hardware as the multi-level Rolling Window of Tr
## 6. Messaging between nodes
Each node has four neighbour ports (`PORT-UP`, `PORT-DOWN`, `PORT-LEFT`, `PORT-RIGHT`) mapped into its
address space. A read from a port blocks until the neighbour writes; a write blocks until the neighbour
reads. This is the GA144 model. No instruction is added: a port is an address.
Each node has ports mapped into its address space. A read from a port blocks until the neighbour writes;
a write blocks until the neighbour reads. This is the GA144 model. No instruction is added: a port is an
address.
**How many ports, and what they connect to (ruled 2026-10-05 and -06; `MESH.md`).** This section first
gave a node four ports, `PORT-UP`, `PORT-DOWN`, `PORT-LEFT` and `PORT-RIGHT`: a flat grid. That is
withdrawn. The number of ports is a build parameter of the node (`V4_PORTS`), as cell width and node
memory are, and which port connects to what is a table that can change while the system runs — "not
constrained by a 3D world; other geometries might be better." The ports are numbered, not named for
directions. Two addresses follow them: "any port", a read of which takes from whichever port has a
neighbour writing, and the port the last such read came from. A node at reset has `P` at "any port" and
executes what a neighbour sends it. Built and tested in the golden model 2026-10-06 (`v4/src/node.c`,
`exec.c`, `fabric.c`; `v4/tests/test_fabric.c`).
### 6.1 Packet format (proposal)
+10
View File
@@ -252,6 +252,16 @@ Each is tested, committed and pushed before the next.
words; an empty node is filled through its port and runs what it was
sent; a word is passed on by a node in between; a node waiting executes
nothing; a node is put to sleep, woken, and removed while looping.
**Done 2026-10-06.** `v4/src/node.c` (the ports, `v4_node_born`),
`v4/src/exec.c` (a fetch from a port waits; execution from a port; the
slot a blocked node goes on from), `v4/src/fabric.c`. `V4_PORTS` is 8.
`v4/tests/test_fabric.c`, 53 checks at both cell widths and under ASan
and UBSan: all of the above, with the empty node filled once by a device
and once by another node holding the capsule in its own memory; the
fabric given more room while nodes run; what cannot be wired refused.
The single-node products are unchanged by it: `hosted-check` on three
ISAs, and the three bare-metal boots with lines typed at each prompt
(`logs/20261006-074907`, `-075150`, `-075532`).
2. **The nucleus as a capsule, and an empty node made a StarForth node
through its port (section 5).**
3. **Messages (section 6):** a StarForth node that reads messages when