aboutsummaryrefslogtreecommitdiffstats
path: root/gowin/pack.cc
diff options
context:
space:
mode:
authorYRabbit <rabbit@yrabbit.cyou>2021-12-20 15:48:38 +1000
committerYRabbit <rabbit@yrabbit.cyou>2021-12-20 15:48:38 +1000
commit5a76b3cb4d506c4920fc3d6b9aff935cbaa2987e (patch)
treef12b583fcbf2021c38299ea8aa49a77360e6c3a6 /gowin/pack.cc
parent62a3e093856063180526b7189d5e711a98036fa0 (diff)
downloadnextpnr-5a76b3cb4d506c4920fc3d6b9aff935cbaa2987e.tar.gz
nextpnr-5a76b3cb4d506c4920fc3d6b9aff935cbaa2987e.tar.bz2
nextpnr-5a76b3cb4d506c4920fc3d6b9aff935cbaa2987e.zip
gowin: Add simplified IO cells processing
Some models have I/O cells that are IOBUFs, and other types (IBUFs and OBUFs) are obtained by feeding 1 or 0 to the OEN input. This is done with general-purpose routing so it's best to do it here to avoid conflicts. For this purpose, in the new bases, these special cells are of type IOBS (IOB Simplified). The proposed changes are compatible with bases of previous versions of Apycula and do not require changing .CST constraint files. Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
Diffstat (limited to 'gowin/pack.cc')
-rw-r--r--gowin/pack.cc23
1 files changed, 21 insertions, 2 deletions
diff --git a/gowin/pack.cc b/gowin/pack.cc
index cb63f1c9..553eeb4e 100644
--- a/gowin/pack.cc
+++ b/gowin/pack.cc
@@ -629,7 +629,7 @@ static void pack_constants(Context *ctx)
std::vector<IdString> dead_nets;
- bool gnd_used = false;
+ bool gnd_used = true; // XXX May be needed for simplified IO
for (auto &net : ctx->nets) {
NetInfo *ni = net.second.get();
@@ -718,8 +718,27 @@ static void pack_io(Context *ctx)
}
packed_cells.insert(iob->name);
}
+ // what type to create
+ IdString new_cell_type = id_IOB;
+ std::string constr_bel_name = std::string("");
+ // check whether the given IO is limited to simplified IO cells
+ auto constr_bel = ci->attrs.find(id_BEL);
+ if (constr_bel != ci->attrs.end()) {
+ constr_bel_name = constr_bel->second.as_string();
+ }
+ constr_bel = iob->attrs.find(id_BEL);
+ if (constr_bel != iob->attrs.end()) {
+ constr_bel_name = constr_bel->second.as_string();
+ }
+ if (!constr_bel_name.empty()) {
+ BelId constr_bel = ctx->getBelByNameStr(constr_bel_name);
+ if (constr_bel != BelId()) {
+ new_cell_type = ctx->bels[constr_bel].type;
+ }
+ }
+
// Create a IOB buffer
- std::unique_ptr<CellInfo> ice_cell = create_generic_cell(ctx, id_IOB, ci->name.str(ctx) + "$iob");
+ std::unique_ptr<CellInfo> ice_cell = create_generic_cell(ctx, new_cell_type, ci->name.str(ctx) + "$iob");
gwio_to_iob(ctx, ci, ice_cell.get(), packed_cells);
new_cells.push_back(std::move(ice_cell));
auto gwiob = new_cells.back().get();