Example #1
0
                    start_gate = item_start.net[1]
                    distances.append(((start_gate, end_gate), 2))
                    
                    print(gate_connections)
                    # Delete wire from gate connections dictionary
                    try:
                        del gate_connections[item_start.net]
                    except:
                        del gate_connections[(start_gate, end_gate)]

                    print("This is deleted")
                    print(item_start.net)
                    # Delete blocking wire
                    for j, item2_start in enumerate(allwires):
                        if item2_start.net == item_start.net:
                            wire = classs.Wire([0, 0, 0], (0, 0))
                            allwires[j] = wire
                    break
    print("COUNT")
    print(count)
    
    # Create switch variable to switch start moving direction
    if count > len(netlist)+5:
        # Reconnect deleted wires in switched direction
        switch_variable = 1
    else:
        switch_variable = 0
    
    # Overwrite coordinate but save coordinate_begin in different variable        
    coordinate = coordinate_begin
    
    while coordinate != coordinate_end:
        # Determine direction in which wire has to move
        if x_coordinate_start > x_coordinate_end:
            step_x = -1
        elif x_coordinate_start < x_coordinate_end:
            step_x = 1

        if y_coordinate_start > y_coordinate_end:
            step_y = -1
        elif y_coordinate_start < y_coordinate_end:
            step_y = 1

        # Append start coordinate to wire
        wires.append(coordinate)
        wire = classs.Wire(coordinate, connected_gate)
        allwires.append(wire)

        if switch_variable == 0:
            # Loop until x-coordinate from start gate equals x-coordinate from end gate
            while x_coordinate_start != x_coordinate_end:
                x_coordinate_start = x_coordinate_start + step_x
                coordinate = [
                    x_coordinate_start, y_coordinate_start, z_coordinate_start
                ]
                # Check for other gates or other wires
                if gate_connections:
                    (x_coordinate_start,
                     z_coordinate_start) = change.change_coor(
                         gate_connections, coordinate, gate_coordinates, wires,
                         coordinate_end, x_coordinate_start, -step_x,
Example #3
0
        # z_coordinate_check = z_coordinate_end + 1
        # check_coordinate = [x_coordinate_end, y_coordinate_end, z_coordinate_check]
        # for item in allwires:
        #     if item.coordinate == check_coordinate and item.net[0] != gate_end and item.net[1] != gate_end:
        #         (wires, x_coordinate_start, y_coordinate_start, z_coordinate_start, coordinate, gate_connections, allwires) = delete.delete_wire(wires, coordinate_begin, item.net, distances, gate_connections, allwires)
        #         break
        #     else:
        #         copy_gate_connections = copy.deepcopy(gate_connections)
        #         for key in copy_gate_connections:
        #             if len(copy_gate_connections[key]) > 75:
        #                 (wires, x_coordinate_start, y_coordinate_start, z_coordinate_start, coordinate, gate_connections, allwires) = delete.delete_wire(wires, coordinate_begin, key, distances, gate_connections, allwires)
        #     break
                    

        for i in a_star_route:
            wire = classs.Wire([i.x, i.y, i.z], connected_gate)
            allwires.append(wire)    
            blocked.append(str(i))
        
        a_star_route.reverse()
        print("NET: ", a_star_route)
        gate_connections.update({connected_gate: a_star_route})
        

    
        # if len(gate_connections) > 23: 
        #     break