cut over intr decls
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 20 Jul 2018 03:58:11 +0000 (04:58 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 20 Jul 2018 03:58:11 +0000 (04:58 +0100)
src/bsv/peripheral_gen.py

index 94e1274a1c811d4ac3eedeca23ac1c75afc8f3d7..a97697e17a89be2a3320ce8297351313603c6579 100644 (file)
@@ -1,15 +1,16 @@
 class PBase(object):
     pass
 
-class UART(PBase):
+class uart(PBase):
     def importfn(self):
         return "          import Uart16550         :: *;"
 
     def ifacedecl(self):
-        return "            interface RS232_PHY_Ifc uart{0}_coe;"
+        return "            interface RS232_PHY_Ifc uart{0}_coe;" \
+               "            method Bit#(1) uart{0}_intr;"
 
 
-class RS232(PBase):
+class rs232(PBase):
     def importfn(self):
         return "        import Uart_bs::*;\n" \
                "        import RS232_modified::*;"
@@ -18,12 +19,13 @@ class RS232(PBase):
         return "            interface RS232 uart{0}_coe;"
 
 
-class spi(PBase):
+class twi(PBase):
     def importfn(self):
         return "        import I2C_top           :: *;"
 
     def ifacedecl(self):
-        return "            interface I2C_out i2c{0}_out;"
+        return "            interface I2C_out i2c{0}_out;" \
+               "            method Bit#(1) i2c{0}_isint;"
 
 
 class qspi(PBase):
@@ -31,13 +33,35 @@ class qspi(PBase):
         return "        import qspi              :: *;"
 
     def ifacedecl(self):
-        return "            interface QSPI_out qspi{0}_out;"
+        return "            interface QSPI_out qspi{0}_out;" \
+               "            method Bit#(1) qspi{0}_isint;"
 
 
 class pwm(PBase):
     def importfn(self):
+        return "        import pwm::*;"
+
+    def ifacedecl(self):
         return "        interface PWMIO pwm_o;"
 
+
+class gpio(PBase):
+    def importfn(self):
+        return "     import pinmux::*;" \
+               "     import mux::*;" \
+               "     import gpio::*;"
+
     def ifacedecl(self):
-        return "        import pwm::*;"
+        return "        interface GPIO_config#({1}) pad_config{0};"
+
+
 
+class PFactory(object):
+    def __init__(self):
+        return {'uart': uart,
+                'rs232': rs232,
+                'twi': twi,
+                'qspi', qspi,
+                'pwm', pwm,
+                'gpio', 'gpio'
+                }