我在 Linux 中使用 pcap.h 头文件来解析 pcap 文件。程序正确编译和解析数据包。但是,我想将相同的逻辑放在 FPGA 上,为此我使用 Xilinx Vivado HLS 工具。我在 Xilinx Vivado 中链接 pcap.h 文件时遇到问题。所以,现在我有两个选择: 1. 如何在 Xilinx Vivado HLS 中链接外部库?2.如果1.不可能,我想知道是否可以在不使用pcap.h头文件的情况下解析pcap数据包?
2 回答
There are 3 things.
All code which should be converted to HW has to have a source.
libpcap can not be obviously used to read packet from FPGA interfaces.
For simulation purposes (I expect this is what you want) the rules are same as for generic c/c++ program. You need to add include directory where the pcap.h is stored in order to include it and you have to link the libpcap library in order to link final test executable. You can find this settings in project properties. Or you can write your make for the tests.
无法将外部库链接到 Vivado HLS 综合过程。生成 RTL 时需要所有 C/C++ 源文件。但是,在使用 C 仿真或 RTL/C 协同仿真进行测试时,可以链接外部库。在这两种情况下,您都需要在Project Settings - Simulation下编辑CFLAGS和Linker Flags设置。