Ejemplo n.º 1
0
static void breadth_first_expand_neighbours (int inode, float pcost, int inet,
          float bend_cost) {

/* Puts all the rr_nodes adjacent to inode on the heap.  rr_nodes outside   *
 * the expanded bounding box specified in route_bb are not added to the     *
 * heap.  pcost is the path_cost to get to inode.                           */

 int iconn, to_node, num_edges;
 t_rr_type from_type, to_type;
 float tot_cost;

 num_edges = rr_node[inode].num_edges;
 for (iconn=0;iconn<num_edges;iconn++) {
    to_node = rr_node[inode].edges[iconn];

    if (   rr_node[to_node].xhigh < route_bb[inet].xmin ||
           rr_node[to_node].xlow > route_bb[inet].xmax  ||
           rr_node[to_node].yhigh < route_bb[inet].ymin ||
           rr_node[to_node].ylow > route_bb[inet].ymax    )
       continue;      /* Node is outside (expanded) bounding box. */

    tot_cost = pcost + get_rr_cong_cost (to_node);

    if (bend_cost != 0.) {
       from_type = rr_node[inode].type;
       to_type = rr_node[to_node].type;
       if ((from_type == CHANX && to_type == CHANY) ||
              (from_type == CHANY && to_type == CHANX))
          tot_cost += bend_cost;
    }

    node_to_heap (to_node, tot_cost, inode, iconn, OPEN, OPEN);
 }
}
Ejemplo n.º 2
0
static void
directed_search_add_source_to_heap(int inet,
				   int target_node,
				   float astar_fac)
{

/* Adds the SOURCE of this net to the heap.  Used to start a net's routing. */

    int inode;
    float back_cost, tot_cost;

    inode = net_rr_terminals[inet][0];	/* SOURCE */
    back_cost = 0.0 + get_rr_cong_cost(inode);

    /* setting the total cost to 0 because it's the only element on the heap */
    if(!is_empty_heap())
	{
	    printf
		("Error: Wrong Assumption: in directed_search_add_source_to_heap "
		 "the heap is not empty. Need to properly calculate source node's cost.\n");
	    exit(1);
	}

    /* WMF: path cost is 0. could use tot_cost = 0 to save some computation time, but
     * for consistency, I chose to do the expected cost calculation. */
    tot_cost =
	back_cost + astar_fac * get_directed_search_expected_cost(inode,
								  target_node);
    node_to_heap(inode, tot_cost, NO_PREVIOUS, NO_PREVIOUS, back_cost, OPEN);

}
Ejemplo n.º 3
0
void reserve_locally_used_opins (float pres_fac, boolean rip_up_local_opins,
          t_ivec **clb_opins_used_locally) {

/* If some subblock outputs are hooked directly to CLB outputs, then      *
 * some CLB outputs are occupied if their associated subblock is used     *
 * locally, even though the inter-CLB netlist does not say those outputs  *
 * have to connect to anything.  This is important when you have          *
 * logically equivalent outputs.  Code below makes sure any CLB outputs   *
 * that are used by being directly hooked to subblocks get properly       *
 * reserved.                                                              */

 int iblk, num_local_opin, inode, from_node, iconn, num_edges, to_node;
 int iclass, ipin;
 float cost;
 struct s_heap *heap_head_ptr;

 if (rip_up_local_opins) {
    for (iblk=0;iblk<num_blocks;iblk++) {
       for (iclass=0;iclass<num_class;iclass++) {
          num_local_opin = clb_opins_used_locally[iblk][iclass].nelem; 
                  /* Always 0 for pads and for RECEIVER (IPIN) classes */
          for (ipin=0;ipin<num_local_opin;ipin++) {
             inode = clb_opins_used_locally[iblk][iclass].list[ipin];
             adjust_one_rr_occ_and_pcost (inode, -1, pres_fac);
          }
       }
    }
 }     
 
 for (iblk=0;iblk<num_blocks;iblk++) {
    for (iclass=0;iclass<num_class;iclass++) {
       num_local_opin = clb_opins_used_locally[iblk][iclass].nelem; 
               /* Always 0 for pads and for RECEIVER (IPIN) classes */

       if (num_local_opin != 0) {  /* Have to reserve (use) some OPINs */
          from_node = rr_clb_source[iblk][iclass];
          num_edges = rr_node[from_node].num_edges;
          for (iconn=0;iconn<num_edges;iconn++) {
             to_node = rr_node[from_node].edges[iconn];
             cost = get_rr_cong_cost (to_node);
             node_to_heap (to_node, cost, OPEN, OPEN, 0., 0.);
          }

          for (ipin=0;ipin<num_local_opin;ipin++) {
             heap_head_ptr = get_heap_head ();
             inode = heap_head_ptr->index;
             adjust_one_rr_occ_and_pcost (inode, 1, pres_fac);
             clb_opins_used_locally[iblk][iclass].list[ipin] = inode;
             free_heap_data (heap_head_ptr);
          }

          empty_heap ();
       }
    }
 }
}
Ejemplo n.º 4
0
static void breadth_first_add_source_to_heap (int inet) {

/* Adds the SOURCE of this net to the heap.  Used to start a net's routing. */

 int inode;
 float cost;

 inode = net_rr_terminals[inet][0];   /* SOURCE */
 cost = get_rr_cong_cost (inode);

 node_to_heap (inode, cost, NO_PREVIOUS, NO_PREVIOUS, OPEN, OPEN);
}
Ejemplo n.º 5
0
/**
 * Adapted from breadth_first_add_source_to_heap() 
 */
static void inc_breadth_first_add_inode_to_heap(int inode)
{
	float cost;
	cost = get_rr_cong_cost(inode);
	node_to_heap(inode, cost, NO_PREVIOUS, NO_PREVIOUS, OPEN, OPEN);
}
Ejemplo n.º 6
0
static void
directed_search_expand_neighbours(struct s_heap *current,
				  int inet,
				  float bend_cost,
				  int target_node,
				  int highfanout_rlim,
				  float astar_fac)
{

/* Puts all the rr_nodes adjacent to current on the heap.  rr_nodes outside   *
 * the expanded bounding box specified in route_bb are not added to the     *
 * heap.  back_cost is the path_cost to get to inode. total cost i.e.
 * tot_cost is path_cost + (expected_cost to target sink) */

    int iconn, to_node, num_edges, inode, target_x, target_y;
    t_rr_type from_type, to_type;
    float new_tot_cost, old_back_pcost, new_back_pcost;

    inode = current->index;
    old_back_pcost = current->backward_path_cost;
    num_edges = rr_node[inode].num_edges;

    target_x = rr_node[target_node].xhigh;
    target_y = rr_node[target_node].yhigh;

    for(iconn = 0; iconn < num_edges; iconn++)
	{
	    to_node = rr_node[inode].edges[iconn];

	    if(rr_node[to_node].xhigh < route_bb[inet].xmin ||
	       rr_node[to_node].xlow > route_bb[inet].xmax ||
	       rr_node[to_node].yhigh < route_bb[inet].ymin ||
	       rr_node[to_node].ylow > route_bb[inet].ymax)
		continue;	/* Node is outside (expanded) bounding box. */

		if(clb_net[inet].num_sinks >= HIGH_FANOUT_NET_LIM) {
			if(rr_node[to_node].xhigh < target_x - highfanout_rlim ||
				rr_node[to_node].xlow > target_x + highfanout_rlim ||
				rr_node[to_node].yhigh < target_y - highfanout_rlim ||
				rr_node[to_node].ylow > target_y + highfanout_rlim)
			continue;	/* Node is outside high fanout bin. */
		}

/* Prune away IPINs that lead to blocks other than the target one.  Avoids  *
 * the issue of how to cost them properly so they don't get expanded before *
 * more promising routes, but makes route-throughs (via CLBs) impossible.   *
 * Change this if you want to investigate route-throughs.                   */

	    to_type = rr_node[to_node].type;
	    if(to_type == IPIN && (rr_node[to_node].xhigh != target_x ||
				   rr_node[to_node].yhigh != target_y))
		continue;

/* new_back_pcost stores the "known" part of the cost to this node -- the   *
 * congestion cost of all the routing resources back to the existing route  *
 * new_tot_cost 
 * is this "known" backward cost + an expected cost to get to the target.   */

	    new_back_pcost = old_back_pcost + get_rr_cong_cost(to_node);

	    if(bend_cost != 0.)
		{
		    from_type = rr_node[inode].type;
		    to_type = rr_node[to_node].type;
		    if((from_type == CHANX && to_type == CHANY) ||
		       (from_type == CHANY && to_type == CHANX))
			new_back_pcost += bend_cost;
		}

	    /* Calculate the new total cost = path cost + astar_fac * remaining distance to target */
	    new_tot_cost = new_back_pcost + astar_fac *
		get_directed_search_expected_cost(to_node, target_node);

	    node_to_heap(to_node, new_tot_cost, inode, iconn, new_back_pcost,
			 OPEN);
	}
}