aboutsummaryrefslogtreecommitdiffstats
path: root/generic/examples/simple.py
diff options
context:
space:
mode:
authorDavid Shah <dave@ds0.me>2019-04-01 19:13:16 +0100
committerDavid Shah <dave@ds0.me>2019-04-02 15:30:01 +0100
commitca918078bfe6c4b1a279c7df7c59fb9de0f9710a (patch)
tree21a9f8b013e402a9fff1db0d62a52c24227913e8 /generic/examples/simple.py
parent99c3713293f4cc56ab933b952ec522ade7526eb8 (diff)
downloadnextpnr-ca918078bfe6c4b1a279c7df7c59fb9de0f9710a.tar.gz
nextpnr-ca918078bfe6c4b1a279c7df7c59fb9de0f9710a.tar.bz2
nextpnr-ca918078bfe6c4b1a279c7df7c59fb9de0f9710a.zip
generic: Add a simple packer for generic SLICEs and IOBs
Signed-off-by: David Shah <dave@ds0.me>
Diffstat (limited to 'generic/examples/simple.py')
-rw-r--r--generic/examples/simple.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/generic/examples/simple.py b/generic/examples/simple.py
index da41dc5b..17808fc7 100644
--- a/generic/examples/simple.py
+++ b/generic/examples/simple.py
@@ -1,3 +1,16 @@
-ctx.addBel(name="SLICE_X1Y1", type="SLICE_LUT4", loc=Loc(1, 1, 0), gb=False)
-ctx.addBel(name="IO0_I", type="$nextpnr_ibuf", loc=Loc(0, 0, 0), gb=False)
-ctx.addBel(name="IO1_O", type="$nextpnr_obuf", loc=Loc(1, 0, 0), gb=False) \ No newline at end of file
+X = 12
+Y = 12
+
+def is_io(x, y):
+ return x == 0 or x == X-1 or y == 0 or y == Y-1
+
+
+for x in range(X):
+ for y in range(Y):
+ if is_io(x, y):
+ if x == y:
+ continue
+ for z in range(2):
+ ctx.addBel(name="X%dY%d_IO%d" % (x, y, z), type="GENERIC_IOB", loc=Loc(x, y, z), gb=False)
+ else:
+ ctx.addBel(name="X%dY%d_SLICE%d" % (x, y, z), type="GENERIC_SLICE", loc=Loc(x, y, z), gb=False)