From 482bf21ac77afd7bbb88c5613ed9561851fb1051 Mon Sep 17 00:00:00 2001 From: Neel Date: Mon, 12 Mar 2018 13:38:28 +0530 Subject: [PATCH] syntax upgrades for python3 and above --- README.md | 5 +++++ src/actual_pinmux.py | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5e29e06..0016601 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,11 @@ Currently the code supports the following peripherals: 3. Provide support for dedicated pins. 4. Provide scheme to prevent short-circuit when inputs are mapped to multiple IOs. + +## REQUIREMENTS: + 1. Python3 and above to generate BSV code. + 2. BSV compiler to generate verilog code from BSV code. + ## Quick Start Set parameters such as number of UARTs, SPIs, IO Cells, etc. in the file src/params.py . diff --git a/src/actual_pinmux.py b/src/actual_pinmux.py index 95695b9..1c7928d 100644 --- a/src/actual_pinmux.py +++ b/src/actual_pinmux.py @@ -30,7 +30,7 @@ for lineno,line in enumerate(pinmap_file): line1=line.split() if(lineno>0): if(lineno>N_IO): - print"ERROR: Parameter N_IO("+str(N_IO)+") is less than the pin number in line: "+str(lineno)+" of pinmap.txt" + print("ERROR: Parameter N_IO("+str(N_IO)+") is less than the pin number in line: "+str(lineno)+" of pinmap.txt") exit(1) ######## Mux each generic IO cell with the mapping###### # provided in the pinmap file @@ -52,10 +52,11 @@ for lineno,line in enumerate(pinmap_file): ## since the interfaces are always standard and cannot change from user-to-user ## plus reduces human-error as well :) for i in range(0,len(line1)-1): - temp=line1[i+1].translate(None,digits) + digits = str.maketrans(dict.fromkeys('0123456789')) + temp=line1[i+1].translate(digits) x=dictionary.get(temp); if(x==None): - print "Error: The signal : "+str(line1[i+1])+" in lineno: "+str(lineno)+"of pinmap.txt is not present in the current dictionary.\nSoln: Either update the dictionary or fix typo." + print("Error: The signal : "+str(line1[i+1])+" in lineno: "+str(lineno)+"of pinmap.txt is not present in the current dictionary.\nSoln: Either update the dictionary or fix typo.") exit(1) if(x=="input" or x=="inout"): pinmux=pinmux+input_wire.format(line1[0],i,line1[i+1])+"\n" -- 2.30.2