[keymgr] D2 preparation

- update specific signal to mubi

Signed-off-by: Timothy Chen <timothytim@google.com>
diff --git a/hw/ip/keymgr/keymgr.core b/hw/ip/keymgr/keymgr.core
index 326b4a5..9d5b458 100644
--- a/hw/ip/keymgr/keymgr.core
+++ b/hw/ip/keymgr/keymgr.core
@@ -13,6 +13,7 @@
       - lowrisc:prim:lc_sync
       - lowrisc:prim:lfsr
       - lowrisc:prim:msb_extend
+      - lowrisc:prim:mubi
       - lowrisc:prim:sec_anchor
       - lowrisc:prim:sparse_fsm
       - lowrisc:ip:flash_ctrl_pkg
diff --git a/hw/ip/keymgr/rtl/keymgr.sv b/hw/ip/keymgr/rtl/keymgr.sv
index e15ea99..3da9246 100644
--- a/hw/ip/keymgr/rtl/keymgr.sv
+++ b/hw/ip/keymgr/rtl/keymgr.sv
@@ -77,6 +77,8 @@
   `ASSERT_INIT(GenDataWidth_A, GenDataWidth <= KDFMaxWidth)
   `ASSERT_INIT(OutputKeyDiff_A, RndCnstHardOutputSeed != RndCnstSoftOutputSeed)
 
+  import prim_mubi_pkg::mubi4_test_true_strict;
+  import prim_mubi_pkg::mubi4_test_false_strict;
 
   /////////////////////////////////////
   // Anchor incoming seeds and constants
@@ -235,7 +237,7 @@
 
   keymgr_stage_e stage_sel;
   logic invalid_stage_sel;
-  keymgr_gen_out_e key_sel;
+  prim_mubi_pkg::mubi4_t hw_key_sel;
   logic adv_en, id_en, gen_en;
   logic wipe_key;
   hw_key_req_t kmac_key;
@@ -288,7 +290,7 @@
     .data_valid_o(data_valid),
     .working_state_o(hw2reg.working_state.d),
     .root_key_i(otp_key_i),
-    .hw_sel_o(key_sel),
+    .hw_sel_o(hw_key_sel),
     .stage_sel_o(stage_sel),
     .invalid_stage_sel_o(invalid_stage_sel),
     .cdi_sel_o(cdi_sel),
@@ -433,7 +435,8 @@
   assign cipher_seed = cipher_sel == Aes  ? aes_seed  :
                        cipher_sel == Kmac ? kmac_seed :
                        cipher_sel == Otbn ? otbn_seed : RndCnstNoneSeed;
-  assign output_key = (key_sel == HwKey) ? hard_output_seed : soft_output_seed;
+  assign output_key = mubi4_test_true_strict(hw_key_sel) ? hard_output_seed :
+                      soft_output_seed;
   assign gen_in = invalid_stage_sel ? {GenLfsrCopies{lfsr[31:0]}} : {reg2hw.key_version,
                                                                      reg2hw.salt,
                                                                      cipher_seed,
@@ -515,7 +518,7 @@
     .clr_key_i(keymgr_sideload_clr_e'(reg2hw.sideload_clear.q)),
     .wipe_key_i(wipe_key),
     .dest_sel_i(cipher_sel),
-    .key_sel_i(key_sel),
+    .hw_key_sel_i(hw_key_sel),
     .data_en_i(data_en),
     .data_valid_i(data_valid),
     .key_i(kmac_key),
@@ -528,6 +531,18 @@
   );
 
   for (genvar i = 0; i < 8; i++) begin : gen_sw_assigns
+
+    prim_mubi_pkg::mubi4_t [1:0] hw_key_sel_buf;
+    prim_mubi4_sync #(
+      .NumCopies(2),
+      .AsyncOn(0)
+    ) u_mubi_buf (
+      .clk_i('0),
+      .rst_ni('0),
+      .mubi_i(hw_key_sel),
+      .mubi_o(hw_key_sel_buf)
+    );
+
     prim_sec_anchor_buf #(
      .Width(32)
     ) u_prim_buf_share0_d (
@@ -545,14 +560,14 @@
     prim_sec_anchor_buf #(
      .Width(1)
     ) u_prim_buf_share0_de (
-      .in_i(wipe_key | data_valid & (key_sel == SwKey)),
+      .in_i(wipe_key | data_valid & mubi4_test_false_strict(hw_key_sel_buf[0])),
       .out_o(hw2reg.sw_share0_output[i].de)
     );
 
     prim_sec_anchor_buf #(
      .Width(1)
     ) u_prim_buf_share1_de (
-      .in_i(wipe_key | data_valid & (key_sel == SwKey)),
+      .in_i(wipe_key | data_valid & mubi4_test_false_strict(hw_key_sel_buf[1])),
       .out_o(hw2reg.sw_share1_output[i].de)
     );
   end
diff --git a/hw/ip/keymgr/rtl/keymgr_ctrl.sv b/hw/ip/keymgr/rtl/keymgr_ctrl.sv
index abf4bbd..c27f088 100644
--- a/hw/ip/keymgr/rtl/keymgr_ctrl.sv
+++ b/hw/ip/keymgr/rtl/keymgr_ctrl.sv
@@ -43,7 +43,7 @@
 
   // Data input
   input  otp_ctrl_pkg::otp_keymgr_key_t root_key_i,
-  output keymgr_gen_out_e hw_sel_o,
+  output prim_mubi_pkg::mubi4_t hw_sel_o,
   output keymgr_stage_e stage_sel_o,
   output logic invalid_stage_sel_o,
   output logic [CdiWidth-1:0] cdi_sel_o,
@@ -367,9 +367,13 @@
     .err_o(cnt_err)
   );
 
-  // TODO: Create a no select option, do not leave this as binary
-  assign hw_sel_o = gen_out_hw_sel ? HwKey : SwKey;
 
+  prim_mubi4_sender u_hw_sel (
+    .clk_i,
+    .rst_ni,
+    .mubi_i (prim_mubi_pkg::mubi4_bool_to_mubi(gen_out_hw_sel)),
+    .mubi_o (hw_sel_o)
+  );
 
   // when in a state that accepts commands, look at op_ack for completion
   // when in a state that does not accept commands, wait for other triggers.
diff --git a/hw/ip/keymgr/rtl/keymgr_sideload_key_ctrl.sv b/hw/ip/keymgr/rtl/keymgr_sideload_key_ctrl.sv
index c7143e2..3d3826e 100644
--- a/hw/ip/keymgr/rtl/keymgr_sideload_key_ctrl.sv
+++ b/hw/ip/keymgr/rtl/keymgr_sideload_key_ctrl.sv
@@ -14,7 +14,7 @@
   input wipe_key_i,  // wipe key deletes and renders sideloads useless until reboot
   input [Shares-1:0][RandWidth-1:0] entropy_i,
   input keymgr_key_dest_e dest_sel_i,
-  input keymgr_gen_out_e key_sel_i,
+  input prim_mubi_pkg::mubi4_t hw_key_sel_i,
   input data_en_i,
   input data_valid_i,
   input hw_key_req_t key_i,
@@ -135,10 +135,22 @@
     endcase // unique case (state_q)
   end
 
+  import prim_mubi_pkg::mubi4_test_true_strict;
+  prim_mubi_pkg::mubi4_t [2:0] hw_key_sel;
+  prim_mubi4_sync #(
+    .NumCopies(3),
+    .AsyncOn(0)
+  ) u_mubi_buf (
+    .clk_i('0),
+    .rst_ni('0),
+    .mubi_i(hw_key_sel_i),
+    .mubi_o(hw_key_sel)
+  );
+
   logic aes_sel, kmac_sel, otbn_sel;
-  assign aes_sel  = dest_sel_i == Aes  & key_sel_i == HwKey;
-  assign kmac_sel = dest_sel_i == Kmac & key_sel_i == HwKey;
-  assign otbn_sel = dest_sel_i == Otbn & key_sel_i == HwKey;
+  assign aes_sel  = dest_sel_i == Aes  & mubi4_test_true_strict(hw_key_sel[0]);
+  assign kmac_sel = dest_sel_i == Kmac & mubi4_test_true_strict(hw_key_sel[1]);
+  assign otbn_sel = dest_sel_i == Otbn & mubi4_test_true_strict(hw_key_sel[2]);
 
   keymgr_sideload_key u_aes_key (
     .clk_i,