[top] Change edn hook-up

see #5487

Signed-off-by: Timothy Chen <timothytim@google.com>
diff --git a/hw/ip/edn/data/edn.hjson b/hw/ip/edn/data/edn.hjson
index 4193385..490f672 100644
--- a/hw/ip/edn/data/edn.hjson
+++ b/hw/ip/edn/data/edn.hjson
@@ -51,7 +51,7 @@
       type:    "req_rsp",
       name:    "edn",
       act:     "rsp",
-      width:   "4",
+      width:   "6",
       default: "'0",
       desc:    '''
                The collection of peripheral ports supported by edn. The width (4)
diff --git a/hw/ip/edn/rtl/edn.sv b/hw/ip/edn/rtl/edn.sv
index 6fb6bb7..84b75da 100644
--- a/hw/ip/edn/rtl/edn.sv
+++ b/hw/ip/edn/rtl/edn.sv
@@ -10,7 +10,7 @@
   import edn_pkg::*;
   import edn_reg_pkg::*;
 #(
-  parameter int NumEndPoints = 4,
+  parameter int NumEndPoints = 6,
   parameter logic [NumAlerts-1:0] AlertAsyncOn = {NumAlerts{1'b1}},
   parameter int BootInsCmd = 32'h0000_0001,
   parameter int BootGenCmd = 32'h0000_3003
diff --git a/hw/top_earlgrey/data/autogen/top_earlgrey.gen.hjson b/hw/top_earlgrey/data/autogen/top_earlgrey.gen.hjson
index c73a645..6d2fe8b 100644
--- a/hw/top_earlgrey/data/autogen/top_earlgrey.gen.hjson
+++ b/hw/top_earlgrey/data/autogen/top_earlgrey.gen.hjson
@@ -1894,8 +1894,8 @@
           width: 1
           inst_name: alert_handler
           default: ""
-          top_signame: edn1_edn
-          index: 0
+          top_signame: edn0_edn
+          index: 4
         }
         {
           name: esc_rx
@@ -3469,8 +3469,8 @@
           width: 1
           inst_name: aes
           default: ""
-          top_signame: edn1_edn
-          index: 2
+          top_signame: edn0_edn
+          index: 5
         }
         {
           name: tl
@@ -4178,7 +4178,7 @@
           package: edn_pkg
           type: req_rsp
           act: rsp
-          width: 4
+          width: 6
           default: "'0"
           inst_name: edn0
           end_idx: -1
@@ -4250,10 +4250,10 @@
           package: edn_pkg
           type: req_rsp
           act: rsp
-          width: 4
+          width: 6
           default: "'0"
           inst_name: edn1
-          end_idx: 3
+          end_idx: 1
           top_type: partial-one-to-N
           top_signame: edn1_edn
           index: -1
@@ -4475,7 +4475,7 @@
           inst_name: otbn
           default: ""
           top_signame: edn1_edn
-          index: 1
+          index: 0
         }
         {
           name: idle
@@ -5005,12 +5005,12 @@
         otp_ctrl.edn
         ast_edn.edn
         kmac.entropy
+        alert_handler.edn
+        aes.edn
       ]
       edn1.edn:
       [
-        alert_handler.edn
         otbn.edn
-        aes.edn
       ]
       otp_ctrl.otp_keymgr_key:
       [
@@ -9463,8 +9463,8 @@
         width: 1
         inst_name: alert_handler
         default: ""
-        top_signame: edn1_edn
-        index: 0
+        top_signame: edn0_edn
+        index: 4
       }
       {
         name: esc_rx
@@ -10534,8 +10534,8 @@
         width: 1
         inst_name: aes
         default: ""
-        top_signame: edn1_edn
-        index: 2
+        top_signame: edn0_edn
+        index: 5
       }
       {
         name: tl
@@ -10912,7 +10912,7 @@
         package: edn_pkg
         type: req_rsp
         act: rsp
-        width: 4
+        width: 6
         default: "'0"
         inst_name: edn0
         end_idx: -1
@@ -10960,10 +10960,10 @@
         package: edn_pkg
         type: req_rsp
         act: rsp
-        width: 4
+        width: 6
         default: "'0"
         inst_name: edn1
-        end_idx: 3
+        end_idx: 1
         top_type: partial-one-to-N
         top_signame: edn1_edn
         index: -1
@@ -11091,7 +11091,7 @@
         inst_name: otbn
         default: ""
         top_signame: edn1_edn
-        index: 1
+        index: 0
       }
       {
         name: idle
@@ -12766,7 +12766,7 @@
         package: edn_pkg
         struct: edn_req
         signame: edn0_edn_req
-        width: 4
+        width: 6
         type: req_rsp
         end_idx: -1
         act: rsp
@@ -12777,7 +12777,7 @@
         package: edn_pkg
         struct: edn_rsp
         signame: edn0_edn_rsp
-        width: 4
+        width: 6
         type: req_rsp
         end_idx: -1
         act: rsp
@@ -12788,9 +12788,9 @@
         package: edn_pkg
         struct: edn_req
         signame: edn1_edn_req
-        width: 4
+        width: 6
         type: req_rsp
-        end_idx: 3
+        end_idx: 1
         act: rsp
         suffix: req
         default: "'0"
@@ -12799,9 +12799,9 @@
         package: edn_pkg
         struct: edn_rsp
         signame: edn1_edn_rsp
-        width: 4
+        width: 6
         type: req_rsp
-        end_idx: 3
+        end_idx: 1
         act: rsp
         suffix: rsp
         default: "'0"
diff --git a/hw/top_earlgrey/data/top_earlgrey.hjson b/hw/top_earlgrey/data/top_earlgrey.hjson
index 78bafa4..e9745ae 100755
--- a/hw/top_earlgrey/data/top_earlgrey.hjson
+++ b/hw/top_earlgrey/data/top_earlgrey.hjson
@@ -785,9 +785,10 @@
       'usbdev.usb_suspend'      : ['pinmux_aon.usb_suspend'],
       'pinmux_aon.usb_state_debug' : ['usbdev.usb_state_debug'],
 
-      // TODO see #4447
-      'edn0.edn'              : ['keymgr.edn', 'otp_ctrl.edn', 'ast_edn.edn', 'kmac.entropy'],
-      'edn1.edn'              : ['alert_handler.edn', 'otbn.edn', 'aes.edn'],
+      // Edn connections
+      'edn0.edn'              : ['keymgr.edn', 'otp_ctrl.edn', 'ast_edn.edn', 'kmac.entropy',
+                                 'alert_handler.edn', 'aes.edn'],
+      'edn1.edn'              : ['otbn.edn'],
 
       // KeyMgr Sideload & KDF function
       'otp_ctrl.otp_keymgr_key' : ['keymgr.otp_key'],
diff --git a/hw/top_earlgrey/rtl/autogen/top_earlgrey.sv b/hw/top_earlgrey/rtl/autogen/top_earlgrey.sv
index df2e19b..0f357df 100644
--- a/hw/top_earlgrey/rtl/autogen/top_earlgrey.sv
+++ b/hw/top_earlgrey/rtl/autogen/top_earlgrey.sv
@@ -446,10 +446,10 @@
   logic       usbdev_usb_aon_wake_ack;
   logic       usbdev_usb_suspend;
   usbdev_pkg::awk_state_t       pinmux_aon_usb_state_debug;
-  edn_pkg::edn_req_t [3:0] edn0_edn_req;
-  edn_pkg::edn_rsp_t [3:0] edn0_edn_rsp;
-  edn_pkg::edn_req_t [3:0] edn1_edn_req;
-  edn_pkg::edn_rsp_t [3:0] edn1_edn_rsp;
+  edn_pkg::edn_req_t [5:0] edn0_edn_req;
+  edn_pkg::edn_rsp_t [5:0] edn0_edn_rsp;
+  edn_pkg::edn_req_t [5:0] edn1_edn_req;
+  edn_pkg::edn_rsp_t [5:0] edn1_edn_rsp;
   otp_ctrl_pkg::otp_keymgr_key_t       otp_ctrl_otp_keymgr_key;
   keymgr_pkg::hw_key_req_t       keymgr_kmac_key;
   keymgr_pkg::kmac_data_req_t       keymgr_kmac_data_req;
@@ -579,11 +579,23 @@
   assign ast_edn_edn_rsp_o = edn0_edn_rsp[2];
 
   // define partial inter-module tie-off
+  edn_pkg::edn_rsp_t unused_edn1_edn_rsp1;
+  edn_pkg::edn_rsp_t unused_edn1_edn_rsp2;
   edn_pkg::edn_rsp_t unused_edn1_edn_rsp3;
+  edn_pkg::edn_rsp_t unused_edn1_edn_rsp4;
+  edn_pkg::edn_rsp_t unused_edn1_edn_rsp5;
 
   // assign partial inter-module tie-off
+  assign unused_edn1_edn_rsp1 = edn1_edn_rsp[1];
+  assign unused_edn1_edn_rsp2 = edn1_edn_rsp[2];
   assign unused_edn1_edn_rsp3 = edn1_edn_rsp[3];
+  assign unused_edn1_edn_rsp4 = edn1_edn_rsp[4];
+  assign unused_edn1_edn_rsp5 = edn1_edn_rsp[5];
+  assign edn1_edn_req[1] = '0;
+  assign edn1_edn_req[2] = '0;
   assign edn1_edn_req[3] = '0;
+  assign edn1_edn_req[4] = '0;
+  assign edn1_edn_req[5] = '0;
 
 
   // Unused reset signals
@@ -1522,8 +1534,8 @@
 
       // Inter-module signals
       .crashdump_o(alert_handler_crashdump),
-      .edn_o(edn1_edn_req[0]),
-      .edn_i(edn1_edn_rsp[0]),
+      .edn_o(edn0_edn_req[4]),
+      .edn_i(edn0_edn_rsp[4]),
       .esc_rx_i(alert_handler_esc_rx),
       .esc_tx_o(alert_handler_esc_tx),
       .tl_i(alert_handler_tl_req),
@@ -1848,8 +1860,8 @@
       // Inter-module signals
       .idle_o(clkmgr_aon_idle[0]),
       .lc_escalate_en_i(lc_ctrl_lc_escalate_en),
-      .edn_o(edn1_edn_req[2]),
-      .edn_i(edn1_edn_rsp[2]),
+      .edn_o(edn0_edn_req[5]),
+      .edn_i(edn0_edn_rsp[5]),
       .tl_i(aes_tl_req),
       .tl_o(aes_tl_rsp),
 
@@ -2098,8 +2110,8 @@
       .alert_rx_i  ( alert_rx[28:27] ),
 
       // Inter-module signals
-      .edn_o(edn1_edn_req[1]),
-      .edn_i(edn1_edn_rsp[1]),
+      .edn_o(edn1_edn_req[0]),
+      .edn_i(edn1_edn_rsp[0]),
       .idle_o(clkmgr_aon_idle[3]),
       .tl_i(otbn_tl_req),
       .tl_o(otbn_tl_rsp),
diff --git a/sw/device/tests/aes_test.c b/sw/device/tests/aes_test.c
index 82765f3..93a04df 100644
--- a/sw/device/tests/aes_test.c
+++ b/sw/device/tests/aes_test.c
@@ -51,7 +51,7 @@
                       ENTROPY_SRC_CONF_REG_OFFSET, 0x2);
   mmio_region_write32(mmio_region_from_addr(TOP_EARLGREY_CSRNG_BASE_ADDR),
                       CSRNG_CTRL_REG_OFFSET, 0x1);
-  mmio_region_write32(mmio_region_from_addr(TOP_EARLGREY_EDN1_BASE_ADDR),
+  mmio_region_write32(mmio_region_from_addr(TOP_EARLGREY_EDN0_BASE_ADDR),
                       EDN_CTRL_REG_OFFSET, 0x1);
 
   // Wait for AES unit being idle
@@ -90,12 +90,12 @@
           kCipherTextGold[i], buffer[i]);
   }
 
-  // Disable and re-enable EDN1 to get some more entropy out of it. This is
+  // Disable and re-enable EDN0 to get some more entropy out of it. This is
   // dirty and needs to be reworked. We need to setup CSRNG/EDN to continously
   // provide entropy.
-  mmio_region_write32(mmio_region_from_addr(TOP_EARLGREY_EDN1_BASE_ADDR),
+  mmio_region_write32(mmio_region_from_addr(TOP_EARLGREY_EDN0_BASE_ADDR),
                       EDN_CTRL_REG_OFFSET, 0x0);
-  mmio_region_write32(mmio_region_from_addr(TOP_EARLGREY_EDN1_BASE_ADDR),
+  mmio_region_write32(mmio_region_from_addr(TOP_EARLGREY_EDN0_BASE_ADDR),
                       EDN_CTRL_REG_OFFSET, 0x1);
 
   // Decode
diff --git a/sw/device/tests/dif/dif_aes_smoketest.c b/sw/device/tests/dif/dif_aes_smoketest.c
index 6e85a0c..0d23423 100644
--- a/sw/device/tests/dif/dif_aes_smoketest.c
+++ b/sw/device/tests/dif/dif_aes_smoketest.c
@@ -75,7 +75,7 @@
                       ENTROPY_SRC_CONF_REG_OFFSET, 0x2);
   mmio_region_write32(mmio_region_from_addr(TOP_EARLGREY_CSRNG_BASE_ADDR),
                       CSRNG_CTRL_REG_OFFSET, 0x1);
-  mmio_region_write32(mmio_region_from_addr(TOP_EARLGREY_EDN1_BASE_ADDR),
+  mmio_region_write32(mmio_region_from_addr(TOP_EARLGREY_EDN0_BASE_ADDR),
                       EDN_CTRL_REG_OFFSET, 0x1);
 
   // Initialise AES.
@@ -132,12 +132,12 @@
           cipher_text_gold_words[i], out_data_cipher.data[i]);
   }
 
-  // Disable and re-enable EDN1 to get some more entropy out of it. This is
+  // Disable and re-enable EDN0 to get some more entropy out of it. This is
   // dirty and needs to be reworked. We need to setup CSRNG/EDN to continously
   // provide entropy.
-  mmio_region_write32(mmio_region_from_addr(TOP_EARLGREY_EDN1_BASE_ADDR),
+  mmio_region_write32(mmio_region_from_addr(TOP_EARLGREY_EDN0_BASE_ADDR),
                       EDN_CTRL_REG_OFFSET, 0x0);
-  mmio_region_write32(mmio_region_from_addr(TOP_EARLGREY_EDN1_BASE_ADDR),
+  mmio_region_write32(mmio_region_from_addr(TOP_EARLGREY_EDN0_BASE_ADDR),
                       EDN_CTRL_REG_OFFSET, 0x1);
 
   // Setup ECB decryption transaction.