# second argument is the mux value.
# Third argument is the signal from the pinmap file
mux_wire = '''
- if(wrcell{0}_mux=={1})
- {2}<=cell{0}_mux_in;'''
+ rule assign_{2}_on_cell{0}(wrcell{0}_mux=={1});
+ {2}<=cell{0}_mux_in;
+ endrule
+'''
dedicated_wire = '''
rule assign_{1}_on_cell{0};
{1}<=cell{0}_mux_in;
digits = maketrans('0123456789', ' ' * 10) # delete space later
-def cn(idx):
+def cn(idx): # idx is an integer
return "cell%s_mux" % str(idx)
def transfn(temp):
+ """ removes the number from the string of signal name.
+ """
temp = temp.split('_')
if len(temp) == 2:
temp[0] = temp[0].translate(digits)
def init(p, ifaces):
+ """ generates the actual output pinmux for each io-cell. blank lines
+ need to output "0" to the iopad, if there is no entry in
+ that column.
+ """
p.pinmux = ' '
global dedicated_wire
for cell in p.muxed_cells:
+ p.pinmux += " // output muxer for cell idx %s\n" % cell[0]
p.pinmux += " %s_out=" % cn(cell[0])
for i in range(0, len(cell) - 2):
p.pinmux += "wr%s" % cn(cell[0]) + \
p.pinmux += ";\n"
# ======================================================== #
- # check each cell if "peripheral input/inout" then assign its wire
- # Here we check the direction of each signal in the dictionary.
- # We choose to keep the dictionary within the code and not user-input
- # since the interfaces are always standard and cannot change from
- # user-to-user. Plus this also reduces human-error as well :)
- p.pinmux += " rule assign_inputs_from_io_to_wires;"
- for cell in p.muxed_cells:
+ # check each cell if "peripheral input/inout" then assign its wire
+ # Here we check the direction of each signal in the dictionary.
+ # We choose to keep the dictionary within the code and not user-input
+ # since the interfaces are always standard and cannot change from
+ # user-to-user. Plus this also reduces human-error as well :)
for i in range(0, len(cell) - 1):
cname = cell[i + 1]
+ if not cname: # skip blank entries, no need to test
+ continue
temp = transfn(cname)
x = ifaces.getifacetype(temp)
#print (cname, temp, x)
p.pinmux += \
mux_wire.format(cell[0], i, "wr" + cname +
"_in") + "\n"
- p.pinmux += " endrule\n"
# ============================================================ #
# ================== Logic for dedicated pins ========= #