From: Luke Kenneth Casson Leighton Date: Sat, 14 Apr 2018 11:16:19 +0000 (+0100) Subject: put cell width at fixed (max) bits X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bf08f76841dab3d8ee3ce2a38d3a717216279d13;p=pinmux.git put cell width at fixed (max) bits --- diff --git a/src/bsv/pinmux_generator.py b/src/bsv/pinmux_generator.py index b80f65b..7a01fb3 100644 --- a/src/bsv/pinmux_generator.py +++ b/src/bsv/pinmux_generator.py @@ -141,9 +141,14 @@ def write_pmp(pmp, p, ifaces): // the followins wires capture the pin-mux selection // values for each mux assigned to a CELL ''') + max_num_cells = 0 + for cell in p.muxed_cells: + max_num_cells = max(len(cell)-1, max_num_cells) + cell_bit_width = 'Bit#(%d)' %int(math.log(max_num_cells, 2)) + for cell in p.muxed_cells: bsv_file.write(mux_interface.wirefmt( - cell[0], 'Bit#(' + str(int(math.log(len(cell) - 1, 2))) + ')')) + cell[0], cell_bit_width)) ifaces.wirefmt(bsv_file)