[top] Escalation hook-up

- Complete escalation hook-up
- nmi_gen is still not removed yet because it is the only module
  generating a vanilla reset requests.  Keep until rbox / aon_timer lands

Signed-off-by: Timothy Chen <timothytim@google.com>

[nmi_gen] Tie-off inputs

Signed-off-by: Timothy Chen <timothytim@google.com>

[top] remove comments

Signed-off-by: Timothy Chen <timothytim@google.com>
diff --git a/hw/ip/alert_handler/data/alert_handler.hjson.tpl b/hw/ip/alert_handler/data/alert_handler.hjson.tpl
index 937b585..cea2831 100644
--- a/hw/ip/alert_handler/data/alert_handler.hjson.tpl
+++ b/hw/ip/alert_handler/data/alert_handler.hjson.tpl
@@ -118,21 +118,20 @@
       default: " 1'b0",
       act:     "rcv",
     },
-    // TODO: wire up once all endpoints support the intersig feature.
-    // { struct:  "esc_rx"
-    //   type:    "uni"
-    //   name:    "esc_rx"
-    //   act:     "rcv"
-    //   width:   "4", // N_ESC_SEV
-    //   package: "prim_esc_pkg"
-    // },
-    // { struct:  "esc_tx"
-    //   type:    "uni"
-    //   name:    "esc_tx"
-    //   act:     "req"
-    //   width:   "4", // N_ESC_SEV
-    //   package: "prim_esc_pkg"
-    // },
+    { struct:  "esc_rx"
+      type:    "uni"
+      name:    "esc_rx"
+      act:     "rcv"
+      width:   "4", // N_ESC_SEV
+      package: "prim_esc_pkg"
+    },
+    { struct:  "esc_tx"
+      type:    "uni"
+      name:    "esc_tx"
+      act:     "req"
+      width:   "4", // N_ESC_SEV
+      package: "prim_esc_pkg"
+    },
   ]
 ##############################################################################
 # interrupt registers for the classes
diff --git a/hw/ip/nmi_gen/data/nmi_gen.hjson b/hw/ip/nmi_gen/data/nmi_gen.hjson
index e2402d3..471b1ac 100644
--- a/hw/ip/nmi_gen/data/nmi_gen.hjson
+++ b/hw/ip/nmi_gen/data/nmi_gen.hjson
@@ -41,6 +41,22 @@
       package: "",
       default: "1'b0"
     },
+
+    { struct:  "esc_tx",
+      type:    "uni",
+      name:    "esc_tx",
+      act:     "rcv",
+      package: "prim_esc_pkg",
+      default: "'{3{prim_esc_pkg::ESC_TX_DEFAULT}}"
+    },
+
+    { struct:  "esc_rx",
+      type:    "uni",
+      name:    "esc_rx",
+      act:     "req",
+      package: "prim_esc_pkg",
+    },
+
   ],
 
   registers: [
diff --git a/hw/top_earlgrey/data/top_earlgrey.hjson b/hw/top_earlgrey/data/top_earlgrey.hjson
index 4b904ad..07a574c 100755
--- a/hw/top_earlgrey/data/top_earlgrey.hjson
+++ b/hw/top_earlgrey/data/top_earlgrey.hjson
@@ -162,6 +162,32 @@
   // Number of cores: used in rv_plic and timer
   num_cores: "1",
 
+
+  // `host` defines the host only components in the system (such as processor)
+  // This should eventually be used to cover more functionality, but for now,
+  // it is a temporary solution for top level connectivity
+  host: [
+    { name: "rv_core_ibex",
+      type: "rv_core_ibex",
+      inter_signal_list: [
+        { struct:  "esc_tx",
+          type:    "uni",
+          name:    "esc_nmi_tx",
+          act:     "rcv",
+          package: "prim_esc_pkg",
+        },
+
+        { struct:  "esc_rx",
+          type:    "uni",
+          name:    "esc_nmi_rx",
+          act:     "req",
+          package: "prim_esc_pkg",
+        },
+      ],
+    }
+
+  ]
+
   // `module` defines the peripherals.
   // Details are coming from each modules' config file `ip.hjson`
   // TODO: Define parameter here
@@ -513,17 +539,16 @@
   //  e.g flash_ctrl0.flash: [flash_phy0.flash_ctrl]
   inter_module: {
     'connect': {
-      'alert_handler.crashdump': ['rstmgr.alert_dump'],
-      // TODO: uncomment once NMI gen is removed,
-      // the processor core wrapper supports intermodule signals
-      // and the reset manager has an escalation input.
-      //'alert_handler.esc_rx': ['lc_ctrl.esc_wipe_secrets_rx',
-      //                         'lc_ctrl.esc_scrap_state_rx'
-      //                         'pwrmgr.esc_rst_rx'],
-      //'alert_handler.esc_tx': ['lc_ctrl.esc_wipe_secrets_tx',
-      //                         'lc_ctrl.esc_scrap_state_tx',
-      //                         'pwrmgr.esc_rst_tx'],
-      'csrng.csrng_cmd' : ['edn0.csrng_cmd', 'edn1.csrng_cmd'],
+      'alert_handler.crashdump' : ['rstmgr.alert_dump'],
+      'alert_handler.esc_rx'    : ['rv_core_ibex.esc_nmi_rx',
+                                   'lc_ctrl.esc_wipe_secrets_rx',
+                                   'lc_ctrl.esc_scrap_state_rx'
+                                   'pwrmgr.esc_rst_rx'],
+      'alert_handler.esc_tx'    : ['rv_core_ibex.esc_nmi_tx',
+                                   'lc_ctrl.esc_wipe_secrets_tx',
+                                   'lc_ctrl.esc_scrap_state_tx',
+                                   'pwrmgr.esc_rst_tx'],
+      'csrng.csrng_cmd'         : ['edn0.csrng_cmd', 'edn1.csrng_cmd'],
       'csrng.entropy_src_hw_if' : ['entropy_src.entropy_src_hw_if'],
       'flash_ctrl.flash'        : ['eflash.flash_ctrl'],
       'flash_ctrl.keymgr'       : ['keymgr.flash'],
diff --git a/hw/top_earlgrey/data/top_earlgrey.sv.tpl b/hw/top_earlgrey/data/top_earlgrey.sv.tpl
index 4896798..36a9a4a 100644
--- a/hw/top_earlgrey/data/top_earlgrey.sv.tpl
+++ b/hw/top_earlgrey/data/top_earlgrey.sv.tpl
@@ -167,9 +167,6 @@
   // Alert list
   prim_alert_pkg::alert_tx_t [alert_pkg::NAlerts-1:0]  alert_tx;
   prim_alert_pkg::alert_rx_t [alert_pkg::NAlerts-1:0]  alert_rx;
-  // Escalation outputs
-  prim_esc_pkg::esc_tx_t [alert_pkg::N_ESC_SEV-1:0]  esc_tx;
-  prim_esc_pkg::esc_rx_t [alert_pkg::N_ESC_SEV-1:0]  esc_rx;
 
 % if not top["alert"]:
   for (genvar k = 0; k < alert_pkg::NAlerts; k++) begin : gen_alert_tie_off
@@ -244,8 +241,8 @@
     .irq_timer_i          (intr_rv_timer_timer_expired_0_0),
     .irq_external_i       (irq_plic),
     // escalation input from alert handler (NMI)
-    .esc_tx_i             (esc_tx[0]),
-    .esc_rx_o             (esc_rx[0]),
+    .esc_tx_i             (alert_handler_esc_tx[0]),
+    .esc_rx_o             (alert_handler_esc_rx[0]),
     // debug interface
     .debug_req_i          (debug_req),
     // CPU control signals
@@ -615,14 +612,6 @@
       // alert signals
       .alert_rx_o  ( alert_rx ),
       .alert_tx_i  ( alert_tx ),
-      // escalation outputs
-      .esc_rx_i    ( esc_rx   ),
-      .esc_tx_o    ( esc_tx   ),
-    % endif
-    % if m["type"] == "nmi_gen":
-      // escalation signal inputs
-      .esc_rx_o    ( esc_rx[3:1] ),
-      .esc_tx_i    ( esc_tx[3:1] ),
     % endif
     % if m["scan"] == "true":
       .scanmode_i   (scanmode_i),
diff --git a/util/topgen/intermodule.py b/util/topgen/intermodule.py
index e8fd2cf..7092d7a 100644
--- a/util/topgen/intermodule.py
+++ b/util/topgen/intermodule.py
@@ -195,7 +195,8 @@
         topcfg["inter_signal"] = OrderedDict()
 
     # Gather the inter_signal_list
-    instances = topcfg["module"] + topcfg["memory"] + topcfg["xbar"]
+    instances = topcfg["module"] + topcfg["memory"] + topcfg["xbar"] + \
+        topcfg["host"]
 
     intermodule_instances = [x for x in instances if "inter_signal_list" in x]
 
@@ -687,7 +688,7 @@
 
             # If not, error
             else:
-                log.error("'uni' type connection {req} should be either"
+                log.error("'uni' type connection {req} should be either "
                           "OneToN or Broadcast".format(req=req))
                 error += 1
         elif req_struct["type"] == "uni":