From 65ac2b19eb021bec3f5c6f2043e19d56a4ca5d7b Mon Sep 17 00:00:00 2001 From: Neel Date: Sat, 14 Apr 2018 16:41:00 +0530 Subject: [PATCH] the assignment of a wire from an input configured pin must happen through individual rules. The pinmuxing table might be defined such a way that input pins pin0 and pin2 drive the same function wrfunc. So pin0 using wrcell0_mux to assign wrfunc and pin2 uses wrcell2_mux to assign the same write again. Within the same rule this will cause a multi-driven issue. BSV takes care of this issue by generating an implicit priority between the rules. If rule-A is written before rule-B, then the effects of rule-B will be shadowed i.e only the output of rule-A will be visible. --- src/bsv/actual_pinmux.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/bsv/actual_pinmux.py b/src/bsv/actual_pinmux.py index 982cf46..374976f 100644 --- a/src/bsv/actual_pinmux.py +++ b/src/bsv/actual_pinmux.py @@ -10,8 +10,10 @@ except ImportError: # 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; @@ -45,13 +47,11 @@ def init(p, ifaces): 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] temp = transfn(cname) @@ -68,7 +68,6 @@ def init(p, ifaces): p.pinmux += \ mux_wire.format(cell[0], i, "wr" + cname + "_in") + "\n" - p.pinmux += " endrule\n" # ============================================================ # # ================== Logic for dedicated pins ========= # -- 2.30.2