# Simple way of connecting cellular automata?

Discussion in 'VHDL' started by Pleg, Mar 4, 2006.

1. ### PlegGuest

Hi, I'm writing a little test program for an array of 64 cellular automata
for generating random numbers. The CA I've chosen has a connectivity of
{-7,0,11,17} with cyclic boundary conditions, that is, for example, the cell
number 20 has as input the outputs of cells {13,20,31,37}, and cell number
60 {53,60,7,13} (and so on for every cell). I'd rather not connect every
cell by hand, it'll be terribly tedious and easy to make mistakes
(expecially considering that this is just a test, and the real machine will
have 144 CA...)
So, is there an easy and automatic way of doing these connections?
In the test I wrote in C, the code was simply

for(j=0;j<L;j++){m_next[j]=rule50745(m[modulo(j-7)],m[j],m[modulo(j+11)],m[m
odulo(j+17)]);}

where "rule50745" is the rule for the next state and "modulo" is just

int modulo(int num){
int out=num;
if(num<0){out=num+L;}
else if(num>=L){out=num-L;}
return out;}

Any idea? Thx,

Pleg

Pleg, Mar 4, 2006