0

I am using Vivado HLS 2018.3. I am defining 108-bit unsigned integer using ap_int.h library. In the test bench I am initializing a 108-bit variable as :

inData = 259614842926741381426524816461004;

However, while doing C simulation, I am getting error as follows :

warning: integer constant is too large for its type

And my code is not compiling. However this same source code works fine for 16-bit input in test bench. Please suggest a way out. Thanks !

ikegami
  • 367,544
  • 15
  • 269
  • 518
MAJID AHMAD
  • 123
  • 3
  • 1
    C or C++? Please pick only one target language, also see the descriptions of those tags. In any case, search for "large integer" plus the "[language]" in square brackets to find a bunch of related questions and to get an idea of possible approaches. – Ulrich Eckhardt Mar 26 '22 at 05:52
  • "using ap_int.h library." Okay, and *what does the documentation for the library say* about how to initialize the variables? – Karl Knechtel Mar 26 '22 at 06:06
  • `this same source code works fine for 16-bit input` obviously. If you use `int` then it's required to have at least 16 bits by C and C++ standards. But there's no arbitrary-precision type in C or C++ and if the value is larger than `intmax_t` then you have to use bigint library – phuclv Mar 26 '22 at 06:15
  • Sorry that I couldn't explain this question properly. It is not related to ordinary C/C++ but Vivado HLS. Vivado has some different rules regarding C/C++. – MAJID AHMAD Mar 28 '22 at 09:27

0 Answers0