From 49cdb4e9c80d08de144269ad9aaae0d9c5660aea Mon Sep 17 00:00:00 2001 From: chungshien Date: Tue, 20 Feb 2024 21:05:13 -0800 Subject: [PATCH] Change none-fabric to non-fabric --- .../manual/file_formats/bitstream_setting.rst | 12 ++--- .../libarchopenfpga/src/bitstream_setting.cpp | 20 ++++----- libs/libarchopenfpga/src/bitstream_setting.h | 26 +++++------ .../src/read_xml_bitstream_setting.cpp | 32 +++++++------- .../src/base/openfpga_bitstream_template.h | 4 +- ...> extract_device_non_fabric_bitstream.cpp} | 44 +++++++++---------- ... => extract_device_non_fabric_bitstream.h} | 10 ++--- .../config/bitstream_annotation.xml | 4 +- 8 files changed, 76 insertions(+), 76 deletions(-) rename openfpga/src/fpga_bitstream/{extract_device_none_fabric_bitstream.cpp => extract_device_non_fabric_bitstream.cpp} (87%) rename openfpga/src/fpga_bitstream/{extract_device_none_fabric_bitstream.h => extract_device_non_fabric_bitstream.h} (63%) diff --git a/docs/source/manual/file_formats/bitstream_setting.rst b/docs/source/manual/file_formats/bitstream_setting.rst index 894f5b93d..eb2af5ddf 100644 --- a/docs/source/manual/file_formats/bitstream_setting.rst +++ b/docs/source/manual/file_formats/bitstream_setting.rst @@ -13,9 +13,9 @@ This can define a hard-coded bitstream for a reconfigurable resource in FPGA fab - + - + pb_type-related Settings @@ -74,12 +74,12 @@ The following syntax are applicable to the XML definition tagged by ``interconne The default path can be either ``iopad.inpad`` or ``ff.Q`` which corresponds to the first input and the second input respectively. -none_fabric-related Settings +non_fabric-related Settings ^^^^^^^^^^^^^^^^^^^^^^^^ This is special syntax to extract PB defined parameter or attribute and save the data into dedicated JSON file outside of fabric bitstream -The following syntax are applicable to the XML definition tagged by ``none-fabric`` in bitstream setting files. +The following syntax are applicable to the XML definition tagged by ``non_fabric`` in bitstream setting files. .. option:: name="" @@ -106,9 +106,9 @@ The following syntax are applicable to the XML definition tagged by ``none-fabri For example, .. code-block:: xml - + - + The final ``pb_type`` name is "bram.bram_lr[mem_36K_tdp].mem_36K" diff --git a/libs/libarchopenfpga/src/bitstream_setting.cpp b/libs/libarchopenfpga/src/bitstream_setting.cpp index 29dd029fa..7d763f9d2 100644 --- a/libs/libarchopenfpga/src/bitstream_setting.cpp +++ b/libs/libarchopenfpga/src/bitstream_setting.cpp @@ -102,8 +102,8 @@ std::string BitstreamSetting::default_path( return interconnect_default_paths_[interconnect_setting_id]; } -std::vector BitstreamSetting::none_fabric() const { - return none_fabric_; +std::vector BitstreamSetting::non_fabric() const { + return non_fabric_; } /************************************************************************ @@ -158,23 +158,23 @@ BitstreamSetting::add_bitstream_interconnect_setting( return interc_setting_id; } -void BitstreamSetting::add_none_fabric(const std::string& name, - const std::string& file) { +void BitstreamSetting::add_non_fabric(const std::string& name, + const std::string& file) { VTR_ASSERT(name.size()); VTR_ASSERT(file.size()); - none_fabric_.push_back(NoneFabricBitstreamSetting(name, file)); + non_fabric_.push_back(NonFabricBitstreamSetting(name, file)); } -void BitstreamSetting::add_none_fabric_pb(const std::string& pb, - const std::string& content) { - VTR_ASSERT(none_fabric_.size()); +void BitstreamSetting::add_non_fabric_pb(const std::string& pb, + const std::string& content) { + VTR_ASSERT(non_fabric_.size()); VTR_ASSERT(content.find(".param ") == 0 || content.find(".attr ") == 0); if (content.find(".param ") == 0) { VTR_ASSERT(content.size() > 7); - none_fabric_.back().add_pb(pb, "param", content.substr(7)); + non_fabric_.back().add_pb(pb, "param", content.substr(7)); } else { VTR_ASSERT(content.size() > 6); - none_fabric_.back().add_pb(pb, "attr", content.substr(6)); + non_fabric_.back().add_pb(pb, "attr", content.substr(6)); } } diff --git a/libs/libarchopenfpga/src/bitstream_setting.h b/libs/libarchopenfpga/src/bitstream_setting.h index cc6969aad..1b12c8de3 100644 --- a/libs/libarchopenfpga/src/bitstream_setting.h +++ b/libs/libarchopenfpga/src/bitstream_setting.h @@ -14,27 +14,27 @@ /* namespace openfpga begins */ namespace openfpga { -struct NoneFabricBitstreamPBSetting { - NoneFabricBitstreamPBSetting(const std::string& p = "", - const std::string& t = "", - const std::string& c = "") +struct NonFabricBitstreamPBSetting { + NonFabricBitstreamPBSetting(const std::string& p = "", + const std::string& t = "", + const std::string& c = "") : pb(p), type(t), content(c) {} const std::string pb = ""; const std::string type = ""; const std::string content = ""; }; -struct NoneFabricBitstreamSetting { - NoneFabricBitstreamSetting(const std::string& n = "", - const std::string& f = "") +struct NonFabricBitstreamSetting { + NonFabricBitstreamSetting(const std::string& n = "", + const std::string& f = "") : name(n), file(f) {} void add_pb(const std::string& p, const std::string& t, const std::string& c) { - pbs.push_back(NoneFabricBitstreamPBSetting(p, t, c)); + pbs.push_back(NonFabricBitstreamPBSetting(p, t, c)); } const std::string name = ""; const std::string file = ""; - std::vector pbs; + std::vector pbs; }; /******************************************************************** @@ -97,7 +97,7 @@ class BitstreamSetting { const BitstreamInterconnectSettingId& interconnect_setting_id) const; std::string default_path( const BitstreamInterconnectSettingId& interconnect_setting_id) const; - std::vector none_fabric() const; + std::vector non_fabric() const; public: /* Public Mutators */ BitstreamPbTypeSettingId add_bitstream_pb_type_setting( @@ -117,8 +117,8 @@ class BitstreamSetting { const std::vector& parent_mode_names, const std::string& default_path); - void add_none_fabric(const std::string& name, const std::string& file); - void add_none_fabric_pb(const std::string& pb, const std::string& content); + void add_non_fabric(const std::string& name, const std::string& file); + void add_non_fabric_pb(const std::string& pb, const std::string& content); public: /* Public Validators */ bool valid_bitstream_pb_type_setting_id( @@ -161,7 +161,7 @@ class BitstreamSetting { interconnect_parent_mode_names_; vtr::vector interconnect_default_paths_; - std::vector none_fabric_; + std::vector non_fabric_; }; } // namespace openfpga diff --git a/libs/libarchopenfpga/src/read_xml_bitstream_setting.cpp b/libs/libarchopenfpga/src/read_xml_bitstream_setting.cpp index a18baee12..7f6bd1237 100644 --- a/libs/libarchopenfpga/src/read_xml_bitstream_setting.cpp +++ b/libs/libarchopenfpga/src/read_xml_bitstream_setting.cpp @@ -77,28 +77,28 @@ static void read_xml_bitstream_interconnect_setting( } /******************************************************************** - * Parse XML description for a none_fabric annotation under a XML + * Parse XML description for a non_fabric annotation under a XML *node *******************************************************************/ -static void read_xml_none_fabric_bitstream_setting( - pugi::xml_node& xml_none_fabric, const pugiutil::loc_data& loc_data, +static void read_xml_non_fabric_bitstream_setting( + pugi::xml_node& xml_non_fabric, const pugiutil::loc_data& loc_data, openfpga::BitstreamSetting& bitstream_setting) { const std::string& name_attr = - get_attribute(xml_none_fabric, "name", loc_data).as_string(); + get_attribute(xml_non_fabric, "name", loc_data).as_string(); const std::string& file_attr = - get_attribute(xml_none_fabric, "file", loc_data).as_string(); - /* Add to none fabric */ - bitstream_setting.add_none_fabric(name_attr, file_attr); - for (pugi::xml_node xml_child : xml_none_fabric.children()) { + get_attribute(xml_non_fabric, "file", loc_data).as_string(); + /* Add to non-fabric */ + bitstream_setting.add_non_fabric(name_attr, file_attr); + for (pugi::xml_node xml_child : xml_non_fabric.children()) { if (xml_child.name() != std::string("pb")) { - bad_tag(xml_child, loc_data, xml_none_fabric, {"pb"}); + bad_tag(xml_child, loc_data, xml_non_fabric, {"pb"}); } const std::string& pb_name_attr = get_attribute(xml_child, "name", loc_data).as_string(); const std::string& content_attr = get_attribute(xml_child, "content", loc_data).as_string(); - /* Add PB to none fabric */ - bitstream_setting.add_none_fabric_pb(pb_name_attr, content_attr); + /* Add PB to non-fabric */ + bitstream_setting.add_non_fabric_pb(pb_name_attr, content_attr); } } @@ -116,9 +116,9 @@ openfpga::BitstreamSetting read_xml_bitstream_setting( /* Error out if the XML child has an invalid name! */ if ((xml_child.name() != std::string("pb_type")) && (xml_child.name() != std::string("interconnect")) && - (xml_child.name() != std::string("none_fabric"))) { + (xml_child.name() != std::string("non_fabric"))) { bad_tag(xml_child, loc_data, Node, - {"pb_type | interconnect | none_fabric"}); + {"pb_type | interconnect | non_fabric"}); } if (xml_child.name() == std::string("pb_type")) { @@ -128,9 +128,9 @@ openfpga::BitstreamSetting read_xml_bitstream_setting( read_xml_bitstream_interconnect_setting(xml_child, loc_data, bitstream_setting); } else { - VTR_ASSERT_SAFE(xml_child.name() == std::string("none_fabric")); - read_xml_none_fabric_bitstream_setting(xml_child, loc_data, - bitstream_setting); + VTR_ASSERT_SAFE(xml_child.name() == std::string("non_fabric")); + read_xml_non_fabric_bitstream_setting(xml_child, loc_data, + bitstream_setting); } } diff --git a/openfpga/src/base/openfpga_bitstream_template.h b/openfpga/src/base/openfpga_bitstream_template.h index c3d0ea3d6..c132e907f 100644 --- a/openfpga/src/base/openfpga_bitstream_template.h +++ b/openfpga/src/base/openfpga_bitstream_template.h @@ -11,7 +11,7 @@ #include "command.h" #include "command_context.h" #include "command_exit_codes.h" -#include "extract_device_none_fabric_bitstream.h" +#include "extract_device_non_fabric_bitstream.h" #include "globals.h" #include "openfpga_digest.h" #include "openfpga_naming.h" @@ -60,7 +60,7 @@ int fpga_bitstream_template(T& openfpga_ctx, const Command& cmd, !cmd_context.option_enable(cmd, opt_no_time_stamp)); } - extract_device_none_fabric_bitstream( + extract_device_non_fabric_bitstream( g_vpr_ctx, openfpga_ctx, cmd_context.option_enable(cmd, opt_verbose)); /* TODO: should identify the error code from internal function execution */ diff --git a/openfpga/src/fpga_bitstream/extract_device_none_fabric_bitstream.cpp b/openfpga/src/fpga_bitstream/extract_device_non_fabric_bitstream.cpp similarity index 87% rename from openfpga/src/fpga_bitstream/extract_device_none_fabric_bitstream.cpp rename to openfpga/src/fpga_bitstream/extract_device_non_fabric_bitstream.cpp index d208a0b2b..3793c1b3d 100644 --- a/openfpga/src/fpga_bitstream/extract_device_none_fabric_bitstream.cpp +++ b/openfpga/src/fpga_bitstream/extract_device_non_fabric_bitstream.cpp @@ -9,7 +9,7 @@ #include /* Headers from vtrutil library */ -#include "extract_device_none_fabric_bitstream.h" +#include "extract_device_non_fabric_bitstream.h" #include "openfpga_pb_parser.h" #include "pb_type_utils.h" #include "vtr_assert.h" @@ -31,7 +31,7 @@ namespace openfpga { *******************************************************************/ static bool extract_pb_data(std::fstream& fp, const AtomContext& atom_ctx, const t_pb* op_pb, const t_pb_type* target_pb_type, - const NoneFabricBitstreamPBSetting& setting) { + const NonFabricBitstreamPBSetting& setting) { t_pb_graph_node* pb_graph_node = op_pb->pb_graph_node; t_pb_type* pb_type = pb_graph_node->pb_type; bool found_pb = false; @@ -84,10 +84,10 @@ static bool extract_pb_data(std::fstream& fp, const AtomContext& atom_ctx, /******************************************************************** * Extract data from the targetted PB (from that particular grid) *******************************************************************/ -static void extract_grid_none_fabric_bitstream( +static void extract_grid_non_fabric_bitstream( std::fstream& fp, const VprContext& vpr_ctx, const ClusterBlockId& cluster_block_id, const t_pb_type* target_pb_type, - const NoneFabricBitstreamPBSetting setting) { + const NonFabricBitstreamPBSetting setting) { const ClusteringContext& clustering_ctx = vpr_ctx.clustering(); const AtomContext& atom_ctx = vpr_ctx.atom(); @@ -102,8 +102,8 @@ static void extract_grid_none_fabric_bitstream( /******************************************************************** * Extract data from the targetted PB (from the device) *******************************************************************/ -static void extract_device_none_fabric_pb_bitstream( - std::fstream& fp, const NoneFabricBitstreamPBSetting setting, +static void extract_device_non_fabric_pb_bitstream( + std::fstream& fp, const NonFabricBitstreamPBSetting setting, const std::string& target_parent_pb_name, const t_pb_type* target_pb_type, const VprContext& vpr_ctx) { const DeviceContext& device_ctx = vpr_ctx.device(); @@ -163,8 +163,8 @@ static void extract_device_none_fabric_pb_bitstream( fp << " {\n"; fp << " \"x\" : " << (uint32_t)(ix) << ",\n"; fp << " \"y\" : " << (uint32_t)(iy); - extract_grid_none_fabric_bitstream(fp, vpr_ctx, cluster_blk_id, - target_pb_type, setting); + extract_grid_non_fabric_bitstream(fp, vpr_ctx, cluster_blk_id, + target_pb_type, setting); fp << "\n }"; grid_count++; } @@ -212,31 +212,31 @@ static t_pb_type* find_pb_type(const DeviceContext& device_ctx, } /******************************************************************** - * A top-level function to extract data based on none-fabric bitstream setting + * A top-level function to extract data based on non-fabric bitstream setting *******************************************************************/ -void extract_device_none_fabric_bitstream(const VprContext& vpr_ctx, - const OpenfpgaContext& openfpga_ctx, - const bool& verbose) { +void extract_device_non_fabric_bitstream(const VprContext& vpr_ctx, + const OpenfpgaContext& openfpga_ctx, + const bool& verbose) { std::string timer_message = - std::string("\nBuild none-fabric bitstream for implementation '") + + std::string("\nBuild non-fabric bitstream for implementation '") + vpr_ctx.atom().nlist.netlist_name() + std::string("'\n"); vtr::ScopedStartFinishTimer timer(timer_message); const openfpga::BitstreamSetting& bitstream_setting = openfpga_ctx.bitstream_setting(); - std::vector none_fabric_setting = - bitstream_setting.none_fabric(); + std::vector non_fabric_setting = + bitstream_setting.non_fabric(); // Only proceed if it is defined in bitstream_setting.xml - if (none_fabric_setting.size()) { - // Go through each none_fabric settting - for (auto setting : none_fabric_setting) { + if (non_fabric_setting.size()) { + // Go through each non_fabric settting + for (auto setting : non_fabric_setting) { std::fstream fp; fp.open(setting.file.c_str(), std::fstream::out); fp << "{\n"; fp << " \"" << setting.name.c_str() << "\" : [\n"; if (setting.name == PRINT_LAYOUT_NAME) { - extract_device_none_fabric_pb_bitstream( - fp, NoneFabricBitstreamPBSetting{}, setting.name, nullptr, vpr_ctx); + extract_device_non_fabric_pb_bitstream( + fp, NonFabricBitstreamPBSetting{}, setting.name, nullptr, vpr_ctx); } else { int pb_count = 0; // Extract each needed PB data @@ -262,8 +262,8 @@ void extract_device_none_fabric_bitstream(const VprContext& vpr_ctx, fp << " \"content\" : \"" << pb_setting.content.c_str() << "\""; if (target_pb_type != nullptr && is_primitive_pb_type(target_pb_type)) { - extract_device_none_fabric_pb_bitstream( - fp, pb_setting, setting.name, target_pb_type, vpr_ctx); + extract_device_non_fabric_pb_bitstream(fp, pb_setting, setting.name, + target_pb_type, vpr_ctx); } fp << "\n }"; pb_count++; diff --git a/openfpga/src/fpga_bitstream/extract_device_none_fabric_bitstream.h b/openfpga/src/fpga_bitstream/extract_device_non_fabric_bitstream.h similarity index 63% rename from openfpga/src/fpga_bitstream/extract_device_none_fabric_bitstream.h rename to openfpga/src/fpga_bitstream/extract_device_non_fabric_bitstream.h index 2a83bc63f..658c40b96 100644 --- a/openfpga/src/fpga_bitstream/extract_device_none_fabric_bitstream.h +++ b/openfpga/src/fpga_bitstream/extract_device_non_fabric_bitstream.h @@ -1,5 +1,5 @@ -#ifndef EXTRACT_DEVICE_NONE_FABRIC_BITSTREAM_H -#define EXTRACT_DEVICE_NONE_FABRIC_BITSTREAM_H +#ifndef EXTRACT_DEVICE_NON_FABRIC_BITSTREAM_H +#define EXTRACT_DEVICE_NON_FABRIC_BITSTREAM_H /******************************************************************** * Include header files that are required by function declaration @@ -16,9 +16,9 @@ /* begin namespace openfpga */ namespace openfpga { -void extract_device_none_fabric_bitstream(const VprContext& vpr_ctx, - const OpenfpgaContext& openfpga_ctx, - const bool& verbose); +void extract_device_non_fabric_bitstream(const VprContext& vpr_ctx, + const OpenfpgaContext& openfpga_ctx, + const bool& verbose); } /* end namespace openfpga */ diff --git a/openfpga_flow/tasks/fpga_bitstream/extract_dsp_mode_bit/config/bitstream_annotation.xml b/openfpga_flow/tasks/fpga_bitstream/extract_dsp_mode_bit/config/bitstream_annotation.xml index 33807b043..7c835ad7e 100644 --- a/openfpga_flow/tasks/fpga_bitstream/extract_dsp_mode_bit/config/bitstream_annotation.xml +++ b/openfpga_flow/tasks/fpga_bitstream/extract_dsp_mode_bit/config/bitstream_annotation.xml @@ -1,7 +1,7 @@ - + - +