An example of a register machine computation

States: s1, s2, s3, s4, s5, s0

Registers: R(x), R(y)

Commands:


(s1, R(x), s0, s2, s3) 	branch command

(s2, R(x), s4) destructor command

(s3, R(x), s5) destructor command

(s4, R(y), 0, s1) constructor command

(s5, R(y), 1, s1) constructor command

Initial configuration:

State s1,

R(x) : 01101

R(y) :


Computation:

State s1, Command (s1, R(x), s0, s2, s3)

R(x) : 01101

R(y) :


State s2, Command (s2, R(x), s4)

R(x) : 1101

R(y) :


State s4, Command (s4, R(y), 0, s1)

R(x) : 1101

R(y) : 0


State s1, Command (s1, R(x), s0, s2, s3)

R(x) : 1101

R(y) : 0


State s3, Command (s3, R(x), s5)

R(x) : 101

R(y) : 0


State s5, Command (s5, R(y), 1, s1)

R(x) : 101

R(y) : 10


State s1, Command (s1, R(x), s0, s2, s3)

R(x) : 101

R(y) : 10


State s3, Command (s3, R(x), s5)

R(x) : 01

R(y) : 10


State s5, Command (s5, R(y), 1, s1)

R(x) : 01

R(y) : 110


State s1, Command (s1, R(x), s0, s2, s3)

R(x) : 01

R(y) : 110


State s2, Command (s2, R(x), s4)

R(x) : 1

R(y) : 110


State s4, Command (s4, R(y), 0, s1)

R(x) : 1

R(y) : 0110


State s1, Command (s1, R(x), s0, s2, s3)

R(x) : 1

R(y) : 0110


State s3, Command (s3, R(x), s5)

R(x) :

R(y) : 0110


State s5, Command (s5, R(y), 1, s1)

R(x) :

R(y) : 10110


State s1, Command (s1, R(x), s0, s2, s3)

R(x) :

R(y) : 10110


State s0, final state

Input: 01101 Output: 10110

This register machine takes the contents of R(x) and places them in reverse order in R(y).