From 2e77d45fa3c951835ba9140aa74b680a9dbb411b Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Thu, 31 May 2018 16:10:42 +0100 Subject: [PATCH] autopep8 cleanup --- src/bsv/interface_decl.py | 10 +++++----- src/bsv/pinmux_generator.py | 7 ++++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/bsv/interface_decl.py b/src/bsv/interface_decl.py index a1313f4..b24e13d 100644 --- a/src/bsv/interface_decl.py +++ b/src/bsv/interface_decl.py @@ -150,8 +150,8 @@ class Interface(object): pname = self.pname(p['name']).format(*args) if p.get('outen') is True: outname = self.ifacefmtoutfn(pname) - ganged.append("%s_outen" % outname) # match wirefmt - + ganged.append("%s_outen" % outname) # match wirefmt + gangedfmt = '{%s} = duplicate(%s);' res.append(gangedfmt % (',\n '.join(ganged), name)) return '\n'.join(res) + '\n\n' @@ -166,7 +166,7 @@ class Interface(object): if p.get('outen') is True: outname = self.ifacefmtoutfn(name) params.append('outputval:%s_out,' % outname) - params.append('output_en:%s_outen,' % outname) # match busfmt + params.append('output_en:%s_outen,' % outname) # match busfmt params.append('input_en:~%s_outen,' % outname) elif p.get('action'): outname = self.ifacefmtoutfn(name) @@ -289,8 +289,8 @@ class Interfaces(UserDict): elif ln[1] == 'inout': d['outen'] = True if len(ln) == 3: - bus = ln[2] - if not ganged.has_key(bus): + bus = ln[2] + if bus not in ganged: ganged[bus] = [] ganged[bus].append(name) spec.append(d) diff --git a/src/bsv/pinmux_generator.py b/src/bsv/pinmux_generator.py index 5eeabf5..26082db 100644 --- a/src/bsv/pinmux_generator.py +++ b/src/bsv/pinmux_generator.py @@ -81,11 +81,11 @@ def pinmuxgen(pth=None, verify=True): # copy over template and library files shutil.copyfile(os.path.join(cwd, 'Makefile.template'), - os.path.join(bp, 'Makefile')) + os.path.join(bp, 'Makefile')) cwd = os.path.join(cwd, 'bsv_lib') for fname in ['AXI4_Lite_Types.bsv', 'Semi_FIFOF.bsv']: shutil.copyfile(os.path.join(cwd, fname), - os.path.join(bl, fname)) + os.path.join(bl, fname)) bus = os.path.join(bp, 'busenable.bsv') pmp = os.path.join(bp, 'pinmux.bsv') @@ -108,9 +108,10 @@ def write_bus(bus, p, ifaces): def get_cell_bit_width(p): max_num_cells = 0 for cell in p.muxed_cells: - max_num_cells = max(len(cell)-1, max_num_cells) + max_num_cells = max(len(cell) - 1, max_num_cells) return int(math.log(max_num_cells, 2)) + def write_pmp(pmp, p, ifaces): # package and interface declaration followed by # the generic io_cell definition -- 2.30.2