Skip to content

Instantly share code, notes, and snippets.

@lancejpollard
Last active June 17, 2021 02:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lancejpollard/0c8a4fc7a4605eef14e8fd2ad7f463e3 to your computer and use it in GitHub Desktop.
Save lancejpollard/0c8a4fc7a4605eef14e8fd2ad7f463e3 to your computer and use it in GitHub Desktop.

Notes on the Railway Model of Computation

From A universal cellular automaton in the hyperbolic plane.

Switches

A switch is a point from which a track splits. So it starts with one track, and ends with two.

You can go in two directions on the switch:

  1. forward: 1 to one of 2 tracks
  2. backward: one of 2 to 1 tracks

The forward approach is called the "active" direction in the paper, the backward approach the "passive" direction.

There are 3 types of switches:

  1. fixed
  2. toggle
  3. memory

The fixed switch doesn't do anything, it always chooses the same output track on the active passage.

      ___ o
i ___/
     \___

or

      ___
i ___/
     \___ o

The toggle switch alternates between one track and the next depending on the last active passage output track.

         ___ o
1  i ___/
        \___

         ___
2  i ___/
        \___ o

         ___ o
3  i ___/
        \___

         ___
4  i ___/
        \___ o

...

The memory switch sends any active passage to the track which the last passive passage came in through. So it always goes in one direction if nothing comes in passively, and only changes to a new direction when the passive passage comes in from the alternative track.

          ___ i
1a  o ___/
         \___

          ___ o
2a  i ___/
         \___

          ___ o
3a  i ___/
         \___

          ___ o
4a  i ___/
         \___

...

          ___ 
1b  o ___/
         \___ i

          ___ 
2b  i ___/
         \___ o

          ___ 
3b  i ___/
         \___ o

          ___ 
4b  i ___/
         \___ o

...

Registers

Unit Register

Used for incrementing and decrementing.

The content of the elementary circuit is encoded by the position of the switches.

The (m) is the memory switch, the (t) the toggle switch.

          ________________ o1
         /        \
i1___(m)/          \(t)___ i2
        \          /
         \________/_______ o2

Going in through the left on (m) is a read, going in from the right on (t) is a write.

There are many ways you can organize the switches, the layout. This is just one visualization.

Passing through the flip-flop switch performs a NOT operation on the content of the elementary circuit.

The Unit Circuit

Incrementing the Unit Register

Decrementing the Unit Register

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment