Skip to content

Commit e07eee7

Browse files
committed
Merge branch 'master' of https://github.com/verilog-to-routing/vtr-verilog-to-routing into openfpga_update
2 parents 84ed5da + 2f5e240 commit e07eee7

35 files changed

+673
-772
lines changed

libs/libarchfpga/src/device_grid.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ class DeviceGrid {
8080
inline int get_height_offset(const t_physical_tile_loc& tile_loc) const {
8181
return grid_[tile_loc.layer_num][tile_loc.x][tile_loc.y].height_offset;
8282
}
83+
///@brief Returns true if the given location is the root location (bottom left corner) of a tile.
84+
inline bool is_root_location(const t_physical_tile_loc& tile_loc) const {
85+
return get_width_offset(tile_loc) == 0 && get_height_offset(tile_loc) == 0;
86+
}
8387

8488
///@brief Returns a rectangle which represents the bounding box of the tile at the given location.
8589
inline vtr::Rect<int> get_tile_bb(const t_physical_tile_loc& tile_loc) const {

libs/libarchfpga/src/physical_types.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -545,10 +545,13 @@ struct t_port_power {
545545
bool reverse_scaled; /* Scale by (1-prob) */
546546
};
547547

548-
//The type of Fc specification
548+
/**
549+
* @enum e_fc_type
550+
* @brief The type of Fc specification
551+
*/
549552
enum class e_fc_type {
550-
IN, //The fc specification for an input pin
551-
OUT //The fc specification for an output pin
553+
IN, /**< Fc specification for an input pin. */
554+
OUT /**< Fc specification for an output pin. */
552555
};
553556

554557
//The value type of the Fc specification
@@ -1567,6 +1570,7 @@ enum e_directionality {
15671570
UNI_DIRECTIONAL,
15681571
BI_DIRECTIONAL
15691572
};
1573+
15701574
/* X_AXIS: Data that describes an x-directed wire segment (CHANX) *
15711575
* Y_AXIS: Data that describes an y-directed wire segment (CHANY) *
15721576
* BOTH_AXIS: Data that can be applied to both x-directed and y-directed wire segment */

libs/librrgraph/src/base/check_rr_graph.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ void check_rr_graph(const RRGraphView& rr_graph,
5454
const DeviceGrid& grid,
5555
const VibDeviceGrid& vib_grid,
5656
const t_chan_width& chan_width,
57-
const t_graph_type graph_type,
57+
const e_graph_type graph_type,
5858
bool is_flat) {
5959
e_route_type route_type = DETAILED;
60-
if (graph_type == GRAPH_GLOBAL) {
60+
if (graph_type == e_graph_type::GLOBAL) {
6161
route_type = GLOBAL;
6262
}
6363

libs/librrgraph/src/base/check_rr_graph.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ void check_rr_graph(const RRGraphView& rr_graph,
1111
const DeviceGrid& grid,
1212
const VibDeviceGrid& vib_grid,
1313
const t_chan_width& chan_width,
14-
const t_graph_type graph_type,
14+
const e_graph_type graph_type,
1515
bool is_flat);
1616

1717
void check_rr_node(const RRGraphView& rr_graph,

libs/librrgraph/src/base/get_parallel_segs.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#include "get_parallel_segs.h"
22

3-
/*Gets t_segment_inf for parallel segments as defined by the user.
4-
*Segments that have BOTH_AXIS attribute value are always included in the returned vector.*/
53
std::vector<t_segment_inf> get_parallel_segs(const std::vector<t_segment_inf>& segment_inf,
64
t_unified_to_parallel_seg_index& seg_index_map,
75
enum e_parallel_axis parallel_axis,

libs/librrgraph/src/base/get_parallel_segs.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@
44
#include "rr_graph_type.h"
55
#include "physical_types.h"
66

7+
/**
8+
* @brief Returns segments aligned with a given axis, including BOTH_AXIS segments.
9+
*
10+
* Filters the unified segment list (`segment_inf`) to include only segments matching
11+
* the specified `parallel_axis` or marked as `BOTH_AXIS`. Also populates `seg_index_map`
12+
* to map unified indices to axis-specific ones.
13+
*
14+
* @param segment_inf Unified list of all segments.
15+
* @param seg_index_map Map from unified to axis-specific segment indices.
16+
* @param parallel_axis Axis to filter segments by.
17+
* @return Filtered list of segments for the given axis.
18+
*/
719
std::vector<t_segment_inf> get_parallel_segs(const std::vector<t_segment_inf>& segment_inf,
820
t_unified_to_parallel_seg_index& seg_index_map,
921
enum e_parallel_axis parallel_axis,

libs/librrgraph/src/base/rr_graph_type.h

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,32 @@ enum e_route_type {
1919
DETAILED
2020
};
2121

22-
enum e_graph_type {
23-
GRAPH_GLOBAL, /* One node per channel with wire capacity > 1 and full connectivity */
24-
GRAPH_BIDIR, /* Detailed bidirectional graph */
25-
GRAPH_UNIDIR, /* Detailed unidir graph, untilable */
26-
/* RESEARCH TODO: Get this option debugged */
27-
GRAPH_UNIDIR_TILEABLE /* Detail unidir graph with wire groups multiples of 2*L */
22+
/**
23+
* @enum e_graph_type
24+
* @brief Represents the type of routing resource graph
25+
*/
26+
enum class e_graph_type {
27+
GLOBAL, ///< One node per channel with wire capacity > 1 and full connectivity
28+
BIDIR, ///< Detailed bidirectional routing graph
29+
UNIDIR, ///< Detailed unidirectional routing graph (non-tileable)
30+
UNIDIR_TILEABLE ///< Tileable unidirectional graph with wire groups in multiples of 2 * L (experimental)
2831
};
29-
typedef enum e_graph_type t_graph_type;
3032

31-
/* This map is used to get indices w.r.t segment_inf_x or segment_inf_y based on parallel_axis of a segment,
32-
* from indices w.r.t the **unified** segment vector, segment_inf in devices context which stores all segments
33-
* regardless of their axis. (see get_parallel_segs for more details)*/
33+
/**
34+
* @typedef t_unified_to_parallel_seg_index
35+
* @brief Maps indices from the unified segment list to axis-specific segment lists.
36+
*
37+
* This map is used to translate indices from the unified segment vector
38+
* (`segment_inf` in the device context, which contains all segments regardless of axis)
39+
* to axis-specific segment vectors (`segment_inf_x` or `segment_inf_y`), based on the
40+
* segment's parallel axis.
41+
*
42+
* Each entry maps a unified segment index to a pair containing:
43+
* - The index in the corresponding axis-specific segment vector
44+
* - The axis of the segment (X or Y)
45+
*
46+
* @see get_parallel_segs for more details.
47+
*/
3448
typedef std::unordered_multimap<size_t, std::pair<size_t, e_parallel_axis>> t_unified_to_parallel_seg_index;
3549

3650
#endif

libs/librrgraph/src/base/rr_node_types.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ typedef uint16_t t_edge_size;
6767
/**
6868
* @brief An iterator that dereferences to an edge index
6969
*
70-
* Used inconjunction with vtr::Range to return ranges of edge indices
70+
* Used in conjunction with vtr::Range to return ranges of edge indices
7171
*/
7272
class edge_idx_iterator {
7373
public:
@@ -102,7 +102,7 @@ typedef vtr::Range<edge_idx_iterator> edge_idx_range;
102102
typedef std::vector<std::map<int, int>> t_arch_switch_fanin;
103103

104104
/*
105-
* Reistance/Capacitance data for an RR Nodes
105+
* Resistance/Capacitance data for an RR Nodes
106106
*
107107
* In practice many RR nodes have the same values, so they are fly-weighted
108108
* to keep t_rr_node small. Each RR node holds an rc_index which allows

libs/librrgraph/src/io/rr_graph_reader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ void load_rr_file(RRGraphBuilder* rr_graph_builder,
4646
std::vector<t_rr_rc_data>* rr_rc_data,
4747
const DeviceGrid& grid,
4848
const std::vector<t_arch_switch_inf>& arch_switch_inf,
49-
const t_graph_type graph_type,
49+
e_graph_type graph_type,
5050
const t_arch* arch,
5151
t_chan_width* chan_width,
5252
const enum e_base_cost_type base_cost_type,

libs/librrgraph/src/io/rr_graph_reader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ void load_rr_file(RRGraphBuilder* rr_graph_builder,
2121
std::vector<t_rr_rc_data>* rr_rc_data,
2222
const DeviceGrid& grid,
2323
const std::vector<t_arch_switch_inf>& arch_switch_inf,
24-
const t_graph_type graph_type,
24+
e_graph_type graph_type,
2525
const t_arch* arch,
2626
t_chan_width* chan_width,
2727
const enum e_base_cost_type base_cost_type,

0 commit comments

Comments
 (0)