if (!assignedInputDRAMs(output.getSingleEdge().getDest()).contains(wanted)) assign.put(output.getSingleEdge(), wanted); else
if (!assignedInputDRAMs(output.getSingleEdge().getDest()).contains(wanted)) { assign.put(output.getSingleEdge(), wanted);  return assign; } else {
    public static HashMap assignment(OutputTraceNode output, RawChip chip)     {	HashMap assign = new HashMap();	Iterator edges = output.getSortedOutputs().iterator();	//the edges that have more than one input 	//and were not initially assigned	HashSet needToAssign = new HashSet();	HashSet unassignedPorts = new HashSet();	//if this outputtracenode has one output try to assign it 	//to the same dram as its previous buffer	if (output.oneOutput()) {	    StreamingDram wanted = 		IntraTraceBuffer.getBuffer(output.getPrevFilter(),					   output).getDRAM();	    //if the dram is not being used by another buffer connected to 	    //the input trace, then assign it, otherwise let the below crap	    //handle it.	    if (!assignedInputDRAMs(output.getSingleEdge().getDest()).contains(wanted))		assign.put(output.getSingleEdge(), wanted);	    else		needToAssign.add(output.getSingleEdge());	}	//populate the unassigned ports set	for (int i = 0; i < chip.getDevices().length; i++) 	    unassignedPorts.add(chip.getDevices()[i]);	//try to assign input trace nodes with one input 	//first to make them redundant	while (edges.hasNext()) {	    Edge edge = (Edge)edges.next();	    if (edge.getDest().oneInput()) {		StreamingDram wanted =		    IntraTraceBuffer.getBuffer(edge.getDest(), 					       edge.getDest().getNextFilter()).getDRAM();		if (unassignedPorts.contains(wanted)) {		    unassignedPorts.remove(wanted);		    assign.put(edge, wanted);		}		else //we could not assign it, the port was already assigned to a one input		    needToAssign.add(edge);	    }	    else {		//otherwise we need to assign it below		needToAssign.add(edge);	    }	    	}	//assign the rest	SpaceTimeBackend.println("  Need to assign (normally): " + needToAssign.size());	edges = needToAssign.iterator();	while (edges.hasNext()) {	    Edge edge = (Edge)edges.next();	    SpaceTimeBackend.println("    Getting assignment for " + edge);	    //now assign the buffer to the first available port that show up 	    //in the iterator	    Iterator portOrder = assignmentOrder(edge, chip);	    boolean assigned = false;	    //SpaceTimeBackend.println("Assigning " + output + "->" + inputT + ": ");	    while (portOrder.hasNext()) {		StreamingDram current = ((PortDistance)portOrder.next()).dest;		//SpaceTimeBackend.println("  Trying " + current);		//assign the current dram to this input trace node		//and exit the inner loop if the port has not 		//been used by this output trace and the corresponding input trace		if (unassignedPorts.contains(current) && 		    !assignedInputDRAMs(edge.getDest()).contains(current)) {		    unassignedPorts.remove(current);		    assign.put(edge, current);		    assigned = true;		    //SpaceTimeBackend.println("  Assigned to " + current);		    break;		}	    }	    assert assigned : "Split/join width exceeds number of ports on the chip";	}	return assign;    }