aboutsummaryrefslogtreecommitdiffstats
path: root/gowin/pack.cc
diff options
context:
space:
mode:
authorYRabbit <rabbit@yrabbit.cyou>2021-08-31 07:36:11 +1000
committerYRabbit <rabbit@yrabbit.cyou>2021-08-31 07:36:11 +1000
commit23a5e9185887758e7d5fd83fe49686aaa5783896 (patch)
tree5332e0cf993a7173ed578ab4b3160ffb0e36c4ae /gowin/pack.cc
parent0e83db47a067b55f45567c89a08af470196a18e7 (diff)
downloadnextpnr-23a5e9185887758e7d5fd83fe49686aaa5783896.tar.gz
nextpnr-23a5e9185887758e7d5fd83fe49686aaa5783896.tar.bz2
nextpnr-23a5e9185887758e7d5fd83fe49686aaa5783896.zip
gowin: Add constraints on primitive placement.
Added support for the INS_LOC instruction in the constraints file (.CST), which is used to specify object placement. Expanded treatment of IO_LOC/IO_PORT constraints, which now can be applied to both ports and IO buffers. Port constraints have priority. Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
Diffstat (limited to 'gowin/pack.cc')
-rw-r--r--gowin/pack.cc16
1 files changed, 13 insertions, 3 deletions
diff --git a/gowin/pack.cc b/gowin/pack.cc
index 213889f5..708f06da 100644
--- a/gowin/pack.cc
+++ b/gowin/pack.cc
@@ -253,9 +253,19 @@ static void pack_io(Context *ctx)
auto gwiob = new_cells.back().get();
packed_cells.insert(ci->name);
- if (iob != nullptr)
- for (auto &attr : iob->attrs)
- gwiob->attrs[attr.first] = attr.second;
+ if (iob != nullptr) {
+ // in Gowin .CST port attributes take precedence over cell attributes.
+ // first copy cell attrs related to IO
+ for (auto &attr : ci->attrs) {
+ if (attr.first == IdString(ID_BEL) || attr.first.str(ctx)[0] == '&') {
+ gwiob->setAttr(attr.first, attr.second);
+ }
+ }
+ // rewrite attributes from the port
+ for (auto &attr : iob->attrs) {
+ gwiob->setAttr(attr.first, attr.second);
+ }
+ }
}
}
for (auto pcell : packed_cells) {