Node curr = new Node(source.getTile(), dev.getPrimitiveExternalPin(source), null, 0);
while(!we.getWireDirection(curr.getWire()).equals(WireDirection.CLK) && !we.getWireType(curr.getWire()).equals(WireType.INT_SOURCE)){
WireConnection[] wires = curr.getConnections();
if(wires == null) return null;
WireConnection w = wires[0];
if(we.getWireName(w.getWire()).contains("COUT") && wires.length > 1 ){
w = wires[1];
}
curr = new Node(w.getTile(curr.tile),w.getWire(), null, 0);
}
return curr;
}