#pragma once #include #include "EnumNameMap.h" #include "Helper.h" using std::string; namespace gt { class LibertyCell; class LibertyPort; class TimingArc; struct LutTemplate; class Lut; enum class TimingSense { non_unate, positive_unate, negative_unate, unknown }; enum class TimingType { clear, combinational, combinational_fall, combinational_rise, falling_edge, hold_falling, hold_rising, min_pulse_width, minimum_period, nochange_high_high, nochange_high_low, nochange_low_high, nochange_low_low, non_seq_hold_falling, non_seq_hold_rising, non_seq_setup_falling, non_seq_setup_rising, preset, recovery_falling, recovery_rising, removal_falling, removal_rising, retaining_time, rising_edge, setup_falling, setup_rising, skew_falling, skew_rising, three_state_disable, three_state_disable_fall, three_state_disable_rise, three_state_enable, three_state_enable_fall, three_state_enable_rise, min_clock_tree_path, max_clock_tree_path, unknown }; TimingSense findTimingSense(const std::string sense_name); TimingType findTimingType(const std::string type_name); class InternalArc { public: InternalArc(); string encode_str_; LibertyCell* cell_; LibertyPort* liberty_port_; string related_port_name_; LibertyPort* from_port_ = nullptr; LibertyPort* to_port_ = nullptr; Lut* internal_power_[MAX_TRAN]; // Lut* internal_power_feature_; bool is_cond_ = false; string encode_arc(); InternalArc * clone() const { InternalArc* arc_copy = new InternalArc(); arc_copy->cell_ = this->cell_; //liberty_port need redirect arc_copy->related_port_name_ = this->related_port_name_; for_each_el(el){ arc_copy->internal_power_[el] = this->internal_power_[el]; } arc_copy->is_cond_ = this->is_cond_; return arc_copy; } }; class TimingArc { public: TimingArc(); // TimingArc(TimingArcSet* set, LibertyPort* from, LibertyPort* to, Tran irf, Tran orf); int id = -1; string encode_str_; LibertyCell* cell_; LibertyPort* liberty_port_; TimingType timing_type_ = TimingType::unknown; TimingSense timing_sense_ = TimingSense::unknown; string related_port_name_; LibertyPort* from_port_; LibertyPort* to_port_; string sdf_cond_; bool is_cond_ = false; // TimingArcSet* timing_arc_set_; Lut* cell_delay_[MAX_TRAN]; Lut* transition_[MAX_TRAN]; Lut* constraint_[MAX_TRAN]; TimingArc* clone() const { TimingArc* arc_copy = new TimingArc(); // 1. 浅拷贝指针成员(port pointer) arc_copy->from_port_ = this->from_port_; arc_copy->to_port_ = this->to_port_; arc_copy->cell_ = this->cell_; // 2. 拷贝基本数据类型 arc_copy->related_port_name_ = this->related_port_name_; arc_copy->timing_sense_ = this->timing_sense_; arc_copy->timing_type_ = this->timing_type_; arc_copy->is_cond_ = this->is_cond_; // 3. 拷贝 STL 容器(自动深拷贝) for_each_el(el){ arc_copy->cell_delay_[el] = this->cell_delay_[el]; arc_copy->transition_[el] = this->transition_[el]; arc_copy->constraint_[el] = this->constraint_[el]; } return arc_copy; } string encode_arc(); bool is_constraint() const; bool is_min_constraint() const; bool is_max_constraint() const; bool is_rising_edge_triggered() const; bool is_falling_edge_triggered() const; }; }; // namespace gt