0
\$\begingroup\$

In the testbench for a SystemVerilog module, I have the following array declaration and initialization:

real testVals [][] = '{
 '{1.5, 1.5}, 
 '{2.0, 3.0},
 '{0.0, 0.0},
 '{-1.5, 1.5},
 '{-1.5, 4.0},
 '{-1.5, 3.0},
 '{-1.5, -3.0},
 '{9.5E255, 4.2E200},
 '{9.5E500, 4.2E200} // line 63
};

When I try to compile the code using QuestaSim, I get this error:

** Error: (vlog-13037) fp_adder_tb.sv(63): near "9.5E500": Numeric value exceeds 32-bit capacity.

Why do I get an error about a 32-bit capacity limit when the data-type is real? This would make sense for an integer or int, but it should be a double-precision float. Also, 9.5E255 is also well beyond the range of a 32-bit value - why is it okay? If I remove the one offending line, it compiles without a problem.

QuestaSim version: QuestaSim-64 vlog 10.4c Compiler 2015.07 Jul 19 2015

asked Apr 25, 2016 at 6:47
\$\endgroup\$

1 Answer 1

3
\$\begingroup\$

Even floating point numbers have limits. 9.5e+500 is outside the limits of binary64 (4.9e-324 to 1.8e+308), which is what real implements.

As for why it's complaining about "32-bit capacity", that I couldn't tell you. Might be a compiler bug.

answered Apr 25, 2016 at 7:27
\$\endgroup\$
1
  • \$\begingroup\$ Yup... I had a brainfart when I thought about the range of a double-precision float. You are correct that I'm requesting a value that is out of range, and that the "32-bit" thing is probably just a buggy compiler error message. \$\endgroup\$ Commented Apr 25, 2016 at 8:06

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.