25
25
26
26
NEXTPNR_NAMESPACE_BEGIN
27
27
28
- struct CellPortKey
29
- {
30
- CellPortKey (){};
31
- CellPortKey (IdString cell, IdString port) : cell(cell), port(port){};
32
- explicit CellPortKey (const PortRef &pr)
33
- {
34
- NPNR_ASSERT (pr.cell != nullptr );
35
- cell = pr.cell ->name ;
36
- port = pr.port ;
37
- }
38
- IdString cell, port;
39
- unsigned int hash () const { return mkhash (cell.hash (), port.hash ()); }
40
- inline bool operator ==(const CellPortKey &other) const { return (cell == other.cell ) && (port == other.port ); }
41
- inline bool operator !=(const CellPortKey &other) const { return (cell != other.cell ) || (port != other.port ); }
42
- inline bool operator <(const CellPortKey &other) const
43
- {
44
- return cell == other.cell ? port < other.port : cell < other.cell ;
45
- }
46
- };
47
-
48
28
struct ClockDomainKey
49
29
{
50
30
IdString clock;
@@ -58,48 +38,7 @@ struct ClockDomainKey
58
38
inline bool operator ==(const ClockDomainKey &other) const { return (clock == other.clock ) && (edge == other.edge ); }
59
39
};
60
40
61
- // TODO: perhaps move these elsewhere
62
- struct FalsePath
63
- {
64
- };
65
-
66
- struct MinMaxDelay
67
- {
68
- enum class Type
69
- {
70
- MAXDELAY,
71
- MINDELAY
72
- };
73
-
74
- [[maybe_unused]] static const std::string type_to_str (Type typ)
75
- {
76
- switch (typ) {
77
- case Type::MAXDELAY:
78
- return " MAXDELAY" ;
79
- case Type::MINDELAY:
80
- return " MINDELAY" ;
81
- default :
82
- log_error (" Impossible MinMaxDelay::Type" );
83
- }
84
- }
85
-
86
- Type type;
87
- delay_t delay;
88
- bool datapath_only;
89
- };
90
-
91
- struct MultiCycle
92
- {
93
- size_t cycles;
94
- };
95
-
96
- struct TimingException
97
- {
98
- std::variant<FalsePath, MinMaxDelay, MultiCycle> type;
99
-
100
- pool<CellPortKey> startpoints;
101
- pool<CellPortKey> endpoints;
102
- };
41
+ typedef int exception_id_t ;
103
42
104
43
typedef int domain_id_t ;
105
44
@@ -114,8 +53,6 @@ struct ClockDomainPairKey
114
53
unsigned int hash () const { return mkhash (launch, capture); }
115
54
};
116
55
117
- typedef int constraint_id_t ;
118
-
119
56
struct TimingAnalyser
120
57
{
121
58
public:
@@ -233,9 +170,15 @@ struct TimingAnalyser
233
170
: type(type), other_port(other_port), value(value), edge(edge){};
234
171
};
235
172
236
- enum HasConstraint
173
+ // To track whether a path has a timing exception during a forwards/backwards pass.
174
+ // During the forward pass the startpoints propagate out FORWARDONLY.
175
+ // During the backwards pass all ports that contain a "FORWARDONLY" will
176
+ // move to "CONSTRAINED". Once the forward and backward passes have been
177
+ // done only the constraints on ports that are "CONSTRAINED" apply.
178
+ enum class HasPathException
237
179
{
238
180
FORWARDONLY,
181
+ BACKWARDONLY,
239
182
CONSTRAINED
240
183
};
241
184
@@ -258,7 +201,7 @@ struct TimingAnalyser
258
201
worst_hold_slack = std::numeric_limits<delay_t >::max();
259
202
// Forall timing constraints the uint8_t indicates
260
203
// - During forward walking
261
- dict<constraint_id_t , uint8_t > per_constraint ;
204
+ dict<exception_id_t , uint8_t > per_timing_exception ;
262
205
};
263
206
264
207
struct PerDomain
@@ -284,9 +227,7 @@ struct TimingAnalyser
284
227
domain_id_t domain_id (const NetInfo *net, ClockEdge edge);
285
228
domain_id_t domain_pair_id (domain_id_t launch, domain_id_t capture);
286
229
287
- void copy_domains (const CellPortKey &from, const CellPortKey &to, bool backwards);
288
-
289
- void propagate_constraints (const CellPortKey &from, const CellPortKey &to, bool backwards);
230
+ void propagate_domains_and_constraints (const CellPortKey &from, const CellPortKey &to, bool backwards);
290
231
291
232
[[maybe_unused]] static const std::string arcType_to_str (CellArc::ArcType typ);
292
233
@@ -296,11 +237,12 @@ struct TimingAnalyser
296
237
std::vector<PerDomain> domains;
297
238
std::vector<PerDomainPair> domain_pairs;
298
239
dict<std::pair<IdString, IdString>, delay_t > clock_delays;
240
+ // std::vector<PathConstraint> path_constraints;
299
241
300
242
std::vector<CellPortKey> topological_order;
301
243
302
244
domain_id_t async_clock_id;
303
- constraint_id_t clock_constraint_id ;
245
+ exception_id_t no_exception_id ;
304
246
305
247
Context *ctx;
306
248
0 commit comments