[prim] Add test for mubi invalid

Signed-off-by: Timothy Chen <timothytim@google.com>
diff --git a/hw/ip/prim/rtl/prim_mubi4_sender.sv b/hw/ip/prim/rtl/prim_mubi4_sender.sv
index 49b809c..be6ea7b 100644
--- a/hw/ip/prim/rtl/prim_mubi4_sender.sv
+++ b/hw/ip/prim/rtl/prim_mubi4_sender.sv
@@ -39,4 +39,11 @@
 
   assign mubi_o = mubi4_t'(mubi_out);
 
+  ////////////////
+  // Assertions //
+  ////////////////
+
+  // The outputs should be known at all times.
+  `ASSERT_KNOWN(OutputsKnown_A, mubi_o)
+
 endmodule : prim_mubi4_sender
diff --git a/hw/ip/prim/rtl/prim_mubi_pkg.sv b/hw/ip/prim/rtl/prim_mubi_pkg.sv
index 20cb4f5..3559c28 100644
--- a/hw/ip/prim/rtl/prim_mubi_pkg.sv
+++ b/hw/ip/prim/rtl/prim_mubi_pkg.sv
@@ -147,6 +147,11 @@
   // make a typedef such that this can be used as an intersignal type as well
   typedef mubi8_e mubi8_t;
 
+  // Test whether the value is supplied is one of the valid enumerations
+  function automatic logic mubi8_test_invalid(mubi8_e val);
+    return ~(val inside {MuBi8True, MuBi8False});
+  endfunction : mubi8_test_invalid
+
   // Test whether the multibit value signals an "enabled" condition.
   // The strict version of this function requires
   // the multibit value to equal True.
@@ -269,6 +274,11 @@
   // make a typedef such that this can be used as an intersignal type as well
   typedef mubi12_e mubi12_t;
 
+  // Test whether the value is supplied is one of the valid enumerations
+  function automatic logic mubi12_test_invalid(mubi12_e val);
+    return ~(val inside {MuBi12True, MuBi12False});
+  endfunction : mubi12_test_invalid
+
   // Test whether the multibit value signals an "enabled" condition.
   // The strict version of this function requires
   // the multibit value to equal True.
@@ -391,6 +401,11 @@
   // make a typedef such that this can be used as an intersignal type as well
   typedef mubi16_e mubi16_t;
 
+  // Test whether the value is supplied is one of the valid enumerations
+  function automatic logic mubi16_test_invalid(mubi16_e val);
+    return ~(val inside {MuBi16True, MuBi16False});
+  endfunction : mubi16_test_invalid
+
   // Test whether the multibit value signals an "enabled" condition.
   // The strict version of this function requires
   // the multibit value to equal True.
diff --git a/util/design/data/prim_mubi_pkg.sv.tpl b/util/design/data/prim_mubi_pkg.sv.tpl
index 64d06f6..9ca00f2 100644
--- a/util/design/data/prim_mubi_pkg.sv.tpl
+++ b/util/design/data/prim_mubi_pkg.sv.tpl
@@ -32,6 +32,11 @@
   // make a typedef such that this can be used as an intersignal type as well
   typedef mubi${nbits}_e mubi${nbits}_t;
 
+  // Test whether the value is supplied is one of the valid enumerations
+  function automatic logic mubi${nbits}_test_invalid(mubi${nbits}_e val);
+    return ~(val inside {MuBi${nbits}True, MuBi${nbits}False});
+  endfunction : mubi${nbits}_test_invalid
+
   // Test whether the multibit value signals an "enabled" condition.
   // The strict version of this function requires
   // the multibit value to equal True.