ghidra/Ghidra/Processors/RISCV/data/languages/riscv.csr.sinc

167 lines
4.3 KiB
Plaintext

# RV32/RV64 Zicsr Standard Extension
# csrrc d,E,s 00003073 0000707f SIMPLE (0, 0)
:csrrc rdDst,csr,rs1 is rs1 & csr & rdDst & op0001=0x3 & op0204=0x4 & op0506=0x3 & funct3=0x3 & op1519
{
local tmprs1:$(XLEN) = rs1;
local oldcsr:$(XLEN) = csr:$(XLEN);
rdDst = oldcsr;
local tmp:$(XLEN) = op1519;
if (tmp == 0) goto inst_next;
local newcsr:$(XLEN) = oldcsr & ~tmprs1;
csr = newcsr;
}
# csrrci d,E,Z 00007073 0000707f SIMPLE (0, 0)
:csrrci rdDst,csr,op1519 is op1519 & csr & rdDst & op0001=0x3 & op0204=0x4 & op0506=0x3 & funct3=0x7
{
local oldcsr:$(XLEN) = csr:$(XLEN);
rdDst = oldcsr;
local tmp:$(XLEN) = op1519;
if (tmp == 0) goto inst_next;
csr = csr & ~tmp;
}
# csrrs d,E,s 00002073 0000707f SIMPLE (0, 0)
:csrrs rdDst,csr,rs1 is rs1 & csr & rdDst & op0001=0x3 & op0204=0x4 & op0506=0x3 & funct3=0x2 & op1519
{
local tmprs1 = rs1;
local oldcsr:$(XLEN) = csr:$(XLEN);
rdDst = oldcsr;
local tmp:$(XLEN) = op1519;
if (tmp == 0) goto inst_next;
csr = csr | tmprs1;
}
# csrrsi d,E,Z 00006073 0000707f SIMPLE (0, 0)
:csrrsi rdDst,csr,op1519 is op1519 & csr & rdDst & op0001=0x3 & op0204=0x4 & op0506=0x3 & funct3=0x6
{
local oldcsr:$(XLEN) = csr:$(XLEN);
rdDst = oldcsr;
local tmp:$(XLEN) = op1519;
if (tmp == 0) goto inst_next;
csr = csr | tmp;
}
# csrrw d,E,s 00001073 0000707f SIMPLE (0, 0)
:csrrw rdDst,csr,rs1 is rs1 & csr & rdDst & op0001=0x3 & op0204=0x4 & op0506=0x3 & funct3=0x1 & op1519
{
local tmprs1:$(XLEN) = rs1;
local oldcsr:$(XLEN) = csr:$(XLEN);
local tmp:$(XLEN) = op1519;
csr = tmprs1;
if (tmp == 0) goto inst_next;
rdDst = oldcsr;
}
# csrrwi d,E,Z 00005073 0000707f SIMPLE (0, 0)
:csrrwi rdDst,csr,op1519 is op1519 & csr & rdDst & op0001=0x3 & op0204=0x4 & op0506=0x3 & funct3=0x5
{
local oldcsr:$(XLEN) = csr:$(XLEN);
local tmp:$(XLEN) = op1519;
csr = tmp;
if (tmp == 0) goto inst_next;
rdDst = oldcsr;
}
# frcsr d 00302073 fffff07f SIMPLE (0, 0)
:frcsr rdDst is rdDst & op0001=0x3 & op0204=0x4 & op0506=0x3 & funct3=0x2 & op1531=0x60
{
rdDst = fcsr;
}
# frflags d 00102073 fffff07f SIMPLE (0, 0)
:frflags rdDst is rdDst & op0001=0x3 & op0204=0x4 & op0506=0x3 & funct3=0x2 & op1531=0x20
{
rdDst = zext(fflags[0,5]);
}
# frrm d 00202073 fffff07f SIMPLE (0, 0)
:frrm rdDst is rdDst & op0001=0x3 & op0204=0x4 & op0506=0x3 & funct3=0x2 & op1531=0x40
{
rdDst = frm;
}
# fscsr s 00301073 fff07fff SIMPLE (0, 0)
:fscsr rs1 is rs1 & op0001=0x3 & op0204=0x4 & op0506=0x3 & funct3=0x1 & op0711=0x0 & op2031=0x3
{
zero = fcsr;
fcsr = rs1;
}
# fscsr d,s 00301073 fff0707f SIMPLE (0, 0)
:fscsr rdDst,rs1 is rs1 & rdDst & op0001=0x3 & op0204=0x4 & op0506=0x3 & funct3=0x1 & op2031=0x3
{
rdDst = fcsr;
fcsr = rs1;
}
# fsflags s 00101073 fff07fff SIMPLE (0, 0)
:fsflags rs1 is rs1 & op0001=0x3 & op0204=0x4 & op0506=0x3 & funct3=0x1 & op0711=0x0 & op2031=0x1
{
zero = zext(fflags[0,5]);
fflags[0,5] = rs1[0,5];
}
# fsflags d,s 00101073 fff0707f SIMPLE (0, 0)
:fsflags rdDst,rs1 is rs1 & rdDst & op0001=0x3 & op0204=0x4 & op0506=0x3 & funct3=0x1 & op2031=0x1
{
rdDst = zext(fflags[0,5]);
fflags[0,5] = rs1[0,5];
}
# fsflagsi d,Z 00105073 fff0707f SIMPLE (0, 0)
:fsflagsi rdDst,op1519 is op1519 & rdDst & op0001=0x3 & op0204=0x4 & op0506=0x3 & funct3=0x5 & op2031=0x1
{
rdDst = zext(fflags[0,5]);
local tmp:1 = op1519:1;
fflags[0,5] = tmp[0,5];
}
# fsflagsi Z 00105073 fff07fff SIMPLE (0, 0)
:fsflagsi op1519 is op1519 & op0001=0x3 & op0204=0x4 & op0506=0x3 & funct3=0x5 & op0711=0x0 & op2031=0x1
{
zero = zext(fflags[0,5]);
local tmp:1 = op1519:1;
fflags[0,5] = tmp[0,5];
}
# fsrm s 00201073 fff07fff SIMPLE (0, 0)
:fsrm rs1 is rs1 & op0001=0x3 & op0204=0x4 & op0506=0x3 & funct3=0x1 & op0711=0x0 & op2031=0x2
{
zero = zext(frm[0,3]);
frm[0,3] = rs1[0,3];
}
# fsrm d,s 00201073 fff0707f SIMPLE (0, 0)
:fsrm rdDst,rs1 is rs1 & rdDst & op0001=0x3 & op0204=0x4 & op0506=0x3 & funct3=0x1 & op2031=0x2
{
rdDst = zext(frm[0,3]);
frm[0,3] = rs1[0,3];
}
# fsrmi d,Z 00205073 fff0707f SIMPLE (0, 0)
:fsrmi rdDst,op1519 is op1519 & rdDst & op0001=0x3 & op0204=0x4 & op0506=0x3 & funct3=0x5 & op2031=0x2
{
rdDst = zext(frm[0,3]);
local tmp:1 = op1519:1;
frm[0,3] = tmp[0,3];
}
# fsrmi Z 00205073 fff07fff SIMPLE (0, 0)
:fsrmi op1519 is op1519 & op0001=0x3 & op0204=0x4 & op0506=0x3 & funct3=0x5 & op0711=0x0 & op2031=0x2
{
zero = zext(frm[0,3]);
local tmp:1 = op1519:1;
frm[0,3] = tmp[0,3];
}