consistent naming on io interface
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 22 Mar 2018 05:04:15 +0000 (05:04 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 22 Mar 2018 05:04:15 +0000 (05:04 +0000)
src/interface_decl.py
src/interface_def.py

index 1d22bbf829554aafcd090decaf05521f498ba7bd..50f8ce7f0b2b67ebc510f057adf94ac1dcf18b0b 100644 (file)
@@ -104,14 +104,17 @@ class Interface(object):
                             self.ifacefmtdecfn2)
 
     def ifacedef(self, *args):
-        res = '\n'.join(map(self.ifacefmtpin, self.pins)).format(*args)
+        res = '\n'.join(map(self.ifacefmtpin, self.pins))
+        print res
+        res = res.format(*args)
         return '\n' + res + '\n'
 
 
 class IOInterface(Interface):
 
     def ifacefmtoutfn(self, name):
-        return "cell{0}_mux_out.%s" % (name[3:-4])
+        """ for now strip off io{0}_ part """
+        return "cell{0}_mux_out.%s" % name[6:]
 
     def ifacefmtinfn(self, name):
         return "cell{0}_mux_in"
@@ -123,15 +126,15 @@ mux_interface = Interface([{'name': 'cell{0}_mux', 'ready':False,
                       'enabled':False,
                      'bitspec': '{1}', 'action': True}])
 
-io_interface = IOInterface([{'name': 'io_outputval_{0}', 'enabled': False},
-                          {'name': 'io_output_en_{0}', 'enabled': False},
-                          {'name': 'io_input_en_{0}', 'enabled': False},
-                          {'name': 'io_pullup_en_{0}', 'enabled': False},
-                          {'name': 'io_pulldown_en_{0}', 'enabled': False},
-                          {'name': 'io_drivestrength_{0}', 'enabled': False},
-                          {'name': 'io_pushpull_en_{0}', 'enabled': False},
-                          {'name': 'io_opendrain_en_{0}', 'enabled': False},
-                          {'name': 'io_inputval_{0}', 'action': True, 'io': True},
+io_interface = IOInterface([{'name': 'io{0}_outputval', 'enabled': False},
+                          {'name': 'io{0}_output_en', 'enabled': False},
+                          {'name': 'io{0}_input_en', 'enabled': False},
+                          {'name': 'io{0}_pullup_en', 'enabled': False},
+                          {'name': 'io{0}_pulldown_en', 'enabled': False},
+                          {'name': 'io{0}_drivestrength', 'enabled': False},
+                          {'name': 'io{0}_pushpull_en', 'enabled': False},
+                          {'name': 'io{0}_opendrain_en', 'enabled': False},
+                          {'name': 'io{0}_inputval', 'action': True, 'io': True},
                           ])
 
 # == Peripheral Interface definitions == #
index 0dbe9228115aac80c2c67412b9ac0d4d6c34aa67..07088b16663be5b0e06e1e13a974a9df64233114 100644 (file)
@@ -5,15 +5,15 @@ mux_interface_def = '''
       endmethod
 '''
 io_interface_def = '''
-      method io_outputval_{0}=cell{0}_mux_out.outputval;
-      method io_output_en_{0}=cell{0}_mux_out.output_en;
-      method io_input_en_{0}=cell{0}_mux_out.input_en;
-      method io_pullup_en_{0}=cell{0}_mux_out.pullup_en;
-      method io_pulldown_en_{0}=cell{0}_mux_out.pulldown_en;
-      method io_drivestrength_{0}=cell{0}_mux_out.drivestrength;
-      method io_pushpull_en_{0}=cell{0}_mux_out.pushpull_en;
-      method io_opendrain_en_{0}=cell{0}_mux_out.opendrain_en;
-      method Action  io_inputval_{0}(Bit#(1) in);
+      method io{0}_outputval=cell{0}_mux_out.outputval;
+      method io{0}_output_en=cell{0}_mux_out.output_en;
+      method io{0}_input_en=cell{0}_mux_out.input_en;
+      method io{0}_pullup_en=cell{0}_mux_out.pullup_en;
+      method io{0}_pulldown_en=cell{0}_mux_out.pulldown_en;
+      method io{0}_drivestrength=cell{0}_mux_out.drivestrength;
+      method io{0}_pushpull_en=cell{0}_mux_out.pushpull_en;
+      method io{0}_opendrain_en=cell{0}_mux_out.opendrain_en;
+      method Action  io{0}_inputval(Bit#(1) in);
          cell{0}_mux_in<=in;
       endmethod
 '''