From 11afcc66f875bfcf10642f8bab3812bfcf56e6d2 Mon Sep 17 00:00:00 2001 From: Neel Date: Tue, 20 Mar 2018 13:02:02 +0530 Subject: [PATCH] switching to python2 and added pep8 auto-sorter to make. --- Makefile | 2 ++ README.md | 2 +- src/actual_pinmux.py | 7 ++++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 90db368..b978409 100644 --- a/Makefile +++ b/Makefile @@ -42,3 +42,5 @@ gen_verilog: check-restore check-blue clean: rm -rf $(BSVBUILDDIR) *.log $(BSVOUTDIR) ./bbl* verilog obj_dir bsv_src src/*.pyc +pep8: + autopep8 -r -i src diff --git a/README.md b/README.md index 0016601..c907668 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Currently the code supports the following peripherals: ## REQUIREMENTS: - 1. Python3 and above to generate BSV code. + 1. Python2 to generate BSV code. 2. BSV compiler to generate verilog code from BSV code. ## Quick Start diff --git a/src/actual_pinmux.py b/src/actual_pinmux.py index f24c976..ff6902a 100644 --- a/src/actual_pinmux.py +++ b/src/actual_pinmux.py @@ -1,5 +1,9 @@ from parse import * from string import digits +try: + from string import maketrans +except ImportError: + maketrans = str.maketrans # dictionary of properties of signals that are supported. @@ -35,7 +39,7 @@ dedicated_wire = ''' ''' # ============================================================ pinmux = ''' ''' -digits = str.maketrans(dict.fromkeys('0123456789')) +digits = maketrans('0123456789', ' '*10) # delete space later for cell in muxed_cells: pinmux = pinmux + " cell" + str(cell[0]) + "_out=" @@ -58,6 +62,7 @@ for cell in muxed_cells: # user-to-user. Plus this also reduces human-error as well :) for i in range(0, len(cell) - 1): temp = cell[i + 1].translate(digits) + temp = temp.replace(' ', '') x = dictionary.get(temp) if(x is None): print( -- 2.30.2