feat(v4.0.0): the wire in the engine -- whole messages, put and taken in one step
Queues of whole messages on the wires between nodes (v4/wire.h), the six addresses and ten operations a node asks of the fabric (MESH.md 7d.3), and the fabric's pool of queues. Engine only: the nucleus does not use any of it yet. The ports in the host map move to BUF0_W - 140 so that the new addresses are not among the nucleus variables, with a compile-time check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
50be766e7b
commit
d5cd64605d
+46
-3
@@ -44,6 +44,15 @@
|
||||
#endif
|
||||
#define V4_PORT_ANY V4_PORTS /* not a port: "whichever port has a neighbour writing" */
|
||||
|
||||
/* The indexes, after the ports, of what a node asks of the fabric about whole
|
||||
* messages on its wires (docs/v4.0.0/MESH.md 7d.3); see v4_node_port_attach. */
|
||||
#define V4_PORT_WIRE (V4_PORTS + 4u) /* store the number of a port: what follows is about that wire */
|
||||
#define V4_PORT_A (V4_PORTS + 5u) /* store a value an operation needs */
|
||||
#define V4_PORT_B (V4_PORTS + 6u) /* store a second */
|
||||
#define V4_PORT_DO (V4_PORTS + 7u) /* store the number of an operation: the node is blocked until it is done */
|
||||
#define V4_PORT_HOW (V4_PORTS + 8u) /* fetch how it went */
|
||||
#define V4_PORT_HAVE (V4_PORTS + 9u) /* fetch which wires have a message waiting: bit k for port k */
|
||||
|
||||
#ifndef V4_NODE_WORDS
|
||||
#define V4_NODE_WORDS 1024u
|
||||
#endif
|
||||
@@ -113,6 +122,15 @@ typedef struct {
|
||||
unsigned readers; /* bit k: the neighbour on port k is blocked reading from this node */
|
||||
unsigned since_look; /* words taken from this node since it last fetched either of those */
|
||||
|
||||
/* Whole messages on the wires (MESH.md 7d.3). See v4_node_port_attach. */
|
||||
unsigned wire; /* the port that A, B and Do are about; V4_PORTS if what was stored is not a port */
|
||||
v4_cell wire_a, wire_b; /* A and B */
|
||||
int doing; /* non-zero: blocked, having stored `do_op` to Do */
|
||||
v4_cell do_op; /* the operation */
|
||||
v4_cell how; /* how the last one went */
|
||||
unsigned have; /* which wires had a message waiting, as the fabric last said: bit k for port k */
|
||||
int have_fetched; /* non-zero: `have` has been fetched since the fabric last cleared what had arrived */
|
||||
|
||||
/* DSTACK-DEPTH and RSTACK-DEPTH (D-16). See v4_node_stack_regs_attach. */
|
||||
v4_cell dstack_reg; /* its word address, or -1 */
|
||||
v4_cell rstack_reg; /* its word address, or -1 */
|
||||
@@ -187,11 +205,24 @@ void v4_node_console_attach(v4_node *n, v4_cell addr);
|
||||
* ports have anything on them at all: bit V4_PORTS + k
|
||||
* for port k. A port with nothing on it can never
|
||||
* be read from or written to.
|
||||
* The last two are how a node looks before it writes (MESH.md 7a), as the
|
||||
* base + V4_PORTS + 4 .. + 9 whole messages on the wires (MESH.md 7d.3), the
|
||||
* indexes V4_PORT_WIRE, V4_PORT_A, V4_PORT_B, V4_PORT_DO,
|
||||
* V4_PORT_HOW and V4_PORT_HAVE:
|
||||
* Wire, A, B store: what an operation is about and
|
||||
* needs; fetch gives back what was stored
|
||||
* Do store: the number of an operation. The
|
||||
* node is blocked until whoever connects
|
||||
* its ports has done it (v4_node_doing,
|
||||
* v4_node_done); fetch gives the number
|
||||
* How fetch: how the last one went
|
||||
* Have fetch: which wires have a message
|
||||
* waiting, bit k for port k, as the fabric
|
||||
* last said (v4_node_have)
|
||||
* The two before them are how a node looks before it writes (MESH.md 7a), as the
|
||||
* F18's io register lets it. They are what whoever connects the ports last
|
||||
* said, v4_node_port_status; fetching them waits for nothing and changes
|
||||
* nothing.
|
||||
* (read only)
|
||||
* nothing. Of the whole-message addresses How and Have are read only: a
|
||||
* store to either is an address fault, as to "any port".
|
||||
* None of them is memory while the ports are attached.
|
||||
*
|
||||
* A WRITE. A store to a port does not write memory: the node keeps the
|
||||
@@ -219,6 +250,18 @@ void v4_node_port_attach(v4_node *n, v4_cell base);
|
||||
/* The neighbour has taken what the node wrote. */
|
||||
void v4_node_port_served(v4_node *n);
|
||||
|
||||
/* WHOLE MESSAGES (MESH.md 7d.3). A store to Do records the operation in
|
||||
* n->do_op and blocks the node, as a store to a port does: n->doing. For
|
||||
* whoever connects the node's ports: 1 if the node is blocked at one; the
|
||||
* operation is done, `how` is what the node will fetch from How, and the
|
||||
* node goes on from the opcode after the store; and `mask` is which wires
|
||||
* have a message waiting, as the node will fetch it from Have. Fetching
|
||||
* Have also sets n->have_fetched, for whoever connects the ports to see and
|
||||
* clear. */
|
||||
int v4_node_doing(const v4_node *n);
|
||||
void v4_node_done(v4_node *n, v4_cell how);
|
||||
void v4_node_have(v4_node *n, unsigned mask);
|
||||
|
||||
/* How many words the node has had taken since it last looked at its
|
||||
* neighbours (a fetch of either of the two status addresses). A node that
|
||||
* looks before it begins a message (MESH.md 7a) and is blocked writing with
|
||||
|
||||
Reference in New Issue
Block a user