Search code examples
verilogvivado

Verilog "Range Index cannot be a real number" error on range definition


I am defining the range of an output 'Z' based on parameter 'N' and getting an error when setting up the size, not sure why the error is occurring since it works fine when I do something similar for an input 'X'.

What doesn't work:

output [((4*N)+((0.5*N*N) - (0.5*N)))-1 : 0] Z

//When passing it to another module:
.Z(Z[((4*i)+((0.5*i*i) - (0.5*i))) +: (4+i)]))

Both result in ERROR: [VRFC 10-1300] range index cannot be a real number which confuses me since

input [((8*N)+(N*N-1))-1 : 0] X
//and
.X(X[((8*i) + (i*i - i)) +: 8+(2*i)])

works just fine...

Completely stumped here, would appreciate any insight as there aren't a ton of resources out there.


Solution

  • As @TimRoberts said, stuffing a float into an equation that should return an integer is what caused that error.

    Instead doing

    output [((4*N)+(((N*N)/2) - (N/2)))-1 : 0] Z
    

    resulted in something that was finally able to simulate.