1
0
mirror of https://github.com/YosysHQ/nextpnr.git synced 2026-02-06 00:25:07 +00:00

ecp5: Preserve top level IO properly

Signed-off-by: David Shah <dave@ds0.me>
This commit is contained in:
David Shah
2019-10-18 15:58:57 +01:00
parent 872e296f7b
commit cf5cbd1153
4 changed files with 36 additions and 13 deletions

View File

@@ -88,7 +88,7 @@ void connect_port(const Context *ctx, NetInfo *net, CellInfo *cell, IdString por
NPNR_ASSERT(net->driver.cell == nullptr);
net->driver.cell = cell;
net->driver.port = port_name;
} else if (port.type == PORT_IN) {
} else if (port.type == PORT_IN || port.type == PORT_INOUT) {
PortRef user;
user.cell = cell;
user.port = port_name;
@@ -146,4 +146,14 @@ void rename_port(Context *ctx, CellInfo *cell, IdString old_name, IdString new_n
cell->ports[new_name] = pi;
}
void rename_net(Context *ctx, NetInfo *net, IdString new_name)
{
if (net == nullptr)
return;
NPNR_ASSERT(!ctx->nets.count(new_name));
std::swap(ctx->nets[net->name], ctx->nets[new_name]);
ctx->nets.erase(net->name);
net->name = new_name;
}
NEXTPNR_NAMESPACE_END

View File

@@ -94,6 +94,9 @@ void connect_ports(Context *ctx, CellInfo *cell1, IdString port1_name, CellInfo
// Rename a port if it exists on a cell
void rename_port(Context *ctx, CellInfo *cell, IdString old_name, IdString new_name);
// Rename a net without invalidating pointers to it
void rename_net(Context *ctx, NetInfo *net, IdString new_name);
void print_utilisation(const Context *ctx);
NEXTPNR_NAMESPACE_END