Package edu.byu.ece.rapidSmith.bitstreamTools.bitstream

Examples of edu.byu.ece.rapidSmith.bitstreamTools.bitstream.Bitstream


    cmdLineParser.checkHelpOptionExitOnHelpMessage(options);
   
    /////////////////////////////////////////////////////////////////////
    // 1. Parse bitstream
    /////////////////////////////////////////////////////////////////////
    Bitstream bitstream = cmdLineParser.parseRequiredBitstreamFromOptionsExitOnError(options, true);
   
    //int printLevel = 1;
   
    // header only
    if (options.has(PRINT_HEADER_OPTION)) {
      System.out.println(bitstream.getHeader().toString());
      System.exit(1);
    }
    // print XML
    if (options.has(PRINT_XML_OPTION)) {
      System.out.println(bitstream.toXMLString());
      System.exit(1);     
    }
    // Print full bitstream
    PrintWriter pw = new PrintWriter(System.out);
    bitstream.toStream(true, true, pw);
    pw.flush();
    pw.close();       
    }
View Full Code Here


    DEBUG = cmdLineParser.debugEnabled(options);
   
    /////////////////////////////////////////////////////////////////////
    // 1. Parse bitstream
    /////////////////////////////////////////////////////////////////////
    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)) {
View Full Code Here

    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 {
      fos = new FileOutputStream("test.dat");
      //bitstream.outputRawBitstream(fos);
      bitstream.outputHeaderBitstream(fos);
    } catch (IOException e) {
      System.exit(1);
    }
   
  }
View Full Code Here

       
        if (args.length != 1) {
            System.err.println("Usage: java edu.byu.ece.bitstreamTools.examples.DebugBitstreamDecoder <input.bit>");
        }
       
        Bitstream bitstream = null;
        try {
            bitstream = BitstreamParser.parseBitstream(args[0]);
        } catch (BitstreamParseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } 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) {
View Full Code Here

       
        if (args.length != 1) {
            System.err.println("Usage: java edu.byu.ece.bitstreamTools.examples.RowCounter <input.bit>");
        }
       
        Bitstream bitstream = null;
        try {
            bitstream = BitstreamParser.parseBitstream(args[0]);
        } catch (BitstreamParseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } 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>();
       
        PacketList packets = bitstream.getPackets();
        for (Packet p : packets) {
            if (p.getRegType() == RegisterType.LOUT) {
                int farAddress = p.getData().get(0);
                far.setFAR(farAddress);
                int currentRow = far.getRow();
View Full Code Here

    cmdLineParser.checkHelpOptionExitOnHelpMessage(options);

    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();
    Iterator<Packet> p = packets.iterator();

    while (p.hasNext()) {
      printFDRIWrite(partInfo, p, printAllFrames);
    }
View Full Code Here

        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);
View Full Code Here

    s += "Minor: " + FrameAddressRegister.getMinorFromAddress(spec, frame.getFrameAddress());
    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;
   
View Full Code Here

    cmdLineParser.checkHelpOptionExitOnHelpMessage(options);
   
    /////////////////////////////////////////////////////////////////////
    // 1. Parse bitstream
    /////////////////////////////////////////////////////////////////////
    Bitstream bitstream = cmdLineParser.parseRequiredBitstreamFromOptionsExitOnError(options, true);
   
    /////////////////////////////////////////////////////////////////////
    // 2. Obtain part information
    /////////////////////////////////////////////////////////////////////
    XilinxConfigurationSpecification partInfo = cmdLineParser.getPartInfoExitOnError(options, bitstream, true);
View Full Code Here

            System.err.println("Not a valid number:"+args[1]);
            System.exit(1);
          }
        }
       
        Bitstream bitStream = BitstreamParser.parseBitstreamExitOnError(args[0]);
        System.out.println(bitStream.toString(printLevel));
       
    }
View Full Code Here

TOP

Related Classes of edu.byu.ece.rapidSmith.bitstreamTools.bitstream.Bitstream

Copyright © 2018 www.massapicom. 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.