protected void getDeviceIDCodesAndRowCounts(){

        int i = 0;
        for (String currPartName : _partNames) {
            System.out.println("Extracting device ID code and row counts for " + currPartName);
            Process p;
            String fullPartName = currPartName + _validPackages.get(i).get(0) + _validSpeedGrades.get(i).get(0);
            try {
                // Generate small XDL design
                FileWriter fw = new FileWriter(_xdlFile);
                fw.write("design \"top\" "+fullPartName+" v3.2 , cfg \"\";");
                fw.close();

                // This is a debug bitstream
                p = Runtime.getRuntime().exec("xdl -xdl2ncd -force "+ kFilePrefix + ".xdl" + " " + kFilePrefix + ".ncd");
                p.waitFor();
                p = Runtime.getRuntime().exec("bitgen -g DebugBitstream:Yes -w -d "+ kFilePrefix + ".ncd ");
                BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
                while((input.readLine()) != null){
                }
                p.waitFor();

                // Parse bitstream for ID code
                _deviceIDCodes.add(parseBitstreamForIDCode(kFilePrefix + ".bit"));

                // Parse bitstream for row counts
                Bitstream bitstream = null;
                try {
                    bitstream = BitstreamParser.parseBitstream(kFilePrefix + ".bit");
                } catch (BitstreamParseException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }

                Set<Integer> topRows = new HashSet<Integer>();
                Set<Integer> bottomRows = new HashSet<Integer>();

                PacketList packets = bitstream.getPackets();
                for (Packet packet : packets) {
                    if (packet.getRegType() == RegisterType.LOUT) {
                        int farAddress = packet.getData().get(0);
                        int currentRow = (farAddress & _rowMask) >>> _rowBitPos;
                        int currentTopBottom = (farAddress & _topBottomMask) >>> _topBottomBitPos;
                        
                        Set<Integer> rowSet = (currentTopBottom == 0) ? topRows : bottomRows;
                        rowSet.add(currentRow);
                    }
                }
                
                _numTopRows.add(topRows.size());
                _numBottomRows.add(bottomRows.size());                
                
                p.destroy();


            } catch (IOException e) {
                e.printStackTrace();
                System.err.println("There was an error running xilinx tools.  Check that Xilinx tools are on your path.");
                System.exit(1);
            }
            catch (InterruptedException e) {
                e.printStackTrace();
                System.exit(1);
            }
            i++;
        }
    }