3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-19 07:09:05 +00:00

sta: use ID::sta_arrival

This commit is contained in:
Eddie Hung 2020-04-02 12:13:37 -07:00
parent cf6b60f79c
commit 10eaeabe1e
3 changed files with 10 additions and 9 deletions

View file

@ -154,6 +154,7 @@ X(SRC_EN)
X(SRC_PEN)
X(SRC_POL)
X(SRC_WIDTH)
X(sta_arrival)
X(STATE_BITS)
X(STATE_NUM)
X(STATE_NUM_LOG2)

View file

@ -141,8 +141,8 @@ struct TimingInfo
}
}
else if (cell->type == ID($specrule)) {
auto type = cell->getParam(ID::TYPE).decode_string();
if (type != "$setup" && type != "$setuphold")
IdString type = cell->getParam(ID::TYPE).decode_string();
if (type != ID($setup) && type != ID($setuphold))
continue;
auto src = cell->getPort(ID::SRC);
auto dst = cell->getPort(ID::DST).as_bit();

View file

@ -135,7 +135,7 @@ struct StaWorker
for (const auto &b : sigmap(wire))
queue.emplace_back(b);
// All primary inputs to arrive at time zero
wire->set_intvec_attribute(ID(sta_arrival), std::vector<int>(GetSize(wire), 0));
wire->set_intvec_attribute(ID::sta_arrival, std::vector<int>(GetSize(wire), 0));
}
if (wire->port_output)
for (const auto &b : sigmap(wire))
@ -152,12 +152,12 @@ struct StaWorker
auto it = data.find(b);
if (it == data.end())
continue;
const auto& src_arrivals = b.wire->get_intvec_attribute(ID(sta_arrival));
const auto& src_arrivals = b.wire->get_intvec_attribute(ID::sta_arrival);
log_assert(GetSize(src_arrivals) == GetSize(b.wire));
auto src_arrival = src_arrivals[b.offset];
for (const auto &d : it->second.fanouts) {
const auto &dst_bit = std::get<0>(d);
auto dst_arrivals = dst_bit.wire->get_intvec_attribute(ID(sta_arrival));
auto dst_arrivals = dst_bit.wire->get_intvec_attribute(ID::sta_arrival);
if (dst_arrivals.empty())
dst_arrivals = std::vector<int>(GetSize(dst_bit.wire), -1);
else
@ -166,7 +166,7 @@ struct StaWorker
auto new_arrival = src_arrival + std::get<1>(d);
if (dst_arrival < new_arrival) {
dst_arrival = std::max(dst_arrival, new_arrival);
dst_bit.wire->set_intvec_attribute(ID(sta_arrival), dst_arrivals);
dst_bit.wire->set_intvec_attribute(ID::sta_arrival, dst_arrivals);
queue.emplace_back(dst_bit);
data[dst_bit].backtrack = b;
@ -194,7 +194,7 @@ struct StaWorker
}
auto jt = data.find(b);
while (jt != data.end()) {
int arrival = b.wire->get_intvec_attribute(ID(sta_arrival))[b.offset];
int arrival = b.wire->get_intvec_attribute(ID::sta_arrival)[b.offset];
if (jt->second.driver) {
log(" %s\n", log_signal(b));
log(" %6d %s (%s.%s->%s)\n", arrival, log_id(jt->second.driver), log_id(jt->second.driver->type), log_id(jt->second.src_port), log_id(jt->second.dst_port));
@ -210,11 +210,11 @@ struct StaWorker
std::map<int, unsigned> arrival_histogram;
for (const auto &i : endpoints) {
const auto &b = i.first;
if (!b.wire->attributes.count(ID(sta_arrival))) {
if (!b.wire->attributes.count(ID::sta_arrival)) {
log_warning("Wire %s.%s has no (* sta_arrival *) value.\n", log_id(module), log_signal(b));
continue;
}
auto arrival = b.wire->get_intvec_attribute(ID(sta_arrival))[b.offset];
auto arrival = b.wire->get_intvec_attribute(ID::sta_arrival)[b.offset];
if (arrival < 0) {
// FIXME: Might be an unreachable signal
// Might be a constant driven signal (e.g. through OBUF)