From 65f696c1d76508840952077b3056f736d5442668 Mon Sep 17 00:00:00 2001 From: tangxifan Date: Tue, 9 Jul 2019 17:41:20 -0600 Subject: [PATCH] fix critical bugs in rectangle floorplan --- .../device/rr_graph/tileable_rr_graph_builder.cpp | 13 +++++++++---- .../vpr/SRC/fpga_x2p/base/fpga_x2p_unique_routing.c | 8 +++++++- vpr7_x2p/vpr/SRC/fpga_x2p/base/rr_blocks.cpp | 4 ++-- vpr7_x2p/vpr/SRC/fpga_x2p/base/rr_blocks.h | 4 ++-- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/vpr7_x2p/vpr/SRC/device/rr_graph/tileable_rr_graph_builder.cpp b/vpr7_x2p/vpr/SRC/device/rr_graph/tileable_rr_graph_builder.cpp index fe521ffa0..3d919ecc0 100644 --- a/vpr7_x2p/vpr/SRC/device/rr_graph/tileable_rr_graph_builder.cpp +++ b/vpr7_x2p/vpr/SRC/device/rr_graph/tileable_rr_graph_builder.cpp @@ -687,10 +687,15 @@ void alloc_rr_graph_fast_lookup(const DeviceCoordinator& device_size, if ((SOURCE == type) || (OPIN == type) ) { continue; } - rr_graph->rr_node_indices[type] = (t_ivec **) my_malloc(sizeof(t_ivec *) * device_size.get_x()); - for (size_t i = 0; i < device_size.get_x(); ++i) { - rr_graph->rr_node_indices[type][i] = (t_ivec *) my_malloc(sizeof(t_ivec) * device_size.get_y()); - for (size_t j = 0; j < device_size.get_y(); ++j) { + DeviceCoordinator actual_device_size(device_size); + /* Special for CHANX: we use (y,x) in allocation */ + if (CHANX == type) { + actual_device_size.rotate(); + } + rr_graph->rr_node_indices[type] = (t_ivec **) my_malloc(sizeof(t_ivec *) * actual_device_size.get_x()); + for (size_t i = 0; i < actual_device_size.get_x(); ++i) { + rr_graph->rr_node_indices[type][i] = (t_ivec *) my_malloc(sizeof(t_ivec) * actual_device_size.get_y()); + for (size_t j = 0; j < actual_device_size.get_y(); ++j) { rr_graph->rr_node_indices[type][i][j].nelem = 0; rr_graph->rr_node_indices[type][i][j].list = NULL; } diff --git a/vpr7_x2p/vpr/SRC/fpga_x2p/base/fpga_x2p_unique_routing.c b/vpr7_x2p/vpr/SRC/fpga_x2p/base/fpga_x2p_unique_routing.c index dc76ff55d..315f4f5ff 100644 --- a/vpr7_x2p/vpr/SRC/fpga_x2p/base/fpga_x2p_unique_routing.c +++ b/vpr7_x2p/vpr/SRC/fpga_x2p/base/fpga_x2p_unique_routing.c @@ -1354,6 +1354,12 @@ DeviceRRGSB build_device_rr_gsb(boolean output_sb_xml, char* sb_xml_dir, "Backannotated %d switch blocks.\n", (nx + 1) * (ny + 1) ); + /* End time count */ + t_end = clock(); + + run_time_sec = (float)(t_end - t_start) / CLOCKS_PER_SEC; + vpr_printf(TIO_MESSAGE_INFO, "Backannotation of Switch Block took %g seconds\n\n", run_time_sec); + if (TRUE == output_sb_xml) { create_dir_path(sb_xml_dir); @@ -1406,7 +1412,7 @@ DeviceRRGSB build_device_rr_gsb(boolean output_sb_xml, char* sb_xml_dir, t_end = clock(); run_time_sec = (float)(t_end - t_start) / CLOCKS_PER_SEC; - vpr_printf(TIO_MESSAGE_INFO, "Routing architecture uniqifying took %g seconds\n", run_time_sec); + vpr_printf(TIO_MESSAGE_INFO, "Routing architecture uniqifying took %g seconds\n\n", run_time_sec); return LL_device_rr_gsb; } diff --git a/vpr7_x2p/vpr/SRC/fpga_x2p/base/rr_blocks.cpp b/vpr7_x2p/vpr/SRC/fpga_x2p/base/rr_blocks.cpp index f0d59fd9b..42fc21c17 100644 --- a/vpr7_x2p/vpr/SRC/fpga_x2p/base/rr_blocks.cpp +++ b/vpr7_x2p/vpr/SRC/fpga_x2p/base/rr_blocks.cpp @@ -2598,7 +2598,7 @@ void DeviceRRGSB::reserve_sb_unique_submodule_id(DeviceCoordinator& coordinator) } /* Resize rr_switch_block array is needed*/ -void DeviceRRGSB::resize_upon_need(DeviceCoordinator& coordinator) { +void DeviceRRGSB::resize_upon_need(const DeviceCoordinator& coordinator) { if (coordinator.get_x() + 1 > rr_gsb_.size()) { rr_gsb_.resize(coordinator.get_x() + 1); @@ -2622,7 +2622,7 @@ void DeviceRRGSB::resize_upon_need(DeviceCoordinator& coordinator) { } /* Add a switch block to the array, which will automatically identify and update the lists of unique mirrors and rotatable mirrors */ -void DeviceRRGSB::add_rr_gsb(DeviceCoordinator& coordinator, +void DeviceRRGSB::add_rr_gsb(const DeviceCoordinator& coordinator, const RRGSB& rr_gsb) { /* Resize upon needs*/ resize_upon_need(coordinator); diff --git a/vpr7_x2p/vpr/SRC/fpga_x2p/base/rr_blocks.h b/vpr7_x2p/vpr/SRC/fpga_x2p/base/rr_blocks.h index d95c08d75..e87ee78c6 100644 --- a/vpr7_x2p/vpr/SRC/fpga_x2p/base/rr_blocks.h +++ b/vpr7_x2p/vpr/SRC/fpga_x2p/base/rr_blocks.h @@ -353,8 +353,8 @@ class DeviceRRGSB { void set_cb_conf_bits_msb(DeviceCoordinator& coordinator, t_rr_type cb_type, size_t conf_bits_msb); /* TODO: TOBE DEPRECATED!!! conf_bits should be initialized when creating a switch block!!! */ void reserve(DeviceCoordinator& coordinator); /* Pre-allocate the rr_switch_block array that the device requires */ void reserve_sb_unique_submodule_id(DeviceCoordinator& coordinator); /* Pre-allocate the rr_sb_unique_module_id matrix that the device requires */ - void resize_upon_need(DeviceCoordinator& coordinator); /* Resize the rr_switch_block array if needed */ - void add_rr_gsb(DeviceCoordinator& coordinator, const RRGSB& rr_gsb); /* Add a switch block to the array, which will automatically identify and update the lists of unique mirrors and rotatable mirrors */ + void resize_upon_need(const DeviceCoordinator& coordinator); /* Resize the rr_switch_block array if needed */ + void add_rr_gsb(const DeviceCoordinator& coordinator, const RRGSB& rr_gsb); /* Add a switch block to the array, which will automatically identify and update the lists of unique mirrors and rotatable mirrors */ void build_unique_module(); /* Add a switch block to the array, which will automatically identify and update the lists of unique mirrors and rotatable mirrors */ void clear(); /* clean the content */ private: /* Internal cleaners */