Skip to content

Commit 2e768c7

Browse files
committed
[vpr][route][crr] add comments for crr sw block mng
1 parent cf75217 commit 2e768c7

File tree

3 files changed

+25
-9
lines changed

3 files changed

+25
-9
lines changed

vpr/src/route/rr_graph_generation/tileable_rr_graph/crr_generator/crr_pattern_matcher.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@
66

77
namespace crrgenerator {
88

9-
class PatternMatcher {
9+
/**
10+
* @brief Helper class used by the CRR Generator to determine which switch block pattern
11+
* should be applied to each tile. It does so by finding the first matching pattern
12+
* for each location.
13+
*/
14+
class CRRPatternMatcher {
1015
private:
1116
// Helper function to parse range [start:end:step] or comma-separated values [7,20]
1217
static bool matches_range(int value, const std::string& range_str) {

vpr/src/route/rr_graph_generation/tileable_rr_graph/crr_generator/crr_switch_block_manager.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@ namespace crrgenerator {
1515
SwitchBlockManager::SwitchBlockManager() = default;
1616

1717
void SwitchBlockManager::initialize(const std::string& sb_maps_file,
18-
const std::string& sb_annotated_dir) {
18+
const std::string& sb_templates_dir) {
1919
VTR_LOG("Initializing SwitchBlockManager with maps file: %s\n", sb_maps_file.c_str());
2020

21-
annotated_dir_ = sb_annotated_dir;
22-
2321
// Load YAML configuration
2422
try {
2523
YAML::Node config = YAML::LoadFile(sb_maps_file);
@@ -42,7 +40,7 @@ void SwitchBlockManager::initialize(const std::string& sb_maps_file,
4240
sw_template_file = "";
4341
}
4442

45-
std::string full_path = std::filesystem::path(annotated_dir_) / sw_template_file;
43+
std::string full_path = std::filesystem::path(sb_templates_dir) / sw_template_file;
4644
if (sw_template_file.empty()) {
4745
full_path = "";
4846
}

vpr/src/route/rr_graph_generation/tileable_rr_graph/crr_generator/crr_switch_block_manager.h

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@ class SwitchBlockManager {
2222
/**
2323
* @brief Initialize the manager with configuration file
2424
* @param sb_maps_file Path to the YAML configuration file
25-
* @param sb_annotated_dir Directory containing switch template files
26-
* @param is_annotated Whether the switches are annotated in switch template files
25+
* @param sb_templates_dir Directory containing switch template files
2726
*/
2827
void initialize(const std::string& sb_maps_file,
29-
const std::string& sb_annotated_dir);
28+
const std::string& sb_templates_dir);
3029

3130
/**
3231
* @brief Get the switch template file name for a given pattern
@@ -81,12 +80,26 @@ class SwitchBlockManager {
8180
* YAML file, the pattern defined earliest in the list will be used.
8281
*/
8382
std::vector<std::string> ordered_switch_block_patterns_;
83+
84+
/**
85+
* @brief Maps switch block patterns to their corresponding full file paths.
86+
*/
8487
std::unordered_map<std::string, std::string> switch_block_to_file_;
88+
89+
/**
90+
* @brief Maps switch block patterns to their corresponding dataframes.
91+
*/
8592
std::unordered_map<std::string, DataFrame*> dataframes_;
93+
94+
/**
95+
* @brief Maps full file paths to their corresponding dataframes.
96+
*/
8697
std::unordered_map<std::string, DataFrame> file_cache_;
8798

99+
/**
100+
* @brief Processor for reading and processing switch block template files.
101+
*/
88102
DataFrameProcessor processor_;
89-
std::string annotated_dir_;
90103

91104
// Validation
92105
void validate_yaml_structure(const YAML::Node& root);

0 commit comments

Comments
 (0)