[padctrl] Remove padctrl sources and merge functionality into pinmux

Note that hw/ip/padctrl still contains some legacy documentation
material and design sources that need to be moved or merged with the
pinmux docs. This will be done in a separate PR.

Signed-off-by: Michael Schaffner <msf@opentitan.org>
diff --git a/util/build_docs.py b/util/build_docs.py
index 253bf9a..477361f 100755
--- a/util/build_docs.py
+++ b/util/build_docs.py
@@ -70,7 +70,6 @@
         "hw/ip/nmi_gen/data/nmi_gen.hjson",
         "hw/ip/otbn/data/otbn.hjson",
         "hw/ip/otp_ctrl/data/otp_ctrl.hjson",
-        "hw/ip/padctrl/data/padctrl.hjson",
         "hw/ip/pattgen/data/pattgen.hjson",
         "hw/ip/pwm/data/pwm.hjson",
         "hw/top_earlgrey/ip/pinmux/data/autogen/pinmux.hjson",
@@ -105,7 +104,6 @@
         "hw/ip/keymgr/data/keymgr_testplan.hjson",
         "hw/ip/lc_ctrl/data/lc_ctrl_testplan.hjson",
         "hw/ip/otp_ctrl/data/otp_ctrl_testplan.hjson",
-        "hw/ip/padctrl/data/padctrl_fpv_testplan.hjson",
         "hw/ip/pattgen/data/pattgen_testplan.hjson",
         "hw/ip/pinmux/data/pinmux_fpv_testplan.hjson",
         "hw/ip/rv_plic/data/rv_plic_fpv_testplan.hjson",
diff --git a/util/syn_yosys.sh b/util/syn_yosys.sh
index b3c9ec1..14a6fb5 100755
--- a/util/syn_yosys.sh
+++ b/util/syn_yosys.sh
@@ -79,7 +79,6 @@
   "aes"
   "hmac"
   "pinmux"
-  "padctrl"
   "alert_handler"
   "pwrmgr"
   "rstmgr"
diff --git a/util/topgen-fusesoc.py b/util/topgen-fusesoc.py
index c864032..ba2936b 100644
--- a/util/topgen-fusesoc.py
+++ b/util/topgen-fusesoc.py
@@ -90,7 +90,7 @@
     # example, flash_ctrl depends on topgen but also on pwrmgr_pkg which depends on
     # pwrmgr_reg_pkg generated by topgen.
     if reg_only:
-        for ip in ['alert_handler', 'clkmgr', 'flash_ctrl', 'padctrl', 'pinmux', 'pwrmgr',
+        for ip in ['alert_handler', 'clkmgr', 'flash_ctrl', 'pinmux', 'pwrmgr',
                    'rstmgr', 'rv_plic']:
             core_filepath = os.path.abspath('generated-%s.core' % ip)
             name = 'lowrisc:ip:%s_reggen' % ip,
diff --git a/util/topgen.py b/util/topgen.py
index 25ea189..0bd4783 100755
--- a/util/topgen.py
+++ b/util/topgen.py
@@ -330,7 +330,7 @@
     return bit_pos
 
 
-def generate_pinmux_and_padctrl(top, out_path):
+def generate_pinmux(top, out_path):
     topname = top["name"]
     # MIO Pads
     n_mio_pads = top["pinmux"]["num_mio"]
@@ -390,6 +390,9 @@
     n_dio_periph_out = num_dio_inouts + num_dio_outputs
     n_dio_pads = num_dio_inouts + num_dio_inputs + num_dio_outputs
 
+    # TODO: derive this value
+    attr_dw = 10
+
     if n_dio_pads <= 0:
         # TODO: add support for no DIO case
         log.error("Topgen does currently not support generation of a top " +
@@ -412,6 +415,7 @@
     log.info("num_dio_inputs:  %d" % num_dio_inputs)
     log.info("num_dio_outputs: %d" % num_dio_outputs)
     log.info("num_dio_inouts:  %d" % num_dio_inouts)
+    log.info("attr_dw:         %d" % attr_dw)
     log.info("num_wkup_detect: %d" % num_wkup_detect)
     log.info("wkup_cnt_width:  %d" % wkup_cnt_width)
     log.info("This translates to:")
@@ -460,6 +464,7 @@
                 n_dio_periph_in=n_dio_pads,
                 n_dio_periph_out=n_dio_pads,
                 n_dio_pads=n_dio_pads,
+                attr_dw=attr_dw,
                 n_wkup_detect=num_wkup_detect,
                 wkup_cnt_width=wkup_cnt_width,
                 usb_start_pos=usb_start_pos,
@@ -486,48 +491,6 @@
     validate.validate(hjson_obj)
     gen_rtl.gen_rtl(hjson_obj, str(rtl_path))
 
-    # Target path
-    #   rtl: padctrl_reg_pkg.sv & padctrl_reg_top.sv
-    #   data: padctrl.hjson
-    rtl_path = out_path / 'ip/padctrl/rtl/autogen'
-    rtl_path.mkdir(parents=True, exist_ok=True)
-    data_path = out_path / 'ip/padctrl/data/autogen'
-    data_path.mkdir(parents=True, exist_ok=True)
-
-    # Template path
-    tpl_path = Path(
-        __file__).resolve().parent / '../hw/ip/padctrl/data/padctrl.hjson.tpl'
-
-    # Generate register package and RTLs
-    gencmd = ("// util/topgen.py -t hw/top_{topname}/data/top_{topname}.hjson "
-              "-o hw/top_{topname}/\n\n".format(topname=topname))
-
-    hjson_gen_path = data_path / "padctrl.hjson"
-
-    out = StringIO()
-    with tpl_path.open(mode='r', encoding='UTF-8') as fin:
-        hjson_tpl = Template(fin.read())
-        try:
-            out = hjson_tpl.render(n_mio_pads=n_mio_pads,
-                                   n_dio_pads=n_dio_pads,
-                                   attr_dw=10)
-        except:  # noqa: E722
-            log.error(exceptions.text_error_template().render())
-        log.info("PADCTRL HJSON: %s" % out)
-
-    if out == "":
-        log.error("Cannot generate padctrl HJSON")
-        return
-
-    with hjson_gen_path.open(mode='w', encoding='UTF-8') as fout:
-        fout.write(genhdr + gencmd + out)
-
-    hjson_obj = hjson.loads(out,
-                            use_decimal=True,
-                            object_pairs_hook=validate.checking_dict)
-    validate.validate(hjson_obj)
-    gen_rtl.gen_rtl(hjson_obj, str(rtl_path))
-
 
 def generate_clkmgr(top, cfg_path, out_path):
 
@@ -1036,7 +999,7 @@
             sys.exit()
 
     # Generate Pinmux
-    generate_pinmux_and_padctrl(completecfg, out_path)
+    generate_pinmux(completecfg, out_path)
 
     # Generate Pwrmgr
     generate_pwrmgr(completecfg, out_path)