3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-06-03 21:01:23 +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_PEN)
X(SRC_POL) X(SRC_POL)
X(SRC_WIDTH) X(SRC_WIDTH)
X(sta_arrival)
X(STATE_BITS) X(STATE_BITS)
X(STATE_NUM) X(STATE_NUM)
X(STATE_NUM_LOG2) X(STATE_NUM_LOG2)

View file

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

View file

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