Skip to content

Commit 177340f

Browse files
committed
wip
1 parent 334ac9d commit 177340f

File tree

2 files changed

+23
-19
lines changed

2 files changed

+23
-19
lines changed

common/kernel/timing.cc

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -262,13 +262,13 @@ void TimingAnalyser::setup_port_domains_and_constraints()
262262
// copy domains across routing
263263
if (pi.net != nullptr)
264264
for (auto &usr : pi.net->users)
265-
copy_domains(port, CellPortKey(usr), false);
265+
propagate_domains_and_constraints(port, CellPortKey(usr), false);
266266
} else {
267267
// copy domains from input to output
268268
for (auto &fanout : pd.cell_arcs) {
269269
if (fanout.type != CellArc::COMBINATIONAL)
270270
continue;
271-
copy_domains(port, CellPortKey(port.cell, fanout.other_port), false);
271+
propagate_domains_and_constraints(port, CellPortKey(port.cell, fanout.other_port), false);
272272
}
273273
}
274274
}
@@ -281,7 +281,7 @@ void TimingAnalyser::setup_port_domains_and_constraints()
281281
for (auto &fanin : pd.cell_arcs) {
282282
if (fanin.type != CellArc::COMBINATIONAL)
283283
continue;
284-
copy_domains(port, CellPortKey(port.cell, fanin.other_port), true);
284+
propagate_domains_and_constraints(port, CellPortKey(port.cell, fanin.other_port), true);
285285
}
286286
} else {
287287
if (first_iter) {
@@ -302,7 +302,7 @@ void TimingAnalyser::setup_port_domains_and_constraints()
302302
}
303303
// copy port to driver
304304
if (pi.net != nullptr && pi.net->driver.cell != nullptr)
305-
copy_domains(port, CellPortKey(pi.net->driver), true);
305+
propagate_domains_and_constraints(port, CellPortKey(pi.net->driver), true);
306306
}
307307
}
308308
// Iterate over ports and find domain pairs
@@ -1296,17 +1296,13 @@ domain_id_t TimingAnalyser::domain_pair_id(domain_id_t launch, domain_id_t captu
12961296
return inserted.first->second;
12971297
}
12981298

1299-
void TimingAnalyser::copy_domains(const CellPortKey &from, const CellPortKey &to, bool backward)
1299+
void TimingAnalyser::propagate_domains_and_constraints(const CellPortKey &from, const CellPortKey &to, bool backward)
13001300
{
13011301
auto &f = ports.at(from), &t = ports.at(to);
13021302
for (auto &dom : (backward ? f.required : f.arrival)) {
13031303
updated_domains_constraints |= (backward ? t.required : t.arrival).emplace(dom.first, ArrivReqTime{}).second;
13041304
}
1305-
}
13061305

1307-
void TimingAnalyser::propagate_constraints(const CellPortKey &from, const CellPortKey &to, bool backward)
1308-
{
1309-
auto &f = ports.at(from), &t = ports.at(to);
13101306
for (auto &ct : f.per_constraint) {
13111307
bool has_constraint = t.per_constraint.count(ct.first) > 0;
13121308
bool same_constraint = has_constraint ? ct.second == t.per_constraint.at(ct.first) : false;

common/kernel/timing.h

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ struct ClockDomainKey
5959
};
6060

6161
// TODO: perhaps move these elsewhere
62+
6263
struct FalsePath
6364
{
6465
};
@@ -93,14 +94,18 @@ struct MultiCycle
9394
size_t cycles;
9495
};
9596

96-
struct TimingException
97+
using TimingException = std::variant<FalsePath, MinMaxDelay, MultiCycle>;
98+
99+
struct PathConstraint
97100
{
98-
std::variant<FalsePath, MinMaxDelay, MultiCycle> type;
101+
TimingException exception;
99102

100103
pool<CellPortKey> startpoints;
101104
pool<CellPortKey> endpoints;
102105
};
103106

107+
typedef int exception_id_t;
108+
104109
typedef int domain_id_t;
105110

106111
struct ClockDomainPairKey
@@ -114,8 +119,6 @@ struct ClockDomainPairKey
114119
unsigned int hash() const { return mkhash(launch, capture); }
115120
};
116121

117-
typedef int constraint_id_t;
118-
119122
struct TimingAnalyser
120123
{
121124
public:
@@ -233,9 +236,15 @@ struct TimingAnalyser
233236
: type(type), other_port(other_port), value(value), edge(edge){};
234237
};
235238

236-
enum HasConstraint
239+
// To track whether a path has a timing exception during a forwards/backwards pass.
240+
// During the forward pass the startpoints propagate out FORWARDONLY.
241+
// During the backwards pass all ports that contain a "FORWARDONLY" will
242+
// move to "CONSTRAINED". Once the forward and backward passes have been
243+
// done only the constraints on ports that are "CONSTRAINED" apply.
244+
enum class HasPathException
237245
{
238246
FORWARDONLY,
247+
BACKWARDONLY,
239248
CONSTRAINED
240249
};
241250

@@ -258,7 +267,7 @@ struct TimingAnalyser
258267
worst_hold_slack = std::numeric_limits<delay_t>::max();
259268
// Forall timing constraints the uint8_t indicates
260269
// - During forward walking
261-
dict<constraint_id_t, uint8_t> per_constraint;
270+
dict<exception_id_t, uint8_t> per_timing_exception;
262271
};
263272

264273
struct PerDomain
@@ -284,9 +293,7 @@ struct TimingAnalyser
284293
domain_id_t domain_id(const NetInfo *net, ClockEdge edge);
285294
domain_id_t domain_pair_id(domain_id_t launch, domain_id_t capture);
286295

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);
296+
void propagate_domains_and_constraints(const CellPortKey &from, const CellPortKey &to, bool backwards);
290297

291298
[[maybe_unused]] static const std::string arcType_to_str(CellArc::ArcType typ);
292299

@@ -296,11 +303,12 @@ struct TimingAnalyser
296303
std::vector<PerDomain> domains;
297304
std::vector<PerDomainPair> domain_pairs;
298305
dict<std::pair<IdString, IdString>, delay_t> clock_delays;
306+
std::vector<PathConstraint> path_constraints;
299307

300308
std::vector<CellPortKey> topological_order;
301309

302310
domain_id_t async_clock_id;
303-
constraint_id_t clock_constraint_id;
311+
exception_id_t no_exception_id;
304312

305313
Context *ctx;
306314

0 commit comments

Comments
 (0)