@@ -31,15 +31,6 @@ void CRRGraphGenerator::run() {
3131 // Build connections
3232 build_connections ();
3333
34- // Create output graph
35- // create_output_graph();
36-
37- // Write output files
38- // write_output_files();
39-
40- // Print summary
41- // print_processing_summary();
42-
4334 auto end_time = std::chrono::steady_clock::now ();
4435 auto duration =
4536 std::chrono::duration_cast<std::chrono::seconds>(end_time - start_time);
@@ -82,165 +73,4 @@ void CRRGraphGenerator::build_connections() {
8273 VTR_LOG (" CRR Graph Generator: Connection building completed\n " );
8374}
8475
85- // void CRRGraphGenerator::create_output_graph() {
86- // VTR_LOG("CRR Graph Generator: Creating output graph\n");
87-
88- // // Create new graph based on input graph
89- // output_graph_ = std::make_unique<RRGraph>(input_graph_);
90-
91- // // Add new switches to output graph
92- // if (crr_opts_.annotated_rr_graph) {
93- // size_t nxt_switch_id =
94- // connection_builder_->get_default_swithes_map().size();
95- // int max_sw_delay_ps = sb_manager_.get_max_switch_delay_ps();
96- // std::string default_sw_type = "";
97- // Timing default_timing;
98- // Sizing default_sizing;
99-
100- // // Get default timing and sizing from input graph
101- // for (const auto& graph_sw : input_graph_.get_switches()) {
102- // std::string sw_name = graph_sw.get_name();
103- // std::transform(sw_name.begin(), sw_name.end(), sw_name.begin(),
104- // ::tolower);
105- // if (sw_name.find("l1") != std::string::npos || sw_name.find("l4") != std::string::npos) {
106- // default_sw_type = graph_sw.get_type();
107- // default_timing = graph_sw.get_timing();
108- // default_sizing = graph_sw.get_sizing();
109- // }
110- // }
111-
112- // // Add sw_zero switch - we don't use delayless switch because OpenFPGA doesn't work with it.
113- // Switch sw_zero(static_cast<SwitchId>(nxt_switch_id), "sw_zero", default_sw_type, Timing(0, 0), default_sizing);
114- // output_graph_->add_switch(sw_zero);
115-
116- // // Add new switches to output graph
117- // for (int curr_sw_delay_ps = static_cast<int>(nxt_switch_id) + 1;
118- // curr_sw_delay_ps <= max_sw_delay_ps; curr_sw_delay_ps++) {
119- // float curr_sw_delay_s = static_cast<float>(curr_sw_delay_ps) * 1e-12f;
120- // Switch curr_switch(
121- // static_cast<SwitchId>(curr_sw_delay_ps),
122- // "sw_" + std::to_string(curr_sw_delay_ps), default_sw_type,
123- // Timing(default_timing.Cin, curr_sw_delay_s), default_sizing);
124- // VTR_LOG_DEBUG("Adding switch: %s with delay: %e s\n", curr_switch.get_name().c_str(), curr_sw_delay_s);
125- // output_graph_->add_switch(curr_switch);
126- // }
127- // }
128-
129- // // Get all connections from connection builder
130- // auto all_connections = connection_builder_->get_all_connections();
131-
132- // auto preserved_edges = input_graph_.get_preserved_edges(
133- // crr_opts_.preserve_pin_connections);
134- // VTR_LOG("CRR Graph Generator: Number of preserved edges: %zu\n", preserved_edges.size());
135-
136- // // Clear existing edges and add new ones
137- // output_graph_->get_edges().clear();
138-
139- // // Add preserved edges
140- // for (const auto& edge : preserved_edges) {
141- // output_graph_->add_edge(edge);
142- // }
143-
144- // add_custom_edges();
145-
146- // output_graph_->sort_nodes();
147- // output_graph_->sort_edges();
148- // output_graph_->shrink_to_fit();
149-
150- // VTR_LOG("CRR Graph Generator: Output graph created with %zu edges\n",
151- // output_graph_->get_edge_count());
152- // }
153-
154- // void CRRGraphGenerator::add_custom_edges() {
155- // VTR_LOG("CRR Graph Generator: Adding custom edges\n");
156-
157- // // Add new connections
158- // const DeviceGrid& grid = g_vpr_ctx.device().grid;
159- // size_t total_tiles =
160- // static_cast<size_t>((grid.width() + 1 - 2) * (grid.height() + 1 - 2));
161- // ProgressTracker tracker(total_tiles, "Adding new connections");
162- // std::vector<std::future<void>> futures;
163- // std::mutex graph_mutex;
164-
165- // for (Coordinate tile_x = 0; tile_x <= grid.width() - 2; tile_x++) {
166- // for (Coordinate tile_y = 0; tile_y <= grid.height() - 2; tile_y++) {
167- // auto fut = thread_pool_->submit([this, tile_x, tile_y, &graph_mutex, &tracker]() {
168- // std::vector<Connection> tile_connections =
169- // connection_builder_->get_tile_connections(tile_x, tile_y);
170-
171- // {
172- // std::lock_guard<std::mutex> lock(graph_mutex);
173- // for (const auto& connection : tile_connections) {
174- // output_graph_->add_edge(connection.src_node(),
175- // connection.sink_node(),
176- // connection.switch_id());
177- // }
178- // }
179-
180- // tracker.increment();
181- // });
182- // futures.push_back(std::move(fut));
183- // }
184- // }
185-
186- // // Wait for all tasks to complete
187- // for (auto& fut : futures) {
188- // fut.get();
189- // }
190- // }
191-
192- void CRRGraphGenerator::write_output_files () {
193- if (!output_graph_xml_.empty ()) {
194- VTR_LOG (" CRR Graph Generator: Writing output files\n " );
195- xml_handler_->write_rr_graph (output_graph_xml_, *output_graph_);
196- VTR_LOG (" CRR Graph Generator: Output files written successfully\n " );
197- } else {
198- VTR_LOG (" CRR Graph Generator: No output file specified\n " );
199- }
200- }
201-
202- void CRRGraphGenerator::print_processing_summary () {
203- // VTR_LOG("CRR Graph Generator: === Processing Summary ===\n");
204-
205- // VTR_LOG("CRR Graph Generator: Input graph:\n");
206- // VTR_LOG(" Nodes: %zu\n", input_graph_.get_node_count());
207- // VTR_LOG(" Edges: %zu\n", input_graph_.get_edge_count());
208- // VTR_LOG(" Switches: %zu\n", input_graph_.get_switch_count());
209-
210- // VTR_LOG("CRR Graph Generator: Output graph:\n");
211- // VTR_LOG(" Nodes: %zu\n", output_graph_->get_node_count());
212- // VTR_LOG(" Edges: %zu\n", output_graph_->get_edge_count());
213- // VTR_LOG(" Switches: %zu\n", output_graph_->get_switch_count());
214-
215- // int new_edges =
216- // static_cast<int>(output_graph_->get_edge_count()) - static_cast<int>(input_graph_.get_edge_count());
217- // VTR_LOG(" New edges added: %d\n", new_edges);
218-
219- // VTR_LOG("Switch blocks processed: %zu\n", sb_manager_.get_all_patterns().size());
220- // VTR_LOG("Total connections: %zu\n", sb_manager_.get_total_connections());
221-
222- // VTR_LOG("Grid locations processed: %dx%d\n", g_vpr_ctx.device().grid.width() - 2, g_vpr_ctx.device().grid.height() - 2);
223- }
224-
225- void CRRGraphGenerator::validate_processing_results () {
226- // Basic validation
227- if (!output_graph_) {
228- VTR_LOG_ERROR (" Output graph was not created\n " );
229- }
230-
231- if (output_graph_->get_node_count () == 0 ) {
232- VTR_LOG_ERROR (" Output graph has no nodes\n " );
233- }
234-
235- if (output_graph_->get_edge_count () == 0 ) {
236- VTR_LOG_ERROR (" Output graph has no edges\n " );
237- }
238-
239- if (output_graph_->get_switch_count () == 0 ) {
240- VTR_LOG_ERROR (" Output graph has no switches\n " );
241- }
242-
243- VTR_LOG (" Processing results validation passed\n " );
244- }
245-
24676} // namespace crrgenerator
0 commit comments