Forum Discussion
Sample project with RTL module library not working
Hello Intel Support,
I am attempting to compile a library of RTL components to use in my HLS project.
The HLS project compiles when testing for x86-64 simulation, but the compiler complains about the desired RTL function being "undefined" when attempting to compile for test-fpga.
I have included the relevant files .v and .xml files, but cannot upload the .cpp or .h file though they are included when I compile the library
I am curious as to which file likely has the issue since I can do simulation but not compilation.
Thank you in advance
The issue is in my expHBU.h file. I put
uint8_t expHBU(uint8_t input);Rather than the CORRECT
extern "C" { uint8_t expHBU(uint8_t input); }This extern is extremely esoteric and should be included in the reference manual.
8 Replies
- YoshiakiS_Altera
Occasional Contributor
Hello messn036,
For investigation, could you please upload your failure log?
Best regards,
Yoshiaki Saito
- messn036
New Contributor
i++ component_testbench.cpp expHBU.a -v --dont-error-if-large-area-est -march=Cyclone10GX -o test-fpga Target FPGA part name: 10CX220YF780I5G Target FPGA family name: Cyclone10GX Target FPGA speed grade: -5 Resolved expHBU.a to /home/grads/messn036/OpenCL-HUBERT/OpenCL-HUBERT/component_ip/expHBU.a Analyzing component_testbench.cpp for testbench generation Creating x86-64 testbench Analyzing component_testbench.cpp for hardware generation Verifying version information in the included files. Expecting version 21.2.0.67.4 for all included files. Included files passed version check. Checked: /home/grads/messn036/OpenCL-HUBERT/OpenCL-HUBERT/component_ip/expHBU.a Preprocessing FPGA Libraries Optimizing component(s) and generating Verilog files component_testbench.cpp:9: Compiler Error: undefined reference to 'expHBU(unsigned char)' HLS Main Optimizer FAILED. make: *** [test-fpga] Error 1I have done some basic troubleshooting in the meantime an narrowed down my error a bit. To compile the RTL library, I am using the following commands
fpga_crossgen exp_wrapper.xml --target hls --emulation_model expHBU.cpp -o expHBU.o fpga_libtool --target hls --create expHBU.a expHBU.oBut It seems like I need to use different flags to get the xml and verilog to compile for NOT the x86-64 simulation but for the test-fpga version. Am I right here? When should I expect to compile the xml and verilog?
- messn036
New Contributor
Additional information: If I compile the library with just the fpga_crossgen command (exclude the expHBU.a step)
fpga_crossgen exp_wrapper.xml --target hls --emulation_model expHBU.cpp -o expHBU.oAnd then attempt a -march=Cyclone10GX compile
i++ component_testbench.cpp expHBU.o -v --dont-error-if-large-area-est -march=Cyclone10GX -o test-fpgaI get the following error
Compiler Error: Cannot find Library file ./test-fpga.prj/spec.xml - YoshiakiS_Altera
Occasional Contributor
Hello messn036,
Thank you for sharing the failure log with us.
I think the simple design is necessary to investigate it for us.
So could you share simple full design which can duplicate the error with us?
Best regards,
Yoshiaki Saito
- messn036
New Contributor
Here are the source files I am using. I am trying to model the basic rtl library tutorial the best I can (which compiles fine in my environment). I'm sure its some easy syntax error that none of the compilers or packagers is catching.
I cannot upload the .cpp and .h files because this site rejects them. Here is the source
expHBU.h
#include <stdint.h> #include "HLS/math.h" uint8_t expHBU(uint8_t input);expHBU.cpp
#include "expHBU.h" uint8_t expHBU(uint8_t input){ return (uint8_t)exp(input); }component_testbench.cpp
#include "HLS/hls.h" #include "HLS/stdio.h" #include "HLS/math.h" #include "expHBU.h" component uint8_t executeexp(uint8_t exponent) { return expHBU(exponent); } component uint8_t executeexp_basic(uint8_t exponent) { return exp(exponent); } int main() { uint8_t exponent = 3; uint8_t result = executeexp(exponent); printf("result %d \n", result); return 0; }Reminder: the x86 simulation works, but the FPGA compile does NOT
Thanks,
messn036
- messn036
New Contributor
The issue is in my expHBU.h file. I put
uint8_t expHBU(uint8_t input);Rather than the CORRECT
extern "C" { uint8_t expHBU(uint8_t input); }This extern is extremely esoteric and should be included in the reference manual.