Exemple #1
0
void
save_routing(struct s_trace **best_routing,
	     t_ivec ** fb_opins_used_locally,
	     t_ivec ** saved_clb_opins_used_locally)
{

/* This routing frees any routing currently held in best routing,       *
 * then copies over the current routing (held in trace_head), and       *
 * finally sets trace_head and trace_tail to all NULLs so that the      *
 * connection to the saved routing is broken.  This is necessary so     *
 * that the next iteration of the router does not free the saved        *
 * routing elements.  Also saves any data about locally used clb_opins, *
 * since this is also part of the routing.                              */

    int inet, iblk, iclass, ipin, num_local_opins;
    struct s_trace *tptr, *tempptr;
    t_type_ptr type;

    for(inet = 0; inet < num_nets; inet++)
	{

/* Free any previously saved routing.  It is no longer best. */
	    tptr = best_routing[inet];
	    while(tptr != NULL)
		{
		    tempptr = tptr->next;
		    free_trace_data(tptr);
		    tptr = tempptr;
		}

/* Save a pointer to the current routing in best_routing. */
	    best_routing[inet] = trace_head[inet];

/* Set the current (working) routing to NULL so the current trace       *
 * elements won't be reused by the memory allocator.                    */

	    trace_head[inet] = NULL;
	    trace_tail[inet] = NULL;
	}

/* Save which OPINs are locally used.                           */

    for(iblk = 0; iblk < num_blocks; iblk++)
	{
	    type = block[iblk].type;
	    for(iclass = 0; iclass < type->num_class; iclass++)
		{
		    num_local_opins =
			fb_opins_used_locally[iblk][iclass].nelem;
		    for(ipin = 0; ipin < num_local_opins; ipin++)
			{
			    saved_clb_opins_used_locally[iblk][iclass].
				list[ipin] =
				fb_opins_used_locally[iblk][iclass].
				list[ipin];
			}
		}
	}
}
void free_traceback (int inet) {

/* Puts the entire traceback (old routing) for this net on the free list *
 * and sets the trace_head pointers etc. for the net to NULL.            */

 struct s_trace *tptr, *tempptr;

 tptr = trace_head[inet];

 while (tptr != NULL) {
    tempptr = tptr->next; 
    free_trace_data (tptr);
    tptr = tempptr;
 }
 
 trace_head[inet] = NULL; 
 trace_tail[inet] = NULL;
}