ecp5: Adding DCCA insertion function
Signed-off-by: David Shah <davey1576@gmail.com>
This commit is contained in:
parent
97b12fa741
commit
dfdaaa6f57
@ -124,6 +124,10 @@ std::unique_ptr<CellInfo> create_ecp5_cell(Context *ctx, IdString type, std::str
|
||||
add_port(ctx, new_cell.get(), "C", PORT_IN);
|
||||
add_port(ctx, new_cell.get(), "D", PORT_IN);
|
||||
add_port(ctx, new_cell.get(), "Z", PORT_OUT);
|
||||
} else if (type == ctx->id("DCCA")) {
|
||||
add_port(ctx, new_cell.get(), "CLKI", PORT_IN);
|
||||
add_port(ctx, new_cell.get(), "CLKO", PORT_OUT);
|
||||
add_port(ctx, new_cell.get(), "CE", PORT_IN);
|
||||
} else {
|
||||
log_error("unable to create ECP5 cell of type %s", type.c_str(ctx));
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <iomanip>
|
||||
#include <queue>
|
||||
#include "nextpnr.h"
|
||||
#include "cells.h"
|
||||
|
||||
#include "log.h"
|
||||
|
||||
@ -230,6 +231,34 @@ class Ecp5GlobalRouter
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Insert a DCC into a net to promote it to a global
|
||||
NetInfo *insert_dcc(NetInfo *net)
|
||||
{
|
||||
auto dcc = create_ecp5_cell(ctx, ctx->id("DCCA"), "$gbuf$" + net->name.str(ctx));
|
||||
|
||||
std::unique_ptr<NetInfo> glbnet = std::unique_ptr<NetInfo>(new NetInfo);
|
||||
glbnet->name = ctx->id("$glbnet$" + net->name.str(ctx));
|
||||
glbnet->driver.cell = dcc.get();
|
||||
glbnet->driver.port = ctx->id("CLKO");
|
||||
|
||||
for (auto user : net->users) {
|
||||
user.cell->ports.at(user.port).net = glbnet.get();
|
||||
}
|
||||
net->users.clear();
|
||||
|
||||
dcc->ports[ctx->id("CLKI")].net = net;
|
||||
PortRef clki_pr;
|
||||
clki_pr.port = ctx->id("CLKI");
|
||||
clki_pr.cell = dcc.get();
|
||||
net->users.push_back(clki_pr);
|
||||
|
||||
ctx->cells[dcc->name] = std::move(dcc);
|
||||
NetInfo *glbptr = glbnet.get();
|
||||
ctx->nets[glbnet->name] = std::move(glbnet);
|
||||
return glbptr;
|
||||
}
|
||||
|
||||
Context *ctx;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user