forked from The-OpenROAD-Project/OpenSTA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCycleAccting.hh
122 lines (109 loc) · 3.41 KB
/
CycleAccting.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
// OpenSTA, Static Timing Analyzer
// Copyright (c) 2022, Parallax Software, Inc.
//
// 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
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
#pragma once
#include "UnorderedSet.hh"
#include "MinMax.hh"
#include "TimingRole.hh"
#include "StaState.hh"
#include "SdcClass.hh"
namespace sta {
class CycleAcctingHash
{
public:
size_t operator()(const CycleAccting *acct) const;
};
class CycleAcctingEqual
{
public:
bool operator()(const CycleAccting *acct1,
const CycleAccting *acct2) const;
};
class CycleAcctingLess
{
public:
bool operator()(const CycleAccting *acct1,
const CycleAccting *acct2) const;
};
typedef UnorderedSet<CycleAccting*, CycleAcctingHash, CycleAcctingEqual> CycleAcctingSet;
class CycleAcctings
{
public:
CycleAcctings(Sdc *sdc);
~CycleAcctings();
void clear();
// Find the cycle accounting info for paths that start at src clock
// edge and end at target clock edge.
CycleAccting *cycleAccting(const ClockEdge *src,
const ClockEdge *tgt);
void reportClkToClkMaxCycleWarnings(Report *report);
private:
Sdc *sdc_;
CycleAcctingSet cycle_acctings_;
};
class CycleAccting
{
public:
CycleAccting(const ClockEdge *src,
const ClockEdge *tgt);
// Fill in required times.
void findDelays(StaState *sta);
// Find delays when source clk edge is the default arrival clock edge
// (from unclocked set_input_delay).
void findDefaultArrivalSrcDelays();
const ClockEdge *src() const { return src_; }
const ClockEdge *target() const { return tgt_; }
float requiredTime(const TimingRole *check_role);
int sourceCycle(const TimingRole *check_role);
int targetCycle(const TimingRole *check_role);
float sourceTimeOffset(const TimingRole *check_role);
float targetTimeOffset(const TimingRole *check_role);
bool maxCyclesExceeded() const { return max_cycles_exceeded_; }
private:
void setHoldAccting(int src_cycle,
int tgt_cycle,
float delay,
float req);
void setAccting(TimingRole *role,
int src_cycle,
int tgt_cycle,
float delay,
float req);
void setSetupAccting(int src_cycle,
int tgt_cycle,
float delay,
float req);
void setDefaultSetupAccting(int src_cycle,
int tgt_cycle,
float delay,
float req);
void setDefaultHoldAccting(int src_cycle,
int tgt_cycle,
float delay,
float req);
int firstCycle(const ClockEdge *clk_edge) const;
const ClockEdge *src_;
const ClockEdge *tgt_;
// Setup/hold delay from source to target.
float delay_[TimingRole::index_max + 1];
// Delay from beginning of src_cycle_'th cycle to target edge.
float required_[TimingRole::index_max + 1];
// Source clock cycle offset.
int src_cycle_[TimingRole::index_max + 1];
// Target clock cycle offset.
int tgt_cycle_[TimingRole::index_max + 1];
bool max_cycles_exceeded_;
};
} // namespace