Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Possibly simple SystemVerilog question. 'Any multiple of'

Status
Not open for further replies.

BartlebyScrivener

Member level 5
Joined
Feb 8, 2012
Messages
90
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
2,081
Hi all, I am very new to digital design and verilog so this might be quite simple....

Is there any way I can write the condition.

x does not equal 'any multiple of' Y

it is the 'any multiple of' I am unsure about. I am making a paramatised 2D mesh of router modules and want to ensure the routers at the edge of the mesh do not look for inputs where there is not one.

Also, I am writing a network-on-chip, it is the first thing I have designed and written and I dont have a teacher, can I just post the whole lot on here once I am done for a critique?

Thankyou1
 

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...
 
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!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top