Basic Communication Timing

A project log for TIS-104-real

A hardware implementation of the TIS-100 computer game.

Rasmus SvenssonRasmus Svensson 03/16/2016 at 21:050 Comments

When we were thinking about how the communication between the modules should work, we realized that we did not know how TIS-100 behaved in certain cases.

The first unknown was when reads and writes to neighboring nodes occur during a machine tick. For example, is it even possible for a node to read and write during a single tick? Consider the following program:

Node A              Node B

ADD RIGHT         |

Its behavior can be described like this. Each game tick can be divided into a read phase and a write phase. Each instruction first executes its read operation (if any). If no value could be read, the node stalls for the whole tick and tries again in the next read phase. Then the instruction executes its write operation (if any). This signals to a neighboring node that data is available to read. Since writes occur after reads, the writing operation can never complete during its first tick. This "wasted" tick is not counted as idle time by the game.

The behavior of the code above can therefore be described as follows:

Node A                         Node B

1R -                         | 1R No value to read
1W Signal value available    | 1W -

2R Transmit value            | 2R Receive value
2W -                         | 2W Signal value available
3R Receive value | 3R Transmit value 3W - | 3W -

Since Node B has no value to read for the first tick, it is idle here. This means it has 33% idle time, which is consistent with the value shown in the game. Both programs turn out to take exactly three ticks per iteration.

This cleared up our intuition for a while. Then we thought about ANY... Stay tuned for the next post!