From 8372eead6a81ab3053521898a4da080745777f6f Mon Sep 17 00:00:00 2001 From: Lin Date: Wed, 28 Aug 2024 18:14:33 +0800 Subject: [PATCH] add preload flag to device_rr_gsb and revert change to build fabric --- openfpga/src/annotation/device_rr_gsb.cpp | 5 +++++ openfpga/src/annotation/device_rr_gsb.h | 6 +++++- openfpga/src/base/openfpga_build_fabric_template.h | 5 ++--- openfpga/src/base/openfpga_setup_command_template.h | 5 ----- openfpga/src/fabric/read_xml_unique_blocks.cpp | 1 + .../read_unique_blocks_example_script.openfpga | 2 +- 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/openfpga/src/annotation/device_rr_gsb.cpp b/openfpga/src/annotation/device_rr_gsb.cpp index 33193d000..732df18bc 100644 --- a/openfpga/src/annotation/device_rr_gsb.cpp +++ b/openfpga/src/annotation/device_rr_gsb.cpp @@ -66,6 +66,9 @@ size_t DeviceRRGSB::get_num_cb_unique_module(const t_rr_type& cb_type) const { } } +void DeviceRRGSB::init_preload_flag() { preload_ = false; } +void DeviceRRGSB::set_preload_flag(const bool flag) { preload_ = flag; } +bool DeviceRRGSB::get_preload_flag() const { return preload_; } /* Identify if a GSB actually exists at a location */ bool DeviceRRGSB::is_gsb_exist(const RRGraphView& rr_graph, const vtr::Point coord) const { @@ -420,6 +423,7 @@ void DeviceRRGSB::clear() { clear_sb_unique_module(); clear_sb_unique_module_id(); + init_preload_flag(); } void DeviceRRGSB::clear_unique_modules() { @@ -432,6 +436,7 @@ void DeviceRRGSB::clear_unique_modules() { clear_sb_unique_module(); clear_sb_unique_module_id(); + init_preload_flag(); } void DeviceRRGSB::clear_gsb() { diff --git a/openfpga/src/annotation/device_rr_gsb.h b/openfpga/src/annotation/device_rr_gsb.h index f9a151f05..bd1178421 100644 --- a/openfpga/src/annotation/device_rr_gsb.h +++ b/openfpga/src/annotation/device_rr_gsb.h @@ -68,7 +68,9 @@ class DeviceRRGSB { size_t get_cb_unique_module_index(const t_rr_type& cb_type, const vtr::Point& coordinate) const; - public: /* Mutators */ + public: /* Mutators */ + void set_preload_flag(const bool flag); + bool get_preload_flag() const; void build_gsb_unique_module(); /* Add a switch block to the array, which will automatically identify and update the lists of unique mirrors and rotatable mirrors */ @@ -124,6 +126,7 @@ class DeviceRRGSB { private: /* Internal cleaners */ void clear_gsb(); /* clean the content */ void clear_cb_unique_module(const t_rr_type& cb_type); /* clean the content */ + void init_preload_flag(); void clear_cb_unique_module_id( const t_rr_type& cb_type); /* clean the content */ void clear_sb_unique_module(); /* clean the content */ @@ -162,6 +165,7 @@ class DeviceRRGSB { private: /* Internal Data */ std::vector> rr_gsb_; + bool preload_; std::vector> gsb_unique_module_id_; /* A map from rr_gsb to its unique mirror */ diff --git a/openfpga/src/base/openfpga_build_fabric_template.h b/openfpga/src/base/openfpga_build_fabric_template.h index 18825759e..c4303b962 100644 --- a/openfpga/src/base/openfpga_build_fabric_template.h +++ b/openfpga/src/base/openfpga_build_fabric_template.h @@ -102,7 +102,6 @@ int build_fabric_template(T& openfpga_ctx, const Command& cmd, const CommandContext& cmd_context) { CommandOptionId opt_frame_view = cmd.option("frame_view"); CommandOptionId opt_compress_routing = cmd.option("compress_routing"); - CommandOptionId opt_preload = cmd.option("preload_unique_blocks"); CommandOptionId opt_duplicate_grid_pin = cmd.option("duplicate_grid_pin"); CommandOptionId opt_gen_random_fabric_key = cmd.option("generate_random_fabric_key"); @@ -146,13 +145,13 @@ int build_fabric_template(T& openfpga_ctx, const Command& cmd, } if (true == cmd_context.option_enable(cmd, opt_compress_routing) && - false == cmd_context.option_enable(cmd, opt_preload)) { + false == openfpga_ctx.device_rr_gsb().get_preload_flag()) { compress_routing_hierarchy_template( openfpga_ctx, cmd_context.option_enable(cmd, opt_verbose)); /* Update flow manager to enable compress routing */ openfpga_ctx.mutable_flow_manager().set_compress_routing(true); } else if (true == cmd_context.option_enable(cmd, opt_compress_routing) && - true == cmd_context.option_enable(cmd, opt_preload)) { + true == openfpga_ctx.device_rr_gsb().get_preload_flag()) { openfpga_ctx.mutable_flow_manager().set_compress_routing(true); } diff --git a/openfpga/src/base/openfpga_setup_command_template.h b/openfpga/src/base/openfpga_setup_command_template.h index 2aa8adae3..f13c62700 100644 --- a/openfpga/src/base/openfpga_setup_command_template.h +++ b/openfpga/src/base/openfpga_setup_command_template.h @@ -391,11 +391,6 @@ ShellCommandId add_build_fabric_command_template( "Compress the number of unique routing modules by " "identifying the unique GSBs"); - /* Add an option '--preload_unique_blocks' */ - shell_cmd.add_option( - "preload_unique_blocks", false, - "preload unique routing modules from user input xml file"); - /* Add an option '--duplicate_grid_pin' */ shell_cmd.add_option("duplicate_grid_pin", false, "Duplicate the pins on the same side of a grid"); diff --git a/openfpga/src/fabric/read_xml_unique_blocks.cpp b/openfpga/src/fabric/read_xml_unique_blocks.cpp index 0888e390c..16c55a810 100644 --- a/openfpga/src/fabric/read_xml_unique_blocks.cpp +++ b/openfpga/src/fabric/read_xml_unique_blocks.cpp @@ -155,6 +155,7 @@ 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_preload_flag(true); if (verbose_output) { report_unique_module_status_read(device_rr_gsb, true); } diff --git a/openfpga_flow/openfpga_shell_scripts/read_unique_blocks_example_script.openfpga b/openfpga_flow/openfpga_shell_scripts/read_unique_blocks_example_script.openfpga index 491cefa4b..91e717186 100644 --- a/openfpga_flow/openfpga_shell_scripts/read_unique_blocks_example_script.openfpga +++ b/openfpga_flow/openfpga_shell_scripts/read_unique_blocks_example_script.openfpga @@ -21,7 +21,7 @@ read_unique_blocks --file ${READ_UNIQUE_BLOCKS_XML} --verbose --type xml # Build the module graph # - Enabled compression on routing architecture modules # - Enable pin duplication on grid modules -build_fabric --compress_routing --preload_unique_blocks #--verbose +build_fabric --compress_routing #--verbose #write unique blocks xml file write_unique_blocks --file ./write_unique_block.xml --verbose --type xml