static float
assign_blocks_and_route_net(t_type_ptr source_type,
			    int source_x_loc,
			    int source_y_loc,
			    t_type_ptr sink_type,
			    int sink_x_loc,
			    int sink_y_loc,
			    struct s_router_opts router_opts,
			    struct s_det_routing_arch det_routing_arch,
			    t_segment_inf * segment_inf,
			    t_timing_inf timing_inf)
{
    /*places blocks at the specified locations, and routes a net between them */
    /*returns the delay of this net */
    boolean is_routeable;
    int ipin;
    float pres_fac, T_crit;
    float net_delay_value;

    int source_z_loc, sink_z_loc;

    /* Only one block per tile */
    source_z_loc = 0;
    sink_z_loc = 0;

    net_delay_value = IMPOSSIBLE;	/*set to known value for debug purposes */

    assign_locations(source_type, source_x_loc, source_y_loc, source_z_loc,
		     sink_type, sink_x_loc, sink_y_loc, sink_z_loc);

    load_net_rr_terminals(rr_node_indices);

    T_crit = 1;
    pres_fac = 0;		/* ignore congestion */

    for(ipin = 1; ipin <= clb_net[NET_USED].num_sinks; ipin++)
	net_slack[NET_USED][ipin] = 0;

    is_routeable = timing_driven_route_net(NET_USED, pres_fac,
					   router_opts.max_criticality,
					   router_opts.criticality_exp,
					   router_opts.astar_fac,
					   router_opts.bend_cost,
					   net_slack[NET_USED],
					   pin_criticality, sink_order,
					   rt_node_of_sink, T_crit,
					   net_delay[NET_USED]);

    net_delay_value = net_delay[NET_USED][NET_USED_SINK_BLOCK];

    grid[source_x_loc][source_y_loc].usage = 0;
    grid[source_x_loc][source_y_loc].blocks[source_z_loc] = EMPTY;
    grid[sink_x_loc][sink_y_loc].usage = 0;
    grid[sink_x_loc][sink_y_loc].blocks[sink_z_loc] = EMPTY;

    return (net_delay_value);
}
static float assign_blocks_and_route_net(enum e_block_types source_type,
		int source_x_loc, int source_y_loc, enum e_block_types sink_type,
		int sink_x_loc, int sink_y_loc, struct s_router_opts router_opts,
		struct s_det_routing_arch det_routing_arch, t_segment_inf *segment_inf,
		t_timing_inf timing_inf) {

	/*places blocks at the specified locations, and routes a net between them*/
	/*returns the delay of this net */

	boolean is_routeable;
	int ipin;
	float pres_fac, T_crit;
	float net_delay_value;
	int **rr_node_indices;
	int nodes_per_chan;

	net_delay_value = IMPOSSIBLE; /*set to known value for debug purposes*/

	assign_locations(source_type, source_x_loc, source_y_loc, sink_type,
			sink_x_loc, sink_y_loc);

	rr_node_indices = get_rr_node_indices();
	nodes_per_chan = get_nodes_per_chan();

	load_net_rr_terminals(rr_node_indices, nodes_per_chan, num_direct, io_rat);

	T_crit = 1;
	pres_fac = 0; /* ignore congestion */

	for (ipin = 1; ipin < net[NET_USED].num_pins; ipin++)
		net_slack[NET_USED][ipin] = 0;

	is_routeable = timing_driven_route_net(NET_USED, pres_fac,
			router_opts.max_criticality, router_opts.criticality_exp,
			router_opts.astar_fac, router_opts.bend_cost, net_slack[NET_USED],
			pin_criticality, sink_order, rt_node_of_sink, T_crit,
			net_delay[NET_USED]);

	net_delay_value = net_delay[NET_USED][NET_USED_SINK_BLOCK];

	if (!is_folding) {
		clb[source_x_loc][source_y_loc].occ = 0;
		clb[sink_x_loc][sink_y_loc].occ = 0;
	} else {
		//nionio added two lines
		clb[source_x_loc][source_y_loc].occ = 0;
		clb[sink_x_loc][sink_y_loc].occ = 0;
		stage_clb[0][source_x_loc][source_y_loc].occ = 0;
		stage_clb[0][sink_x_loc][sink_y_loc].occ = 0;
	}

	return (net_delay_value);

}
static float assign_blocks_and_route_net(t_type_ptr source_type,
		int source_x_loc, int source_y_loc, t_type_ptr sink_type,
		int sink_x_loc, int sink_y_loc, struct s_router_opts router_opts,
		struct s_det_routing_arch det_routing_arch, t_segment_inf * segment_inf,
		t_timing_inf timing_inf) {
	/*places blocks at the specified locations, and routes a net between them */
	/*returns the delay of this net */

	float pres_fac, net_delay_value;

	int source_z_loc, sink_z_loc;

	/* Only one block per tile */
	source_z_loc = 0;
	sink_z_loc = 0;

	net_delay_value = IMPOSSIBLE; /*set to known value for debug purposes */

	assign_locations(source_type, source_x_loc, source_y_loc, source_z_loc,
			sink_type, sink_x_loc, sink_y_loc, sink_z_loc);

	load_net_rr_terminals(rr_node_indices);

	pres_fac = 0; /* ignore congestion */

	/* Route this net with a dummy criticality of 0 by calling 
	timing_driven_route_net with slacks set to NULL. */
	timing_driven_route_net(NET_USED, pres_fac,
			router_opts.max_criticality, router_opts.criticality_exp,
			router_opts.astar_fac, router_opts.bend_cost, 
			pin_criticality, sink_order, rt_node_of_sink, 
			net_delay[NET_USED], NULL);

	net_delay_value = net_delay[NET_USED][NET_USED_SINK_BLOCK];

	grid[source_x_loc][source_y_loc].usage = 0;
	grid[source_x_loc][source_y_loc].blocks[source_z_loc] = EMPTY;
	grid[sink_x_loc][sink_y_loc].usage = 0;
	grid[sink_x_loc][sink_y_loc].blocks[sink_z_loc] = EMPTY;

	return (net_delay_value);
}