[libre-riscv-dev] [Bug 349] privileged-instruction decoding function needed

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Sun May 24 22:51:56 BST 2020


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

--- Comment #1 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
from https://github.com/antonblanchard/microwatt/blob/master/execute1.vhdl

    type privilege_level is (USER, SUPER);
    type op_privilege_array is array(insn_type_t) of privilege_level;
    constant op_privilege: op_privilege_array := (
        OP_ATTN => SUPER,
        OP_MFMSR => SUPER,
        OP_MTMSRD => SUPER,
        OP_RFID => SUPER,
        others => USER
        );

    function instr_is_privileged(op: insn_type_t; insn: std_ulogic_vector(31
downto 0))
        return boolean is
    begin
        if op_privilege(op) = SUPER then
            return true;
        elsif op = OP_MFSPR or op = OP_MTSPR then
            return insn(20) = '1';
        else
            return false;
    end;

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


More information about the libre-riscv-dev mailing list