Trace trace;  while (traces.hasNext()) { trace = (Trace)traces.next();  TraceNode traceNode = trace.getHead(); while (traceNode != null) { SpaceTimeBackend.println("Rawify: " + traceNode);  if (traceNode.isFilterTrace()) { FilterTraceNode filterNode = (FilterTraceNode)traceNode; assert !filterNode.isPredefined() : "Predefined filters should not appear in the trace traversal: " + trace.toString(); RawTile tile = rawChip.getTile((filterNode).getX(), (filterNode).getY());  FilterInfo filterInfo = FilterInfo.getFilterInfo(filterNode);  generateFilterDRAMCommand(filterNode, filterInfo, tile, init, false);  if (filterInfo.isLinear()) { assert FilterInfo.getFilterInfo(filterNode).remaining == 0 : "Items remaining on buffer for init for linear filter"; createSwitchCodeLinear(filterNode, trace,filterInfo,init,false,tile,rawChip); }  else createSwitchCode(filterNode, trace, filterInfo, init, false, tile, rawChip);  tile.addFilterTrace(init, false, filterNode);   if (init) {  generateFilterDRAMCommand(filterNode, filterInfo, tile, false, true);   createSwitchCode(filterNode, trace, filterInfo, false, true, tile, rawChip);   tile.getComputeCode().addTraceInit(filterInfo);  tile.addFilterTrace(false, true, filterNode); } else {   tile.getComputeCode().addTraceSteady(filterInfo); } } else if (traceNode.isInputTrace() && !KjcOptions.magicdram) { assert StreamingDram.differentDRAMs((InputTraceNode)traceNode) : "inputs for a single InputTraceNode coming from same DRAM"; handleFileInput((InputTraceNode)traceNode, init, false, rawChip);  joinInputTrace((InputTraceNode)traceNode, init, false);  generateInputDRAMCommands((InputTraceNode)traceNode, init, false);  if (init) { handleFileInput((InputTraceNode)traceNode, false, true, rawChip); joinInputTrace((InputTraceNode)traceNode, false, true); generateInputDRAMCommands((InputTraceNode)traceNode, false, true); } } else if (traceNode.isOutputTrace() && !KjcOptions.magicdram) { assert StreamingDram.differentDRAMs((OutputTraceNode)traceNode) : "outputs for a single OutputTraceNode going to same DRAM"; handleFileOutput((OutputTraceNode)traceNode, init, false, rawChip);  splitOutputTrace((OutputTraceNode)traceNode, init, false);  outputDRAMCommands((OutputTraceNode)traceNode, init, false);  if (init) { handleFileOutput((OutputTraceNode)traceNode, false, true, rawChip); splitOutputTrace((OutputTraceNode)traceNode, false, true); outputDRAMCommands((OutputTraceNode)traceNode, false, true); } }  traceNode = traceNode.getNext(); }  }
    public static void run(SimpleScheduler scheduler, RawChip rawChip,			   boolean init)     {	Iterator traces;		if (init)	    traces = scheduler.getInitSchedule().iterator();	else	    traces = scheduler.getSchedule().iterator();	//iterate over the traces in the given order and generate the 	//switch code, the tile code, and the off chip stuff for 	//each TraceNode	Trace trace;		while (traces.hasNext()) {	    trace = (Trace)traces.next();	    //iterate over the TraceNodes	    TraceNode traceNode = trace.getHead();	    while (traceNode != null) {		SpaceTimeBackend.println("Rawify: " + traceNode);		//do the appropiate code generation		if (traceNode.isFilterTrace()) {		    FilterTraceNode filterNode = (FilterTraceNode)traceNode;		    assert !filterNode.isPredefined() :			"Predefined filters should not appear in the trace traversal: " + trace.toString();		    RawTile tile = rawChip.getTile((filterNode).getX(), 						   (filterNode).getY());		    //create the filter info class		    FilterInfo filterInfo = FilterInfo.getFilterInfo(filterNode);			//add the dram command if this filter trace is an endpoint...		    generateFilterDRAMCommand(filterNode, filterInfo, tile, init, false);		    		    if (filterInfo.isLinear()) {			assert FilterInfo.getFilterInfo(filterNode).remaining == 0 :			    "Items remaining on buffer for init for linear filter";			createSwitchCodeLinear(filterNode,					       trace,filterInfo,init,false,tile,rawChip);		    }		    		    else 			createSwitchCode(filterNode, 					 trace, filterInfo, init, false, tile, rawChip);		    //used for debugging, nothing more		    tile.addFilterTrace(init, false, filterNode);		    //do every again for the primepump if it is the init stage and add the		    //compute code for the init stage		    if (init) {			//add the dram command if this filter trace is an endpoint...			generateFilterDRAMCommand(filterNode, filterInfo, tile, false, true);			//create the prime pump stage switch code 			//after the initialization switch code			createSwitchCode(filterNode, 					 trace, filterInfo, false, true, tile, rawChip);			//generate the compute code for the trace and place it in			//the tile						tile.getComputeCode().addTraceInit(filterInfo);			//used for debugging			tile.addFilterTrace(false, true, filterNode);		    }		    else {			//generate the compute code for the trace and place it in			//the tile			tile.getComputeCode().addTraceSteady(filterInfo);		    }		}		else if (traceNode.isInputTrace() && !KjcOptions.magicdram) {		    assert StreamingDram.differentDRAMs((InputTraceNode)traceNode) :			"inputs for a single InputTraceNode coming from same DRAM";		    handleFileInput((InputTraceNode)traceNode, init, false, 					rawChip);		    //create the switch code to perform the joining		    joinInputTrace((InputTraceNode)traceNode, init, false);		    //generate the dram command to execute the joining		    generateInputDRAMCommands((InputTraceNode)traceNode, init, false);		    //now create the primepump code		    if (init) {			handleFileInput((InputTraceNode)traceNode, false, true, 					rawChip);			joinInputTrace((InputTraceNode)traceNode, false, true);			generateInputDRAMCommands((InputTraceNode)traceNode, false, true);		    }		}		else if (traceNode.isOutputTrace() && !KjcOptions.magicdram) {		    assert StreamingDram.differentDRAMs((OutputTraceNode)traceNode) :			"outputs for a single OutputTraceNode going to same DRAM";		    handleFileOutput((OutputTraceNode)traceNode, init, false,				     rawChip);		    //create the switch code to perform the splitting		    splitOutputTrace((OutputTraceNode)traceNode, init, false);		    //generate the DRAM command		    outputDRAMCommands((OutputTraceNode)traceNode, init, false);		    //now create the primepump code		    if (init) {			handleFileOutput((OutputTraceNode)traceNode, false, true,					 rawChip);			splitOutputTrace((OutputTraceNode)traceNode, false, true);			outputDRAMCommands((OutputTraceNode)traceNode, false, true);		    }		}		//get the next tracenode		traceNode = traceNode.getNext();	    }	    	}	    }