[lib] add new feature clock tap routing to bitstream setting database

This commit is contained in:
tangxifan 2024-11-26 12:43:27 -08:00
parent 3d4b18ea36
commit 346aacefa9
3 changed files with 76 additions and 0 deletions

View File

@ -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()) &&

View File

@ -62,6 +62,9 @@ class BitstreamSetting {
typedef vtr::vector<BitstreamDefaultModeSettingId,
BitstreamDefaultModeSettingId>::const_iterator
bitstream_default_mode_setting_iterator;
typedef vtr::vector<BitstreamClockRoutingSettingId,
BitstreamClockRoutingSettingId>::const_iterator
bitstream_clock_routing_setting_iterator;
typedef vtr::vector<BitstreamInterconnectSettingId,
BitstreamInterconnectSettingId>::const_iterator
bitstream_interconnect_setting_iterator;
@ -73,6 +76,8 @@ class BitstreamSetting {
bitstream_pb_type_setting_range;
typedef vtr::Range<bitstream_default_mode_setting_iterator>
bitstream_default_mode_setting_range;
typedef vtr::Range<bitstream_clock_routing_setting_iterator>
bitstream_clock_routing_setting_range;
typedef vtr::Range<bitstream_interconnect_setting_iterator>
bitstream_interconnect_setting_range;
typedef vtr::Range<overwrite_bitstream_iterator> 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<std::string> 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<std::string> 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<NonFabricBitstreamSetting> 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<std::string>& 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<std::string>& parent_pb_type_names,
const std::vector<std::string>& parent_mode_names,
const std::vector<size_t>& 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<std::string>& parent_pb_type_names,
const std::vector<std::string>& parent_mode_names,
const std::string& default_path);
/* Non-fabric bitstream setting */
std::vector<NonFabricBitstreamSetting> 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<BitstreamDefaultModeSettingId, std::vector<size_t>>
pb_type_default_mode_bits_;
/* Clock routing */
vtr::vector<BitstreamClockRoutingSettingId, BitstreamClockRoutingSettingId>
clock_routing_setting_ids_;
vtr::vector<BitstreamClockRoutingSettingId, std::string>
clock_routing_network_names_;
vtr::vector<BitstreamClockRoutingSettingId, BasicPort>
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

View File

@ -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<bitstream_pb_type_setting_id_tag>
BitstreamPbTypeSettingId;
typedef vtr::StrongId<bitstream_default_mode_setting_id_tag>
BitstreamDefaultModeSettingId;
typedef vtr::StrongId<bitstream_clock_routing_setting_id_tag>
BitstreamClockRoutingSettingId;
typedef vtr::StrongId<bitstream_interconnect_setting_id_tag>
BitstreamInterconnectSettingId;
typedef vtr::StrongId<overwrite_bitstream_id_tag> OverwriteBitstreamId;