// 2. Obtain part information
/////////////////////////////////////////////////////////////////////
XilinxConfigurationSpecification partInfo = cmdLineParser.getPartInfoExitOnError(options, bitstream, true);
// 3. Create FPGA object
FPGA fpga = new FPGA(partInfo);
// Configure FPGA
fpga.configureBitstream(bitstream);
String outputBitstreamFileName = cmdLineParser.getOutputFileNameStringExitOnError(options);
/////////////////////////////////////////////////////////////////////
// Perform Bitstreams Operations
/////////////////////////////////////////////////////////////////////
if (options.has(XOR_STRING) || options.has(OVERWRITE_STRING) ||options.has(CLEAR_STRING) ||
options.has(AND_STRING) ||options.has(NOT_STRING) ||options.has(OR_STRING)
|| options.has(APPEND_OPTION_STRING)) {
if (!options.has("r")) {
System.err.println("Operational bitfile name needed for bitstream operation");
cmdLineParser.printUsageAndExit();
}
String operationalBitstreamFileName = (String) options.valueOf("r");
// load operational bitstream (this is an odd way of doing it but I am copying Ben's code)
Bitstream opBitstream = BitstreamParser.parseBitstreamExitOnError(operationalBitstreamFileName);
System.out.print("Successfully loaded operational bitstream - ");
// TODO: Make sure the two bitstreams are the same size. Same part?
FPGA fpga2 = new FPGA(partInfo);
fpga2.configureBitstream(opBitstream);
if(options.has(XOR_STRING))
{
FPGAOperation.operation(fpga, fpga2, FPGAOperation.OPERATORS.XOR );
System.out.println("XOR operation performed"); // use this to find differences in BRAM data.
}
else if(options.has(AND_STRING))
{
FPGAOperation.operation(fpga, fpga2, FPGAOperation.OPERATORS.AND );
System.out.println("AND operation performed");
}
else if(options.has(OR_STRING))
{
FPGAOperation.operation(fpga, fpga2, FPGAOperation.OPERATORS.OR );
System.out.println("OR operation performed");
}
else if(options.has(NOT_STRING))
{
FPGAOperation.operation(fpga, fpga2, FPGAOperation.OPERATORS.NOT );
System.out.println("NOT operation performed");
}
else if(options.has(OVERWRITE_STRING))
{
fpga.configureBitstream(opBitstream);
System.out.println("Overwrite operation performed");
}
else if(options.has(CLEAR_STRING))
{
// Find all of the frames that are configured on fpga2
ArrayList<Frame> fpga2configuredFrames = fpga2.getConfiguredFrames();
// Clear all the corresponding frames on fpga1
for (Frame fd : fpga2configuredFrames) {
fd.clear();
}