diff --git a/openfpga/src/annotation/device_rr_gsb.cpp b/openfpga/src/annotation/device_rr_gsb.cpp index 07d608b1b..fdf7b9a74 100644 --- a/openfpga/src/annotation/device_rr_gsb.cpp +++ b/openfpga/src/annotation/device_rr_gsb.cpp @@ -66,7 +66,6 @@ size_t DeviceRRGSB::get_num_cb_unique_module(const t_rr_type& cb_type) const { } } - bool DeviceRRGSB::is_compressed() const { return is_compressed_; } /* Identify if a GSB actually exists at a location */ bool DeviceRRGSB::is_gsb_exist(const RRGraphView& rr_graph, @@ -173,16 +172,17 @@ void DeviceRRGSB::reserve(const vtr::Point& coordinate) { cby_unique_module_id_[x].resize(coordinate.y()); } } -void DeviceRRGSB::reserve_unique_modules(const vtr::Point& coordinate) { - sb_unique_module_id_.resize(coordinate.x()); - cbx_unique_module_id_.resize(coordinate.x()); - cby_unique_module_id_.resize(coordinate.x()); +void DeviceRRGSB::reserve_unique_modules() { + /* As rr_gsb_ has been built, it has valid size. Will reserve space for unique + * blocks according to rr_gsb_'s size*/ + sb_unique_module_id_.resize(rr_gsb_.x()); + cbx_unique_module_id_.resize(rr_gsb_.x()); + cby_unique_module_id_.resize(rr_gsb_.x()); - for (size_t x = 0; x < coordinate.x(); ++x) { - sb_unique_module_id_[x].resize(coordinate.y()); - - cbx_unique_module_id_[x].resize(coordinate.y()); - cby_unique_module_id_[x].resize(coordinate.y()); + for (std::size_t i = 0; i < rr_gsb_.size(); ++i) { + sb_unique_module_id_[i].resize(rr_gsb_[i].size()); + cbx_unique_module_id_[i].resize(rr_gsb_[i].size()); + cby_unique_module_id_[i].resize(rr_gsb_[i].size()); } } @@ -353,6 +353,7 @@ void DeviceRRGSB::build_gsb_unique_module() { } } } + is_compressed_ = true; } void DeviceRRGSB::build_unique_module(const RRGraphView& rr_graph) { @@ -361,8 +362,7 @@ void DeviceRRGSB::build_unique_module(const RRGraphView& rr_graph) { build_cb_unique_module(rr_graph, CHANX); build_cb_unique_module(rr_graph, CHANY); - build_gsb_unique_module(); - is_compressed_ = true; + build_gsb_unique_module(); /*is_compressed_ flip inside build_gsb_unique_module*/ } void DeviceRRGSB::add_gsb_unique_module(const vtr::Point& coordinate) { diff --git a/openfpga/src/annotation/read_xml_unique_blocks.cpp b/openfpga/src/annotation/read_xml_unique_blocks.cpp index 9cb932c3e..88a30280c 100644 --- a/openfpga/src/annotation/read_xml_unique_blocks.cpp +++ b/openfpga/src/annotation/read_xml_unique_blocks.cpp @@ -117,8 +117,7 @@ int read_xml_unique_blocks(DeviceRRGSB& device_rr_gsb, const char* file_name, pugi::xml_node xml_root = get_single_child(doc, "unique_blocks", loc_data); /* clear unique modules & reserve memory to relavant vectors */ device_rr_gsb.clear_unique_modules(); - vtr::Point grid_coord(g_vpr_ctx.device().grid.width() - 1, - g_vpr_ctx.device().grid.height() - 1); + // vtr::Point grid_coord(rr_gsb_.size()); device_rr_gsb.reserve_unique_modules(grid_coord); /* load unique blocks xml file and set up device_rr_gdb */ @@ -155,7 +154,6 @@ int read_xml_unique_blocks(DeviceRRGSB& device_rr_gsb, const char* file_name, /* As preloading gsb hasn't been developed, we should build gsb using the * preloaded cbs and sbs*/ device_rr_gsb.build_gsb_unique_module(); - device_rr_gsb.set_is_dirty_flag(true); if (verbose_output) { report_unique_module_status_read(device_rr_gsb, true); }