vpr likes the tileable rr_graph while fpga_x2p does not
This commit is contained in:
parent
59df305668
commit
cdd4af9c58
|
@ -255,3 +255,50 @@ void add_one_edge_for_two_rr_nodes(const t_rr_graph* rr_graph,
|
|||
return;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Get the coordinator of a starting point of a routing track
|
||||
* For routing tracks in INC_DIRECTION
|
||||
* (xlow, ylow) should be the starting point
|
||||
*
|
||||
* For routing tracks in DEC_DIRECTION
|
||||
* (xhigh, yhigh) should be the starting point
|
||||
***********************************************************************/
|
||||
DeviceCoordinator get_track_rr_node_start_coordinator(const t_rr_node* track_rr_node) {
|
||||
/* Make sure we have CHANX or CHANY */
|
||||
assert ( (CHANX == track_rr_node->type) ||(CHANY == track_rr_node->type) );
|
||||
|
||||
DeviceCoordinator start_coordinator;
|
||||
|
||||
if (INC_DIRECTION == track_rr_node->direction) {
|
||||
start_coordinator.set(track_rr_node->xlow, track_rr_node->ylow);
|
||||
} else {
|
||||
assert (DEC_DIRECTION == track_rr_node->direction);
|
||||
start_coordinator.set(track_rr_node->xhigh, track_rr_node->yhigh);
|
||||
}
|
||||
|
||||
return start_coordinator;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Get the coordinator of a end point of a routing track
|
||||
* For routing tracks in INC_DIRECTION
|
||||
* (xhigh, yhigh) should be the starting point
|
||||
*
|
||||
* For routing tracks in DEC_DIRECTION
|
||||
* (xlow, ylow) should be the starting point
|
||||
***********************************************************************/
|
||||
DeviceCoordinator get_track_rr_node_end_coordinator(const t_rr_node* track_rr_node) {
|
||||
/* Make sure we have CHANX or CHANY */
|
||||
assert ( (CHANX == track_rr_node->type) ||(CHANY == track_rr_node->type) );
|
||||
|
||||
DeviceCoordinator start_coordinator;
|
||||
|
||||
if (INC_DIRECTION == track_rr_node->direction) {
|
||||
start_coordinator.set(track_rr_node->xhigh, track_rr_node->yhigh);
|
||||
} else {
|
||||
assert (DEC_DIRECTION == track_rr_node->direction);
|
||||
start_coordinator.set(track_rr_node->xlow, track_rr_node->ylow);
|
||||
}
|
||||
|
||||
return start_coordinator;
|
||||
}
|
||||
|
|
|
@ -30,5 +30,9 @@ void add_one_edge_for_two_rr_nodes(const t_rr_graph* rr_graph,
|
|||
const int des_rr_node_id,
|
||||
const short switch_id);
|
||||
|
||||
DeviceCoordinator get_track_rr_node_start_coordinator(const t_rr_node* track_rr_node);
|
||||
|
||||
DeviceCoordinator get_track_rr_node_end_coordinator(const t_rr_node* track_rr_node);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -359,8 +359,12 @@ void load_one_chan_rr_nodes_basic_info(const DeviceCoordinator& chan_coordinator
|
|||
*/
|
||||
for (size_t itrack = 0; itrack < chan_details->get_chan_width(); ++itrack) {
|
||||
/* For INC direction, a starting point requires a new chan rr_node */
|
||||
if ( (true == chan_details->is_track_start(itrack))
|
||||
&& (INC_DIRECTION == chan_details->get_track_direction(itrack)) ) {
|
||||
if ( ( (true == chan_details->is_track_start(itrack))
|
||||
&& (INC_DIRECTION == chan_details->get_track_direction(itrack)) )
|
||||
/* For DEC direction, an ending point requires a new chan rr_node */
|
||||
||
|
||||
( (true == chan_details->is_track_end(itrack))
|
||||
&& (DEC_DIRECTION == chan_details->get_track_direction(itrack)) ) ) {
|
||||
/* Use a new chan rr_node */
|
||||
rr_graph->rr_node[*cur_node_id].type = chan_type;
|
||||
rr_graph->rr_node[*cur_node_id].xlow = chan_coordinator.get_x();
|
||||
|
@ -382,33 +386,14 @@ void load_one_chan_rr_nodes_basic_info(const DeviceCoordinator& chan_coordinator
|
|||
(*cur_node_id)++;
|
||||
/* Finish here, go to next */
|
||||
}
|
||||
/* For DEC direction, an ending point requires a new chan rr_node */
|
||||
if ( (true == chan_details->is_track_end(itrack))
|
||||
&& (DEC_DIRECTION == chan_details->get_track_direction(itrack)) ) {
|
||||
/* Use a new chan rr_node */
|
||||
rr_graph->rr_node[*cur_node_id].type = chan_type;
|
||||
rr_graph->rr_node[*cur_node_id].xhigh = chan_coordinator.get_x();
|
||||
rr_graph->rr_node[*cur_node_id].yhigh = chan_coordinator.get_y();
|
||||
rr_graph->rr_node[*cur_node_id].direction = chan_details->get_track_direction(itrack);
|
||||
rr_graph->rr_node[*cur_node_id].ptc_num = itrack;
|
||||
rr_graph->rr_node[*cur_node_id].track_ids.push_back(itrack);
|
||||
rr_graph->rr_node[*cur_node_id].capacity = 1;
|
||||
rr_graph->rr_node[*cur_node_id].occ = 0;
|
||||
/* Update chan_details with node_id */
|
||||
chan_details->set_track_node_id(itrack, *cur_node_id);
|
||||
/* assign switch id */
|
||||
size_t seg_id = chan_details->get_track_segment_id(itrack);
|
||||
rr_graph->rr_node[*cur_node_id].driver_switch = segment_infs[seg_id].opin_switch;
|
||||
/* cost index depends on the segment index */
|
||||
rr_graph->rr_node[*cur_node_id].cost_index = cost_index_offset + seg_id;
|
||||
|
||||
/* Update node counter */
|
||||
(*cur_node_id)++;
|
||||
/* Finish here, go to next */
|
||||
}
|
||||
/* For INC direction, an ending point requires an update on xhigh and yhigh */
|
||||
if ( (true == chan_details->is_track_end(itrack))
|
||||
&& (INC_DIRECTION == chan_details->get_track_direction(itrack)) ) {
|
||||
if ( ( (true == chan_details->is_track_end(itrack))
|
||||
&& (INC_DIRECTION == chan_details->get_track_direction(itrack)) )
|
||||
||
|
||||
/* For DEC direction, an starting point requires an update on xlow and ylow */
|
||||
( (true == chan_details->is_track_start(itrack))
|
||||
&& (DEC_DIRECTION == chan_details->get_track_direction(itrack)) ) ) {
|
||||
/* Get the node_id */
|
||||
size_t rr_node_id = chan_details->get_track_node_id(itrack);
|
||||
/* Do a quick check, make sure we do not mistakenly modify other nodes */
|
||||
|
@ -424,24 +409,7 @@ void load_one_chan_rr_nodes_basic_info(const DeviceCoordinator& chan_coordinator
|
|||
}
|
||||
/* Finish here, go to next */
|
||||
}
|
||||
/* For DEC direction, an starting point requires an update on xlow and ylow */
|
||||
if ( (true == chan_details->is_track_start(itrack))
|
||||
&& (DEC_DIRECTION == chan_details->get_track_direction(itrack)) ) {
|
||||
/* Get the node_id */
|
||||
size_t rr_node_id = chan_details->get_track_node_id(itrack);
|
||||
/* Do a quick check, make sure we do not mistakenly modify other nodes */
|
||||
assert(chan_type == rr_graph->rr_node[rr_node_id].type);
|
||||
assert(chan_details->get_track_direction(itrack) == rr_graph->rr_node[rr_node_id].direction);
|
||||
/* set xlow/ylow and push changes to track_ids */
|
||||
rr_graph->rr_node[rr_node_id].xlow = chan_coordinator.get_x();
|
||||
rr_graph->rr_node[rr_node_id].ylow = chan_coordinator.get_y();
|
||||
/* Do not update track_ids for length-1 wires, they should have only 1 track_id */
|
||||
if ( (rr_graph->rr_node[rr_node_id].xhigh > rr_graph->rr_node[rr_node_id].xlow)
|
||||
|| (rr_graph->rr_node[rr_node_id].yhigh > rr_graph->rr_node[rr_node_id].ylow) ) {
|
||||
rr_graph->rr_node[rr_node_id].track_ids.push_back(itrack);
|
||||
}
|
||||
/* Finish here, go to next */
|
||||
}
|
||||
|
||||
/* Finish processing starting and ending tracks */
|
||||
if ( (true== chan_details->is_track_start(itrack))
|
||||
|| (true == chan_details->is_track_end(itrack)) ) {
|
||||
|
@ -660,7 +628,7 @@ void load_rr_nodes_basic_info(t_rr_graph* rr_graph,
|
|||
}
|
||||
}
|
||||
|
||||
/* Check */
|
||||
/* A quick check */
|
||||
assert ((int)cur_node_id == rr_graph->num_rr_nodes);
|
||||
for (int inode = 0; inode < rr_graph->num_rr_nodes; ++inode) {
|
||||
/* Check: we only support straight wires now.
|
||||
|
@ -668,8 +636,10 @@ void load_rr_nodes_basic_info(t_rr_graph* rr_graph,
|
|||
*/
|
||||
if (CHANX == rr_graph->rr_node[inode].type) {
|
||||
assert (rr_graph->rr_node[inode].ylow == rr_graph->rr_node[inode].yhigh);
|
||||
assert (rr_graph->rr_node[inode].xlow <= rr_graph->rr_node[inode].xhigh);
|
||||
} else if (CHANY == rr_graph->rr_node[inode].type) {
|
||||
assert (rr_graph->rr_node[inode].xlow == rr_graph->rr_node[inode].xhigh);
|
||||
assert (rr_graph->rr_node[inode].ylow <= rr_graph->rr_node[inode].yhigh);
|
||||
} else {
|
||||
assert ( (SOURCE == rr_graph->rr_node[inode].type)
|
||||
|| (SINK == rr_graph->rr_node[inode].type)
|
||||
|
|
|
@ -91,16 +91,25 @@ enum e_track_status determine_track_status_of_gsb(const RRGSB& rr_gsb,
|
|||
/* Get the coordinators */
|
||||
DeviceCoordinator side_coordinator = rr_gsb.get_side_block_coordinator(gsb_side);
|
||||
|
||||
/* Get the coordinator of where the track starts */
|
||||
DeviceCoordinator track_start = get_track_rr_node_start_coordinator(track_node);
|
||||
|
||||
/* INC_DIRECTION start_track: (xlow, ylow) should be same as the GSB side coordinator */
|
||||
if ( ((size_t)track_node->xlow == side_coordinator.get_x())
|
||||
&& ((size_t)track_node->ylow == side_coordinator.get_y())
|
||||
/* DEC_DIRECTION start_track: (xhigh, yhigh) should be same as the GSB side coordinator */
|
||||
if ( (track_start.get_x() == side_coordinator.get_x())
|
||||
&& (track_start.get_y() == side_coordinator.get_y())
|
||||
&& (OUT_PORT == rr_gsb.get_chan_node_direction(gsb_side, track_id)) ) {
|
||||
/* Double check: start track should be an OUTPUT PORT of the GSB */
|
||||
track_status = TRACK_START;
|
||||
}
|
||||
|
||||
/* Get the coordinator of where the track ends */
|
||||
DeviceCoordinator track_end = get_track_rr_node_end_coordinator(track_node);
|
||||
|
||||
/* INC_DIRECTION end_track: (xhigh, yhigh) should be same as the GSB side coordinator */
|
||||
if ( ((size_t)track_node->xhigh == side_coordinator.get_x())
|
||||
&& ((size_t)track_node->yhigh == side_coordinator.get_y())
|
||||
/* DEC_DIRECTION end_track: (xlow, ylow) should be same as the GSB side coordinator */
|
||||
if ( (track_end.get_x() == side_coordinator.get_x())
|
||||
&& (track_end.get_y() == side_coordinator.get_y())
|
||||
&& (IN_PORT == rr_gsb.get_chan_node_direction(gsb_side, track_id)) ) {
|
||||
/* Double check: end track should be an INPUT PORT of the GSB */
|
||||
track_status = TRACK_END;
|
||||
|
@ -132,9 +141,11 @@ bool is_gsb_in_track_cb_population(const RRGSB& rr_gsb,
|
|||
/* Get the coordinators */
|
||||
DeviceCoordinator side_coordinator = rr_gsb.get_side_block_coordinator(gsb_side);
|
||||
|
||||
DeviceCoordinator track_start = get_track_rr_node_start_coordinator(track_node);
|
||||
|
||||
/* Get the offset */
|
||||
size_t offset = std::abs((int)side_coordinator.get_x() - track_node->xlow)
|
||||
+ std::abs((int)side_coordinator.get_y() - track_node->ylow);
|
||||
size_t offset = std::abs((int)side_coordinator.get_x() - (int)track_start.get_x())
|
||||
+ std::abs((int)side_coordinator.get_y() - (int)track_start.get_y());
|
||||
|
||||
/* Get segment id */
|
||||
size_t seg_id = rr_gsb.get_chan_node_segment(gsb_side, track_id);
|
||||
|
@ -171,9 +182,11 @@ bool is_gsb_in_track_sb_population(const RRGSB& rr_gsb,
|
|||
/* Get the coordinators */
|
||||
DeviceCoordinator side_coordinator = rr_gsb.get_side_block_coordinator(gsb_side);
|
||||
|
||||
DeviceCoordinator track_start = get_track_rr_node_start_coordinator(track_node);
|
||||
|
||||
/* Get the offset */
|
||||
size_t offset = std::abs((int)side_coordinator.get_x() - track_node->xlow)
|
||||
+ std::abs((int)side_coordinator.get_y() - track_node->ylow);
|
||||
size_t offset = std::abs((int)side_coordinator.get_x() - (int)track_start.get_x())
|
||||
+ std::abs((int)side_coordinator.get_y() - (int)track_start.get_y());
|
||||
|
||||
/* Get segment id */
|
||||
size_t seg_id = rr_gsb.get_chan_node_segment(gsb_side, track_id);
|
||||
|
@ -1298,6 +1311,20 @@ void build_direct_connections_for_one_gsb(t_rr_graph* rr_graph,
|
|||
if (grid_type != clb_to_clb_directs[i].from_clb_type) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* This opin is specified to connect directly to an ipin,
|
||||
* now compute which ipin to connect to
|
||||
*/
|
||||
DeviceCoordinator to_grid_coordinator(from_grid_coordinator.get_x() + directs[i].x_offset,
|
||||
from_grid_coordinator.get_y() + directs[i].y_offset);
|
||||
|
||||
/* Bypass unmatched direct clb-to-clb connections */
|
||||
t_type_ptr to_grid_type = grids[to_grid_coordinator.get_x()][to_grid_coordinator.get_y()].type;
|
||||
/* Check if to_grid if the same grid */
|
||||
if (to_grid_type != clb_to_clb_directs[i].to_clb_type) {
|
||||
continue;
|
||||
}
|
||||
|
||||
bool swap;
|
||||
int max_index, min_index;
|
||||
/* Compute index of opin with regards to given pins */
|
||||
|
@ -1311,12 +1338,11 @@ void build_direct_connections_for_one_gsb(t_rr_graph* rr_graph,
|
|||
min_index = clb_to_clb_directs[i].from_clb_pin_start_index;
|
||||
max_index = clb_to_clb_directs[i].from_clb_pin_end_index;
|
||||
}
|
||||
|
||||
/* get every opin in the range */
|
||||
for (int opin = min_index; opin <= max_index; ++opin) {
|
||||
int offset = opin - min_index;
|
||||
/* This opin is specified to connect directly to an ipin, now compute which ipin to connect to */
|
||||
DeviceCoordinator to_grid_coordinator(from_grid_coordinator.get_x() + directs[i].x_offset,
|
||||
from_grid_coordinator.get_y() + directs[i].y_offset);
|
||||
|
||||
if ( (to_grid_coordinator.get_x() < device_size.get_x() - 1)
|
||||
&& (to_grid_coordinator.get_y() < device_size.get_y() - 1) ) {
|
||||
int ipin = OPEN;
|
||||
|
@ -1334,6 +1360,7 @@ void build_direct_connections_for_one_gsb(t_rr_graph* rr_graph,
|
|||
ipin = clb_to_clb_directs[i].to_clb_pin_start_index + offset;
|
||||
}
|
||||
}
|
||||
|
||||
/* Get the pin index in the rr_graph */
|
||||
int from_grid_ofs = from_grid.offset;
|
||||
int to_grid_ofs = grids[to_grid_coordinator.get_x()][to_grid_coordinator.get_y()].offset;
|
||||
|
|
Loading…
Reference in New Issue