add `define generator
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 20 Jul 2018 05:06:35 +0000 (06:06 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 20 Jul 2018 05:06:35 +0000 (06:06 +0100)
src/bsv/peripheral_gen.py

index ab68dcbbe7cbae52da50d213aea0e99d4bb3d2cd..270bc80222b427c66acee2adf416536dfbc00915 100644 (file)
@@ -1,6 +1,14 @@
 class PBase(object):
     pass
 
+    def axi_reg_def(self, start, name, idx):
+        name = name.upper()
+        offs = self.num_axi_regs32()*4
+        end = start + offs - 1
+        return ("    `define%(name)s%(idx)dBase  'h%(start)08x'\n" \
+                "    `define%(name)s%(idx)dEnd   'h%(end)08x'\n" % locals(),
+                offs)
+
 
 class uart(PBase):
     def importfn(self):