Skip to content

Commit 0177ba1

Browse files
reformat comments of t_arch_switch_inf
1 parent 6b21d55 commit 0177ba1

File tree

7 files changed

+93
-105
lines changed

7 files changed

+93
-105
lines changed

libs/libarchfpga/src/physical_types.h

Lines changed: 42 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1697,51 +1697,46 @@ enum class BufferSize {
16971697
ABSOLUTE
16981698
};
16991699

1700-
/* Lists all the important information about a switch type read from the *
1701-
* architecture file. *
1702-
* [0 .. Arch.num_switch] *
1703-
* buffered: Does this switch include a buffer? *
1704-
* R: Equivalent resistance of the buffer/switch. *
1705-
* Cin: Input capacitance. *
1706-
* Cout: Output capacitance. *
1707-
* Cinternal: Since multiplexers and tristate buffers are modeled as a *
1708-
* parallel stream of pass transistors feeding into a buffer, *
1709-
* we would expect an additional "internal capacitance" *
1710-
* to arise when the pass transistor is enabled and the signal *
1711-
* must propagate to the buffer. See diagram of one stream below: *
1712-
* *
1713-
* Pass Transistor *
1714-
* | *
1715-
* ----- *
1716-
* ----- Buffer *
1717-
* | | |\ *
1718-
* ------ -------| \-------- *
1719-
* | | | / | *
1720-
* ===== ===== |/ ===== *
1721-
* ===== ===== ===== *
1722-
* | | | *
1723-
* Input C Internal C Output C *
1724-
* *
1725-
* Tdel_map: A map where the key is the number of inputs and the entry *
1726-
* is the corresponding delay. If there is only one entry at key *
1727-
* UNDEFINED, then delay is a constant (doesn't vary with fan-in). *
1728-
* A map saves us the trouble of sorting, and has lower access *
1729-
* time for interpolation/extrapolation purposes *
1730-
* mux_trans_size: The area of each transistor in the segment's driving mux *
1731-
* measured in minimum width transistor units *
1732-
* buf_size: The area of the buffer. If set to zero, area should be *
1733-
* calculated from R */
1700+
/**
1701+
* @struct t_arch_switch_inf
1702+
* @brief Lists all the important information about a switch type read from the architecture file.
1703+
*/
17341704
struct t_arch_switch_inf {
17351705
public:
17361706
static constexpr int UNDEFINED_FANIN = -1;
17371707

17381708
std::string name;
1709+
/// Equivalent resistance of the buffer/switch
17391710
float R = 0.;
1711+
/// Input capacitance
17401712
float Cin = 0.;
1713+
/// Output capacitance
17411714
float Cout = 0.;
1715+
/**
1716+
* @brief The internal capacitance.
1717+
* @details Since multiplexers and tristate buffers are modeled as a
1718+
* parallel stream of pass transistors feeding into a buffer,
1719+
* we would expect an additional "internal capacitance
1720+
* to arise when the pass transistor is enabled and the signal
1721+
* must propagate to the buffer. See diagram of one stream below:
1722+
*
1723+
* Pass Transistor
1724+
* |
1725+
* -----
1726+
* ----- Buffer
1727+
* | | |\
1728+
* ------ -------| \ -----
1729+
* | | | / |
1730+
* ===== ===== |/ =====
1731+
* ===== ===== =====
1732+
* | | |
1733+
* Input C Internal C Output C
1734+
*/
17421735
float Cinternal = 0.;
1736+
/// The area of each transistor in the segment's driving mux measured in minimum width transistor units
17431737
float mux_trans_size = 1.;
17441738
BufferSize buf_size_type = BufferSize::AUTO;
1739+
/// The area of the buffer. If set to zero, area should be calculated from R
17451740
float buf_size = 0.;
17461741
e_power_buffer_type power_buffer_type = POWER_BUFFER_TYPE_AUTO;
17471742
float power_buffer_size = 0.;
@@ -1774,6 +1769,15 @@ struct t_arch_switch_inf {
17741769

17751770
private:
17761771
SwitchType type_ = SwitchType::INVALID;
1772+
1773+
/**
1774+
* @brief Maps the number of inputs to a delay.
1775+
* @details A map where the key is the number of inputs and the entry
1776+
* is the corresponding delay. If there is only one entry at key
1777+
* UNDEFINED, then delay is a constant (doesn't vary with fan-in).
1778+
* A map saves us the trouble of sorting, and has lower access
1779+
* time for interpolation/extrapolation purposes
1780+
*/
17771781
std::map<int, double> Tdel_map_;
17781782

17791783
friend void PrintArchInfo(FILE*, const t_arch*);
@@ -2048,7 +2052,8 @@ struct t_arch {
20482052
mutable vtr::string_internment strings;
20492053
std::vector<vtr::interned_string> interned_strings;
20502054

2051-
char* architecture_id; //Secure hash digest of the architecture file to uniquely identify this architecture
2055+
/// Secure hash digest of the architecture file to uniquely identify this architecture
2056+
char* architecture_id;
20522057

20532058
t_chan_width_dist Chans;
20542059
enum e_switch_block_type SBType;
@@ -2059,6 +2064,7 @@ struct t_arch {
20592064
float grid_logic_tile_area;
20602065
std::vector<t_segment_inf> Segments;
20612066

2067+
/// Contains information from all switch types defined in the architecture file.
20622068
std::vector<t_arch_switch_inf> switches;
20632069

20642070
/// Contains information about all direct chain connections in the architecture
@@ -2115,7 +2121,7 @@ struct t_arch {
21152121

21162122
t_clock_arch_spec clock_arch; // Clock related data types
21172123

2118-
// if we have an embedded NoC in the architecture, then we store it here
2124+
/// Stores NoC-related architectural information when there is an embedded NoC
21192125
t_noc_inf* noc = nullptr;
21202126
};
21212127

vpr/src/base/blk_loc_registry.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ class BlkLocRegistry {
128128
*/
129129
void revert_move_blocks(const t_pl_blocks_to_be_moved& blocks_affected);
130130

131-
///@brief Helper function that returns the x, y coordinates of a pin
132131
/**
133132
* @brief Returns the coordinates of a cluster pin
134133
* @param pin The unique Id of the cluster pin whose coordinates is desired.

vpr/src/place/centroid_move_generator.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,23 +77,12 @@ class CentroidMoveGenerator : public MoveGenerator {
7777

7878
/**
7979
* @brief Calculates the exact centroid location
80-
*
81-
* This function is very useful in centroid and weightedCentroid moves as it calculates
82-
* the centroid location. It returns the calculated location in centroid.
83-
*
8480
* When NoC attraction is enabled, the computed centroid is slightly adjusted towards the location
8581
* of NoC routers that are in the same NoC group b_from.
8682
*
8783
* @param b_from The block Id of the moving block
88-
* @param timing_weights Determines whether to calculate centroid or
89-
* weighted centroid location. If true, use the timing weights (weighted centroid).
9084
* @param criticalities A pointer to the placer criticalities which is used when
9185
* calculating weighted centroid (send a NULL pointer in case of centroid)
92-
* @param noc_attraction_enabled Indicates whether the computed centroid location
93-
* should be adjusted towards NoC routers in the NoC group of the given block.
94-
* @param noc_attraction_weight When NoC attraction is enabled, this weight
95-
* specifies to which extent the computed centroid should be adjusted. A value
96-
* in range [0, 1] is expected.
9786
*
9887
* @return The calculated location is returned in centroid parameter that is sent by reference
9988
*/

vpr/src/place/move_transactions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ struct t_pl_moved_block {
3232

3333
class MoveAbortionLogger {
3434
public:
35-
/// Records a reasons for an aborted move.
35+
/// Records reasons for an aborted move.
3636
void log_move_abort(std::string_view reason);
3737

3838
/// Prints a brief report about aborted move reasons and counts.

vpr/src/place/place_macro.cpp

Lines changed: 17 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ void PlaceMacros::alloc_and_load_placement_macros(const std::vector<t_direct_inf
7171
* only at first. Allocate for the second dimension when I know
7272
* the size. Otherwise, the array is going to be of size
7373
* cluster_ctx.clb_nlist.blocks().size()^2 (There are big
74-
* benckmarks VPR that have cluster_ctx.clb_nlist.blocks().size()
74+
* benchmarks VPR that have cluster_ctx.clb_nlist.blocks().size()
7575
* in the 100k's range).
7676
*
7777
* The placement macro array is freed by the caller(s).
@@ -378,15 +378,9 @@ static bool try_combine_macros(std::vector<std::vector<ClusterBlockId>>& pl_macr
378378
return true;
379379
}
380380

381-
int PlaceMacros::get_imacro_from_iblk(ClusterBlockId iblk) const{
382-
/* This mapping is needed for fast lookups whether the block with index *
383-
* iblk belongs to a placement macro or not. *
384-
* *
385-
* The array imacro_from_iblk_ is used for the mapping for speed reason *
386-
* [0...cluster_ctx.clb_nlist.blocks().size()-1] */
387-
381+
int PlaceMacros::get_imacro_from_iblk(ClusterBlockId iblk) const {
388382
int imacro;
389-
if (iblk) {
383+
if (iblk != ClusterBlockId::INVALID()) {
390384
/* Return the imacro for the block. */
391385
imacro = imacro_from_iblk_[iblk];
392386
} else {
@@ -396,53 +390,31 @@ int PlaceMacros::get_imacro_from_iblk(ClusterBlockId iblk) const{
396390
return imacro;
397391
}
398392

399-
void PlaceMacros::set_imacro_for_iblk(int imacro, ClusterBlockId blk_id) {
400-
auto& cluster_ctx = g_vpr_ctx.clustering();
401-
402-
imacro_from_iblk_.resize(cluster_ctx.clb_nlist.blocks().size());
403-
imacro_from_iblk_.insert(blk_id, imacro);
404-
}
405-
406393
void PlaceMacros::alloc_and_load_idirect_from_blk_pin_(const std::vector<t_direct_inf>& directs) {
407-
/* Allocates and loads idirect_from_blk_pin and direct_type_from_blk_pin arrays. *
408-
* *
409-
* For a bus (multiple bits) direct connection, all the pins in the bus are marked. *
410-
* *
411-
* idirect_from_blk_pin array allow us to quickly find pins that could be in a *
412-
* direct connection. Values stored is the index of the possible direct connection *
413-
* as specified in the arch file, OPEN (-1) is stored for pins that could not be *
414-
* part of a direct chain connection. *
415-
* *
416-
* direct_type_from_blk_pin array stores the value SOURCE if the pin is the *
417-
* from_pin, SINK if the pin is the to_pin in the direct connection as specified in *
418-
* the arch file, OPEN (-1) is stored for pins that could not be part of a direct *
419-
* chain connection. *
420-
* *
421-
* Stores the pointers to the two 2D arrays in the addresses passed in. *
422-
* *
423-
* The two arrays are freed by the caller(s). */
394+
const auto& device_ctx = g_vpr_ctx.device();
395+
424396
constexpr size_t MAX_STRING_LEN = 512;
425397

426-
char to_pb_type_name[MAX_STRING_LEN + 1], to_port_name[MAX_STRING_LEN + 1],
427-
from_pb_type_name[MAX_STRING_LEN + 1], from_port_name[MAX_STRING_LEN + 1];
398+
char to_pb_type_name[MAX_STRING_LEN + 1];
399+
char to_port_name[MAX_STRING_LEN + 1];
400+
char from_pb_type_name[MAX_STRING_LEN + 1];
401+
char from_port_name[MAX_STRING_LEN + 1];
428402

429-
int to_start_pin_index = -1, to_end_pin_index = -1;
430-
int from_start_pin_index = -1, from_end_pin_index = -1;
431-
auto& device_ctx = g_vpr_ctx.device();
403+
int to_start_pin_index = -1;
404+
int to_end_pin_index = -1;
405+
int from_start_pin_index = -1;
406+
int from_end_pin_index = -1;
432407

433-
/* Allocate and initialize the values to OPEN (-1). */
408+
// Allocate and initialize the values to OPEN (-1).
434409
idirect_from_blk_pin_.resize(device_ctx.physical_tile_types.size());
435410
direct_type_from_blk_pin_.resize(device_ctx.physical_tile_types.size());
436-
for (const auto& type : device_ctx.physical_tile_types) {
411+
for (const t_physical_tile_type& type : device_ctx.physical_tile_types) {
437412
if (is_empty_type(&type)) {
438413
continue;
439414
}
440415

441-
int itype = type.index;
442-
int num_type_pins = type.num_pins;
443-
444-
idirect_from_blk_pin_[itype].resize(num_type_pins, OPEN);
445-
direct_type_from_blk_pin_[itype].resize(num_type_pins, OPEN);
416+
idirect_from_blk_pin_[type.index].resize(type.num_pins, OPEN);
417+
direct_type_from_blk_pin_[type.index].resize(type.num_pins, OPEN);
446418
}
447419

448420
/* Load the values */
@@ -679,10 +651,6 @@ bool PlaceMacros::net_is_driven_by_direct_(ClusterNetId clb_net) {
679651
return direct != OPEN;
680652
}
681653

682-
//t_pl_macro& PlaceMacros::operator[](size_t idx) {
683-
// return pl_macros_[idx];
684-
//}
685-
686654
const t_pl_macro& PlaceMacros::operator[](int idx) const {
687655
return pl_macros_[idx];
688656
}

vpr/src/place/place_macro.h

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,12 @@
133133
struct t_pl_macro_member {
134134
///@brief The cluster_ctx.blocks index of this block.
135135
ClusterBlockId blk_index;
136-
///@brief The offset from the first macro member to this member
136+
///@brief The location offset from the first macro member to this member
137137
t_pl_offset offset;
138138
};
139139

140140
struct t_pl_macro {
141-
///@brief An array of blocks in this macro [0:num_macro-1].
141+
///@brief A vector of blocks in this macro [0:num_macro-1].
142142
std::vector<t_pl_macro_member> members;
143143
};
144144

@@ -165,10 +165,14 @@ class PlaceMacros {
165165
*/
166166
void alloc_and_load_placement_macros(const std::vector<t_direct_inf>& directs);
167167

168+
/**
169+
* @brief Returns the placement macro index to which the given block belongs.
170+
* @param iblk The unique ID of a clustered block whose placement macro is of interest.
171+
* @return The placement macro index that the given block is part of. A negative integer
172+
* in returned if the block is not part of a macro.
173+
*/
168174
int get_imacro_from_iblk(ClusterBlockId iblk) const;
169175

170-
void set_imacro_for_iblk(int imacro, ClusterBlockId blk_id);
171-
172176
/**
173177
* @brief Finds the head block of the macro that contains a given clustered block
174178
* @details Placement macro head is the base of the macro, where the locations of the other macro members can be
@@ -178,10 +182,17 @@ class PlaceMacros {
178182
*/
179183
ClusterBlockId macro_head(ClusterBlockId blk) const;
180184

185+
/// @brief Returns a constant reference to all placement macros.
181186
const std::vector<t_pl_macro>& macros() const;
182187

183-
// t_pl_macro& operator[](size_t idx);
184-
const t_pl_macro& operator[](int idx) const;
188+
/**
189+
* @brief Returns the placement macro associated with a macro index.
190+
* @param idx An index specifying a macro. get_imacro_from_iblk() can
191+
* be called to find out a the macro index of the placement macro a
192+
* clustered block is part of.
193+
* @return A placement macro associated with the given index.
194+
*/
195+
const t_pl_macro& operator[](int idx) const;
185196

186197
private:
187198

@@ -223,6 +234,21 @@ class PlaceMacros {
223234

224235
bool net_is_driven_by_direct_(ClusterNetId clb_net);
225236

237+
/**
238+
* @brief Allocates and loads idirect_from_blk_pin and direct_type_from_blk_pin arrays.
239+
*
240+
* @details For a bus (multiple bits) direct connection, all the pins in the bus are marked.
241+
* idirect_from_blk_pin vector allow us to quickly find pins that could be in a
242+
* direct connection. Values stored is the index of the possible direct connection
243+
* as specified in the arch file, OPEN (-1) is stored for pins that could not be
244+
* part of a direct chain connection.
245+
*
246+
* direct_type_from_blk_pin vector stores the value SOURCE if the pin is the
247+
* from_pin, SINK if the pin is the to_pin in the direct connection as specified in
248+
* the arch file, OPEN (-1) is stored for pins that could not be part of a direct
249+
* chain connection.
250+
* @param directs Contains information about all direct connections in the architecture.
251+
*/
226252
void alloc_and_load_idirect_from_blk_pin_(const std::vector<t_direct_inf>& directs);
227253
};
228254

vpr/src/place/simpleRL_move_generator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class KArmedBanditAgent {
2929
* @brief Update the agent Q-table based on the reward received by the SA algorithm
3030
*
3131
* @param reward A double value calculated in "place.cpp" file showing how placement cost was affected by the prior action taken
32-
* @param reward_func The reward function used by the agent, detail explanation can be found on "m.h" file
32+
* @param reward_func The reward function used by the agent.
3333
*/
3434
void process_outcome(double, e_reward_function);
3535

0 commit comments

Comments
 (0)