diff --git a/libs/libarchopenfpga/src/bitstream_setting.cpp b/libs/libarchopenfpga/src/bitstream_setting.cpp index 3a92a519f..afdf6998b 100644 --- a/libs/libarchopenfpga/src/bitstream_setting.cpp +++ b/libs/libarchopenfpga/src/bitstream_setting.cpp @@ -126,6 +126,20 @@ std::string BitstreamSetting::default_mode_bits_to_string( return mode_bits_str; } +std::string BitstreamSetting::clock_routing_network_name( + const BitstreamClockRoutingSettingId& clock_routing_setting_id) const { + VTR_ASSERT(true == + valid_bitstream_clock_routing_setting_id(clock_routing_setting_id)); + return clock_routing_network_names_[clock_routing_setting_id]; +} + +BasicPort BitstreamSetting::clock_routing_pin( + const BitstreamClockRoutingSettingId& clock_routing_setting_id) const { + VTR_ASSERT(true == + valid_bitstream_clock_routing_setting_id(clock_routing_setting_id)); + return clock_routing_pins_[clock_routing_setting_id]; +} + std::string BitstreamSetting::interconnect_name( const BitstreamInterconnectSettingId& interconnect_setting_id) const { VTR_ASSERT(true == @@ -222,6 +236,19 @@ BitstreamSetting::add_bitstream_default_mode_setting( return default_mode_setting_id; } +BitstreamClockRoutingSettingId +BitstreamSetting::add_bitstream_clock_routing_setting( + const std::string& ntwk_name, + const BasicPort& pin) { + BitstreamClockRoutingSettingId clock_routing_setting_id = + BitstreamClockRoutingSettingId(clock_routing_setting_ids_.size()); + clock_routing_setting_ids_.push_back(clock_routing_setting_id); + clock_routing_network_names_.push_back(ntwk_name); + clock_routing_pins_.push_back(pin); + + return clock_routing_setting_id; +} + BitstreamInterconnectSettingId BitstreamSetting::add_bitstream_interconnect_setting( const std::string& interconnect_name, @@ -290,6 +317,13 @@ bool BitstreamSetting::valid_bitstream_default_mode_setting_id( default_mode_setting_ids_[default_mode_setting_id]); } +bool BitstreamSetting::valid_bitstream_clock_routing_setting_id( + const BitstreamClockRoutingSettingId& clock_routing_setting_id) const { + return (size_t(clock_routing_setting_id) < clock_routing_setting_ids_.size()) && + (clock_routing_setting_id == + clock_routing_setting_ids_[clock_routing_setting_id]); +} + bool BitstreamSetting::valid_bitstream_interconnect_setting_id( const BitstreamInterconnectSettingId& interconnect_setting_id) const { return (size_t(interconnect_setting_id) < interconnect_setting_ids_.size()) && diff --git a/libs/libarchopenfpga/src/bitstream_setting.h b/libs/libarchopenfpga/src/bitstream_setting.h index e97b1e912..d5d17907e 100644 --- a/libs/libarchopenfpga/src/bitstream_setting.h +++ b/libs/libarchopenfpga/src/bitstream_setting.h @@ -62,6 +62,9 @@ class BitstreamSetting { typedef vtr::vector::const_iterator bitstream_default_mode_setting_iterator; + typedef vtr::vector::const_iterator + bitstream_clock_routing_setting_iterator; typedef vtr::vector::const_iterator bitstream_interconnect_setting_iterator; @@ -73,6 +76,8 @@ class BitstreamSetting { bitstream_pb_type_setting_range; typedef vtr::Range bitstream_default_mode_setting_range; + typedef vtr::Range + bitstream_clock_routing_setting_range; typedef vtr::Range bitstream_interconnect_setting_range; typedef vtr::Range overwrite_bitstream_range; @@ -83,10 +88,12 @@ class BitstreamSetting { public: /* Accessors: aggregates */ bitstream_pb_type_setting_range pb_type_settings() const; bitstream_default_mode_setting_range default_mode_settings() const; + bitstream_clock_routing_setting_range clock_routing_settings() const; bitstream_interconnect_setting_range interconnect_settings() const; overwrite_bitstream_range overwrite_bitstreams() const; public: /* Public Accessors */ + /* pb_type settings */ std::string pb_type_name( const BitstreamPbTypeSettingId& pb_type_setting_id) const; std::vector parent_pb_type_names( @@ -114,6 +121,13 @@ class BitstreamSetting { std::string default_mode_bits_to_string( const BitstreamDefaultModeSettingId& default_mode_setting_id) const; + /* Clock routing settings */ + std::string clock_routing_network_name( + const BitstreamClockRoutingSettingId& clock_routing_setting_id) const; + BasicPort clock_routing_pin( + const BitstreamClockRoutingSettingId& clock_routing_setting_id) const; + + /* Interconnect settings */ std::string interconnect_name( const BitstreamInterconnectSettingId& interconnect_setting_id) const; std::vector parent_pb_type_names( @@ -122,11 +136,16 @@ class BitstreamSetting { const BitstreamInterconnectSettingId& interconnect_setting_id) const; std::string default_path( const BitstreamInterconnectSettingId& interconnect_setting_id) const; + + /* Non-fabric bitstream setting */ std::vector non_fabric() const; + + /* Bitstream overwriting setting */ std::string overwrite_bitstream_path(const OverwriteBitstreamId& id) const; bool overwrite_bitstream_value(const OverwriteBitstreamId& id) const; public: /* Public Mutators */ + /* pb_type settings */ BitstreamPbTypeSettingId add_bitstream_pb_type_setting( const std::string& pb_type_name, const std::vector& parent_pb_type_names, @@ -138,21 +157,31 @@ class BitstreamSetting { void set_bitstream_offset(const BitstreamPbTypeSettingId& pb_type_setting_id, const size_t& offset); + /* Default Mode Bit settings */ BitstreamDefaultModeSettingId add_bitstream_default_mode_setting( const std::string& pb_type_name, const std::vector& parent_pb_type_names, const std::vector& parent_mode_names, const std::vector& mode_bits); + /* Clock routing settings */ + BitstreamClockRoutingSettingId add_bitstream_clock_routing_setting( + const std::string& ntwk_name, + const BasicPort& pin); + + /* Interconnect settings */ BitstreamInterconnectSettingId add_bitstream_interconnect_setting( const std::string& interconnect_name, const std::vector& parent_pb_type_names, const std::vector& parent_mode_names, const std::string& default_path); + /* Non-fabric bitstream setting */ + std::vector non_fabric() const; 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); + /* Bitstream overwriting setting */ OverwriteBitstreamId add_overwrite_bitstream(const std::string& path, const bool& value); @@ -161,6 +190,8 @@ class BitstreamSetting { const BitstreamPbTypeSettingId& pb_type_setting_id) const; bool valid_bitstream_default_mode_setting_id( const BitstreamDefaultModeSettingId& default_mode_setting_id) const; + bool valid_bitstream_clock_routing_setting_id( + const BitstreamClockRoutingSettingId& clock_routing_setting_id) const; bool valid_bitstream_interconnect_setting_id( const BitstreamInterconnectSettingId& interconnect_setting_id) const; bool valid_overwrite_bitstream_id(const OverwriteBitstreamId& id) const; @@ -198,6 +229,14 @@ class BitstreamSetting { vtr::vector> pb_type_default_mode_bits_; + /* Clock routing */ + vtr::vector + clock_routing_setting_ids_; + vtr::vector + clock_routing_network_names_; + vtr::vector + clock_routing_pins_; + /* Interconnect-related settings: * - Name of interconnect under a given pb_type * - The default path to be considered for a given interconnect during diff --git a/libs/libarchopenfpga/src/bitstream_setting_fwd.h b/libs/libarchopenfpga/src/bitstream_setting_fwd.h index 06d9655c7..73dfb6f46 100644 --- a/libs/libarchopenfpga/src/bitstream_setting_fwd.h +++ b/libs/libarchopenfpga/src/bitstream_setting_fwd.h @@ -15,6 +15,7 @@ struct bitstream_pb_type_setting_id_tag; struct bitstream_default_mode_setting_id_tag; +struct bitstream_clock_routing_setting_id_tag; struct bitstream_interconnect_setting_id_tag; struct overwrite_bitstream_id_tag; @@ -22,6 +23,8 @@ typedef vtr::StrongId BitstreamPbTypeSettingId; typedef vtr::StrongId BitstreamDefaultModeSettingId; +typedef vtr::StrongId + BitstreamClockRoutingSettingId; typedef vtr::StrongId BitstreamInterconnectSettingId; typedef vtr::StrongId OverwriteBitstreamId;