def get_pip_class(wire_from, wire_to): if "FCO" in wire_from or "FCI" in wire_to: return pip_class_to_idx["zero"] if "F5" in wire_from or "FX" in wire_from or "FXA" in wire_to or "FXB" in wire_to: return pip_class_to_idx["zero"] class_name = pip_classes.get_pip_class(wire_from, wire_to) if class_name is None or class_name not in pip_class_to_idx: class_name = "default" return pip_class_to_idx[class_name]
def get_equations(ncl): signals, bels = extract_ncl_routing.parse_ncl(ncl) wire_fanout = {} # wire, pipclass -> fanout path_pip_classes = {} # (src, dest) -> [(wire, pipclass)] for name, sig in sorted(signals.items()): nd = extract_ncl_routing.net_to_dict(sig, bels) drivers, loads, route = sig if len(drivers) != 1: continue if nd is None: continue drv = drivers[0] for load in loads: path = [] if load not in nd: continue wire = nd[load] skip = False while wire != drv: path.append(wire) if wire not in nd: skip = True break wire = nd[wire] if skip: continue path.reverse() path_pip_classes[drv, load] = [] for i in range(len(path) - 1): pip_src = path[i] pip_dst = path[i + 1] pip_class = pip_classes.get_pip_class(pip_src, pip_dst) if pip_class is None: skip = True break path_pip_classes[drv, load].append((pip_src, pip_class)) wire_fanout[pip_src, pip_class] = wire_fanout.get( (pip_src, pip_class), 0) + 1 if skip: del path_pip_classes[drv, load] continue return path_pip_classes, wire_fanout
def get_pip_class(wire_from, wire_to): class_name = pip_classes.get_pip_class(wire_from, wire_to) if class_name is None or class_name not in pip_class_to_idx: class_name = "default" return pip_class_to_idx[class_name]