Skip to content

Commit 0741b49

Browse files
authored
Merge pull request #3289 from verilog-to-routing/temp_org_rr_g_remaining_comments
Address remaining comments from #3281
2 parents c93de7d + 2e8a11d commit 0741b49

File tree

6 files changed

+68
-44
lines changed

6 files changed

+68
-44
lines changed

libs/libarchfpga/src/physical_types.h

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1532,22 +1532,23 @@ struct t_pb_graph_pin_power {
15321532
/* FPGA Routing architecture */
15331533
/*************************************************************************************************/
15341534

1535-
/* Description of routing channel distribution across the FPGA, only available for global routing
1536-
* Width is standard dev. for Gaussian. xpeak is where peak *
1537-
* occurs. dc is the dc offset for Gaussian and pulse waveforms. */
1535+
/// @brief Description of routing channel distribution across the FPGA, only available for global routing
15381536
enum class e_stat {
15391537
UNIFORM,
15401538
GAUSSIAN,
15411539
PULSE,
15421540
DELTA
15431541
};
15441542

1543+
/// @brief Parameters describing a channel distribution.
1544+
/// @note If detailed routing is performed, only a uniform (all channels in a given direction are the same width)
1545+
/// distribution is supported.
15451546
struct t_chan {
1546-
e_stat type;
1547-
float peak;
1548-
float width;
1549-
float xpeak;
1550-
float dc;
1547+
e_stat type; ///< Distribution type
1548+
float peak; ///< Peak value. For a UNIFORM distribution, this is the value for all channels (in a given direction).
1549+
float width; ///< Standard deviation (Gaussian)
1550+
float xpeak; ///< Peak location (Gaussian)
1551+
float dc; ///< DC offset (Gaussian, pulse)
15511552
};
15521553

15531554
/* chan_x_dist: Describes the x-directed channel width distribution. *
@@ -1754,13 +1755,14 @@ struct t_hash_segment_inf {
17541755
}
17551756
};
17561757

1758+
/// @brief Enumerates switch types used in the FPGA architecture and RR graph.
17571759
enum class e_switch_type {
1758-
MUX = 0, //A configurable (buffered) mux (single-driver)
1759-
TRISTATE, //A configurable tristate-able buffer (multi-driver)
1760-
PASS_GATE, //A configurable pass transistor switch (multi-driver)
1761-
SHORT, //A non-configurable electrically shorted connection (multi-driver)
1762-
BUFFER, //A non-configurable non-tristate-able buffer (uni-driver)
1763-
INVALID, //Unspecified, usually an error
1760+
MUX = 0, ///< A configurable (buffered) mux (single-driver)
1761+
TRISTATE, ///< A configurable tristate-able buffer (multi-driver)
1762+
PASS_GATE, ///< A configurable pass transistor switch (multi-driver)
1763+
SHORT, ///< A non-configurable electrically shorted connection (multi-driver)
1764+
BUFFER, ///< A non-configurable non-tristate-able buffer (uni-driver)
1765+
INVALID, ///< Unspecified, usually an error
17641766
NUM_SWITCH_TYPES
17651767
};
17661768

libs/librrgraph/src/base/rr_edge.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ struct t_rr_edge_info {
2929

3030
typedef std::vector<t_rr_edge_info> t_rr_edge_info_set;
3131

32+
/// @brief Sorts and removes duplicate RR edges in-place.
3233
inline void uniquify_edges(t_rr_edge_info_set& rr_edges_to_create) {
3334
std::stable_sort(rr_edges_to_create.begin(), rr_edges_to_create.end());
3435
rr_edges_to_create.erase(std::unique(rr_edges_to_create.begin(), rr_edges_to_create.end()), rr_edges_to_create.end());

libs/librrgraph/src/base/rr_switch.h

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,54 +5,48 @@
55

66
#include "physical_types.h"
77

8-
/* Lists all the important information about an rr switch type. *
9-
* The s_rr_switch_inf describes a switch derived from a switch described *
10-
* by s_arch_switch_inf. This indirection allows us to vary properties of a *
11-
* given switch, such as varying delay with switch fan-in. *
12-
* buffered: Does this switch isolate it's input/output into separate *
13-
* DC-connected sub-circuits? *
14-
* configurable: Is this switch is configurable (i.e. can the switch can be *
15-
* turned on or off)?. This allows modelling of non-optional *
16-
* switches (e.g. fixed buffers, or shorted connections) which *
17-
* must be used (e.g. expanded by the router) if a connected *
18-
* segment is used. *
19-
* R: Equivalent resistance of the buffer/switch. *
20-
* Cin: Input capacitance. *
21-
* Cout: Output capacitance. *
22-
* Cinternal: Internal capacitance, see the definition above. *
23-
* Tdel: Intrinsic delay. The delay through an unloaded switch is *
24-
* Tdel + R * Cout. *
25-
* mux_trans_size: The area of each transistor in the segment's driving mux *
26-
* measured in minimum width transistor units *
27-
* buf_size: The area of the buffer. If set to zero, area should be *
28-
* calculated from R
29-
* intra_tile: Indicate whether this rr_switch is a switch type used inside *
30-
* clusters. These switch types are not specified in the *
31-
* architecture description file and are added when flat router *
32-
* is enabled */
8+
/**
9+
* @brief Lists all the important information about an RR switch type.
10+
*
11+
* The t_rr_switch_inf describes a switch derived from a switch described
12+
* by t_arch_switch_inf. This indirection allows us to vary properties of a
13+
* given switch, such as varying delay with switch fan-in.
14+
*/
3315
struct t_rr_switch_inf {
16+
/// Equivalent resistance of the buffer/switch.
3417
float R = 0.;
18+
/// Input capacitance.
3519
float Cin = 0.;
20+
/// Output capacitance.
3621
float Cout = 0.;
22+
/// Internal capacitance.
3723
float Cinternal = 0.;
24+
/// Intrinsic delay. The delay through an unloaded switch is Tdel + R * Cout.
3825
float Tdel = 0.;
26+
/// The area of each transistor in the segment's driving mux measured in minimum width transistor units
3927
float mux_trans_size = 0.;
28+
/// The area of the buffer. If set to zero, area should be calculated from R
4029
float buf_size = 0.;
4130
std::string name;
4231
e_power_buffer_type power_buffer_type = POWER_BUFFER_TYPE_UNDEFINED;
4332
float power_buffer_size = 0.;
4433

34+
/// Indicate whether this rr_switch is a switch type used inside clusters.
35+
/// These switch types are not specified in the architecture description file
36+
/// and are added when flat router is enabled.
4537
bool intra_tile = false;
4638

47-
public:
39+
public: // Getters
4840
/// Returns the type of switch
4941
e_switch_type type() const;
5042

5143
/// Returns true if this switch type isolates its input and output into
5244
/// separate DC-connected subcircuits
5345
bool buffered() const;
5446

55-
/// Returns true if this switch type is configurable
47+
/// Returns true if this switch type is configurable (i.e. can the switch can be turned on or off)
48+
/// This allows modelling of non-optional switches (e.g. fixed buffers, or shorted connections)
49+
/// which must be used (e.g. expanded by the router) if a connected segment is used.
5650
bool configurable() const;
5751

5852
bool operator==(const t_rr_switch_inf& other) const;
@@ -67,7 +61,7 @@ struct t_rr_switch_inf {
6761
std::size_t operator()(const t_rr_switch_inf& s) const;
6862
};
6963

70-
public:
64+
public: // Setters
7165
void set_type(e_switch_type type_val);
7266

7367
private:

vpr/src/route/rr_graph_generation/rr_graph_switch_utils.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11

22
#pragma once
33

4+
/**
5+
* @file
6+
* @brief Utilities for creating and initializing rr_switch structures from architecture switches.
7+
*
8+
* This header defines functions that translate high-level architecture switch
9+
* descriptions (`t_arch_switch_inf`) into detailed rr_switch items used in RR graph.
10+
* These functions:
11+
* - Copy and resolve switch electrical parameters into `t_rr_switch_inf`.
12+
* - Expand architecture switches into fanin-specific rr_switch variants.
13+
* - Provide mappings from (arch_switch, fanin) --> rr_switch index.
14+
*
15+
* They are invoked during RR graph construction to allocate, initialize,
16+
* and remap all switch information.
17+
*/
18+
419
#include <map>
520
#include <vector>
621

vpr/src/route/rr_graph_generation/rr_graph_tile_nodes.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ void add_classes_rr_graph(RRGraphBuilder& rr_graph_builder,
1212
const std::vector<int>& class_num_vec,
1313
const t_physical_tile_loc& root_loc,
1414
t_physical_tile_type_ptr physical_type) {
15-
auto& mutable_device_ctx = g_vpr_ctx.mutable_device();
15+
DeviceContext& mutable_device_ctx = g_vpr_ctx.mutable_device();
1616

1717
for (int class_num : class_num_vec) {
1818
e_pin_type class_type = get_class_type_from_class_physical_num(physical_type, class_num);
@@ -106,7 +106,7 @@ void connect_src_sink_to_pins(RRGraphBuilder& rr_graph_builder,
106106
bool switches_remapped) {
107107
for (int class_num : class_num_vec) {
108108
const std::vector<int>& pin_list = get_pin_list_from_class_physical_num(physical_type_ptr, class_num);
109-
auto class_type = get_class_type_from_class_physical_num(physical_type_ptr, class_num);
109+
e_pin_type class_type = get_class_type_from_class_physical_num(physical_type_ptr, class_num);
110110
RRNodeId class_rr_node_id = get_class_rr_node_id(rr_graph_builder.node_lookup(), physical_type_ptr, tile_loc, class_num);
111111
VTR_ASSERT(class_rr_node_id != RRNodeId::INVALID());
112112
for (int pin_num : pin_list) {

vpr/src/route/rr_graph_generation/rr_graph_tile_nodes.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,29 @@
11

22
#pragma once
33

4+
/**
5+
* @file
6+
* @brief Functions for creating RR graph nodes for tile classes and pins.
7+
*
8+
* This header declares utilities used during RR graph construction:
9+
* - Adds SOURCE and SINK nodes for within a tile.
10+
* - Adds OPIN and IPIN nodes for physical pins of a tile.
11+
* - Provides connections between source/sinks and pins using delayless switches.
12+
*/
13+
414
#include <vector>
515
#include "physical_types.h"
616
#include "rr_edge.h"
717

818
class RRGraphBuilder;
919

20+
/// @brief Create SOURCE and SINK nodes for each class in a tile and set their properties.
1021
void add_classes_rr_graph(RRGraphBuilder& rr_graph_builder,
1122
const std::vector<int>& class_num_vec,
1223
const t_physical_tile_loc& root_loc,
1324
t_physical_tile_type_ptr physical_type);
1425

26+
/// @brief Create OPIN and IPIN nodes for each pin in a tile and set their properties.
1527
void add_pins_rr_graph(RRGraphBuilder& rr_graph_builder,
1628
const std::vector<int>& pin_num_vec,
1729
const t_physical_tile_loc& root_loc,

0 commit comments

Comments
 (0)