mirror of
https://github.com/YosysHQ/yosys
synced 2025-08-06 03:10:26 +00:00
timinginfo: arrival/required times with clocks
This commit is contained in:
parent
b96866c456
commit
ddbe81df78
4 changed files with 63 additions and 66 deletions
|
@ -82,7 +82,7 @@ struct StaWorker
|
|||
auto it = t.required.find(namebit);
|
||||
if (it == t.required.end())
|
||||
continue;
|
||||
endpoints[bit] = it->second;
|
||||
endpoints[bit] = it->second.first;
|
||||
}
|
||||
if (cell->output(conn.first)) {
|
||||
dst_bits.insert(std::make_pair(bit,namebit));
|
||||
|
@ -90,14 +90,8 @@ struct StaWorker
|
|||
auto it = t.arrival.find(namebit);
|
||||
if (it == t.arrival.end())
|
||||
continue;
|
||||
auto arrivals = bit.wire->get_intvec_attribute(ID(sta_arrival));
|
||||
if (arrivals.empty())
|
||||
arrivals = std::vector<int>(GetSize(bit.wire), -1);
|
||||
else
|
||||
log_assert(GetSize(arrivals) == GetSize(bit.wire));
|
||||
arrivals[bit.offset] = it->second;
|
||||
bit.wire->set_intvec_attribute(ID(sta_arrival), arrivals);
|
||||
queue.emplace_back(bit);
|
||||
const auto &s = it->second.second;
|
||||
fanouts[cell->getPort(s.name)[s.offset]].emplace_back(bit,it->second.first);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -143,7 +137,7 @@ struct StaWorker
|
|||
auto new_arrival = src_arrival + d.second + endpoints.at(d.first, 0);
|
||||
if (dst_arrival < new_arrival) {
|
||||
dst_arrival = std::max(dst_arrival, new_arrival);
|
||||
if (dst_arrival > maxarrival) {
|
||||
if (endpoints.count(d.first) && dst_arrival > maxarrival) {
|
||||
maxarrival = dst_arrival;
|
||||
maxbit = d.first;
|
||||
}
|
||||
|
@ -169,6 +163,10 @@ 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))) {
|
||||
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];
|
||||
arrival += i.second;
|
||||
arrival_histogram[arrival]++;
|
||||
|
|
|
@ -440,25 +440,26 @@ void prep_delays(RTLIL::Design *design, bool dff_mode)
|
|||
if (!port_wire->port_input)
|
||||
continue;
|
||||
|
||||
SigSpec O = module->addWire(NEW_ID, GetSize(conn.second));
|
||||
for (int i = 0; i < GetSize(conn.second); i++) {
|
||||
auto d = t.at(TimingInfo::NameBit(conn.first,i), 0);
|
||||
if (d == 0)
|
||||
continue;
|
||||
auto d = i.second.first;
|
||||
if (d == 0)
|
||||
continue;
|
||||
auto offset = i.first.offset;
|
||||
|
||||
auto O = module->addWire(NEW_ID);
|
||||
auto rhs = cell->getPort(i.first.name);
|
||||
#ifndef NDEBUG
|
||||
if (ys_debug(1)) {
|
||||
static std::set<std::tuple<IdString,IdString,int>> seen;
|
||||
if (seen.emplace(derived_type, conn.first, i).second) log("%s.%s[%d] abc9_required = %d\n",
|
||||
log_id(cell->type), log_id(conn.first), i, d);
|
||||
}
|
||||
#endif
|
||||
auto box = module->addCell(NEW_ID, ID($__ABC9_DELAY));
|
||||
box->setPort(ID::I, conn.second[i]);
|
||||
box->setPort(ID::O, O[i]);
|
||||
box->setParam(ID::DELAY, d);
|
||||
conn.second[i] = O[i];
|
||||
if (ys_debug(1)) {
|
||||
static std::set<std::pair<IdString,TimingInfo::NameBit>> seen;
|
||||
if (seen.emplace(derived_type, i.first).second) log("%s.%s[%d] abc9_required = %d\n",
|
||||
log_id(cell->type), log_id(i.first.name), offset, d);
|
||||
}
|
||||
#endif
|
||||
auto box = module->addCell(NEW_ID, ID($__ABC9_DELAY));
|
||||
box->setPort(ID::I, rhs[offset]);
|
||||
box->setPort(ID::O, O);
|
||||
box->setParam(ID::DELAY, d);
|
||||
rhs[offset] = O;
|
||||
cell->setPort(i.first.name, rhs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -606,13 +607,13 @@ void prep_box(RTLIL::Design *design, bool dff_mode)
|
|||
// Assume that no setup time means zero
|
||||
ss << 0;
|
||||
else {
|
||||
ss << it->second;
|
||||
ss << it->second.first;
|
||||
|
||||
#ifndef NDEBUG
|
||||
if (ys_debug(1)) {
|
||||
static std::set<std::pair<IdString,IdString>> seen;
|
||||
if (seen.emplace(module->name, port_name).second) log("%s.%s abc9_required = %d\n", log_id(module),
|
||||
log_id(port_name), it->second);
|
||||
log_id(port_name), it->second.first);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue