Consider clocked cells with COUT, consider constant nets
This commit is contained in:
parent
266b761f41
commit
3f5c0373a5
@ -155,7 +155,7 @@ struct Timing
|
|||||||
for (auto &cell : ctx->cells) {
|
for (auto &cell : ctx->cells) {
|
||||||
input_ports.clear();
|
input_ports.clear();
|
||||||
output_ports.clear();
|
output_ports.clear();
|
||||||
bool is_io = cell.second->type == ctx->id_sb_io;
|
bool is_io = cell.second->type == ctx->id_sb_io; // HACK HACK HACK
|
||||||
for (auto& port : cell.second->ports) {
|
for (auto& port : cell.second->ports) {
|
||||||
if (!port.second.net) continue;
|
if (!port.second.net) continue;
|
||||||
if (port.second.type == PORT_OUT)
|
if (port.second.type == PORT_OUT)
|
||||||
@ -187,28 +187,41 @@ struct Timing
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto it = ctx->nets.find(ctx->id("$PACKER_VCC_NET"));
|
||||||
|
if (it != ctx->nets.end()) {
|
||||||
|
topographical_order.emplace_back(it->second.get());
|
||||||
|
net_data.emplace(it->second.get(), TimingData{});
|
||||||
|
}
|
||||||
|
it = ctx->nets.find(ctx->id("$PACKER_GND_NET"));
|
||||||
|
if (it != ctx->nets.end()) {
|
||||||
|
topographical_order.emplace_back(it->second.get());
|
||||||
|
net_data.emplace(it->second.get(), TimingData{});
|
||||||
|
}
|
||||||
|
|
||||||
std::deque<NetInfo*> queue(topographical_order.begin(), topographical_order.end());
|
std::deque<NetInfo*> queue(topographical_order.begin(), topographical_order.end());
|
||||||
|
|
||||||
while (!queue.empty()) {
|
while (!queue.empty()) {
|
||||||
const auto net = queue.front();
|
const auto net = queue.front();
|
||||||
queue.pop_front();
|
queue.pop_front();
|
||||||
|
|
||||||
|
DelayInfo clkToQ;
|
||||||
for (auto &usr : net->users) {
|
for (auto &usr : net->users) {
|
||||||
if (ctx->getPortClock(usr.cell, usr.port) != IdString()) {
|
auto clock_domain = ctx->getPortClock(usr.cell, usr.port);
|
||||||
} else {
|
// Follow outputs of the user
|
||||||
// Follow outputs of the user
|
for (auto& port : usr.cell->ports) {
|
||||||
for (auto& port : usr.cell->ports) {
|
if (port.second.type == PORT_OUT && port.second.net) {
|
||||||
if (port.second.type == PORT_OUT && port.second.net) {
|
// Skip if this is a clocked output
|
||||||
DelayInfo comb_delay;
|
if (clock_domain != IdString() && ctx->getCellDelay(usr.cell, clock_domain, port.first, clkToQ))
|
||||||
bool is_path = ctx->getCellDelay(usr.cell, usr.port, port.first, comb_delay);
|
continue;
|
||||||
if (is_path) {
|
DelayInfo comb_delay;
|
||||||
auto it = port_fanin.find(&port.second);
|
bool is_path = ctx->getCellDelay(usr.cell, usr.port, port.first, comb_delay);
|
||||||
NPNR_ASSERT(it != port_fanin.end());
|
if (is_path) {
|
||||||
if (--it->second == 0) {
|
auto it = port_fanin.find(&port.second);
|
||||||
topographical_order.emplace_back(port.second.net);
|
NPNR_ASSERT(it != port_fanin.end());
|
||||||
queue.emplace_back(port.second.net);
|
if (--it->second == 0) {
|
||||||
port_fanin.erase(it);
|
topographical_order.emplace_back(port.second.net);
|
||||||
}
|
queue.emplace_back(port.second.net);
|
||||||
|
port_fanin.erase(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -216,6 +229,9 @@ struct Timing
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NPNR_ASSERT(port_fanin.empty());
|
||||||
|
port_fanin.clear();
|
||||||
|
|
||||||
// Find the maximum arrival time and max path length for each net
|
// Find the maximum arrival time and max path length for each net
|
||||||
for (auto net : topographical_order) {
|
for (auto net : topographical_order) {
|
||||||
auto &nd = net_data.at(net);
|
auto &nd = net_data.at(net);
|
||||||
@ -225,7 +241,7 @@ struct Timing
|
|||||||
for (auto &usr : net->users) {
|
for (auto &usr : net->users) {
|
||||||
if (ctx->getPortClock(usr.cell, usr.port) != IdString()) {
|
if (ctx->getPortClock(usr.cell, usr.port) != IdString()) {
|
||||||
} else {
|
} else {
|
||||||
auto net_delay = ctx->getNetinfoRouteDelay(net, usr);
|
auto net_delay = net_delays ? ctx->getNetinfoRouteDelay(net, usr) : delay_t();
|
||||||
auto budget_override = ctx->getBudgetOverride(net, usr, net_delay);
|
auto budget_override = ctx->getBudgetOverride(net, usr, net_delay);
|
||||||
auto usr_arrival = net_arrival + net_delay;
|
auto usr_arrival = net_arrival + net_delay;
|
||||||
// Follow outputs of the user
|
// Follow outputs of the user
|
||||||
@ -254,13 +270,14 @@ struct Timing
|
|||||||
const delay_t net_length_plus_one = nd.max_path_length + 1;
|
const delay_t net_length_plus_one = nd.max_path_length + 1;
|
||||||
auto& net_min_remaining_budget = nd.min_remaining_budget;
|
auto& net_min_remaining_budget = nd.min_remaining_budget;
|
||||||
for (auto &usr : net->users) {
|
for (auto &usr : net->users) {
|
||||||
const auto net_delay = ctx->getNetinfoRouteDelay(net, usr);
|
auto net_delay = net_delays ? ctx->getNetinfoRouteDelay(net, usr) : delay_t();
|
||||||
auto budget_override = ctx->getBudgetOverride(net, usr, net_delay);
|
auto budget_override = ctx->getBudgetOverride(net, usr, net_delay);
|
||||||
if (ctx->getPortClock(usr.cell, usr.port) != IdString()) {
|
if (ctx->getPortClock(usr.cell, usr.port) != IdString()) {
|
||||||
const auto net_arrival = nd.max_arrival;
|
const auto net_arrival = nd.max_arrival;
|
||||||
auto path_budget = clk_period - (net_arrival + net_delay);
|
auto path_budget = clk_period - (net_arrival + net_delay);
|
||||||
auto budget_share = budget_override ? 0 : path_budget / net_length_plus_one;
|
auto budget_share = budget_override ? 0 : path_budget / net_length_plus_one;
|
||||||
usr.budget = std::min(usr.budget, net_delay + budget_share);
|
if (update)
|
||||||
|
usr.budget = std::min(usr.budget, net_delay + budget_share);
|
||||||
net_min_remaining_budget = std::min(net_min_remaining_budget, path_budget - budget_share);
|
net_min_remaining_budget = std::min(net_min_remaining_budget, path_budget - budget_share);
|
||||||
|
|
||||||
min_slack = std::min(min_slack, path_budget);
|
min_slack = std::min(min_slack, path_budget);
|
||||||
@ -278,7 +295,8 @@ struct Timing
|
|||||||
if (is_path) {
|
if (is_path) {
|
||||||
auto path_budget = net_data.at(port.second.net).min_remaining_budget;
|
auto path_budget = net_data.at(port.second.net).min_remaining_budget;
|
||||||
auto budget_share = budget_override ? 0 : path_budget / net_length_plus_one;
|
auto budget_share = budget_override ? 0 : path_budget / net_length_plus_one;
|
||||||
usr.budget = std::min(usr.budget, net_delay + budget_share);
|
if (update)
|
||||||
|
usr.budget = std::min(usr.budget, net_delay + budget_share);
|
||||||
net_min_remaining_budget = std::min(net_min_remaining_budget, path_budget - budget_share);
|
net_min_remaining_budget = std::min(net_min_remaining_budget, path_budget - budget_share);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user