From 72a90a4d8fdeb86cee0f8d8e6d0f89935f955e27 Mon Sep 17 00:00:00 2001 From: Lin Date: Mon, 5 Aug 2024 19:42:21 -0700 Subject: [PATCH] add preload function --- openfpga/src/annotation/device_rr_gsb.cpp | 49 ++++++++++++++------ openfpga/src/annotation/device_rr_gsb.h | 7 +-- openfpga/src/fabric/read_xml_unique_blocks.h | 4 +- 3 files changed, 41 insertions(+), 19 deletions(-) diff --git a/openfpga/src/annotation/device_rr_gsb.cpp b/openfpga/src/annotation/device_rr_gsb.cpp index a2ac6df3d..b3189c055 100644 --- a/openfpga/src/annotation/device_rr_gsb.cpp +++ b/openfpga/src/annotation/device_rr_gsb.cpp @@ -562,20 +562,17 @@ size_t DeviceRRGSB::get_cb_unique_module_index( return cb_unique_module_id; } -void DeviceRRGSB::load_unique_cb_module_from_user_input(int x, int y){ +void DeviceRRGSB::preload_unique_cbx_module(int x, int y) {} +void DeviceRRGSB::preload_unique_cby_module(int x, int y) {} - - -} - -void DeviceRRGSB::load_unique_sb_module_from_user_input(int ix, int iy){ +void DeviceRRGSB::preload_unique_sb_module(int ix, int iy) { vtr::Point sb_coordinate(ix, iy); bool is_unique_module = true; - + for (size_t id = 0; id < get_num_sb_unique_module(); ++id) { - /* Check whether the input module exists.*/ - if (sb_unique_module_[id].x() == ix && sb_unique_module_[id].y() == iy){ + /* Check whether the input module exists.*/ + if (sb_unique_module_[id].x() == ix && sb_unique_module_[id].y() == iy) { is_unique_module = false; sb_unique_module_id_[ix][iy] = id; break; @@ -584,15 +581,39 @@ void DeviceRRGSB::load_unique_sb_module_from_user_input(int ix, int iy){ if (true == is_unique_module) { sb_unique_module_.push_back(sb_coordinate); /* Record the id of unique mirror */ - sb_unique_module_id_[ix][iy] =sb_unique_module_.size() - 1; + sb_unique_module_id_[ix][iy] = sb_unique_module_.size() - 1; } } -void DeviceRRGSB::load_unique_gsb_module_from_user_input(int x, int y){ - - - +/* need to preload after cb and sb are preloaded */ +void DeviceRRGSB::preload_unique_gsb_module(int ix, int iy) { + // vtr::Point gsb_coordinate(ix, iy); + // bool is_unique_module = true; + // for (size_t id = 0; id < get_num_gsb_unique_module(); ++id) { + // const vtr::Point& gsb_unique_module_coordinate = + // gsb_unique_module_[id]; + // if ((sb_unique_module_id_[ix][iy] == + // sb_unique_module_id_[gsb_unique_module_coordinate.x()] + // [gsb_unique_module_coordinate.y()]) && + // (cbx_unique_module_id_[ix][iy] == + // cbx_unique_module_id_[gsb_unique_module_coordinate.x()] + // [gsb_unique_module_coordinate.y()]) && + // (cby_unique_module_id_[ix][iy] == + // cby_unique_module_id_[gsb_unique_module_coordinate.x()] + // [gsb_unique_module_coordinate.y()])) { + // /* This is a mirror, raise the flag and we finish */ + // is_unique_module = false; + // /* Record the id of unique mirror */ + // gsb_unique_module_id_[ix][iy] = id; + // break; + // } + // } + // if (true == is_unique_module) { + // add_gsb_unique_module(gsb_coordinate); + // /* Record the id of unique mirror */ + // gsb_unique_module_id_[ix][iy] = get_num_gsb_unique_module() - 1; + // } } } /* End namespace openfpga*/ diff --git a/openfpga/src/annotation/device_rr_gsb.h b/openfpga/src/annotation/device_rr_gsb.h index 267118e00..911ed31c4 100644 --- a/openfpga/src/annotation/device_rr_gsb.h +++ b/openfpga/src/annotation/device_rr_gsb.h @@ -95,9 +95,10 @@ class DeviceRRGSB { automatically identify and update the lists of unique mirrors and rotatable mirrors */ void clear(); /* clean the content */ - void load_unique_cb_module_from_user_input(int x, int y); - void load_unique_sb_module_from_user_input(int x, int y); - void load_unique_gsb_module_from_user_input(int x, int y); + void preload_unique_cbx_module(int x, int y); + void preload_unique_cby_module(int x, int y); + void preload_unique_sb_module(int x, int y); + void preload_unique_gsb_module(int x, int y); private: /* Internal cleaners */ void clear_gsb(); /* clean the content */ void clear_cb_unique_module(const t_rr_type& cb_type); /* clean the content */ diff --git a/openfpga/src/fabric/read_xml_unique_blocks.h b/openfpga/src/fabric/read_xml_unique_blocks.h index a6b7cb168..b9b17ce91 100644 --- a/openfpga/src/fabric/read_xml_unique_blocks.h +++ b/openfpga/src/fabric/read_xml_unique_blocks.h @@ -42,15 +42,15 @@ void read_xml_unique_instance_info(T& device_rr_gsb, pugi::xml_node& xml_instance_info, const pugiutil::loc_data& loc_data, std::string type) { - std::string pass = "pass here"; int instance_x = get_attribute(xml_instance_info, "x", loc_data).as_int(); int instance_y = get_attribute(xml_instance_info, "y", loc_data).as_int(); if (type == "sb") { - device_rr_gsb.load_unique_sb_module_from_user_input(instance_x, instance_y); + device_rr_gsb.preload_unique_sb_module(instance_x, instance_y); } else if (type == "cb") { // read_cb_unique_blocks(); std::cout << "By pass here" << std::endl; } else if (type == "gsb") { + /* should grab coordinates first and then by pass it to preload gsb*/ std::cout << "By pass here" << std::endl; // read_gsb_unique_blocks(); }