Examples of XilinxConfigurationSpecification


Examples of edu.byu.ece.rapidSmith.bitstreamTools.configurationSpecification.XilinxConfigurationSpecification

    Bitstream bitstream = cmdLineParser.parseRequiredBitstreamFromOptionsExitOnError(options, true);
   
    /////////////////////////////////////////////////////////////////////
    // 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();
        }
        System.out.println("Clear operation performed\n");
      }
      else if(options.has(APPEND_OPTION_STRING)) {
        // Append the packets of the operational bitstream to the packets of the original bitstream
        PacketList opPackets = opBitstream.getPackets();
        PacketList inPackets = bitstream.getPackets();
        inPackets.addAll(opPackets);
        if (writeBitstreamToBIT(bitstream, outputBitstreamFileName) == 0) {
          System.out.println("Generated BRAM Bitstream:"+outputBitstreamFileName);
        } else {
          System.err.println("Problem generating BRAM bitstream");
          System.exit(1);
        }       

        System.out.println("Append operation performed");
      }
    }
       
    /////////////////////////////////////////////////////////////////////
    // Perform Bitstreams Write Operations
    /////////////////////////////////////////////////////////////////////

    // create the bitstream
    Bitstream newBitstream = null;
    BitstreamHeader newHeader = null;

   

    if (options.has(NEW_ALGORITHM)) {
      // TODO
      // for the new algorithm, create a new header with different values
      newHeader = bitstream.getHeader();
    } else {
      // for the old algorithm, copy the header from the original bitstream
      newHeader = bitstream.getHeader();
    }
   
    // BRAM operation   
    if (options.has(BRAM_OPTION_STRING)) {
      if (options.has(NEW_ALGORITHM)) {
        // New algorithm
        System.err.println("New Algorithm not yet supported");
        System.exit(1);
      } else {
        // Use old algorithm
        newBitstream = partInfo.getBitstreamGenerator().createPartialBRAMBitstream(fpga, newHeader);
      }
      if (writeBitstreamToBIT(newBitstream, outputBitstreamFileName) == 0) {
        System.out.println("Generated BRAM Bitstream:"+outputBitstreamFileName);
      } else {
        System.err.println("Problem generating BRAM bitstream");
        System.exit(1);
      }       
    }
   
    // PARTIAL operation
    if (options.has(PARTIAL_OPTION_STRING)) {
      if (newBitstream != null) {
        System.err.println("Only one write can be performed.");
        System.exit(1);
      }
      if (options.has(NEW_ALGORITHM)) {
        // New algorithm (currently same as old algorithm)
        newBitstream = partInfo.getBitstreamGenerator().createPartialBitstream(fpga, newHeader);
      } else {
        // Use old algorithm
        newBitstream = partInfo.getBitstreamGenerator().createPartialBitstream(fpga, newHeader);
      }
      if (writeBitstreamToBIT(newBitstream, outputBitstreamFileName) == 0) {
        System.out.println("Generated Partial Bitstream:"+outputBitstreamFileName);
      } else {
        System.err.println("Problem generating Partial bitstream");
        System.exit(1);
      }       

    }

    if (options.has(FULL_OPTION_STRING)) {
      if (newBitstream != null) {
        System.err.println("Only one write can be performed. Option -f ignored");
        System.exit(1);
      }
      newBitstream = partInfo.getBitstreamGenerator().createFullBitstream(fpga, bitstream.getHeader());
      if (writeBitstreamToBIT(newBitstream, outputBitstreamFileName) == 0) {
        System.out.println("Generated Full Bitstream:"+outputBitstreamFileName);
      } else {
        System.err.println("Problem generating Full bitstream");
        System.exit(1);
View Full Code Here

Examples of edu.byu.ece.rapidSmith.bitstreamTools.configurationSpecification.XilinxConfigurationSpecification

    } catch (NumberFormatException e) {
      System.err.println("Illegal number format: "+farStringAddress);
      System.exit(1);
    }
   
    XilinxConfigurationSpecification spec = DeviceLookup.lookupPartV4V5V6(partname);
   
    System.out.println(spec.toString());
   
    System.out.println(FrameAddressRegister.toString(spec,farAddress));
  }
View Full Code Here

Examples of edu.byu.ece.rapidSmith.bitstreamTools.configurationSpecification.XilinxConfigurationSpecification

    boolean ignoreBRAMContent = false;
    if (args.length > 1 && args[1].equalsIgnoreCase("-noBRAMContent")) {
      ignoreBRAMContent = true;
    }

    XilinxConfigurationSpecification spec = DeviceLookup.lookupPartV4V5V6(partname);
    if (spec == null) {
      DeviceLookup.printAvailableParts(System.err);
      System.exit(1);
    }

    int frameSize = spec.getFrameSize();
    int numTopRows = spec.getTopNumberOfRows();
    int numBottomRows = spec.getBottomNumberOfRows();
   
    BlockType bramContentType = spec.getBRAMContentBlockType();
   
   
    int frameCount = 0;
    for (BlockType blockType : spec.getBlockTypes()) {
      if (ignoreBRAMContent && blockType == bramContentType) {
        continue;
      }
      for (BlockSubType blockSubType : spec.getBlockSubTypeLayout(blockType)) {
        //System.out.println(blockSubType + " " + blockSubType.getFramesPerConfigurationBlock());
        frameCount += blockSubType.getFramesPerConfigurationBlock();
      }
    }
   
    int result = 32 * /* 32 bits per word */
           frameSize * /* Number of words in a frame */    
           (numTopRows + numBottomRows) * /* Number of rows */
           frameCount; /* Number of frames in the columns of one row for all block types */
   
    System.out.println(result + " bits required to configure " + spec.getDeviceName());
    if (ignoreBRAMContent) {
      System.out.println("(without BRAM content bits)");
    }
  }
View Full Code Here

Examples of edu.byu.ece.rapidSmith.bitstreamTools.configurationSpecification.XilinxConfigurationSpecification

      System.err.println("usage: <part name>\n");
      System.exit(1);
    }
    String partname = args[0];
     
    XilinxConfigurationSpecification spec = DeviceLookup.lookupPartV4V5V6(partname);
   
    int idCode = spec.getIntDeviceIDCode();

    // Creates the initial packets
    BitstreamGenerator v4gen = V4BitstreamGenerator.getSharedInstance();
    PacketListCRC packets = v4gen.createInitialPartialBitstream(idCode);

    // TODO: Create data packets here
    final int size = 1312;
    List<Integer> data = new ArrayList<Integer>(size);
    for (int i = 0; i < size; i++ )
      data.add(0);

    // TODO: figure out the far address
    int topBottom = 0;
    int row = 0;
    int column = 0;
    int minor = 0;

    // Set block type in FAR
    // TODO: need to make it easier to figure out the block number
    int blockType = 0;
    List<BlockType> blockTypes = spec.getBlockTypes();
   
    int i = 0;
    for (BlockType blockTypeI : blockTypes) {
        if (blockTypeI == spec.getBRAMContentBlockType()) {
            blockType = i;
        }
        i++;
    }
     
    int farAddress = FrameAddressRegister.createFAR(spec, topBottom, blockType,
        row, column, minor);

    try {
      BitstreamGenerator.createPartialWritePackets(packets, spec, farAddress, data);
    } catch (BitstreamException e) {
      System.exit(1);
    }
   
    // Creates the ending packets
    v4gen.createEndingPartialBitstream(packets);

    // 4. Create bitstream from the packets
    // TODO: create a non header bitstream and see if it can be parsed
    BitstreamHeader header = new BitstreamHeader("temp.ncd","4VSX550-pg125");   
    Bitstream bitstream = new Bitstream(header,spec.getSyncData(), packets);

    // 5. Write the bitstream to a file
    // TODO: create an Ostream
    FileOutputStream fos = null;
    try {
View Full Code Here

Examples of edu.byu.ece.rapidSmith.bitstreamTools.configurationSpecification.XilinxConfigurationSpecification

        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
       
        XilinxConfigurationSpecification spec = DeviceLookup.lookupPartV4V5V6withPackageName(bitstream.getHeader().getPartName());
       
        FrameAddressRegister far = new FrameAddressRegister(spec);
       
        Map<Integer, Integer> columnMap = new LinkedHashMap<Integer, Integer>();
       
        PacketList packets = bitstream.getPackets();
        for (Packet p : packets) {
            if (p.getRegType() == RegisterType.LOUT) {
                int farAddress = p.getData().get(0);
                far.setFAR(farAddress);
                if (far.getRow() != 0 || far.getTopBottom() != 0) {
                    break;
                }
                int column = far.getColumn();
                int frame = far.getMinor();
                columnMap.put(column, frame + 1);
                //System.out.println("TB: " + far.getTopBottom() + ", Block: " + far.getBlockType() + ", Row: " + far.getRow() + ", Column: " + far.getColumn() + ", Frame: " + far.getMinor());
            }
        }
       
       
       
        Map<Integer, List<BlockSubType>> frameCountMap = new LinkedHashMap<Integer, List<BlockSubType>>();

        for (BlockType bt : spec.getBlockTypes()) {
            for (BlockSubType bst : bt.getValidBlockSubTypes()) {
                int frameCount = bst.getFramesPerConfigurationBlock();
                List<BlockSubType> stList = frameCountMap.get(frameCount);
                if (stList == null) {
                    stList = new ArrayList<BlockSubType>();
View Full Code Here

Examples of edu.byu.ece.rapidSmith.bitstreamTools.configurationSpecification.XilinxConfigurationSpecification

        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
       
        XilinxConfigurationSpecification spec = DeviceLookup.lookupPartV4V5V6withPackageName(bitstream.getHeader().getPartName());
       
        FrameAddressRegister far = new FrameAddressRegister(spec);
       
        Set<Integer> topRows = new HashSet<Integer>();
        Set<Integer> bottomRows = new HashSet<Integer>();
View Full Code Here

Examples of edu.byu.ece.rapidSmith.bitstreamTools.configurationSpecification.XilinxConfigurationSpecification

    BitstreamOptionParser.printExecutableHeaderMessage(FrameWriteSummary.class);

    Bitstream bitstream = cmdLineParser.parseRequiredBitstreamFromOptionsExitOnError(options, true);

    XilinxConfigurationSpecification partInfo = cmdLineParser.getPartInfoExitOnError(options, bitstream, true)

    boolean printAllFrames =(options.has(PRINT_ALL_FRAMES));

    // Get part packets
    PacketList packets = bitstream.getPackets();
View Full Code Here

Examples of edu.byu.ece.rapidSmith.bitstreamTools.configurationSpecification.XilinxConfigurationSpecification

    /////////////////////////////////////////////////////////////////////
    // 1. Get base FPGA object
    /////////////////////////////////////////////////////////////////////
    FPGA fpga1 = null;   
    fpga1 = cmdLineParser.createFPGAFromBitstreamOrReadbackFileExitOnError(options);
    XilinxConfigurationSpecification part = fpga1.getDeviceSpecification();
   
    /////////////////////////////////////////////////////////////////////
    // 2. Get compare FPGA object
    /////////////////////////////////////////////////////////////////////
    FPGA fpga2 = null;
    fpga2 = cmdLineParser.createFPGAFromBitstreamOrReadbackFileExitOnError(options,
        COMPARE_READBACK_OPTION,
        COMPARE_BITSTREAM_OPTION, part);

    /////////////////////////////////////////////////////////////////////
    // 3. Get mask FPGA object (if it exists)
    /////////////////////////////////////////////////////////////////////
    Bitstream maskBitstream = cmdLineParser.parseOptionalBitstreamFromOptionsExitOnError(options, MASK_BITSTREAM_OPTION, true);
    if (maskBitstream != null) {
      XilinxConfigurationSpecification partInfo = cmdLineParser.getPartInfoExitOnError(options, maskBitstream, true);
      FPGA maskFPGA = new FPGA(partInfo);   
      // Configure FPGA
      maskFPGA.configureBitstream(maskBitstream);
     
      // Now mask the two FPGAs
View Full Code Here

Examples of edu.byu.ece.rapidSmith.bitstreamTools.configurationSpecification.XilinxConfigurationSpecification

   * Frames that differ.
   */
  public static ArrayList<Integer> diff(FPGA fpga1, FPGA fpga2,
      boolean ignoreUnconfiguredFrames, boolean printData, boolean silentMode) {
   
    XilinxConfigurationSpecification spec1 = fpga1.getDeviceSpecification();
    XilinxConfigurationSpecification spec2 = fpga2.getDeviceSpecification();
    if (spec1 != spec2) {
      System.err.println("Not the same device");
      System.exit(1);
    }

View Full Code Here

Examples of edu.byu.ece.rapidSmith.bitstreamTools.configurationSpecification.XilinxConfigurationSpecification

    return s;
  }
 
  public static void main(String[] args){
    Bitstream bitstream = BitstreamParser.parseBitstreamExitOnError(args[0]);
    XilinxConfigurationSpecification spec = DeviceLookup.lookupPartFromPartnameOrBitstreamExitOnError(bitstream);
    FPGA fpga = new FPGA(spec);
    fpga.configureBitstream(bitstream);
     
    Bitstream bitstreamMask = BitstreamParser.parseBitstreamExitOnError(args[1]);
    XilinxConfigurationSpecification specMask = DeviceLookup.lookupPartFromPartnameOrBitstreamExitOnError(bitstream);
    FPGA fpgaMask = new FPGA(specMask);
    fpgaMask.configureBitstream(bitstreamMask);
    int correct = 0, incorrect = 0, close = 0;
   
    for(Frame frame : fpga.getAllFrames()){
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.