X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Factual_pinmux.py;h=ff6902af01399afefb559eb409c52687d0397d34;hb=11afcc66f875bfcf10642f8bab3812bfcf56e6d2;hp=02603a97122a784daa32b53d57096cb7921f0896;hpb=445782ffd34ed8dc35fc12319d5eb0aff1db535e;p=pinmux.git diff --git a/src/actual_pinmux.py b/src/actual_pinmux.py index 02603a9..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. @@ -11,7 +15,11 @@ dictionary = { "spi_ss" : "output", "spi_miso" : "input", "twi_sda" : "inout", - "twi_scl" : "inout" + "twi_scl" : "inout", + "sd_clk": "output", + "sd_cmd": "output", + "sd_d": "inout", + "pwm": "output" } @@ -31,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=" @@ -54,14 +62,14 @@ 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( - "Error: The signal : " + + "ERROR: The signal : " + str(cell[i + 1]) + - " in lineno: " + - str(lineno) + "of pinmap.txt isn't present in the \ - current dictionary.\nUpdate dictionary or fix-typo.") + " of pinmap.txt isn't present in the current dictionary.\ + \nUpdate dictionary or fix-typo.") exit(1) if(x == "input"): pinmux = pinmux + \