fix vectorised version of gpio get/put interface
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 23 Jul 2018 12:04:58 +0000 (13:04 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 23 Jul 2018 12:04:58 +0000 (13:04 +0100)
src/bsv/interface_decl.py

index 892e1f03aa00607eb68f3370d589874f9f6fecd3..281c6c3a90dd228037fe3e3a162eb16c4816c54c 100644 (file)
@@ -149,7 +149,7 @@ class Pin(object):
             res = "                   %s <= in[%d];" % (fmtname, self.idx)
         else:
             fmtname = fmtoutfn(self.name)
-            res = "                   tget[%d] <= %s;" % (self.idx, fmtname)
+            res = "                   tget[%d] = %s;" % (self.idx, fmtname)
             name = 'tget'
         return (name, res)
 
@@ -370,6 +370,13 @@ class IOInterface(Interface):
 
 class InterfaceGPIO(Interface):
 
+    def ifacepfmt(self, *args):
+        return """
+          interface Put#(Vector#({0}, Bit#(1))) out;
+          interface Put#(Vector#({0}, Bit#(1))) outen;
+          interface Get#(Vector#({0}, Bit#(1))) in;
+""".format(len(self.pinspecs))
+
     def ifacedef2(self, *args):
         tput = []
         tget = []
@@ -386,19 +393,19 @@ class InterfaceGPIO(Interface):
         tputen = '\n'.join(tputen).format(*args)
 
         template = """\
-              interface gpio_out = interface Put#({0})
+              interface out = interface Put#({0})
                  method Action put(Vector#({0},Bit#(1)) in);
 {1}
                  endmethod
                endinterface;
-               interface gpio_outen = interface Put#({0})
+               interface outen = interface Put#({0})
                  method Action put(Vector#({0},Bit#(1)) in);
 {2}
                  endmethod
                endinterface;
-               interface gpio_in = interface Get#({0})
+               interface in = interface Get#({0})
                  method ActionValue#(Vector#({0},Bit#(1))) get;
-                   Vector#({0},Bit#(1)) tputen;
+                   Vector#({0},Bit#(1)) tget;
 {3}
                    return tget;
                  endmethod