ecp5: Fix USRMCLK primitive

Signed-off-by: David Shah <dave@ds0.me>
This commit is contained in:
David Shah 2019-05-10 18:51:45 +01:00
parent 5344bc3b65
commit 12f375a239
3 changed files with 34 additions and 0 deletions

View File

@ -129,4 +129,21 @@ void connect_ports(Context *ctx, CellInfo *cell1, IdString port1_name, CellInfo
connect_port(ctx, port1.net, cell2, port2_name);
}
void rename_port(Context *ctx, CellInfo *cell, IdString old_name, IdString new_name)
{
if (!cell->ports.count(old_name))
return;
PortInfo pi = cell->ports.at(old_name);
if (pi.net != nullptr) {
if (pi.net->driver.cell == cell && pi.net->driver.port == old_name)
pi.net->driver.port = new_name;
for (auto &usr : pi.net->users)
if (usr.cell == cell && usr.port == old_name)
usr.port = new_name;
}
cell->ports.erase(old_name);
pi.name = new_name;
cell->ports[new_name] = pi;
}
NEXTPNR_NAMESPACE_END

View File

@ -91,6 +91,9 @@ void disconnect_port(const Context *ctx, CellInfo *cell, IdString port_name);
// Connect two ports together
void connect_ports(Context *ctx, CellInfo *cell1, IdString port1_name, CellInfo *cell2, IdString port2_name);
// Rename a port if it exists on a cell
void rename_port(Context *ctx, CellInfo *cell, IdString old_name, IdString new_name);
void print_utilisation(const Context *ctx);
NEXTPNR_NAMESPACE_END

View File

@ -1390,6 +1390,19 @@ class Ecp5Packer
}
}
// Miscellaneous packer tasks
void pack_misc()
{
for (auto cell : sorted(ctx->cells)) {
CellInfo *ci = cell.second;
if (ci->type == id_USRMCLK) {
rename_port(ctx, ci, ctx->id("USRMCLKI"), id_PADDO);
rename_port(ctx, ci, ctx->id("USRMCLKTS"), id_PADDT);
rename_port(ctx, ci, ctx->id("USRMCLKO"), id_PADDI);
}
}
}
// Preplace PLL
void preplace_plls()
{
@ -2371,6 +2384,7 @@ class Ecp5Packer
pack_ebr();
pack_dsps();
pack_dcus();
pack_misc();
preplace_plls();
pack_constants();
pack_dram();