[Libre-soc-bugs] [Bug 979] Implement C-based Power ISA decoder compiler

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Sat Sep 2 16:37:16 BST 2023


https://bugs.libre-soc.org/show_bug.cgi?id=979

--- Comment #21 from Dmitry Selyutin <ghostmansd at gmail.com> ---
OK, here's a better idea. No functions at all other than one huge function
which performs the jumps.

static inline int64_t
svp64_operand_disassemble_value(size_t id, uint64_t insn) {
{
    switch (id) {
    case 0: /* BO, SVG, SVme, TO */
        return (int64_t)(
            (((insn >> UINT64_C(21)) & UINT64_C(1)) << UINT64_C(0)) |
            (((insn >> UINT64_C(22)) & UINT64_C(1)) << UINT64_C(1)) |
            (((insn >> UINT64_C(23)) & UINT64_C(1)) << UINT64_C(2)) |
            (((insn >> UINT64_C(24)) & UINT64_C(1)) << UINT64_C(3)) |
            UINT64_C(0)
        );
    case 1: /* RA */
        return (int64_t)(
            (((insn >> UINT64_C(16)) & UINT64_C(1)) << UINT64_C(0)) |
            (((insn >> UINT64_C(17)) & UINT64_C(1)) << UINT64_C(1)) |
            (((insn >> UINT64_C(18)) & UINT64_C(1)) << UINT64_C(2)) |
            (((insn >> UINT64_C(19)) & UINT64_C(1)) << UINT64_C(3)) |
            UINT64_C(0)
        );
}

That's obviously is a sketch, but should illustrate the idea.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the libre-soc-bugs mailing list