10 static uint32_t
bits(uint32_t value,
unsigned int hi,
unsigned int lo)
12 return (value >> lo) & ((1 << (hi+1-lo)) - 1);
15 static uint32_t
bit(uint32_t value,
unsigned int b)
17 return (value >> b) & 1;
23 return bits(r, 4, 0) << 7;
29 return bits(r, 4, 0) << 15;
35 return bits(r, 4, 0) << 20;
39 static uint32_t
imm_i(uint32_t imm)
41 return bits(imm, 11, 0) << 20;
45 static uint32_t
imm_s(uint32_t imm)
47 return (
bits(imm, 4, 0) << 7) | (
bits(imm, 11, 5) << 25);
51 static uint32_t
imm_b(uint32_t imm)
53 return (
bit(imm, 11) << 7) | (
bits(imm, 4, 1) << 8) | (
bits(imm, 10, 5) << 25) | (
bit(imm, 12) << 31);
57 static uint32_t
imm_u(uint32_t imm)
59 return bits(imm, 31, 12) << 12;
63 static uint32_t
imm_j(uint32_t imm)
65 return (
bits(imm, 19, 12) << 12) | (
bit(imm, 11) << 20) | (
bits(imm, 10, 1) << 21) | (
bit(imm, 20) << 31);
69 static uint32_t
jal(
unsigned int rd, uint32_t imm)
75 static uint32_t
csrsi(
unsigned int csr, uint16_t imm)
81 static uint32_t
sw(
unsigned int src,
unsigned int base, uint16_t
offset)
87 static uint32_t
sd(
unsigned int src,
unsigned int base, uint16_t
offset)
93 static uint32_t
sh(
unsigned int src,
unsigned int base, uint16_t
offset)
99 static uint32_t
sb(
unsigned int src,
unsigned int base, uint16_t
offset)
105 static uint32_t
ld(
unsigned int rd,
unsigned int base, uint16_t
offset)
111 static uint32_t
lw(
unsigned int rd,
unsigned int base, uint16_t
offset)
117 static uint32_t
lh(
unsigned int rd,
unsigned int base, uint16_t
offset)
123 static uint32_t
lb(
unsigned int rd,
unsigned int base, uint16_t
offset)
134 static uint32_t
addi(
unsigned int dest,
unsigned int src, uint16_t imm)
__attribute__ ((unused));
135 static uint32_t
addi(
unsigned int dest,
unsigned int src, uint16_t imm)
141 static uint32_t
csrr(
unsigned int rd,
unsigned int csr)
147 static uint32_t
csrrs(
unsigned int rd,
unsigned int rs,
unsigned int csr)
153 static uint32_t
csrrw(
unsigned int rd,
unsigned int rs,
unsigned int csr)
159 static uint32_t
csrrci(
unsigned int rd,
unsigned int zimm,
unsigned int csr)
165 static uint32_t
csrrsi(
unsigned int rd,
unsigned int zimm,
unsigned int csr)
171 static uint32_t
fsw(
unsigned int src,
unsigned int base, uint16_t
offset)
177 static uint32_t
fsd(
unsigned int src,
unsigned int base, uint16_t
offset)
183 static uint32_t
flw(
unsigned int dest,
unsigned int base, uint16_t
offset)
189 static uint32_t
fld(
unsigned int dest,
unsigned int base, uint16_t
offset)
195 static uint32_t
fmv_x_w(
unsigned int dest,
unsigned int src)
201 static uint32_t
fmv_x_d(
unsigned int dest,
unsigned int src)
207 static uint32_t
fmv_w_x(
unsigned int dest,
unsigned int src)
213 static uint32_t
fmv_d_x(
unsigned int dest,
unsigned int src)
238 static uint32_t
lui(
unsigned int dest, uint32_t imm)
__attribute__ ((unused));
239 static uint32_t
lui(
unsigned int dest, uint32_t imm)
285 static uint32_t
xori(
unsigned int dest,
unsigned int src, uint16_t imm)
__attribute__ ((unused));
286 static uint32_t
xori(
unsigned int dest,
unsigned int src, uint16_t imm)
291 static uint32_t
srli(
unsigned int dest,
unsigned int src, uint8_t shamt)
__attribute__ ((unused));
292 static uint32_t
srli(
unsigned int dest,
unsigned int src, uint8_t shamt)
304 static uint32_t
auipc(
unsigned int dest)
309 static uint32_t
vsetvli(
unsigned int dest,
unsigned int src, uint16_t imm)
__attribute__((unused));
310 static uint32_t
vsetvli(
unsigned int dest,
unsigned int src, uint16_t imm)
316 static uint32_t
vmv_x_s(
unsigned int rd,
unsigned int vs2)
322 static uint32_t
vmv_s_x(
unsigned int vd,
unsigned int rs1)
330 unsigned int rs1,
unsigned int vm)
#define MATCH_VSLIDE1DOWN_VX
static uint32_t inst_rd(uint32_t r) __attribute__((unused))
static uint32_t vmv_s_x(unsigned int vd, unsigned int vs2) __attribute__((unused))
static uint32_t imm_i(uint32_t imm) __attribute__((unused))
static uint32_t bits(uint32_t value, unsigned int hi, unsigned int lo)
static uint32_t csrrw(unsigned int rd, unsigned int rs, unsigned int csr) __attribute__((unused))
static uint32_t bit(uint32_t value, unsigned int b)
static uint32_t fmv_d_x(unsigned int dest, unsigned int src) __attribute__((unused))
static uint32_t lb(unsigned int rd, unsigned int base, uint16_t offset) __attribute__((unused))
static uint32_t wfi(void) __attribute__((unused))
static uint32_t csrw(unsigned int source, unsigned int csr) __attribute__((unused))
static uint32_t csrrs(unsigned int rd, unsigned int rs, unsigned int csr) __attribute__((unused))
static uint32_t fence(void) __attribute__((unused))
static uint32_t inst_rs2(uint32_t r) __attribute__((unused))
static uint32_t fsd(unsigned int src, unsigned int base, uint16_t offset) __attribute__((unused))
static uint32_t fence_i(void) __attribute__((unused))
static uint32_t lh(unsigned int rd, unsigned int base, uint16_t offset) __attribute__((unused))
static uint32_t csrrci(unsigned int rd, unsigned int zimm, unsigned int csr) __attribute__((unused))
static uint32_t imm_s(uint32_t imm) __attribute__((unused))
static uint32_t csrr(unsigned int rd, unsigned int csr) __attribute__((unused))
static uint32_t imm_b(uint32_t imm) __attribute__((unused))
static uint32_t sh(unsigned int src, unsigned int base, uint16_t offset) __attribute__((unused))
static uint32_t sw(unsigned int src, unsigned int base, uint16_t offset) __attribute__((unused))
static uint32_t ebreak(void) __attribute__((unused))
static uint32_t jal(unsigned int rd, uint32_t imm) __attribute__((unused))
static uint32_t fsw(unsigned int src, unsigned int base, uint16_t offset) __attribute__((unused))
static uint32_t csrsi(unsigned int csr, uint16_t imm) __attribute__((unused))
static uint32_t lui(unsigned int dest, uint32_t imm) __attribute__((unused))
static uint32_t flw(unsigned int dest, unsigned int base, uint16_t offset) __attribute__((unused))
static uint32_t vmv_x_s(unsigned int rd, unsigned int vs2) __attribute__((unused))
static uint32_t csrrsi(unsigned int rd, unsigned int zimm, unsigned int csr) __attribute__((unused))
static uint32_t ld(unsigned int rd, unsigned int base, uint16_t offset) __attribute__((unused))
static uint32_t fld(unsigned int dest, unsigned int base, uint16_t offset) __attribute__((unused))
static uint32_t vsetvli(unsigned int dest, unsigned int src, uint16_t imm) __attribute__((unused))
static uint32_t sd(unsigned int src, unsigned int base, uint16_t offset) __attribute__((unused))
static uint32_t srli(unsigned int dest, unsigned int src, uint8_t shamt) __attribute__((unused))
static uint32_t fmv_x_w(unsigned int dest, unsigned int src) __attribute__((unused))
static uint32_t vslide1down_vx(unsigned int vd, unsigned int vs2, unsigned int rs1, unsigned int vm) __attribute__((unused))
static uint32_t fmv_w_x(unsigned int dest, unsigned int src) __attribute__((unused))
static uint32_t sb(unsigned int src, unsigned int base, uint16_t offset) __attribute__((unused))
static uint32_t inst_rs1(uint32_t r) __attribute__((unused))
static uint32_t lw(unsigned int rd, unsigned int base, uint16_t offset) __attribute__((unused))
static uint32_t imm_j(uint32_t imm) __attribute__((unused))
static uint32_t xori(unsigned int dest, unsigned int src, uint16_t imm) __attribute__((unused))
static uint32_t addi(unsigned int dest, unsigned int src, uint16_t imm) __attribute__((unused))
static uint32_t auipc(unsigned int dest) __attribute__((unused))
static uint32_t ebreak_c(void) __attribute__((unused))
static uint32_t fmv_x_d(unsigned int dest, unsigned int src) __attribute__((unused))
static uint32_t imm_u(uint32_t imm) __attribute__((unused))
struct qn908x_flash_bank __attribute__