Essentially what you're asking is if (x modulo y != 0). So yes you can do that. As far as I know however (x % y != 0) is not synthesizable when both x and y are variable. So for simulation no problem, but for synthesis AFAIK you'd need some math library. Hopefully this modulo example is trivial enough that the fpga vendor has some ready to go core you can use. I would expect so, but I'm not sure...
]
Thankyou so much. I haven't worried that much about whether or not what I am writing is synthesisable to be honest, I know very little about that yet. I havent even tried writing a test bench yet so it only works in my head! If I get that far I have the option of trying to put it on a BEE3 cube but there is a long way to go yet!
The x and y are passed from parameters so they are only variable to an extent and the mesh is laid out as below.
6-7-8
3-4-5
0-1-2
X_NODES = 5
Y_NODES =5
[63:0] routerInputData [0:4][0
X_NODES*Y_NODES)]
[63:0] networkData [0:4][0
X_NODES*Y_NODES)]
for (nodeNumber = 0; nodeNumber < (X_NODES*Y_NODES); nodeNumber++)
begin
routerInputData[0][nodeNumber] = (nodeNumber < ((X_NODES-1)*Y_NODES)) ? [63:0] networkData [2][nodeNumber + X_NODES] : [63:0] 'b0;
routerInputData[1][nodeNumber] = ((nodeNumber + 1) modulo X_NODES) ? [63:0] networkData [3][nodeNumber + 1] : [63:0] 'b0;
routerInputData[2][nodeNumber] = (nodeNumber > X_NODES) ? [63:0] networkData [0][nodeNumber - X_NODES] : [63:0] 'b0;
routerInputData[3][nodeNumber] = (nodeNumber modulo X_NODES) ? [63:0] networkData [1][nodeNumber -1] : [63:0] 'b0;
routerInputData[4][nodeNumber] = [63:0] 'b0;
end
I have data in a three dimensional array called networkData, I am hoping that I have a selection of 64 bit packets, 5 per router, for 25 routers and that the way array works is
[packet size:0] dataName [0:Number of lines of data per router][0:number of routers]
so that when I want to retrieve information from a specific router I would put
data = dataName[line number][router number]
and if I wanted to write to it
dataName[line number][router number] = data
It works in my head, but that is all! I don't even know if I have really understood the array structure. Thanks for your help!