scsc Posted May 30, 2021 Report Share Posted May 30, 2021 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??? Quote Link to comment Share on other sites More sharing options...
David Black Posted May 30, 2021 Report Share Posted May 30, 2021 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++. Quote Link to comment Share on other sites More sharing options...
scsc Posted May 31, 2021 Author Report Share Posted May 31, 2021 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. Quote Link to comment Share on other sites More sharing options...
maehne Posted May 31, 2021 Report Share Posted May 31, 2021 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. Quote Link to comment Share on other sites More sharing options...
scsc Posted June 1, 2021 Author Report Share Posted June 1, 2021 Problem resolved. This line that caused syntax error input_mant.template set_slc(0, mant_i.template slc<Wfl - 2>(0)); should be: input_mant.set_slc(0, mant_i.template slc<Wfl - 2>(0)); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.