Working on the timing annotator

Signed-off-by: David Shah <davey1576@gmail.com>
This commit is contained in:
David Shah 2018-06-20 13:01:22 +02:00
parent 5ca4663294
commit 4648d3bc83
3 changed files with 23 additions and 7 deletions

View File

@ -62,12 +62,13 @@ static delay_t follow_user_port(Context *ctx, PortRef &user, int path_length,
if (value < user.budget) {
user.budget = value;
}
return value;
}
static delay_t follow_net(Context *ctx, NetInfo *net, int path_length,
delay_t slack)
{
delay_t net_budget = slack / path_length;
delay_t net_budget = slack / (path_length + 1);
for (auto &usr : net->users) {
net_budget = std::min(
net_budget, follow_user_port(ctx, usr, path_length + 1, slack));
@ -77,6 +78,7 @@ static delay_t follow_net(Context *ctx, NetInfo *net, int path_length,
void assign_budget(Context *ctx, float default_clock)
{
log_info("Annotating ports with timing budgets\n");
for (auto cell : ctx->cells) {
for (auto port : cell.second->ports) {
if (port.second.type == PORT_OUT) {

View File

@ -21,7 +21,7 @@
#include <cmath>
#include "log.h"
#include "nextpnr.h"
#include "util.h"
NEXTPNR_NAMESPACE_BEGIN
// -----------------------------------------------------------------------
@ -414,26 +414,39 @@ std::vector<GraphicElement> Arch::getPipGraphics(PipId pip) const
std::vector<GraphicElement> ret;
// FIXME
return ret;
}
};
// -----------------------------------------------------------------------
bool Arch::getCellDelay(const CellInfo *cell, IdString fromPort,
IdString toPort, delay_t &delay) const
{
// TODO
if (cell->type == id("ICESTORM_LC")) {
if (fromPort == id("I0") || fromPort == id("I1") ||
fromPort == id("I2") || fromPort == id("I3")) {
if (toPort == id("O") || toPort == id("LO")) {
delay = 450;
return true;
}
}
}
return false;
}
IdString Arch::getPortClock(const CellInfo *cell, IdString port) const
{
// TODO
if (cell->type == id("ICESTORM_LC") &&
bool_or_default(cell->params, id("DFF_ENABLE"))) {
if (port != id("LO") && port != id("CIN") && port != id("COUT"))
return id("CLK");
}
return IdString();
}
bool Arch::isClockPort(const CellInfo *cell, IdString port) const
{
// TODO
if (cell->type == id("ICESTORM_LC") && port == id("CLK"))
return true;
return false;
}

View File

@ -36,6 +36,7 @@
#include "pybindings.h"
#include "route.h"
#include "version.h"
#include "timing.h"
void svg_dump_el(const GraphicElement &el)
{
@ -232,7 +233,7 @@ int main(int argc, char *argv[])
if (!pack_design(&ctx) && !ctx.force)
log_error("Packing design failed.\n");
assign_budget(&ctx);
print_utilisation(&ctx);
if (!vm.count("pack-only")) {