-
Notifications
You must be signed in to change notification settings - Fork 445
Now direct connection builder in tileable rr_graph supports any subtile index as the from_pin #3318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 17 commits
85b82b1
1009339
6672c7a
9da2e46
83540ce
90de0e8
615eb82
da7c322
cafdcd1
27d3040
6fc15ec
881255c
df2a7de
2ea4ad0
2107714
55ad286
1067e11
e8ebafb
d93f036
97c7bc8
9baa66e
dcbe115
bd589a9
2ffbff3
68d6e23
e11a7ee
daa754f
4c9b8fa
8d3ab0e
aa76d71
35eeb2e
07e8b6f
7ffcdf0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1722,74 +1722,81 @@ void build_direct_connections_for_one_gsb(const RRGraphView& rr_graph, | |
| } | ||
|
|
||
| /* get every opin in the range */ | ||
| for (int opin = min_index; opin <= max_index; ++opin) { | ||
| int offset = opin - min_index; | ||
| for (int relative_opin = min_index; relative_opin <= max_index; ++relative_opin) { | ||
| int offset = relative_opin - min_index; | ||
| //Capacity location determined by pin number relative to pins per capacity instance | ||
| auto [z, relative_opin] = get_capacity_location_from_physical_pin(grid_type, opin); | ||
| VTR_ASSERT(z >= 0 && z < grid_type->capacity); | ||
|
|
||
| if ((to_grid_coordinate.x() < grids.width() - 1) | ||
| && (to_grid_coordinate.y() < grids.height() - 1)) { | ||
| int relative_ipin = UNDEFINED; | ||
| if (clb_to_clb_directs[i].to_clb_pin_start_index | ||
| > clb_to_clb_directs[i].to_clb_pin_end_index) { | ||
| if (true == swap) { | ||
| relative_ipin = clb_to_clb_directs[i].to_clb_pin_end_index + offset; | ||
| for (int z : clb_to_clb_directs[i].from_sub_tiles) { | ||
| int opin = get_physical_pin_from_capacity_location(grid_type, relative_opin, z); | ||
| VTR_ASSERT(z >= 0 && z < grid_type->capacity); | ||
|
|
||
| if ((to_grid_coordinate.x() < grids.width() - 1) | ||
| && (to_grid_coordinate.y() < grids.height() - 1)) { | ||
| int relative_ipin = UNDEFINED; | ||
| if (clb_to_clb_directs[i].to_clb_pin_start_index | ||
| > clb_to_clb_directs[i].to_clb_pin_end_index) { | ||
| if (true == swap) { | ||
| relative_ipin = clb_to_clb_directs[i].to_clb_pin_end_index + offset; | ||
| } else { | ||
| relative_ipin = clb_to_clb_directs[i].to_clb_pin_start_index - offset; | ||
| } | ||
| } else { | ||
| relative_ipin = clb_to_clb_directs[i].to_clb_pin_start_index - offset; | ||
| if (true == swap) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Odd style. I'd use:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adapted |
||
| relative_ipin = clb_to_clb_directs[i].to_clb_pin_end_index - offset; | ||
| } else { | ||
| relative_ipin = clb_to_clb_directs[i].to_clb_pin_start_index + offset; | ||
| } | ||
| } | ||
| } else { | ||
| if (true == swap) { | ||
| relative_ipin = clb_to_clb_directs[i].to_clb_pin_end_index - offset; | ||
| } else { | ||
| relative_ipin = clb_to_clb_directs[i].to_clb_pin_start_index + offset; | ||
|
|
||
| /* Get the pin index in the rr_graph */ | ||
| t_physical_tile_loc from_tile_loc(from_grid_coordinate.x(), from_grid_coordinate.y(), layer); | ||
| t_physical_tile_loc to_tile_loc(to_grid_coordinate.x(), to_grid_coordinate.y(), layer); | ||
|
|
||
| /* Find the side of grid pins, the pin location should be unique! | ||
| * Pin location is required by searching a node in rr_graph | ||
| */ | ||
| std::vector<e_side> opin_grid_side = find_grid_pin_sides(grids, layer, from_grid_coordinate.x() + grid_type->pin_width_offset[opin], from_grid_coordinate.y() + grid_type->pin_height_offset[opin], opin); | ||
| if (1 != opin_grid_side.size()) { | ||
| VPR_FATAL_ERROR(VPR_ERROR_ARCH, "[Arch LINE %d] From pin (index=%d) of direct connection '%s' does not exist on any side of the programmable block '%s'.\n", directs[i].line, opin, directs[i].from_pin.c_str()); | ||
| } | ||
| } | ||
|
|
||
| /* Get the pin index in the rr_graph */ | ||
| t_physical_tile_loc from_tile_loc(from_grid_coordinate.x(), from_grid_coordinate.y(), layer); | ||
| t_physical_tile_loc to_tile_loc(to_grid_coordinate.x(), to_grid_coordinate.y(), layer); | ||
| /* directs[i].sub_tile_offset is added to from_capacity(z) to get the target_capacity */ | ||
| int to_subtile_cap = z + directs[i].sub_tile_offset; | ||
| /* Iterate over all sub_tiles to get the sub_tile which the target_cap belongs to. */ | ||
| const t_sub_tile* to_sub_tile = nullptr; | ||
| for (const t_sub_tile& sub_tile : to_grid_type->sub_tiles) { | ||
| if (sub_tile.capacity.is_in_range(to_subtile_cap)) { | ||
| to_sub_tile = &sub_tile; | ||
| break; | ||
| } | ||
| } | ||
| VTR_ASSERT(to_sub_tile != nullptr); | ||
| if (relative_ipin >= to_sub_tile->num_phy_pins) continue; | ||
| // If this block has capacity > 1 then the pins of z position > 0 are offset | ||
| // by the number of pins per capacity instance | ||
| int ipin = get_physical_pin_from_capacity_location(to_grid_type, relative_ipin, to_subtile_cap); | ||
| std::vector<e_side> ipin_grid_side = find_grid_pin_sides(grids, layer, to_grid_coordinate.x() + to_grid_type->pin_width_offset[ipin], to_grid_coordinate.y() + to_grid_type->pin_height_offset[ipin], ipin); | ||
| if (1 != ipin_grid_side.size()) { | ||
| VPR_FATAL_ERROR(VPR_ERROR_ARCH, "[Arch LINE %d] To pin (index=%d) of direct connection '%s' does not exist on any side of the programmable block '%s'.\n", directs[i].line, relative_ipin, directs[i].to_pin.c_str()); | ||
| } | ||
|
|
||
| /* Find the side of grid pins, the pin location should be unique! | ||
| * Pin location is required by searching a node in rr_graph | ||
| */ | ||
| std::vector<e_side> opin_grid_side = find_grid_pin_sides(grids, layer, from_grid_coordinate.x() + grid_type->pin_width_offset[opin], from_grid_coordinate.y() + grid_type->pin_height_offset[opin], opin); | ||
| if (1 != opin_grid_side.size()) { | ||
| VPR_FATAL_ERROR(VPR_ERROR_ARCH, "[Arch LINE %d] From pin (index=%d) of direct connection '%s' does not exist on any side of the programmable block '%s'.\n", directs[i].line, opin, directs[i].from_pin.c_str()); | ||
| } | ||
|
|
||
| /* directs[i].sub_tile_offset is added to from_capacity(z) to get the target_capacity */ | ||
| int to_subtile_cap = z + directs[i].sub_tile_offset; | ||
| /* Iterate over all sub_tiles to get the sub_tile which the target_cap belongs to. */ | ||
| const t_sub_tile* to_sub_tile = nullptr; | ||
| for (const t_sub_tile& sub_tile : to_grid_type->sub_tiles) { | ||
| if (sub_tile.capacity.is_in_range(to_subtile_cap)) { | ||
| to_sub_tile = &sub_tile; | ||
| break; | ||
| RRNodeId opin_node_id = rr_graph.node_lookup().find_node(layer, | ||
| from_grid_coordinate.x() + grid_type->pin_width_offset[opin], | ||
| from_grid_coordinate.y() + grid_type->pin_height_offset[opin], | ||
| e_rr_type::OPIN, opin, opin_grid_side[0]); | ||
| RRNodeId ipin_node_id = rr_graph.node_lookup().find_node(layer, | ||
| to_grid_coordinate.x() + to_grid_type->pin_width_offset[ipin], | ||
| to_grid_coordinate.y() + to_grid_type->pin_height_offset[ipin], | ||
| e_rr_type::IPIN, ipin, ipin_grid_side[0]); | ||
|
|
||
| /* add edges to the opin_node */ | ||
| if (!opin_node_id) { | ||
| VTR_ASSERT(opin_node_id); | ||
| } | ||
| if (!ipin_node_id) { | ||
| VTR_ASSERT(opin_node_id); | ||
| } | ||
| rr_graph_builder.create_edge_in_cache(opin_node_id, ipin_node_id, RRSwitchId(clb_to_clb_directs[i].switch_index), false); | ||
| } | ||
| VTR_ASSERT(to_sub_tile != nullptr); | ||
| if (relative_ipin >= to_sub_tile->num_phy_pins) continue; | ||
| // If this block has capacity > 1 then the pins of z position > 0 are offset | ||
| // by the number of pins per capacity instance | ||
| int ipin = get_physical_pin_from_capacity_location(to_grid_type, relative_ipin, to_subtile_cap); | ||
| std::vector<e_side> ipin_grid_side = find_grid_pin_sides(grids, layer, to_grid_coordinate.x() + to_grid_type->pin_width_offset[ipin], to_grid_coordinate.y() + to_grid_type->pin_height_offset[ipin], ipin); | ||
| if (1 != ipin_grid_side.size()) { | ||
| VPR_FATAL_ERROR(VPR_ERROR_ARCH, "[Arch LINE %d] To pin (index=%d) of direct connection '%s' does not exist on any side of the programmable block '%s'.\n", directs[i].line, relative_ipin, directs[i].to_pin.c_str()); | ||
| } | ||
|
|
||
| RRNodeId opin_node_id = rr_graph.node_lookup().find_node(layer, | ||
| from_grid_coordinate.x() + grid_type->pin_width_offset[opin], | ||
| from_grid_coordinate.y() + grid_type->pin_height_offset[opin], | ||
| e_rr_type::OPIN, opin, opin_grid_side[0]); | ||
| RRNodeId ipin_node_id = rr_graph.node_lookup().find_node(layer, | ||
| to_grid_coordinate.x() + to_grid_type->pin_width_offset[ipin], | ||
| to_grid_coordinate.y() + to_grid_type->pin_height_offset[ipin], | ||
| e_rr_type::IPIN, ipin, ipin_grid_side[0]); | ||
|
|
||
| /* add edges to the opin_node */ | ||
| VTR_ASSERT(opin_node_id && ipin_node_id); | ||
| rr_graph_builder.create_edge_in_cache(opin_node_id, ipin_node_id, RRSwitchId(clb_to_clb_directs[i].switch_index), false); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1540,6 +1540,25 @@ int get_atom_pin_class_num(const AtomPinId atom_pin_id) { | |
| return get_class_num_from_pin_physical_num(physical_type, pin_physical_num); | ||
| } | ||
|
|
||
| std::vector<int> find_sub_tile_indices_by_port_name(t_physical_tile_type_ptr type, std::string_view port_name) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @tangxifan: I’m a little confused here. Let’s say I have a tile that has 5 subtiles of the same type. All of those subtiles would have the same port name… How would you get the index of a subtile then?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It will get all the indices of the subtiles as long as the subtile has a port in the required name. These subtiles can all be the starting point of a direct connection. |
||
| std::vector<int> ret; | ||
| for (const t_sub_tile& sub_tile : type->sub_tiles) { | ||
| bool matched = false; | ||
| for (const t_physical_tile_port& port : sub_tile.ports) { | ||
| if (port_name == port.name) { | ||
| matched = true; | ||
| break; | ||
| } | ||
| } | ||
| if (matched) { | ||
| for (int idx = sub_tile.capacity.low; idx <= sub_tile.capacity.high; ++idx) { | ||
| ret.push_back(idx); | ||
| } | ||
| } | ||
| } | ||
| return ret; | ||
| } | ||
|
|
||
| t_physical_tile_port find_tile_port_by_name(t_physical_tile_type_ptr type, std::string_view port_name) { | ||
| for (const t_sub_tile& sub_tile : type->sub_tiles) { | ||
| for (const t_physical_tile_port& port : sub_tile.ports) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,7 @@ bool is_clb_external_pin(ClusterBlockId blk_id, int pb_pin_id); | |
|
|
||
| bool is_empty_type(t_physical_tile_type_ptr type); | ||
| bool is_empty_type(t_logical_block_type_ptr type); | ||
| std::vector<int> find_sub_tile_indices_by_port_name(t_physical_tile_type_ptr type, std::string_view port_name); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should have a doxygen comment describing the function purpose, return type and parameters.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Code comments have been added. |
||
|
|
||
| /** | ||
| * @brief Returns the corresponding physical type given the location in the grid. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Odd style. I'd just put
if (swap)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adapted