MCPcopy Create free account
hub / github.com/Xilinx/Vitis_Libraries / import_binary_file

Function import_binary_file

security/ext/xcl2/xcl2.cpp:63–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61 return get_devices("Xilinx");
62}
63cl::Program::Binaries import_binary_file(std::string xclbin_file_name) {
64 std::cout << "INFO: Importing " << xclbin_file_name << std::endl;
65
66 if (access(xclbin_file_name.c_str(), R_OK) != 0) {
67 printf("ERROR: %s xclbin not available please build\n", xclbin_file_name.c_str());
68 exit(EXIT_FAILURE);
69 }
70 // Loading XCL Bin into char buffer
71 std::cout << "Loading: '" << xclbin_file_name.c_str() << "'\n";
72 std::ifstream bin_file(xclbin_file_name.c_str(), std::ifstream::binary);
73 bin_file.seekg(0, bin_file.end);
74 unsigned nb = bin_file.tellg();
75 bin_file.seekg(0, bin_file.beg);
76 char* buf = new char[nb];
77 bin_file.read(buf, nb);
78 bin_file.close();
79
80 cl::Program::Binaries bins;
81 bins.push_back({buf, nb});
82 return bins;
83}
84
85std::string find_binary_file(const std::string& _device_name, const std::string& xclbin_name) {
86 std::cout << "XCLBIN File Name: " << xclbin_name.c_str() << std::endl;

Callers 2

mainFunction · 0.50
mainFunction · 0.50

Calls 3

printfFunction · 0.85
push_backMethod · 0.80
readMethod · 0.45

Tested by

no test coverage detected