diff options
author | William D. Jones <thor0505@comcast.net> | 2020-06-05 04:46:59 -0400 |
---|---|---|
committer | gatecat <gatecat@ds0.me> | 2021-02-12 10:36:59 +0000 |
commit | 81d6bc36148b408f4e79837f832b22c6bfb0b69c (patch) | |
tree | 4115382979d61ef78fcbcb5904d8763d8f0f4fdc /machxo2/facade_import.py | |
parent | 510969ab9704865f87c7c0bd09e0185b729feffc (diff) | |
download | nextpnr-81d6bc36148b408f4e79837f832b22c6bfb0b69c.tar.gz nextpnr-81d6bc36148b408f4e79837f832b22c6bfb0b69c.tar.bz2 nextpnr-81d6bc36148b408f4e79837f832b22c6bfb0b69c.zip |
Create sub import of facade DB for 1200 device.
Signed-off-by: William D. Jones <thor0505@comcast.net>
Diffstat (limited to 'machxo2/facade_import.py')
-rw-r--r-- | machxo2/facade_import.py | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/machxo2/facade_import.py b/machxo2/facade_import.py new file mode 100644 index 00000000..f12461db --- /dev/null +++ b/machxo2/facade_import.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python3 +import pytrellis +import database +import argparse +import json + +class BinaryBlobAssembler: + def l(self, name, ltype = None, export = False): + if ltype is None: + print("label %s" % (name,)) + else: + print("label %s %s" % (name, ltype)) + + def r(self, name, comment): + if comment is None: + print("ref %s" % (name,)) + else: + print("ref %s %s" % (name, comment)) + + def s(self, s, comment): + assert "|" not in s + print("str |%s| %s" % (s, comment)) + + def u8(self, v, comment): + if comment is None: + print("u8 %d" % (v,)) + else: + print("u8 %d %s" % (v, comment)) + + def u16(self, v, comment): + if comment is None: + print("u16 %d" % (v,)) + else: + print("u16 %d %s" % (v, comment)) + + def u32(self, v, comment): + if comment is None: + print("u32 %d" % (v,)) + else: + print("u32 %d %s" % (v, comment)) + + def pre(self, s): + print("pre %s" % s) + + def post(self, s): + print("post %s" % s) + + def push(self, name): + print("push %s" % name) + + def pop(self): + print("pop") + + +dev_names = {"1200": "LCMXO2-1200HC"} + +def main(): + global max_row, max_col, const_id_count + + parser = argparse.ArgumentParser(description="import MachXO2 routing and bels from Project Trellis") + parser.add_argument("device", type=str, help="target device") + parser.add_argument("-p", "--constids", type=str, help="path to constids.inc") + parser.add_argument("-g", "--gfxh", type=str, help="path to gfx.h (unused)") + args = parser.parse_args() + + pytrellis.load_database(database.get_db_root()) + + bba = BinaryBlobAssembler() + bba.pre('#include "nextpnr.h"') + bba.pre('NEXTPNR_NAMESPACE_BEGIN') + bba.post('NEXTPNR_NAMESPACE_END') + bba.push("chipdb_blob_%s" % args.device) + bba.u8(0, None) + bba.pop() + +if __name__ == "__main__": + main() |