No public description

PiperOrigin-RevId: 1004943392
Change-Id: I1bdabb3fb890b55784ec2130d962e9721301aaba
diff --git a/riscv/test/BUILD b/riscv/test/BUILD
index 3ed32f6..26d2f68 100644
--- a/riscv/test/BUILD
+++ b/riscv/test/BUILD
@@ -339,6 +339,19 @@
 )
 
 cc_test(
+    name = "rvm23_encoding_test",
+    size = "small",
+    srcs = [
+        "rvm23_encoding_test.cc",
+    ],
+    deps = [
+        "//riscv:rvm23_bin_fmt",
+        "//riscv:rvm23_isa",
+        "@com_google_googletest//:gtest_main",
+    ],
+)
+
+cc_test(
     name = "riscv64gzb_encoding_test",
     size = "small",
     srcs = [
diff --git a/riscv/test/rvm23_encoding_test.cc b/riscv/test/rvm23_encoding_test.cc
new file mode 100644
index 0000000..d88a632
--- /dev/null
+++ b/riscv/test/rvm23_encoding_test.cc
@@ -0,0 +1,52 @@
+// Copyright 2026 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include <cstdint>
+
+#include "googletest/include/gtest/gtest.h"
+#include "riscv/rvm23_bin_decoder.h"
+#include "riscv/rvm23_enums.h"
+
+namespace {
+
+using ::mpact::sim::riscv::rvm23::DecodeRVM23Inst16;
+using ::mpact::sim::riscv::rvm23::DecodeRVM23Inst32;
+using ::mpact::sim::riscv::rvm23::OpcodeEnum;
+
+// Base RV32G instructions.
+constexpr uint32_t kAdd = 0b0000000'00011'00010'000'00001'0110011;
+constexpr uint32_t kLui = 0b00000000000000000001'00001'0110111;
+
+// Zbb instructions.
+constexpr uint32_t kAndn = 0b0100000'00011'00010'111'00001'0110011;
+
+// Zicond instructions.
+constexpr uint32_t kCzeroEqz = 0b0000111'00011'00010'101'00001'0110011;
+
+// 16-bit compressed instructions.
+constexpr uint16_t kCnop = 0x0001;
+
+TEST(RVM23EncodingTest, Decode32BitBaseAndExtensions) {
+  EXPECT_EQ(DecodeRVM23Inst32(kAdd), OpcodeEnum::kAdd);
+  EXPECT_EQ(DecodeRVM23Inst32(kLui), OpcodeEnum::kLui);
+  EXPECT_EQ(DecodeRVM23Inst32(kAndn), OpcodeEnum::kAndn);
+  EXPECT_EQ(DecodeRVM23Inst32(kCzeroEqz), OpcodeEnum::kCzeroEqz);
+}
+
+TEST(RVM23EncodingTest, Decode16BitCompressed) {
+  EXPECT_EQ(DecodeRVM23Inst16(kCnop), OpcodeEnum::kCnop);
+  EXPECT_EQ(DecodeRVM23Inst16(0x0000), OpcodeEnum::kNone);
+}
+
+}  // namespace