Ether


This code from block 900 is loaded into node 608. And from there into all the other nodes in both the target and host chips of GreenArrays' Eval board. This is the code that establishes the ether which communicates amongst nodes.

Be warned that this is the most complicated block of code that I've written. Stack comments may help:

The header for an ether message is 4 words:

followed by the payload.

The word e608 in the last line is special code to load this block into node 608 from async node 708.

Port calls

The first 4 words of RAM contain calls to the right, left, down and up ports. Because of the way nodes are mirrored, if you move left/right those calls must be swapped. If you move up/down those calls must be swapped. This procedure undoes the complication of mirrored nodes.

These port calls are used as the port address. That's ok because only the 9 low-order bits are the address. The call instruction in the high-order bits is ignored.

fill

This is the initial entry point. It puts a non-zero on the stack and jumps to whence. Fill will copy this block of code into every node along the path.

code

This is the nominal entry point. It puts a 0 on the stack and falls into whence.

whence

Determines from which comm port the message comes. The call following the focus call brought us here. So the focus address is on the return stack. It's put into register a where it will remain.

The next word is fetched, which is the path. Fall into turn.

turn

Examines the path:

wither

payload

copy?

mirror

copy

Forwards 3 instruction words and falls into pump. The code for those words is standard transfer code in the comment line just above. The will be executed by the destination node

pump

Simply moves data from the address in register a to that in b. Increment fetch is used to move data from RAM. If it is moving from a port, the increment is suppressed.