43 struct s_trace *start_ptr,
int remaining_connections_to_sink);
46 int inet,
boolean first_time);
83 input_port = output_port = clock_port = 0;
92 for (i = 0; i < pb_type->
num_ports && !found; i++) {
93 prim_port = &pb_type->
ports[i];
110 assert(ipin < prim_port->num_pins);
114 if (
vpack_net[iblk_net].node_block[i] == ilogical_block
115 &&
vpack_net[iblk_net].node_block_port[i]
122 assert(net_pin !=
OPEN);
127 if (
vpack_net[iblk_net].node_block[i] == ilogical_block
128 &&
vpack_net[iblk_net].node_block_port[i]
135 assert(net_pin !=
OPEN);
140 if (
vpack_net[iblk_net].node_block[i] == ilogical_block
145 assert(net_pin !=
OPEN);
155 boolean has_ext_sink, has_ext_source;
156 int curr_ext_output, curr_ext_input, curr_ext_clock;
164 has_ext_sink =
FALSE;
168 if (has_ext_source) {
181 if (has_ext_sink || has_ext_source) {
241 boolean is_primitive;
243 is_primitive = (
boolean) (pb_graph_node->pb_type->num_modes == 0);
245 for (i = 0; i < pb_graph_node->num_input_ports; i++) {
246 for (j = 0; j < pb_graph_node->num_input_pins[i]; j++) {
247 index = pb_graph_node->input_pins[i][j].pin_count_in_cluster;
250 pb_graph_node->input_pins[i][j].num_input_edges;
252 pb_graph_node->input_pins[i][j].num_output_edges;
254 + (float)
rr_node[index].num_edges / 5 + ((
float)j/(float)pb_graph_node->num_input_pins[i])/(float)10;
256 rr_node[index].num_edges *
sizeof(
int));
267 for (k = 0; k < pb_graph_node->input_pins[i][j].num_output_edges;
271 pb_graph_node->input_pins[i][j].output_edges[k]->output_pins[0]->pin_count_in_cluster;
274 pb_graph_node->input_pins[i][j].output_edges[k]->num_output_pins == 1);
279 assert(
rr_node[index].num_edges == 0);
299 if(pb_graph_node->pb_type->class_type ==
LUT_CLASS) {
311 for (i = 0; i < pb_graph_node->num_output_ports; i++) {
312 for (j = 0; j < pb_graph_node->num_output_pins[i]; j++) {
313 index = pb_graph_node->output_pins[i][j].pin_count_in_cluster;
316 pb_graph_node->output_pins[i][j].num_input_edges;
318 pb_graph_node->output_pins[i][j].num_output_edges;
320 + (float)
rr_node[index].num_edges / 5;
322 rr_node[index].num_edges *
sizeof(
int));
333 for (k = 0; k < pb_graph_node->output_pins[i][j].num_output_edges;
337 pb_graph_node->output_pins[i][j].output_edges[k]->output_pins[0]->pin_count_in_cluster;
340 pb_graph_node->output_pins[i][j].output_edges[k]->num_output_pins == 1);
349 for (i = 0; i < pb_graph_node->num_clock_ports; i++) {
350 for (j = 0; j < pb_graph_node->num_clock_pins[i]; j++) {
351 index = pb_graph_node->clock_pins[i][j].pin_count_in_cluster;
354 pb_graph_node->clock_pins[i][j].num_input_edges;
356 pb_graph_node->clock_pins[i][j].num_output_edges;
358 + (float)
rr_node[index].num_edges / 5;
360 rr_node[index].num_edges *
sizeof(
int));
371 for (k = 0; k < pb_graph_node->clock_pins[i][j].num_output_edges;
375 pb_graph_node->clock_pins[i][j].output_edges[k]->output_pins[0]->pin_count_in_cluster;
378 pb_graph_node->clock_pins[i][j].output_edges[k]->num_output_pins == 1);
383 assert(
rr_node[index].num_edges == 0);
406 for (i = 0; i < pb_graph_node->pb_type->num_modes; i++) {
407 for (j = 0; j < pb_graph_node->pb_type->modes[i].num_pb_type_children;
411 < pb_graph_node->pb_type->modes[i].pb_type_children[j].num_pb;
414 &pb_graph_node->child_pb_graph_nodes[i][j][k], arch, i);
435 int i, j, k, m,
index, pb_graph_rr_index;
442 pb_type = clb->type->pb_type;
443 pb_graph_node = clb->type->pb_graph_head;
470 + (float)
rr_node[index].num_edges / 5;
472 rr_node[index].num_edges *
sizeof(
int));
484 + (float)
rr_node[index].num_edges / 5;
495 + (float)
rr_node[index].num_edges / 5;
497 rr_node[index].num_edges *
sizeof(
int));
526 rr_node[pb_graph_rr_index].edges,
527 (count_pins) *
sizeof(int));
529 rr_node[pb_graph_rr_index].switches,
530 (count_pins) *
sizeof(int));
542 arch->num_switches - 1;
554 arch->num_switches - 1;
559 + (float)
rr_node[pb_graph_rr_index].num_edges / 5;
587 if(free_local_rr_graph ==
TRUE) {
589 if (clb->pb->rr_graph[i].edges != NULL) {
590 free(clb->pb->rr_graph[i].edges);
592 if (clb->pb->rr_graph[i].switches != NULL) {
593 free(clb->pb->rr_graph[i].switches);
596 free(clb->pb->rr_graph);
606 best_routing[nets_in_cluster[i]] = NULL;
610 num_nets_in_cluster = 0;
627 boolean success, is_routable;
628 int itry, inet, net_index;
659 vpr_printf(TIO_MESSAGE_INFO,
"Routing failed. Disconnected rr_graph.\n");
697 int i, inode, prev_node, remaining_connections_to_sink;
698 float pcost, new_pcost;
708 remaining_connections_to_sink = 0;
717 remaining_connections_to_sink);
720 if (current == NULL) {
725 inode = current->
index;
729 new_pcost = current->
cost;
730 if (pcost > new_pcost) {
749 if (current == NULL) {
754 inode = current->
index;
769 struct s_trace *start_ptr,
int remaining_connections_to_sink) {
787 struct s_trace *tptr, *next_ptr;
788 int inode, sink_node, last_ipin_node;
792 if (remaining_connections_to_sink == 0) {
793 while (tptr != NULL) {
810 next_ptr = tptr->
next;
811 last_ipin_node =
OPEN;
817 while (next_ptr != NULL) {
823 if(
rr_node[inode].pb_graph_pin != NULL &&
rr_node[inode].pb_graph_pin->num_output_edges == 0)
825 last_ipin_node = inode;
830 next_ptr = tptr->
next;
838 assert(last_ipin_node !=
OPEN);
844 sink_node = tptr->
index;
856 int inet,
boolean first_time) {
862 int iconn, to_node, num_edges;
866 for (iconn = 0; iconn < num_edges; iconn++) {
921 (
vpack_net[inet].num_sinks + 1) *
sizeof(int),
925 (
vpack_net[inet].num_sinks + 1) *
sizeof(int));
938 if (molecule->logical_block_ptrs[i] != NULL) {
940 molecule->logical_block_ptrs[i]->index, primitive_list[i]);
956 assert(primitive->pb_type->num_modes == 0);
973 for (ipin = 0; ipin < port->
size; ipin++) {
975 assert(port->
size == 1);
980 if (iblk_net ==
OPEN) {
995 for (ipin = 0; ipin < port->
size; ipin++) {
997 if (iblk_net ==
OPEN) {
1038 best_routing[inet] = tempptr;
1069 best_routing[inet] = NULL;
1092 int i, j, net_index;
1108 inode = tptr->
index;
1151 int i_pb_type, i_pb_inst;
1154 pb_type = pb_graph_node->
pb_type;
1208 int i, j, k, ipin, net_index, ext_net;
1210 boolean has_ext_source, success;
1211 int curr_ext_output, curr_ext_input, curr_ext_clock;
1226 if(has_ext_source) {
1228 assert(ext_net !=
OPEN);
1230 free(
rr_node[curr_ext_clock].edges);
1251 free(
rr_node[curr_ext_input].edges);
1260 if(ext_net ==
block[iblock].nets[ipin + pin_offset]) {
boolean feasible_routing(void)
t_pb_graph_pin ** clock_pins
static void alloc_net_rr_terminals_cluster(void)
float get_rr_cong_cost(int inode)
static void add_net_rr_terminal_cluster(int iblk_net, t_pb_graph_node *primitive, int ilogical_block, t_model_ports *model_port, int ipin)
t_model_ports * model_port
struct s_trace ** trace_tail
struct s_pb_type * pb_type_children
void free_cluster_legality_checker(void)
struct s_heap * get_heap_head(void)
void free_traceback(int inet)
void free_legalizer_for_cluster(INP t_block *clb, boolean free_local_rr_graph)
t_rr_node_route_inf * rr_node_route_inf
static float rr_node_intrinsic_cost(int inode)
t_rr_indexed_data * rr_indexed_data
void invalidate_heap_entries(int sink_node, int ipin_node)
void free_heap_data(struct s_heap *hptr)
int max_router_iterations
static void breadth_first_expand_trace_segment_cluster(struct s_trace *start_ptr, int remaining_connections_to_sink)
float first_iter_pres_fac
void restore_routing_cluster(void)
void * my_chunk_malloc(size_t size, t_chunk *chunk_info)
void alloc_and_load_rr_graph_for_pb_graph_node(INP t_pb_graph_node *pb_graph_node, INP const t_arch *arch, int mode)
void * my_calloc(size_t nelem, size_t size)
struct s_model_ports * next
void free_trace_structs(void)
void pathfinder_update_cost(float pres_fac, float acc_fac)
void reload_ext_net_rr_terminal_cluster(void)
void force_post_place_route_cb_input_pins(int iblock)
t_pb_graph_pin ** output_pins
void reset_legalizer_for_cluster(t_block *clb)
void reset_path_costs(void)
void setup_intracluster_routing_for_molecule(INP t_pack_molecule *molecule, INP t_pb_graph_node **primitive_list)
boolean try_breadth_first_route_cluster(void)
void save_and_reset_routing_cluster(void)
void set_pb_graph_mode(t_pb_graph_node *pb_graph_node, int mode, int isOn)
#define HUGE_POSITIVE_FLOAT
static void * my_malloc(int ibytes)
int get_array_size_of_molecule(t_pack_molecule *molecule)
void alloc_and_load_rr_node_route_structs(void)
int * vpack_to_clb_net_mapping
struct s_trace ** trace_head
static int num_nets_in_cluster
static void breadth_first_expand_neighbours_cluster(int inode, float pcost, int inet, boolean first_time)
struct s_pb_graph_node *** child_pb_graph_nodes
void node_to_heap(int inode, float cost, int prev_node, int prev_edge, float backward_path_cost, float R_upstream)
void alloc_route_static_structs(void)
boolean is_pin_open(int i)
static boolean breadth_first_route_net_cluster(int inet)
void pathfinder_update_one_cost(struct s_trace *route_segment_start, int add_or_sub, float pres_fac)
static boolean is_net_in_cluster(INP int inet)
struct s_pb_type * pb_type
void reset_rr_node_route_structs(void)
struct s_trace * update_traceback(struct s_heap *hptr, int inet)
static int ext_output_rr_node_index
static int ext_input_rr_node_index
static void * my_realloc(void *memblk, int ibytes)
static int * nets_in_cluster
static int curr_cluster_index
t_pb_graph_pin * pb_graph_pin
void setup_intracluster_routing_for_logical_block(INP int iblock, INP t_pb_graph_node *primitive)
void add_to_mod_list(float *fptr)
void free_rr_node_route_structs(void)
float pack_intrinsic_cost
static void mark_ends_cluster(int inet)
static int ** saved_net_rr_terminals
void free_chunk_memory(t_chunk *chunk_info)
static void breadth_first_add_source_to_heap_cluster(int inet)
static int saved_num_nets_in_cluster
void alloc_and_load_legalizer_for_cluster(INP t_block *clb, INP int clb_index, INP const t_arch *arch)
void free_route_structs()
void save_cluster_solution(void)
t_pb_graph_node * pb_graph_node
static int ext_clock_rr_node_index
void alloc_and_load_cluster_legality_checker(void)
t_pb_graph_pin ** input_pins
struct s_logical_block * logical_block
static struct s_trace ** best_routing