Examples of Bitstream


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

    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

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

       
        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

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

       
        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

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

    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

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

        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

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

    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

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

    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

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

            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

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

    BitstreamOptionParser.printExecutableHeaderMessage(BitstreamManipulation.class);
    // Check for and print help
    cmdLineParser.checkHelpOptionExitOnHelpMessage(options);

    // Get bitstreams
    Bitstream fullBitstream = cmdLineParser.parseRequiredBitstreamFromOptionsExitOnError(options, FULL_OPTION,
        true);   
    Bitstream staticBitstream = cmdLineParser.parseRequiredBitstreamFromOptionsExitOnError(options, STATIC_OPTION,
        true);   
    Bitstream partialBitstream = cmdLineParser.parseRequiredBitstreamFromOptionsExitOnError(options, PARTIAL_OPTION,
        true);   
   
    boolean patchPartial = false;
    if (options.has(PATCH_PARTIAL))
      patchPartial = true;
   
    boolean verbose = false;
    if (options.has(VERBOSE)) {
      verbose = true;
   
    boolean printData = false;
   
    // Get and check parts
    XilinxConfigurationSpecification partInfo = cmdLineParser.getPartInfoExitOnError(options, fullBitstream, true);
    XilinxConfigurationSpecification staticPartInfo = cmdLineParser.getPartInfoExitOnError(options, staticBitstream, false);
    XilinxConfigurationSpecification partialPartInfo = cmdLineParser.getPartInfoExitOnError(options, partialBitstream, false);
   
    if (staticPartInfo != partInfo || partialPartInfo != partInfo) {
      System.err.println("Bitstreams do not match");
      System.exit(1);
    }

    // 3. Create FPGA object
    FPGA fullFPGA = new FPGA(partInfo);   
    FPGA staticFPGA = new FPGA(partInfo);   
    FPGA partialFPGA = new FPGA(partInfo);   

    // Configure FPGA
    fullFPGA.configureBitstream(fullBitstream);
    staticFPGA.configureBitstream(staticBitstream);
    partialFPGA.configureBitstream(partialBitstream);
   
    boolean staticChanged = false;
    boolean partialChanged = false;
   
    // Iterate over all of the frames
    FrameAddressRegister far = new FrameAddressRegister(partInfo);
    for (; far.validFARAddress(); far.incrementFAR()) {
      //System.out.println(far);
     
      Frame fullFrame = fullFPGA.getFrame(far);
      if (!fullFrame.isConfigured()) {
        System.err.println("Error: Unconfigured Frame in the full bitstream at FAR:"+far.getHexAddress());
        System.exit(1);
      }
     
      Frame staticFrame = staticFPGA.getFrame(far);
      Frame partialFrame = partialFPGA.getFrame(far);

      FrameData fullData = fullFrame.getData();
      FrameData staticData = staticFrame.getData();
      FrameData partialData = partialFrame.getData();
     
      if (staticFrame.isConfigured() && partialFrame.isConfigured()) {
        // Both static and partial frames configured
        if (fullData.isEqual(staticData)) {
          if (fullData.isEqual(partialData)) {
            // TODO: All equal: could probably remove the partial frame (future)
            if (verbose)
              System.out.println(far.getHexAddress()+" Static, full, and partial all equal");           
          } else {
            // full and static equal, partial not equal
            System.out.println("Full and static equal, partial not equal:"+far.getHexAddress());           
            if (printData) {
              System.out.println("Full Data\n"+fullData);
              System.out.println("Static Data\n"+staticData);             
              System.out.println("Partial Data\n"+partialData);             
            }
          }       
        } else {
          // full is not equal to static
          if (fullData.isEqual(partialData)) {
            // This is OK. Don't need to do anything here.
            if (staticData.isEmpty())
              System.out.println(far.getHexAddress() + " Full and partial equal, static empty");
            else
              System.out.println(far.getHexAddress() + " Full and partial equal, static not equal and not empty");
            if (printData) {
              System.out.println("Full Data\n"+fullData);
              System.out.println("Static Data\n"+staticData);             
              System.out.println("Partial Data\n"+partialData);             
            }
          } else {
            // Full data is NOT equal to partial data
            if (staticData.isEqual(partialData)) {
              System.out.println("*** Full not equal but static and partial equal:"+far.getHexAddress());                         
            } else {
              System.out.println("*** All three not equal:"+far.getHexAddress());                         
            }
          }
        }     
      } else if (staticFrame.isConfigured()) {
        // static frame is configured and partial frame is NOT configured
        if (fullData.isEqual(staticData)) {
          if (verbose)
            System.out.println(far.getHexAddress()+" Static and full Equal (partial not configured)");
        } else {
          if (!fullData.isEmpty()) {
            // full has data
            if (!staticData.isEmpty()) {
              // Full and static have data
              System.out.println(far.getHexAddress()+" * Full and static NOT equal (partial not configured)");
              if (printData) {
                System.out.println("Full Data\n"+fullData);
                System.out.println("Static Data\n"+staticData);
              }
            } else {
              // full has data , static is empty
              System.out.println(far.getHexAddress()+" * Full has data, static is empty (partial not configured)");
            }
          } else {
            // full does not have data
            System.out.println(far.getHexAddress()+" * Full empty and static NOT equal (partial not configured)");
          }
          if (!patchPartial) {
            staticData.setData(fullData);
            staticChanged = true;
          } else {
            partialData.setData(fullData);
            partialChanged = true;
          }
        }
      } else if (partialFrame.isConfigured()) {
        // partial frame is configured, static frame is NOT configured
        if (fullData.isEqual(partialData)) {
          System.out.println("Partial and full Equal (static not configured):"+far.getHexAddress());
        } else {
          System.out.println("Partial Not Equal:"+far.getHexAddress());         
        }
      } else {
        // neither frame is configured
        if (!fullData.isEmpty()) {
          System.out.println("Frame not empty and static/partial not conifgured:"+far);
        }
      }
    }
   
    if (staticChanged) {
      String oldStaticFileName = cmdLineParser.getBitstreamFileNameFromOptions(options,STATIC_OPTION);
      String newStaticFilename = oldStaticFileName + ".new";
      // create the bitstream
      Bitstream newBitstream = partInfo.getBitstreamGenerator().createFullBitstream(staticFPGA, staticBitstream.getHeader());
      BitstreamManipulation.writeBitstreamToBIT(newBitstream, newStaticFilename);
    }
    if (partialChanged) {
      String oldPartialFileName = cmdLineParser.getBitstreamFileNameFromOptions(options,PARTIAL_OPTION);
      String newPartialFilename = oldPartialFileName + ".new";
      // create the bitstream
      Bitstream newBitstream = partInfo.getBitstreamGenerator().createPartialBitstream(partialFPGA, partialBitstream.getHeader());
      BitstreamManipulation.writeBitstreamToBIT(newBitstream, newPartialFilename);
    }
  }
View Full Code Here

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

        // 3. Add ending packets
        createEndingFullBitstream(packets, fpga.spec);
       
        // 4. Create bitstream from the packets
        return new Bitstream(header, fpga.getDeviceSpecification().getSyncData(), packets);
    }
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.