aboutsummaryrefslogtreecommitdiffstats
path: root/generic/examples/bitstream.py
diff options
context:
space:
mode:
authorDavid Shah <davey1576@gmail.com>2019-04-19 17:40:55 +0100
committerGitHub <noreply@github.com>2019-04-19 17:40:55 +0100
commit5344bc3b65f4e06f983db781e9a82d30b3f1512b (patch)
tree5f794074ccc963a9dbf756558e34a8eba0d5fa26 /generic/examples/bitstream.py
parent0be844e6a8d0a36a50815ec5331fd7480dd20db6 (diff)
parent87a24460813b9f52189323352554a1c352836ee2 (diff)
downloadnextpnr-5344bc3b65f4e06f983db781e9a82d30b3f1512b.tar.gz
nextpnr-5344bc3b65f4e06f983db781e9a82d30b3f1512b.tar.bz2
nextpnr-5344bc3b65f4e06f983db781e9a82d30b3f1512b.zip
Merge pull request #261 from YosysHQ/pygeneric
Python API for generic architecture
Diffstat (limited to 'generic/examples/bitstream.py')
-rw-r--r--generic/examples/bitstream.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/generic/examples/bitstream.py b/generic/examples/bitstream.py
new file mode 100644
index 00000000..1ab94f0c
--- /dev/null
+++ b/generic/examples/bitstream.py
@@ -0,0 +1,17 @@
+from write_fasm import *
+from simple_config import K
+
+# Need to tell FASM generator how to write parameters
+# (celltype, parameter) -> ParameterConfig
+param_map = {
+ ("GENERIC_SLICE", "K"): ParameterConfig(write=False),
+ ("GENERIC_SLICE", "INIT"): ParameterConfig(write=True, numeric=True, width=2**K),
+ ("GENERIC_SLICE", "FF_USED"): ParameterConfig(write=True, numeric=True, width=1),
+
+ ("GENERIC_IOB", "INPUT_USED"): ParameterConfig(write=True, numeric=True, width=1),
+ ("GENERIC_IOB", "OUTPUT_USED"): ParameterConfig(write=True, numeric=True, width=1),
+ ("GENERIC_IOB", "ENABLE_USED"): ParameterConfig(write=True, numeric=True, width=1),
+}
+
+with open("blinky.fasm", "w") as f:
+ write_fasm(ctx, param_map, f) \ No newline at end of file