[lib] now default switch of clk ntwk is split to default_tap_switch and default_driver_switch

This commit is contained in:
tangxifan 2024-06-21 16:45:05 -07:00
parent 4fea194bac
commit 9ccd14bf4d
6 changed files with 49 additions and 20 deletions

View File

@ -1,4 +1,4 @@
<clock_networks default_segment="seg_len1" default_switch="fast_switch">
<clock_networks default_segment="seg_len1" default_tap_switch="fast_switch" default_driver_switch="slow_switch">
<clock_network name="example_network" width="8">
<spine name="spine_lvl3" start_x="0" start_y="2" end_x="2" end_y="2">
<switch_point tap="spine_lvl2_upper" x="2" y="2"/>

View File

@ -18,7 +18,8 @@ namespace openfpga { // Begin namespace openfpga
***********************************************************************/
ClockNetwork::ClockNetwork() {
default_segment_id_ = RRSegmentId::INVALID();
default_switch_id_ = RRSwitchId::INVALID();
default_tap_switch_id_ = RRSwitchId::INVALID();
default_driver_switch_id_ = RRSwitchId::INVALID();
is_dirty_ = true;
}
@ -172,11 +173,16 @@ RRSegmentId ClockNetwork::default_segment() const {
return default_segment_id_;
}
std::string ClockNetwork::default_switch_name() const {
return default_switch_name_;
std::string ClockNetwork::default_tap_switch_name() const {
return default_tap_switch_name_;
}
RRSwitchId ClockNetwork::default_switch() const { return default_switch_id_; }
std::string ClockNetwork::default_driver_switch_name() const {
return default_driver_switch_name_;
}
RRSwitchId ClockNetwork::default_tap_switch() const { return default_tap_switch_id_; }
RRSwitchId ClockNetwork::default_driver_switch() const { return default_driver_switch_id_; }
std::string ClockNetwork::tree_name(const ClockTreeId& tree_id) const {
VTR_ASSERT(valid_tree_id(tree_id));
@ -417,16 +423,24 @@ void ClockNetwork::set_default_segment(const RRSegmentId& seg_id) {
default_segment_id_ = seg_id;
}
void ClockNetwork::set_default_switch(const RRSwitchId& switch_id) {
default_switch_id_ = switch_id;
void ClockNetwork::set_default_tap_switch(const RRSwitchId& switch_id) {
default_tap_switch_id_ = switch_id;
}
void ClockNetwork::set_default_driver_switch(const RRSwitchId& switch_id) {
default_driver_switch_id_ = switch_id;
}
void ClockNetwork::set_default_segment_name(const std::string& name) {
default_segment_name_ = name;
}
void ClockNetwork::set_default_switch_name(const std::string& name) {
default_switch_name_ = name;
void ClockNetwork::set_default_tap_switch_name(const std::string& name) {
default_tap_switch_name_ = name;
}
void ClockNetwork::set_default_driver_switch_name(const std::string& name) {
default_driver_switch_name_ = name;
}
ClockTreeId ClockNetwork::create_tree(const std::string& name, size_t width) {

View File

@ -145,9 +145,11 @@ class ClockNetwork {
/* Reserve a number of trees to be memory efficent */
void reserve_trees(const size_t& num_trees);
void set_default_segment(const RRSegmentId& seg_id);
void set_default_switch(const RRSwitchId& switch_id);
void set_default_tap_switch(const RRSwitchId& switch_id);
void set_default_driver_switch(const RRSwitchId& switch_id);
void set_default_segment_name(const std::string& name);
void set_default_switch_name(const std::string& name);
void set_default_tap_switch_name(const std::string& name);
void set_default_driver_switch_name(const std::string& name);
/* Create a new tree, by default the tree can accomodate only 1 clock signal;
* use width to adjust the size */
ClockTreeId create_tree(const std::string& name, size_t width = 1);
@ -250,8 +252,11 @@ class ClockNetwork {
clock wires */
RRSegmentId default_segment_id_;
std::string
default_switch_name_; /* The routing switch interconnecting clock wire */
RRSwitchId default_switch_id_;
default_tap_switch_name_; /* The routing switch interconnecting clock wire */
RRSwitchId default_tap_switch_id_;
std::string
default_driver_switch_name_; /* The routing switch interconnecting clock wire */
RRSwitchId default_driver_switch_id_;
/* Fast lookup */
std::map<std::string, ClockTreeId> tree_name2id_map_;

View File

@ -6,8 +6,10 @@
constexpr const char* XML_CLOCK_NETWORK_ROOT_NAME = "clock_networks";
constexpr const char* XML_CLOCK_NETWORK_ATTRIBUTE_DEFAULT_SEGMENT =
"default_segment";
constexpr const char* XML_CLOCK_NETWORK_ATTRIBUTE_DEFAULT_SWITCH =
"default_switch";
constexpr const char* XML_CLOCK_NETWORK_ATTRIBUTE_DEFAULT_TAP_SWITCH =
"default_tap_switch";
constexpr const char* XML_CLOCK_NETWORK_ATTRIBUTE_DEFAULT_DRIVER_SWITCH =
"default_driver_switch";
constexpr const char* XML_CLOCK_TREE_NODE_NAME = "clock_network";
constexpr const char* XML_CLOCK_TREE_ATTRIBUTE_NAME = "name";
constexpr const char* XML_CLOCK_TREE_ATTRIBUTE_WIDTH = "width";

View File

@ -263,11 +263,17 @@ ClockNetwork read_xml_clock_network(const char* fname) {
.as_string();
clk_ntwk.set_default_segment_name(default_segment_name);
std::string default_switch_name =
get_attribute(xml_root, XML_CLOCK_NETWORK_ATTRIBUTE_DEFAULT_SWITCH,
std::string default_tap_switch_name =
get_attribute(xml_root, XML_CLOCK_NETWORK_ATTRIBUTE_DEFAULT_TAP_SWITCH,
loc_data)
.as_string();
clk_ntwk.set_default_switch_name(default_switch_name);
clk_ntwk.set_default_tap_switch_name(default_tap_switch_name);
std::string default_driver_switch_name =
get_attribute(xml_root, XML_CLOCK_NETWORK_ATTRIBUTE_DEFAULT_DRIVER_SWITCH,
loc_data)
.as_string();
clk_ntwk.set_default_driver_switch_name(default_driver_switch_name);
size_t num_trees =
std::distance(xml_root.children().begin(), xml_root.children().end());

View File

@ -168,8 +168,10 @@ int write_xml_clock_network(const char* fname, const ClockNetwork& clk_ntwk) {
fp << "<" << XML_CLOCK_NETWORK_ROOT_NAME;
write_xml_attribute(fp, XML_CLOCK_NETWORK_ATTRIBUTE_DEFAULT_SEGMENT,
clk_ntwk.default_segment_name().c_str());
write_xml_attribute(fp, XML_CLOCK_NETWORK_ATTRIBUTE_DEFAULT_SWITCH,
clk_ntwk.default_switch_name().c_str());
write_xml_attribute(fp, XML_CLOCK_NETWORK_ATTRIBUTE_DEFAULT_TAP_SWITCH,
clk_ntwk.default_tap_switch_name().c_str());
write_xml_attribute(fp, XML_CLOCK_NETWORK_ATTRIBUTE_DEFAULT_DRIVER_SWITCH,
clk_ntwk.default_driver_switch_name().c_str());
fp << ">"
<< "\n";