[pinmux] Simplify bitwidth calculation in tpl file
diff --git a/hw/ip/pinmux/doc/pinmux.hjson b/hw/ip/pinmux/doc/pinmux.hjson
index 26f3c36..59d780e 100644
--- a/hw/ip/pinmux/doc/pinmux.hjson
+++ b/hw/ip/pinmux/doc/pinmux.hjson
@@ -54,7 +54,7 @@
 # inputs
     { multireg: { name:     "PERIPH_INSEL",
                   desc:     "Mux select for peripheral inputs.",
-                  count:    "NPeriphOut",
+                  count:    "NPeriphIn",
                   swaccess: "rw",
                   hwaccess: "hro",
                   regwen:   "REGEN",
@@ -94,5 +94,3 @@
   ],
 }
 
-
-
diff --git a/hw/ip/pinmux/doc/pinmux.tpl.hjson b/hw/ip/pinmux/doc/pinmux.tpl.hjson
index 2c84367..565b93e 100644
--- a/hw/ip/pinmux/doc/pinmux.tpl.hjson
+++ b/hw/ip/pinmux/doc/pinmux.tpl.hjson
@@ -60,7 +60,7 @@
                   regwen:   "REGEN",
                   cname:    "IN",
                   fields: [
-                    { bits: "${int(math.ceil(math.log2(n_mio_pads+2))-1)}:0",
+                    { bits: "${(n_mio_pads+1).bit_length()-1}:0",
                       name: "IN",
                       desc: '''
                       0: tie constantly to zero, 1: tie constantly to 1.
@@ -80,7 +80,7 @@
                   regwen:   "REGEN",
                   cname:    "OUT",
                   fields: [
-                    { bits: "${int(math.ceil(math.log2(n_periph_out+3))-1)}:0",
+                    { bits: "${(n_periph_out+2).bit_length()-1}:0",
                       name: "OUT",
                       desc: '''
                       0: tie constantly to zero, 1: tie constantly to 1. 2: high-Z
@@ -93,5 +93,3 @@
     },
   ],
 }
-
-