System.out.println(cn);
    public static void dumpSchedules() {        // this is a hash set that keeps tiles that we have already generated        // code for        HashSet tilesGenerated = new HashSet();        for (int i = 0; i < (streamGraph.getStaticSubGraphs()).length; i++) {            // get all the nodes that have either init switch code            // or steady state switch code            HashSet computeNodes = new HashSet();            // SpaceDynamicBackend.addAll(computeNodes, layout.getTiles());            SpdStaticStreamGraph ssg = (SpdStaticStreamGraph)streamGraph.getStaticSubGraphs()[i];            SpaceDynamicBackend.addAll(computeNodes,                                       ssg.simulator.initSchedules.keySet());            SpaceDynamicBackend.addAll(computeNodes,                                       ssg.simulator.steadySchedules.keySet());            // now add any tiles that don't perform any switching and were            // assigned filters                    Iterator flatNodes = ssg.getFlatNodes().iterator();            while (flatNodes.hasNext()) {                FlatNode node = (FlatNode) flatNodes.next();                if (node.isFilter() && Layout.assignToATile(node))                    computeNodes.add(layout.getTile(node));            }            Iterator tileIterator = computeNodes.iterator();            // for each tiles dump the code            while (tileIterator.hasNext()) {                System.gc();                ComputeNode cn = (ComputeNode) tileIterator.next();                assert cn != null;                // ignore ioports because we do not generate switch code for                // them                if (!cn.isTile())                    continue;                RawTile tile = (RawTile) cn;                //get the node that is assigned to this tile, it might be null...                FlatNode node = layout.getNode(tile);                                                assert !tilesGenerated.contains(tile) : "Trying to generated switch code for a tile that has already been seen";                tilesGenerated.add(tile);                System.out.println("Generating Switch for for tile "                                   + tile.getTileNumber() + "...");                               try {                    // true if we are compressing the switch code                    boolean compression = false;                    // get the code                    String steadyCode = "";                    String initCode = "";                    System.out.println("Converting switch code to string ...");                    if (ssg.simulator.initSchedules.get(tile) != null)                        initCode = ((StringBuffer) ssg.simulator.initSchedules                                    .get(tile)).toString();                    System.gc();                    if (ssg.simulator.steadySchedules.get(tile) != null)                        steadyCode = ((StringBuffer) ssg.simulator.steadySchedules                                      .get(tile)).toString();                    // the sequences we are going to compress if compression is                    // needed                    Repetition[] big3init = null;                    Repetition[] big3work = null;                    System.out.println("Compressing? ...");                    int codeSize = getCodeLength(steadyCode);                    codeSize += getCodeLength(initCode);                    System.gc();                    if (codeSize > 5000) {                        System.out.println("Compression needed.  Code size = "                                           + codeSize);                        compression = true;                        if (USE_BETTER_COMP) {                            // use the more heavyweight compression algorithm...                            big3init = threeBiggestRepetitions(initCode);                            big3work = threeBiggestRepetitions(steadyCode);                        } else {                            big3init = threeBiggestOneReps(initCode);                            big3work = threeBiggestOneReps(steadyCode);                        }                    }                    FileWriter fw = new FileWriter("sw" + tile.getTileNumber()                                                   + ".s");                    fw.write("#  Switch code\n");                    fw.write(getHeader());                    // if this tile is the north neighbor of a bc file i/o                    // device                    // we need to send a data word to it                    printIOStartUp(tile, fw);                    // print the code to get the repetition counts from the                    // processor                    // print the init switch code                    if (big3init != null)                        getRepetitionCounts(big3init, fw);                    toASM(initCode, "i", big3init, fw);                    // loop label                    if (big3work != null)                        getRepetitionCounts(big3work, fw);                    fw.write("sw_loop:\n");                    // print the steady state switch code                    if (ssg.simulator.steadySchedules.get(tile) != null)                        toASM(steadyCode, "w", big3work, fw);                    // print the jump ins                    fw.write("\tj\tsw_loop\n\n");                    fw.write(getTrailer(tile, big3init, big3work));                    fw.close();                    /*                     * if (threeBiggest != null) { System.out.print("Found                     * Seqeunces of: " + threeBiggest[0].repetitions + " " + t" " +                     * threeBiggest[1].repetitions + " " +                     * threeBiggest[1].length + " " +                     * threeBiggest[2].repetitions + " " +                     * threeBiggest[2].length + "\n"); }                     */                    System.out.println("sw" + tile.getTileNumber()                                       + ".s written");                } catch (Exception e) {                    e.printStackTrace();                    Utils.fail("Error creating switch code file for tile "                               + tile.getTileNumber());                }            }        }    }