diff --git a/libs/libarchopenfpga/src/bitstream_setting.cpp b/libs/libarchopenfpga/src/bitstream_setting.cpp index 6092bd91e..b5e50d58e 100644 --- a/libs/libarchopenfpga/src/bitstream_setting.cpp +++ b/libs/libarchopenfpga/src/bitstream_setting.cpp @@ -18,6 +18,12 @@ BitstreamSetting::pb_type_settings() const { pb_type_setting_ids_.end()); } +BitstreamSetting::bitstream_default_mode_setting_range +BitstreamSetting::default_mode_settings() const { + return vtr::make_range(default_mode_setting_ids_.begin(), + default_mode_setting_ids_.end()); +} + BitstreamSetting::bitstream_interconnect_setting_range BitstreamSetting::interconnect_settings() const { return vtr::make_range(interconnect_setting_ids_.begin(), @@ -80,6 +86,30 @@ size_t BitstreamSetting::bitstream_offset( return bitstream_offsets_[pb_type_setting_id]; } +std::string BitstreamSetting::default_mode_pb_type_name( + const BitstreamDefaultModeSettingId& default_mode_setting_id) const { + VTR_ASSERT(true == valid_bitstream_default_mode_setting_id(default_mode_setting_id)); + return default_mode_pb_type_names_[default_mode_setting_id]; +} + +std::vector BitstreamSetting::default_mode_parent_pb_type_names( + const BitstreamDefaultModeSettingId& default_mode_setting_id) const { + VTR_ASSERT(true == valid_bitstream_default_mode_setting_id(default_mode_setting_id)); + return default_mode_parent_pb_type_names_[default_mode_setting_id]; +} + +std::vector BitstreamSetting::default_mode_parent_mode_names( + const BitstreamDefaultModeSettingId& default_mode_setting_id) const { + VTR_ASSERT(true == valid_bitstream_default_mode_setting_id(default_mode_setting_id)); + return default_mode_parent_mode_names_[default_mode_setting_id]; +} + +std::string BitstreamSetting::default_mode_bits( + const BitstreamDefaultModeSettingId& default_mode_setting_id) const { + VTR_ASSERT(true == valid_bitstream_default_mode_setting_id(default_mode_setting_id)); + return pb_type_default_mode_bits_[default_mode_setting_id]; +} + std::string BitstreamSetting::interconnect_name( const BitstreamInterconnectSettingId& interconnect_setting_id) const { VTR_ASSERT(true == @@ -159,6 +189,22 @@ void BitstreamSetting::set_bitstream_offset( bitstream_offsets_[pb_type_setting_id] = offset; } +BitstreamDefaultModeSettingId BitstreamSetting::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::string& mode_bits) { + BitstreamDefaultModeSettingId default_mode_setting_id = + BitstreamDefaultModeSettingId(default_mode_setting_ids_.size()); + default_mode_setting_ids_.push_back(default_mode_setting_id); + default_mode_pb_type_names_.push_back(pb_type_name); + default_mode_parent_pb_type_names_.push_back(parent_pb_type_names); + default_mode_parent_mode_names_.push_back(parent_mode_names); + pb_type_default_mode_bits_.push_back(mode_bits); + + return default_mode_setting_id; +} + BitstreamInterconnectSettingId BitstreamSetting::add_bitstream_interconnect_setting( const std::string& interconnect_name, @@ -220,6 +266,12 @@ bool BitstreamSetting::valid_bitstream_pb_type_setting_id( (pb_type_setting_id == pb_type_setting_ids_[pb_type_setting_id]); } +bool BitstreamSetting::valid_bitstream_default_mode_setting_id( + const BitstreamDefaultModeSettingId& default_mode_setting_id) const { + return (size_t(default_mode_setting_id) < default_mode_setting_ids_.size()) && + (default_mode_setting_id == default_mode_setting_ids_[default_mode_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 8b676e272..31986c8e9 100644 --- a/libs/libarchopenfpga/src/bitstream_setting.h +++ b/libs/libarchopenfpga/src/bitstream_setting.h @@ -157,6 +157,8 @@ class BitstreamSetting { public: /* Public Validators */ bool valid_bitstream_pb_type_setting_id( const BitstreamPbTypeSettingId& pb_type_setting_id) const; + bool valid_bitstream_default_mode_setting_id( + const BitstreamDefaultModeSettingId& default_mode_setting_id) const; bool valid_bitstream_interconnect_setting_id( const BitstreamInterconnectSettingId& interconnect_setting_id) const; bool valid_overwrite_bitstream_id(const OverwriteBitstreamId& id) const;