[otbn] Add second EDN connection

OTBN needs two connections, one for RND and URND. This purely adds the
second EDN connection, RND and URND are not yet implemented.

Fixes #5523

Signed-off-by: Greg Chadwick <gac@lowrisc.org>
diff --git a/hw/ip/edn/data/edn.hjson b/hw/ip/edn/data/edn.hjson
index 490f672..645c604 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:   "6",
+      width:   "7",
       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 44cc3f7..f004a56 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 = 6,
+  parameter int NumEndPoints = 7,
   parameter logic [NumAlerts-1:0] AlertAsyncOn = {NumAlerts{1'b1}},
   parameter int BootInsCmd = 32'h0000_0001,
   parameter int BootGenCmd = 32'h00ff_f003
diff --git a/hw/ip/otbn/data/otbn.hjson b/hw/ip/otbn/data/otbn.hjson
index 5e8b086..d7c0cbb 100644
--- a/hw/ip/otbn/data/otbn.hjson
+++ b/hw/ip/otbn/data/otbn.hjson
@@ -36,13 +36,21 @@
   ]
 
   inter_signal_list: [
-    // EDN interface
+    // EDN interface for RND
     { struct:  "edn"
       type:    "req_rsp"
-      name:    "edn"
+      name:    "edn_rnd"
       act:     "req"
       package: "edn_pkg"
-    }
+    },
+
+    // EDN interface for URND
+    { struct:  "edn"
+      type:    "req_rsp"
+      name:    "edn_urnd"
+      act:     "req"
+      package: "edn_pkg"
+    },
 
     // OTBN is not performing any operation and can be clock/power-gated.
     { name:    "idle",
diff --git a/hw/ip/otbn/dv/verilator/otbn_top_sim.sv b/hw/ip/otbn/dv/verilator/otbn_top_sim.sv
index d6f639b..ab0f638 100644
--- a/hw/ip/otbn/dv/verilator/otbn_top_sim.sv
+++ b/hw/ip/otbn/dv/verilator/otbn_top_sim.sv
@@ -46,50 +46,57 @@
   logic                     dmem_rerror;
 
   // Entropy Distribution Network (EDN)
-  logic                     edn_req;
-  logic                     edn_ack;
-  logic [EdnDataWidth-1:0]  edn_data;
+  logic                     edn_rnd_req, edn_urnd_req;
+  logic                     edn_rnd_ack, edn_urnd_ack;
+  logic [EdnDataWidth-1:0]  edn_rnd_data, edn_urnd_data;
 
   otbn_core #(
     .ImemSizeByte ( ImemSizeByte ),
     .DmemSizeByte ( DmemSizeByte )
   ) u_otbn_core (
-    .clk_i         ( IO_CLK          ),
-    .rst_ni        ( IO_RST_N        ),
+    .clk_i           ( IO_CLK          ),
+    .rst_ni          ( IO_RST_N        ),
 
-    .start_i       ( otbn_start      ),
-    .done_o        ( otbn_done_d     ),
+    .start_i         ( otbn_start      ),
+    .done_o          ( otbn_done_d     ),
 
-    .err_bits_o    ( otbn_err_bits_d ),
+    .err_bits_o      ( otbn_err_bits_d ),
 
-    .start_addr_i  ( ImemStartAddr   ),
+    .start_addr_i    ( ImemStartAddr   ),
 
-    .imem_req_o    ( imem_req        ),
-    .imem_addr_o   ( imem_addr       ),
-    .imem_wdata_o  (                 ),
-    .imem_rdata_i  ( imem_rdata      ),
-    .imem_rvalid_i ( imem_rvalid     ),
-    .imem_rerror_i ( imem_rerror     ),
+    .imem_req_o      ( imem_req        ),
+    .imem_addr_o     ( imem_addr       ),
+    .imem_wdata_o    (                 ),
+    .imem_rdata_i    ( imem_rdata      ),
+    .imem_rvalid_i   ( imem_rvalid     ),
+    .imem_rerror_i   ( imem_rerror     ),
 
-    .dmem_req_o    ( dmem_req        ),
-    .dmem_write_o  ( dmem_write      ),
-    .dmem_addr_o   ( dmem_addr       ),
-    .dmem_wdata_o  ( dmem_wdata      ),
-    .dmem_wmask_o  ( dmem_wmask      ),
-    .dmem_rdata_i  ( dmem_rdata      ),
-    .dmem_rvalid_i ( dmem_rvalid     ),
-    .dmem_rerror_i ( dmem_rerror     ),
+    .dmem_req_o      ( dmem_req        ),
+    .dmem_write_o    ( dmem_write      ),
+    .dmem_addr_o     ( dmem_addr       ),
+    .dmem_wdata_o    ( dmem_wdata      ),
+    .dmem_wmask_o    ( dmem_wmask      ),
+    .dmem_rdata_i    ( dmem_rdata      ),
+    .dmem_rvalid_i   ( dmem_rvalid     ),
+    .dmem_rerror_i   ( dmem_rerror     ),
 
-    .edn_req_o     ( edn_req         ),
-    .edn_ack_i     ( edn_ack         ),
-    .edn_data_i    ( edn_data        )
+    .edn_rnd_req_o   ( edn_rnd_req     ),
+    .edn_rnd_ack_i   ( edn_rnd_ack     ),
+    .edn_rnd_data_i  ( edn_rnd_data    ),
+
+    .edn_urnd_req_o  ( edn_urnd_req    ),
+    .edn_urnd_ack_i  ( edn_urnd_ack    ),
+    .edn_urnd_data_i ( edn_urnd_data   )
   );
 
   // Tie-off EDN signals, eventually simulation will provide something here for testing RND
-  logic unused_edn_req;
-  assign unused_edn_req = edn_req;
-  assign edn_ack = 1'b0;
-  assign edn_data = '0;
+  logic unused_edn_rnd_req, unused_edn_urnd_req;
+  assign unused_edn_rnd_req = edn_rnd_req;
+  assign unused_edn_urnd_req = edn_urnd_req;
+  assign edn_rnd_ack = 1'b0;
+  assign edn_rnd_data = '0;
+  assign edn_urnd_ack = 1'b0;
+  assign edn_urnd_data = '0;
 
   bind otbn_core otbn_trace_if #(.ImemAddrWidth, .DmemAddrWidth) i_otbn_trace_if (.*);
   bind otbn_core otbn_tracer u_otbn_tracer(.*, .otbn_trace(i_otbn_trace_if));
diff --git a/hw/ip/otbn/rtl/otbn.sv b/hw/ip/otbn/rtl/otbn.sv
index 521e015..3dc7b73 100644
--- a/hw/ip/otbn/rtl/otbn.sv
+++ b/hw/ip/otbn/rtl/otbn.sv
@@ -34,8 +34,11 @@
   // EDN clock and interface
   input                                              clk_edn_i,
   input                                              rst_edn_ni,
-  output edn_pkg::edn_req_t                          edn_o,
-  input  edn_pkg::edn_rsp_t                          edn_i
+  output edn_pkg::edn_req_t                          edn_rnd_o,
+  input  edn_pkg::edn_rsp_t                          edn_rnd_i,
+
+  output edn_pkg::edn_req_t                          edn_urnd_o,
+  input  edn_pkg::edn_rsp_t                          edn_urnd_i
 );
 
   import prim_util_pkg::vbits;
@@ -443,25 +446,44 @@
   end
 
 
-  // EDN Connection ============================================================
-  logic edn_req, edn_ack;
-  logic [EdnDataWidth-1:0] edn_data;
+  // EDN Connections ============================================================
+  logic edn_rnd_req, edn_rnd_ack;
+  logic [EdnDataWidth-1:0] edn_rnd_data;
 
-  // This synchronizes the data coming from EDN and stacks the
-  // 32bit EDN words to achieve an internal entropy width of 256 bit.
+  logic edn_urnd_req, edn_urnd_ack;
+  logic [EdnDataWidth-1:0] edn_urnd_data;
+
+  // These synchronize the data coming from EDN and stack the 32 bit EDN words to achieve an
+  // internal entropy width of 256 bit.
+
   prim_edn_req #(
     .OutWidth(EdnDataWidth)
-  ) u_prim_edn_req (
+  ) u_prim_edn_rnd_req (
     .clk_i,
     .rst_ni,
-    .req_i      ( edn_req  ),
-    .ack_o      ( edn_ack  ),
-    .data_o     ( edn_data ),
-    .fips_o     (          ), // unused
+    .req_i      ( edn_rnd_req  ),
+    .ack_o      ( edn_rnd_ack  ),
+    .data_o     ( edn_rnd_data ),
+    .fips_o     (              ), // unused
     .clk_edn_i,
     .rst_edn_ni,
-    .edn_o,
-    .edn_i
+    .edn_o      ( edn_rnd_o    ),
+    .edn_i      ( edn_rnd_i    )
+  );
+
+  prim_edn_req #(
+    .OutWidth(EdnDataWidth)
+  ) u_prim_edn_urnd_req (
+    .clk_i,
+    .rst_ni,
+    .req_i      ( edn_urnd_req  ),
+    .ack_o      ( edn_urnd_ack  ),
+    .data_o     ( edn_urnd_data ),
+    .fips_o     (               ), // unused
+    .clk_edn_i,
+    .rst_edn_ni,
+    .edn_o      ( edn_urnd_o    ),
+    .edn_i      ( edn_urnd_i    )
   );
 
 
@@ -561,32 +583,36 @@
       .clk_i,
       .rst_ni,
 
-      .start_i (start),
-      .done_o  (done),
+      .start_i         (start),
+      .done_o          (done),
 
-      .err_bits_o (err_bits),
+      .err_bits_o      (err_bits),
 
-      .start_addr_i  (start_addr),
+      .start_addr_i    (start_addr),
 
-      .imem_req_o    (imem_req_core),
-      .imem_addr_o   (imem_addr_core),
-      .imem_wdata_o  (imem_wdata_core),
-      .imem_rdata_i  (imem_rdata_core),
-      .imem_rvalid_i (imem_rvalid_core),
-      .imem_rerror_i (imem_rerror_core),
+      .imem_req_o      (imem_req_core),
+      .imem_addr_o     (imem_addr_core),
+      .imem_wdata_o    (imem_wdata_core),
+      .imem_rdata_i    (imem_rdata_core),
+      .imem_rvalid_i   (imem_rvalid_core),
+      .imem_rerror_i   (imem_rerror_core),
 
-      .dmem_req_o    (dmem_req_core),
-      .dmem_write_o  (dmem_write_core),
-      .dmem_addr_o   (dmem_addr_core),
-      .dmem_wdata_o  (dmem_wdata_core),
-      .dmem_wmask_o  (dmem_wmask_core),
-      .dmem_rdata_i  (dmem_rdata_core),
-      .dmem_rvalid_i (dmem_rvalid_core),
-      .dmem_rerror_i (dmem_rerror_core),
+      .dmem_req_o      (dmem_req_core),
+      .dmem_write_o    (dmem_write_core),
+      .dmem_addr_o     (dmem_addr_core),
+      .dmem_wdata_o    (dmem_wdata_core),
+      .dmem_wmask_o    (dmem_wmask_core),
+      .dmem_rdata_i    (dmem_rdata_core),
+      .dmem_rvalid_i   (dmem_rvalid_core),
+      .dmem_rerror_i   (dmem_rerror_core),
 
-      .edn_req_o     (edn_req),
-      .edn_ack_i     (edn_ack),
-      .edn_data_i    (edn_data)
+      .edn_rnd_req_o   (edn_rnd_req),
+      .edn_rnd_ack_i   (edn_rnd_ack),
+      .edn_rnd_data_i  (edn_rnd_data),
+
+      .edn_urnd_req_o  (edn_urnd_req),
+      .edn_urnd_ack_i  (edn_urnd_ack),
+      .edn_urnd_data_i (edn_urnd_data)
     );
   `endif
 
diff --git a/hw/ip/otbn/rtl/otbn_core.sv b/hw/ip/otbn/rtl/otbn_core.sv
index 3496e8d..0c98953 100644
--- a/hw/ip/otbn/rtl/otbn_core.sv
+++ b/hw/ip/otbn/rtl/otbn_core.sv
@@ -51,10 +51,15 @@
   input  logic                     dmem_rvalid_i,
   input  logic                     dmem_rerror_i,
 
-  // Entropy distribution network (EDN)
-  output logic                    edn_req_o,
-  input  logic                    edn_ack_i,
-  input  logic [EdnDataWidth-1:0] edn_data_i
+  // Entropy distribution network (EDN) connections
+  // One for RND, the other for URND
+  output logic                    edn_rnd_req_o,
+  input  logic                    edn_rnd_ack_i,
+  input  logic [EdnDataWidth-1:0] edn_rnd_data_i,
+
+  output logic                    edn_urnd_req_o,
+  input  logic                    edn_urnd_ack_i,
+  input  logic [EdnDataWidth-1:0] edn_urnd_data_i
 );
   // Random number
   // TODO: Hook up to RNG distribution network
@@ -417,11 +422,17 @@
     .ispr_acc_wr_en_i   (ispr_acc_wr_en)
   );
 
-  logic                    unused_edn_ack;
-  logic [EdnDataWidth-1:0] unused_edn_data;
+  logic                    unused_edn_rnd_ack;
+  logic [EdnDataWidth-1:0] unused_edn_rnd_data;
+  logic                    unused_edn_urnd_ack;
+  logic [EdnDataWidth-1:0] unused_edn_urnd_data;
 
   // Tie-off EDN interface
-  assign unused_edn_ack  = edn_ack_i;
-  assign unused_edn_data = edn_data_i;
-  assign edn_req_o       = 1'b0;
+  assign unused_edn_rnd_ack  = edn_rnd_ack_i;
+  assign unused_edn_rnd_data = edn_rnd_data_i;
+  assign edn_rnd_req_o       = 1'b0;
+
+  assign unused_edn_urnd_ack  = edn_urnd_ack_i;
+  assign unused_edn_urnd_data = edn_urnd_data_i;
+  assign edn_urnd_req_o       = 1'b0;
 endmodule