Jump to content

ac_math test code compilation error


scsc

Recommended Posts

Someone seemed had used ac_math library. So here is my question. What's syntax error with the template keyword in the following line of rtest_ac_abs.cpp:

                    ac_fixed<Wfl, Ifl, true> input_mant;
  // Set the sign bit to zero to ensure a positive value.
  input_mant[Wfl - 1] = 0;
  // Set the bit adjacent to the sign bit to 1 to ensure a normalized mantissa
  input_mant[Wfl - 2] = 1;
  // Set the remaining bits to the bit pattern stored in the last (Wfl - 2) bits in mant_i.
 

input_mant.template set_slc(0, mant_i.template slc<Wfl - 2>(0));   //<<< this line has syntax error???

 

Link to comment
Share on other sites

You did not post any error message, so it is practically impossible to answer your question. Perhaps you have run-time variables in the template parameters, which are strictly compile-time.

In any case, this is not part of SystemC, but looks to possibly be part of an Intel FPGA package. SystemC identifiers generally begin with `sc_`. Consider:

1. Take your question elsewhere (e.g., Intel FPGA forum)

2. Look at the header file from whence it came and learn the C++ API from whence it came. If that does not make sense to you, then consider taking a course in C++.

Link to comment
Share on other sites

The error message is simply "syntax error: template in line 371" (the specific line in the post). Why is this an FPGA question? ac_math is from Mentor's HLS library. I agree this is not part of SystemC but I read someone here had posted AC HLS questions too. 

Link to comment
Share on other sites

You still don't provide enough context for enabling us to give you a good response. Ideally, you should provide us with a self-contained executable example exposing your problem. It is also important to know on which platform, with which compiler and library versions you did build your application and what full error message resulted.

Your code snipped seems to stem from some test program, which is part of the ac_math distribution and hosted on GitHub. So, if this gets triggered on your platform following their build instructions, I suggest to check their issue tracker and raise a new issue if needed.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...