2018-09-28 17:54:21 +02:00
|
|
|
// OpenSTA, Static Timing Analyzer
|
2025-01-22 02:54:33 +01:00
|
|
|
// Copyright (c) 2025, Parallax Software, Inc.
|
2018-09-28 17:54:21 +02:00
|
|
|
//
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
// (at your option) any later version.
|
|
|
|
|
//
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2022-01-04 18:17:08 +01:00
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2018-09-28 17:54:21 +02:00
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
//
|
|
|
|
|
// You should have received a copy of the GNU General Public License
|
2022-01-04 18:17:08 +01:00
|
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2025-01-22 02:54:33 +01:00
|
|
|
//
|
|
|
|
|
// The origin of this software must not be misrepresented; you must not
|
|
|
|
|
// claim that you wrote the original software.
|
|
|
|
|
//
|
|
|
|
|
// Altered source versions must be plainly marked as such, and must not be
|
|
|
|
|
// misrepresented as being the original software.
|
|
|
|
|
//
|
|
|
|
|
// This notice may not be removed or altered from any source distribution.
|
2018-09-28 17:54:21 +02:00
|
|
|
|
2020-02-16 01:13:16 +01:00
|
|
|
#pragma once
|
2018-09-28 17:54:21 +02:00
|
|
|
|
2025-03-31 00:27:53 +02:00
|
|
|
#include <map>
|
|
|
|
|
|
2020-04-05 23:53:44 +02:00
|
|
|
#include "MinMax.hh"
|
|
|
|
|
#include "StringUtil.hh"
|
2018-09-28 17:54:21 +02:00
|
|
|
|
|
|
|
|
namespace sta {
|
|
|
|
|
|
|
|
|
|
class TimingRole;
|
|
|
|
|
|
2025-04-12 01:59:48 +02:00
|
|
|
typedef std::map<std::string, const TimingRole*> TimingRoleMap;
|
2018-09-28 17:54:21 +02:00
|
|
|
|
|
|
|
|
class TimingRole
|
|
|
|
|
{
|
|
|
|
|
public:
|
2025-03-31 00:27:53 +02:00
|
|
|
static const TimingRole *find(const char *name);
|
2018-09-28 17:54:21 +02:00
|
|
|
// Singleton accessors.
|
2025-03-31 00:27:53 +02:00
|
|
|
static const TimingRole *wire() { return &wire_; }
|
|
|
|
|
static const TimingRole *combinational() { return &combinational_; }
|
|
|
|
|
static const TimingRole *tristateEnable() { return &tristate_enable_; }
|
|
|
|
|
static const TimingRole *tristateDisable() { return &tristate_disable_; }
|
|
|
|
|
static const TimingRole *regClkToQ() { return ®_clk_q_; }
|
|
|
|
|
static const TimingRole *regSetClr() { return ®_set_clr_; }
|
|
|
|
|
static const TimingRole *latchEnToQ() { return &latch_en_q_; }
|
|
|
|
|
static const TimingRole *latchDtoQ() { return &latch_d_q_; }
|
|
|
|
|
static const TimingRole *setup() { return &setup_; }
|
|
|
|
|
static const TimingRole *hold() { return &hold_; }
|
|
|
|
|
static const TimingRole *recovery() { return &recovery_; }
|
|
|
|
|
static const TimingRole *removal() { return &removal_; }
|
|
|
|
|
static const TimingRole *width() { return &width_; }
|
|
|
|
|
static const TimingRole *period() { return &period_; }
|
|
|
|
|
static const TimingRole *skew() { return &skew_; }
|
|
|
|
|
static const TimingRole *nochange() { return &nochange_; }
|
|
|
|
|
static const TimingRole *outputSetup() { return &output_setup_; }
|
|
|
|
|
static const TimingRole *outputHold() { return &output_hold_; }
|
|
|
|
|
static const TimingRole *gatedClockSetup() { return &gated_clk_setup_; }
|
|
|
|
|
static const TimingRole *gatedClockHold() { return &gated_clk_hold_; }
|
|
|
|
|
static const TimingRole *latchSetup() { return &latch_setup_; }
|
|
|
|
|
static const TimingRole *latchHold() { return &latch_hold_; }
|
|
|
|
|
static const TimingRole *dataCheckSetup() { return &data_check_setup_; }
|
|
|
|
|
static const TimingRole *dataCheckHold() { return &data_check_hold_; }
|
|
|
|
|
static const TimingRole *nonSeqSetup() { return &non_seq_setup_; }
|
|
|
|
|
static const TimingRole *nonSeqHold() { return &non_seq_hold_; }
|
|
|
|
|
static const TimingRole *clockTreePathMin() { return &clock_tree_path_min_; }
|
|
|
|
|
static const TimingRole *clockTreePathMax() { return &clock_tree_path_max_; }
|
2025-04-12 01:59:48 +02:00
|
|
|
const std::string &to_string() const { return name_; }
|
2018-09-28 17:54:21 +02:00
|
|
|
int index() const { return index_; }
|
|
|
|
|
bool isWire() const;
|
|
|
|
|
bool isTimingCheck() const { return is_timing_check_; }
|
2024-04-17 20:49:19 +02:00
|
|
|
// TIming check but not width or period.
|
|
|
|
|
bool isTimingCheckBetween() const;
|
2018-09-28 17:54:21 +02:00
|
|
|
bool isAsyncTimingCheck() const;
|
|
|
|
|
bool isNonSeqTimingCheck() const { return is_non_seq_check_; }
|
|
|
|
|
bool isDataCheck() const;
|
2021-11-04 18:30:23 +01:00
|
|
|
bool isLatchDtoQ() const;
|
2018-09-28 17:54:21 +02:00
|
|
|
const TimingRole *genericRole() const;
|
|
|
|
|
const TimingRole *sdfRole() const;
|
|
|
|
|
// Timing check data path min/max.
|
2025-03-31 00:27:53 +02:00
|
|
|
const MinMax *pathMinMax() const { return path_min_max_; }
|
2018-09-28 17:54:21 +02:00
|
|
|
// Timing check target clock path insertion delay early/late.
|
|
|
|
|
const EarlyLate *tgtClkEarlyLate() const;
|
|
|
|
|
|
|
|
|
|
// Pseudo role to match sdf IOPATH.
|
2025-03-31 00:27:53 +02:00
|
|
|
static const TimingRole *sdfIopath() { return &sdf_iopath_; }
|
2018-09-28 17:54:21 +02:00
|
|
|
static bool less(const TimingRole *role1,
|
|
|
|
|
const TimingRole *role2);
|
|
|
|
|
static const int index_max = 26;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
TimingRole(const char *name,
|
|
|
|
|
bool is_sdf_iopath,
|
|
|
|
|
bool is_timing_check,
|
|
|
|
|
bool is_non_seq_check,
|
2025-03-31 00:27:53 +02:00
|
|
|
const MinMax *path_min_max,
|
2019-03-13 01:25:53 +01:00
|
|
|
// generic_type = nullptr means type is the same as this.
|
2025-03-31 00:27:53 +02:00
|
|
|
const TimingRole *generic_role,
|
2018-09-28 17:54:21 +02:00
|
|
|
int index);
|
|
|
|
|
|
2025-04-12 01:59:48 +02:00
|
|
|
const std::string name_;
|
2018-09-28 17:54:21 +02:00
|
|
|
bool is_timing_check_;
|
|
|
|
|
bool is_sdf_iopath_;
|
|
|
|
|
bool is_non_seq_check_;
|
2025-03-31 00:27:53 +02:00
|
|
|
const TimingRole *generic_role_;
|
2018-09-28 17:54:21 +02:00
|
|
|
unsigned index_;
|
2025-03-31 00:27:53 +02:00
|
|
|
const MinMax *path_min_max_;
|
2018-09-28 17:54:21 +02:00
|
|
|
|
2025-03-31 00:27:53 +02:00
|
|
|
static const TimingRole wire_;
|
|
|
|
|
static const TimingRole combinational_;
|
|
|
|
|
static const TimingRole tristate_enable_;
|
|
|
|
|
static const TimingRole tristate_disable_;
|
|
|
|
|
static const TimingRole reg_clk_q_;
|
|
|
|
|
static const TimingRole reg_set_clr_;
|
|
|
|
|
static const TimingRole latch_en_q_;
|
|
|
|
|
static const TimingRole latch_d_q_;
|
|
|
|
|
static const TimingRole setup_;
|
|
|
|
|
static const TimingRole hold_;
|
|
|
|
|
static const TimingRole recovery_;
|
|
|
|
|
static const TimingRole removal_;
|
|
|
|
|
static const TimingRole width_;
|
|
|
|
|
static const TimingRole period_;
|
|
|
|
|
static const TimingRole skew_;
|
|
|
|
|
static const TimingRole nochange_;
|
|
|
|
|
static const TimingRole sdf_iopath_;
|
|
|
|
|
static const TimingRole output_setup_;
|
|
|
|
|
static const TimingRole output_hold_;
|
|
|
|
|
static const TimingRole gated_clk_setup_;
|
|
|
|
|
static const TimingRole gated_clk_hold_;
|
|
|
|
|
static const TimingRole latch_setup_;
|
|
|
|
|
static const TimingRole latch_hold_;
|
|
|
|
|
static const TimingRole data_check_setup_;
|
|
|
|
|
static const TimingRole data_check_hold_;
|
|
|
|
|
static const TimingRole non_seq_setup_;
|
|
|
|
|
static const TimingRole non_seq_hold_;
|
|
|
|
|
static const TimingRole clock_tree_path_min_;
|
|
|
|
|
static const TimingRole clock_tree_path_max_;
|
2018-09-28 17:54:21 +02:00
|
|
|
static TimingRoleMap timing_roles_;
|
|
|
|
|
|
|
|
|
|
friend class TimingRoleLess;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace
|