[refactor]: Added check for when the Xilinx bitstream compilation should be invoked
@@ -318,6 +318,18 @@ public class OCLCodeCache {
}
}
+ private boolean shouldGenerateXilinxBitstream(File fpgaBitStreamFile, OCLDeviceContext deviceContext) {
+ if (!RuntimeUtilities.ifFileExists(fpgaBitStreamFile)) {
+ if (deviceContext.getPlatformContext().getPlatform().getVendor().equals("Xilinx")) {
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
+
public OCLInstalledCode installFPGASource(String id, String entryPoint, byte[] source) {
String[] compilationCommand;
final String inputFile = FPGA_SOURCE_DIR + LOOKUP_BUFFER_KERNEL_NAME + OPENCL_SOURCE_SUFFIX;
@@ -368,16 +380,14 @@ public class OCLCodeCache {
System.out.println(sourceCode);
}
- if (!RuntimeUtilities.ifFileExists(fpgaBitStreamFile)) {
- if (deviceContext.getPlatformContext().getPlatform().getVendor().equals("Xilinx")) {
+ if(shouldGenerateXilinxBitstream(fpgaBitStreamFile, deviceContext)) {
compilationCommand = composeXilinxHLSCompileCommand(inputFile, entryPoint);
callOSforCompilation(compilationCommand, null);
}
- }
- } else
- // Should not reach here
+ } else {
return null;
}
+ }
return null;
}
