aboutsummaryrefslogtreecommitdiffstats
path: root/gowin/pack.cc
diff options
context:
space:
mode:
authorgatecat <gatecat@ds0.me>2021-12-24 19:28:41 +0000
committerGitHub <noreply@github.com>2021-12-24 19:28:41 +0000
commit643b6971780adf8a6c5623851d9fff9f6a413113 (patch)
treedf73cf0c5b3b4d043f6b916b1b498a353398d36f /gowin/pack.cc
parentde63b5b09a4d4373d872dd2bef3336760edad08f (diff)
parent5a76b3cb4d506c4920fc3d6b9aff935cbaa2987e (diff)
downloadnextpnr-643b6971780adf8a6c5623851d9fff9f6a413113.tar.gz
nextpnr-643b6971780adf8a6c5623851d9fff9f6a413113.tar.bz2
nextpnr-643b6971780adf8a6c5623851d9fff9f6a413113.zip
Merge pull request #884 from yrabbit/simplified-io-pr
gowin: Add simplified IO cells processing
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();