Memory consists of a rectangular pile with large, yet finite, dimensions. It stores an ordered list of bytes in a sequence of nodes in its top-two rows. The nodes are evenly-spaced, ten columns apart, starting from column 0.
To perform a read-modify-write operation, the agent builds a function on top of the bytes to be changed. The function’s output—a row of 8, 16, or 24 evenly-spaced nodes—is the initial segment of a new surface of a taller pile. The agent raises the remaining surface flush with the function’s output by constructing identity functions over all the remaining bytes. The new surface contains the same data as the original surface, except for the bytes targeted by the operation.
To make this clear, the following visualization depicts the layers of a rectangular pile resulting from a read-modify-write operation. The bottom layer shows the initial memory state: five bytes, all zeros. The agent built an 8-bit increment function, INC, above byte 2. INC's output created the first segment of the top layer (the yellow cell). Then the agent built identify functions over the remaining bytes (the up-arrows). The outputs of those functions formed the rest of top layer. The final memory state consists of five bytes, all zeros, except for byte 2, which was incremented.
1 | 00 | 00 | 01 | 00 | 00 |
🡅 | 🡅 | INC | 🡅 | 🡅 | |
0 | 00 | 00 | 00 | 00 | 00 |
0 | 1 | 2 | 3 | 4 |
In the more elaborate example below, the agent assigned byte 0 the sum of bytes 1, 2, 3, and 4, via a sequence of read-modify-write operations.
9 | 0A | 01 | 02 | 03 | 04 |
SWAP | 🡅 | 🡅 | 🡅 | ||
8 | 01 | 0A | 02 | 03 | 04 |
🡅 | SWAP | 🡅 | 🡅 | ||
7 | 01 | 02 | 0A | 03 | 04 |
🡅 | 🡅 | SWAP | 🡅 | ||
6 | 01 | 02 | 03 | 0A | 04 |
🡅 | 🡅 | 🡅 | ADD_AB_FB | ||
5 | 01 | 02 | 03 | 06 | 04 |
🡅 | 🡅 | SWAP | 🡅 | ||
4 | 01 | 02 | 06 | 03 | 04 |
🡅 | 🡅 | ADD_AB_FB | 🡅 | ||
3 | 01 | 02 | 03 | 03 | 04 |
🡅 | SWAP | 🡅 | 🡅 | ||
2 | 01 | 03 | 02 | 03 | 04 |
🡅 | ADD_AB_FB | 🡅 | 🡅 | ||
1 | 01 | 01 | 02 | 03 | 04 |
COPY_B_A | 🡅 | 🡅 | 🡅 | ||
0 | 00 | 01 | 02 | 03 | 04 |
0 | 1 | 2 | 3 | 4 |
Here is an explanation each operation:
The SWAP function provides a way to move values around in memory. Above, the agent used it bring values together for the add functions. And it finished with three consecutive SWAPs to shuttle the computed sum from byte 3 to byte 0.
Memory capacity is always finite, but the agent can expand it endlessly. To allocate a byte, the agent drops eight horizontal I-tetrominoes onto the playfield floor, evenly-spaced, ten columns apart, immediately to the right of the pile. That introduces eight new 0-nodes:
Then the agent stacks identity functions above the new nodes until the output reaches the height of the rest of the pile.
The process is portrayed in the following example. It shows a newly allocated byte appended to the sum pile.
9 | 0A | 01 | 02 | 03 | 04 | 00 |
SWAP | 🡅 | 🡅 | 🡅 | 🡅 | ||
8 | 01 | 0A | 02 | 03 | 04 | 00 |
🡅 | SWAP | 🡅 | 🡅 | 🡅 | ||
7 | 01 | 02 | 0A | 03 | 04 | 00 |
🡅 | 🡅 | SWAP | 🡅 | 🡅 | ||
6 | 01 | 02 | 03 | 0A | 04 | 00 |
🡅 | 🡅 | 🡅 | ADD_AB_FB | 🡅 | ||
5 | 01 | 02 | 03 | 06 | 04 | 00 |
🡅 | 🡅 | SWAP | 🡅 | 🡅 | ||
4 | 01 | 02 | 06 | 03 | 04 | 00 |
🡅 | 🡅 | ADD_AB_FB | 🡅 | 🡅 | ||
3 | 01 | 02 | 03 | 03 | 04 | 00 |
🡅 | SWAP | 🡅 | 🡅 | 🡅 | ||
2 | 01 | 03 | 02 | 03 | 04 | 00 |
🡅 | ADD_AB_FB | 🡅 | 🡅 | 🡅 | ||
1 | 01 | 01 | 02 | 03 | 04 | 00 |
COPY_B_A | 🡅 | 🡅 | 🡅 | 🡅 | ||
0 | 00 | 01 | 02 | 03 | 04 | 00 |
0 | 1 | 2 | 3 | 4 | 5 |
The agent never deallocates memory. The pile's width either remains constant or it increases.
The agent loads the initial memory state by dropping a sequence of horizontal I-tetrominoes (0-nodes) and O-tetrominoes (1-nodes) onto the playfield floor, evenly-spaced, ten columns apart, starting from column 0. For instance, here is a single byte, the value 42:
Since the agent clears newly allocated bytes, all memory locations after the final byte of the initial state effectively contain zero.
© 2023 meatfighter.com |