whitespace, autopep8
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 22 Mar 2018 10:55:40 +0000 (10:55 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 22 Mar 2018 10:55:40 +0000 (10:55 +0000)
src/actual_pinmux.py
src/interface_decl.py
src/pinmux_generator.py

index 99db5a05a14e107afc29dc4b7b218383b8a09303..98380e20fc9be71b7af8af7e9d4623715fb0fcc4 100644 (file)
@@ -39,17 +39,19 @@ dedicated_wire = '''
 '''
 # ============================================================
 pinmux = ''' '''
-digits = maketrans('0123456789', ' '*10) # delete space later
+digits = maketrans('0123456789', ' '*10)  # delete space later
+
 
 def cn(idx):
     return "cell%s_mux" % str(idx)
 
+
 for cell in muxed_cells:
     pinmux = pinmux + "      %s_out=" % cn(cell[0])
     i = 0
     while(i < len(cell) - 1):
         pinmux = pinmux + "wr%s" % cn(cell[0]) + \
-             "==" + str(i) + "?" + cell[i + 1] + "_io:\n\t\t\t"
+            "==" + str(i) + "?" + cell[i + 1] + "_io:\n\t\t\t"
         if(i + 2 == len(cell) - 1):
             pinmux = pinmux + cell[i + 2] + "_io"
             i = i + 2
@@ -69,14 +71,14 @@ for cell in muxed_cells:
         x = dictionary.get(temp)
         if(x is None):
             print(
-              "ERROR: The signal : " +
-              str(cell[i + 1]) +
-              " of pinmap.txt isn't present in the current dictionary.\
+                "ERROR: The signal : " +
+                str(cell[i + 1]) +
+                " of pinmap.txt isn't present in the current dictionary.\
               \nUpdate dictionary or fix-typo.")
             exit(1)
         if(x == "input"):
             pinmux = pinmux + \
-              mux_wire.format(cell[0], i, "wr" + cell[i + 1]) + "\n"
+                mux_wire.format(cell[0], i, "wr" + cell[i + 1]) + "\n"
         elif(x == "inout"):
             pinmux = pinmux + \
                 mux_wire.format(cell[0], i, "wr" + cell[i + 1] +
index 4f95d9df1aa14f16df4aad21ef9c0ea7d9cbb332..cae4e37ce448f5b13fa258347acd6e5dcd5b2abf 100644 (file)
@@ -1,5 +1,6 @@
 from UserDict import UserDict
 
+
 class Pin(object):
     """ pin interface declaration.
         * name is the name of the pin
@@ -70,6 +71,7 @@ class Pin(object):
         res += "<-mkDWire(0);"
         return res
 
+
 class Interface(object):
     """ create an interface from a list of pinspecs.
         each pinspec is a dictionary, see Pin class arguments
@@ -142,7 +144,7 @@ class Interface(object):
 
     def wirefmtpin(self, pin):
         return pin.wirefmt(self.ifacefmtoutfn, self.ifacefmtinfn,
-                            self.ifacefmtdecfn2)
+                           self.ifacefmtdecfn2)
 
     def ifacefmtdecpin(self, pin):
         return pin.ifacefmt(self.ifacefmtdecfn)
@@ -183,7 +185,7 @@ class Interfaces(UserDict):
                 count = int(l[1])
                 spec = self.read_spec(name)
                 self.ifaceadd(name, count, Interface(name, spec))
-                
+
     def ifaceadd(self, name, count, iface):
         self.ifacecount.append((name, count))
         self[name] = iface
@@ -230,21 +232,21 @@ class Interfaces(UserDict):
 
 # ========= Interface declarations ================ #
 
-mux_interface = Interface('cell', [{'name': 'mux', 'ready':False,
-                                    'enabled':False,
+mux_interface = Interface('cell', [{'name': 'mux', 'ready': False,
+                                    'enabled': False,
                                     'bitspec': '{1}', 'action': True}])
 
 io_interface = IOInterface('io',
-                    [{'name': 'outputval', 'enabled': False},
-                     {'name': 'output_en', 'enabled': False},
-                     {'name': 'input_en', 'enabled': False},
-                     {'name': 'pullup_en', 'enabled': False},
-                     {'name': 'pulldown_en', 'enabled': False},
-                     {'name': 'drivestrength', 'enabled': False},
-                     {'name': 'pushpull_en', 'enabled': False},
-                     {'name': 'opendrain_en', 'enabled': False},
-                     {'name': 'inputval', 'action': True, 'io': True},
-                          ])
+                           [{'name': 'outputval', 'enabled': False},
+                            {'name': 'output_en', 'enabled': False},
+                               {'name': 'input_en', 'enabled': False},
+                               {'name': 'pullup_en', 'enabled': False},
+                               {'name': 'pulldown_en', 'enabled': False},
+                               {'name': 'drivestrength', 'enabled': False},
+                               {'name': 'pushpull_en', 'enabled': False},
+                               {'name': 'opendrain_en', 'enabled': False},
+                               {'name': 'inputval', 'action': True, 'io': True},
+                            ])
 
 # == Peripheral Interface definitions == #
 # these are the interface of the peripherals to the pin mux
@@ -259,14 +261,14 @@ ifaces = Interfaces()
 if __name__ == '__main__':
 
     uartinterface_decl = Interface('uart',
-                                [{'name': 'rx'},
-                                 {'name': 'tx', 'action': True},
-                                ])
+                                   [{'name': 'rx'},
+                                    {'name': 'tx', 'action': True},
+                                    ])
 
     twiinterface_decl = Interface('twi',
-                                [{'name': 'sda', 'outen': True},
-                                 {'name': 'scl', 'outen': True},
-                                ])
+                                  [{'name': 'sda', 'outen': True},
+                                   {'name': 'scl', 'outen': True},
+                                   ])
 
     def _pinmunge(p, sep, repl, dedupe=True):
         """ munges the text so it's easier to compare.
index a4a7d72df1ae6b80ea7eae8757770eda7e503583..d7b4d13de4f337e0d24da529d58ae47b73d1079d 100644 (file)
@@ -79,7 +79,7 @@ with open("./bsv_src/pinmux.bsv", "w") as bsv_file:
 
     for cell in muxed_cells:
         bsv_file.write(mux_interface.ifacefmt(cell[0],
-                                        int(math.log(len(cell) - 1, 2))))
+                                              int(math.log(len(cell) - 1, 2))))
 
     bsv_file.write('''
       endinterface
@@ -117,8 +117,8 @@ with open("./bsv_src/pinmux.bsv", "w") as bsv_file:
       // values for each mux assigned to a CELL
 ''')
     for cell in muxed_cells:
-        bsv_file.write(muxwire.format(cell[0], int(math.log(len(cell) - 1, 2))))
-
+        bsv_file.write(muxwire.format(
+            cell[0], int(math.log(len(cell) - 1, 2))))
 
     bsv_file.write(
         '''\n      // following wires capture the values sent to the IO Cell''')
@@ -144,7 +144,7 @@ with open("./bsv_src/pinmux.bsv", "w") as bsv_file:
 ''')
     for cell in muxed_cells:
         bsv_file.write(mux_interface.ifacedef(cell[0],
-                                            int(math.log(len(cell) - 1, 2))))
+                                              int(math.log(len(cell) - 1, 2))))
     bsv_file.write('''
     endinterface;
     interface peripheral_side = interface PeripheralSide
@@ -233,4 +233,3 @@ endpackage
 with open('bsv_src/bus.bsv', 'w') as bsv_file:
     bsv_file.write(axi4_lite.format(ADDR_WIDTH, DATA_WIDTH))
 # ##################################################
-