-1

Quartus returns this error: "and indexing x returns an aggregate value". The code:

module splineInterp(x, y);
input real x [64:0][0:4];
output real y;
y = x[1] - x[0];
endmodule

1 Answers1

4

You have a 2-dimensional (unpacked) array of reals:

input real x [64:0][0:4];

It is illegal in Verilog to not index all unpacked dimensions (if you index any of them). Adding the missing assign statement, this is still illegal:

assign y = x[1] - x[0];

because you have only indexed the first dimension. You will have to say something like

assign y = x[1][4] - x[0][4];

Basically, the error message is telling you that x[0] is an aggregate value - ie it's an array of reals, not a real.

Matthew Taylor
  • 13,365
  • 3
  • 17
  • 44
  • I tried it but got the same result. I thought that real type in verilog always represented by 64 bits then I don't have to specify the array of real like: real x [64:0][0:4]. I tried to define it this way: real x [0:4]. But when i try to use one real number from x array this way: assign y = x[1] - x[0], quartus returns me error i mensioned before. – Санат Б Sep 25 '18 at 06:14
  • Code with reals in is not synthesisable. (ie you cannot turn code with reals in into hardware.) You should not be compiling this code with Quartus. But, to be clear, `real x [64:0][0:4]` is a 2D array of 65 x 5 reals. – Matthew Taylor Sep 25 '18 at 07:59
  • thank you very much. Then do you know any open source libraries to work with fixed or floating point numbers in verilog? – Санат Б Sep 25 '18 at 08:28
  • No, I don't, sorry. I used to work on chips at my last job, which were 100,000s of gates of signal processing logic, all done with fixed point. All done by hand - we didn't use any kind of library. – Matthew Taylor Sep 25 '18 at 10:29