Skip to content

RR graph generation directory #3050

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

Merged
merged 13 commits into from
May 20, 2025
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions libs/libarchfpga/src/physical_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,11 @@ struct t_physical_tile_type {
///@brief Is this t_physical_tile_type an empty type?
bool is_empty() const;

///@brief Returns true if the physical tile type can implement either a .input or .output block type
inline bool is_io() const {
return is_input_type || is_output_type;
}

///@brief Returns the relative pin index within a sub tile that corresponds to the pin within the given port and its index in the port
int find_pin(std::string_view port_name, int pin_index_in_port) const;

Expand Down
15 changes: 0 additions & 15 deletions libs/libarchfpga/src/physical_types_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -637,21 +637,6 @@ bool is_pin_conencted_to_layer(t_physical_tile_type_ptr type, int ipin, int from
return false;
}

// TODO: Remove is_input_type / is_output_type / is_io_type as part of
// https://github.com/verilog-to-routing/vtr-verilog-to-routing/issues/1193
bool is_input_type(t_physical_tile_type_ptr type) {
return type->is_input_type;
}

bool is_output_type(t_physical_tile_type_ptr type) {
return type->is_output_type;
}

bool is_io_type(t_physical_tile_type_ptr type) {
return is_input_type(type)
|| is_output_type(type);
}

std::string block_type_pin_index_to_name(t_physical_tile_type_ptr type, int pin_physical_num, bool is_flat) {
int max_ptc = get_tile_pin_max_ptc(type, is_flat);
VTR_ASSERT(pin_physical_num < max_ptc);
Expand Down
7 changes: 0 additions & 7 deletions libs/libarchfpga/src/physical_types_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,6 @@ bool is_opin(int ipin, t_physical_tile_type_ptr type);
///@brief Returns true if the specified pin is located at "from_layer" and it is connected to "to_layer"
bool is_pin_conencted_to_layer(t_physical_tile_type_ptr type, int ipin, int from_layer, int to_layer, int num_of_avail_layer);

///@brief Returns true if the given physical tile type can implement a .input block type
bool is_input_type(t_physical_tile_type_ptr type);
///@brief Returns true if the given physical tile type can implement a .output block type
bool is_output_type(t_physical_tile_type_ptr type);
///@brief Returns true if the given physical tile type can implement either a .input or .output block type
bool is_io_type(t_physical_tile_type_ptr type);

/**
* @brief Returns the corresponding physical pin based on the input parameters:
*
Expand Down
2 changes: 1 addition & 1 deletion vpr/src/base/ShowSetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ ClusteredNetlistStats::ClusteredNetlistStats() {
auto logical_block = cluster_ctx.clb_nlist.block_type(blk_id);
auto physical_tile = pick_physical_type(logical_block);
num_blocks_type[logical_block->index]++;
if (is_io_type(physical_tile)) {
if (physical_tile->is_io()) {
for (int j = 0; j < logical_block->pb_type->num_pins; j++) {
int physical_pin = get_physical_pin(physical_tile, logical_block, j);

Expand Down
3 changes: 1 addition & 2 deletions vpr/src/base/check_netlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ static int check_connections_to_global_clb_pins(ClusterNetId net_id, int verbosi
int log_index = cluster_ctx.clb_nlist.pin_logical_index(pin_id);
int pin_index = get_physical_pin(physical_type, logical_type, log_index);

if (physical_type->is_ignored_pin[pin_index] != net_is_ignored
&& !is_io_type(physical_type)) {
if (physical_type->is_ignored_pin[pin_index] != net_is_ignored && !physical_type->is_io()) {
VTR_LOGV_WARN(verbosity > 2,
"Global net '%s' connects to non-global architecture pin '%s' (netlist pin '%s')\n",
cluster_ctx.clb_nlist.net_name(net_id).c_str(),
Expand Down
14 changes: 8 additions & 6 deletions vpr/src/base/read_route.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ static void process_nodes(const Netlist<>& net_list, std::ifstream& fp, ClusterN
/* Verify types and ptc*/
if (tokens[2] == "SOURCE" || tokens[2] == "SINK" || tokens[2] == "OPIN" || tokens[2] == "IPIN") {
const auto& type = device_ctx.grid.get_physical_type({x, y, layer_num});
if (tokens[4 + offset] == "Pad:" && !is_io_type(type)) {
if (tokens[4 + offset] == "Pad:" && !type->is_io()) {
vpr_throw(VPR_ERROR_ROUTE, filename, lineno,
"Node %d is of the wrong type", inode);
}
Expand All @@ -319,7 +319,7 @@ static void process_nodes(const Netlist<>& net_list, std::ifstream& fp, ClusterN
if (tokens[6 + offset] != "Switch:") {
/*This is an opin or ipin, process its pin nums*/
auto type = device_ctx.grid.get_physical_type({x, y, layer_num});
if (!is_io_type(type) && (tokens[2] == "IPIN" || tokens[2] == "OPIN")) {
if (!type->is_io() && (tokens[2] == "IPIN" || tokens[2] == "OPIN")) {
int pin_num = rr_graph.node_pin_num(RRNodeId(inode));
int width_offset = device_ctx.grid.get_width_offset({x, y, layer_num});
int height_offset = device_ctx.grid.get_height_offset({x, y, layer_num});
Expand Down Expand Up @@ -592,10 +592,13 @@ void print_route(const Netlist<>& net_list,
fprintf(fp, "to (%d,%d,%d) ", rr_graph.node_xhigh(inode),
rr_graph.node_yhigh(inode), layer_num);

t_physical_tile_type_ptr physical_tile = device_ctx.grid.get_physical_type({ilow, jlow, layer_num});

switch (rr_type) {
case e_rr_type::IPIN:
case e_rr_type::OPIN:
if (is_io_type(device_ctx.grid.get_physical_type({ilow, jlow, layer_num}))) {

if (physical_tile->is_io()) {
fprintf(fp, " Pad: ");
} else { /* IO Pad. */
fprintf(fp, " Pin: ");
Expand All @@ -609,7 +612,7 @@ void print_route(const Netlist<>& net_list,

case e_rr_type::SOURCE:
case e_rr_type::SINK:
if (is_io_type(device_ctx.grid.get_physical_type({ilow, jlow, layer_num}))) {
if (physical_tile->is_io()) {
fprintf(fp, " Pad: ");
} else { /* IO Pad. */
fprintf(fp, " Class: ");
Expand All @@ -625,8 +628,7 @@ void print_route(const Netlist<>& net_list,

fprintf(fp, "%d ", rr_graph.node_ptc_num(inode));

auto physical_tile = device_ctx.grid.get_physical_type({ilow, jlow, layer_num});
if (!is_io_type(physical_tile) && (rr_type == e_rr_type::IPIN || rr_type == e_rr_type::OPIN)) {
if (!physical_tile->is_io() && (rr_type == e_rr_type::IPIN || rr_type == e_rr_type::OPIN)) {
int pin_num = rr_graph.node_pin_num(inode);
int xoffset = device_ctx.grid.get_width_offset({ilow, jlow, layer_num});
int yoffset = device_ctx.grid.get_height_offset({ilow, jlow, layer_num});
Expand Down
9 changes: 3 additions & 6 deletions vpr/src/base/stats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,7 @@ void routing_stats(const Netlist<>& net_list,
auto type = device_ctx.grid.get_physical_type({i, j, layer_num});
int width_offset = device_ctx.grid.get_width_offset({i, j, layer_num});
int height_offset = device_ctx.grid.get_height_offset({i, j, layer_num});
if (width_offset == 0
&& height_offset == 0
&& !is_io_type(type)
&& type != device_ctx.EMPTY_PHYSICAL_TILE_TYPE) {
if (width_offset == 0 && height_offset == 0 && !type->is_io() && !type->is_empty()) {
if (type->area == UNDEFINED) {
area += grid_logic_tile_area * type->width * type->height;
} else {
Expand All @@ -111,7 +108,7 @@ void routing_stats(const Netlist<>& net_list,
for (ClusterBlockId blk_id : cluster_ctx.clb_nlist.blocks()) {
t_pl_loc block_loc = block_locs[blk_id].loc;
auto type = physical_tile_type(block_loc);
if (!is_io_type(type)) {
if (!type->is_io()) {
if (type->area == UNDEFINED) {
used_area += grid_logic_tile_area * type->width * type->height;
} else {
Expand Down Expand Up @@ -473,7 +470,7 @@ void print_lambda() {
t_pl_loc block_loc = block_locs[blk_id].loc;
auto type = physical_tile_type(block_loc);
VTR_ASSERT(type != nullptr);
if (!is_io_type(type)) {
if (!type->is_io()) {
for (int ipin = 0; ipin < type->num_pins; ipin++) {
if (get_pin_type_from_pin_physical_num(type, ipin) == RECEIVER) {
ClusterNetId net_id = cluster_ctx.clb_nlist.block_net(blk_id, ipin);
Expand Down
2 changes: 1 addition & 1 deletion vpr/src/pack/appack_max_dist_th_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void APPackMaxDistThManager::auto_set_max_distance_thresholds(const std::vector<
// Find which type(s) this logical block type looks like.
bool has_memory = has_memory_pbs(lb_ty.pb_type);
bool is_logic_block_type = (lb_ty.index == logic_block_type->index);
bool is_io_block = is_io_type(pick_physical_type(&lb_ty));
bool is_io_block = pick_physical_type(&lb_ty)->is_io();

// Update the max distance threshold based on the type. If the logical
// block type looks like many block types at the same time (for example
Expand Down
8 changes: 4 additions & 4 deletions vpr/src/place/initial_placement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1012,10 +1012,10 @@ static inline void fix_IO_block_types(const t_pl_macro& pl_macro,
vtr::vector_map<ClusterBlockId, t_block_loc>& block_locs) {
const auto& device_ctx = g_vpr_ctx.device();

//If the user marked the IO block pad_loc_type as RANDOM, that means it should be randomly
//placed and then stay fixed to that location, which is why the macro members are marked as fixed.
const auto& type = device_ctx.grid.get_physical_type({loc.x, loc.y, loc.layer});
if (is_io_type(type) && pad_loc_type == e_pad_loc_type::RANDOM) {
// If the user marked the IO block pad_loc_type as RANDOM, that means it should be randomly
// placed and then stay fixed to that location, which is why the macro members are marked as fixed.
const t_physical_tile_type_ptr type = device_ctx.grid.get_physical_type({loc.x, loc.y, loc.layer});
if (type->is_io() && pad_loc_type == e_pad_loc_type::RANDOM) {
for (const t_pl_macro_member& pl_macro_member : pl_macro.members) {
block_locs[pl_macro_member.blk_index].is_fixed = true;
}
Expand Down
2 changes: 1 addition & 1 deletion vpr/src/route/route_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ static t_clb_opins_used alloc_and_load_clb_opins_used_locally() {

clb_opins_used_locally[blk_id].resize((int)type->class_inf.size());

if (is_io_type(type)) continue;
if (type->is_io()) continue;

const auto [pin_low, pin_high] = get_pin_range_for_block(blk_id);

Expand Down
2 changes: 1 addition & 1 deletion vpr/src/route/router_lookahead_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ static void compute_tiles_lookahead(std::unordered_map<int, util::t_ipin_primiti
const t_det_routing_arch& det_routing_arch,
const DeviceContext& device_ctx);
/***
* @brief Compute the cose from tile pins to tile sinks
* @brief Compute the cost from tile pins to tile sinks
* @param intra_tile_pin_primitive_pin_delay [physical_tile_type_idx][from_pin_ptc_num][sink_ptc_num] -> cost
* @param physical_tile
* @param det_routing_arch
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "edge_groups.h"
#include "rr_graph_builder.h"
#include "rr_types.h"
#include "rr_node_indices.h"

//#define VERBOSE
//used for getting the exact count of each edge type and printing it to std out.
Expand Down
File renamed without changes.
Loading
Loading