poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[COMMITTED] pickles: riscv.pk: make RV32_Insn union integral


From: Mohammad-Reza Nabipoor
Subject: [COMMITTED] pickles: riscv.pk: make RV32_Insn union integral
Date: Thu, 3 Nov 2022 21:26:11 +0100

2022-11-03  Mohammad-Reza Nabipoor  <mnabipoor@gnu.org>

        * pickles/riscv.pk (RV32_Insn): Make it integral union and
        remove `as_uint' method.
---
 ChangeLog        |  5 +++++
 pickles/riscv.pk | 14 +-------------
 2 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 67ef1d32..17d82ee4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2022-11-03  Mohammad-Reza Nabipoor  <mnabipoor@gnu.org>
+
+       * pickles/riscv.pk (RV32_Insn): Make it integral union and
+       remove `as_uint' method.
+
 2022-11-03  Mohammad-Reza Nabipoor  <mnabipoor@gnu.org>
 
        * libpoke/pkl-gen.pks (struct_mapper): Handle integral unions.
diff --git a/pickles/riscv.pk b/pickles/riscv.pk
index 00cab04a..26f5a89c 100644
--- a/pickles/riscv.pk
+++ b/pickles/riscv.pk
@@ -524,7 +524,7 @@ type RV32_InsnFmt_J = struct uint<32>
   };
 
 // risbuj
-type RV32_Insn = union
+type RV32_Insn = union uint<32>
   {
     RV32_InsnFmt_R r;
     RV32_InsnFmt_I i;
@@ -533,18 +533,6 @@ type RV32_Insn = union
     RV32_InsnFmt_U u;
     RV32_InsnFmt_J j;
 
-    method as_uint = uint<32>:
-      {
-        type I = uint<32>;
-
-        return !(r ?! E_elem) ? r as I
-             : !(i ?! E_elem) ? i as I
-             : !(s ?! E_elem) ? s as I
-             : !(b ?! E_elem) ? b as I
-             : !(u ?! E_elem) ? u as I
-             : !(j ?! E_elem) ? j as I
-             : 0U /* impossible */;
-      }
     method get_name = string:
       {
         return !(r ?! E_elem) ? r.get_name
-- 
2.38.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]