OpenOCD
opcodes.h File Reference
Include dependency graph for opcodes.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define S0   8
 
#define S1   9
 
#define T0   5
 
#define ZERO   0
 

Functions

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 bit (uint32_t value, unsigned int b)
 
static uint32_t bits (uint32_t value, unsigned int hi, unsigned int lo)
 
static uint32_t csrr (unsigned int rd, unsigned int csr) __attribute__((unused))
 
static uint32_t csrrci (unsigned int rd, unsigned int zimm, unsigned int csr) __attribute__((unused))
 
static uint32_t csrrs (unsigned int rd, unsigned int rs, unsigned int csr) __attribute__((unused))
 
static uint32_t csrrsi (unsigned int rd, unsigned int zimm, unsigned int csr) __attribute__((unused))
 
static uint32_t csrrw (unsigned int rd, unsigned int rs, unsigned int csr) __attribute__((unused))
 
static uint32_t csrsi (unsigned int csr, uint16_t imm) __attribute__((unused))
 
static uint32_t csrw (unsigned int source, unsigned int csr) __attribute__((unused))
 
static uint32_t ebreak (void) __attribute__((unused))
 
static uint32_t ebreak_c (void) __attribute__((unused))
 
static uint32_t fence (void) __attribute__((unused))
 
static uint32_t fence_i (void) __attribute__((unused))
 
static uint32_t fld (unsigned int dest, unsigned int base, uint16_t offset) __attribute__((unused))
 
static uint32_t flw (unsigned int dest, unsigned int base, uint16_t offset) __attribute__((unused))
 
static uint32_t fmv_d_x (unsigned int dest, unsigned int src) __attribute__((unused))
 
static uint32_t fmv_w_x (unsigned int dest, unsigned int src) __attribute__((unused))
 
static uint32_t fmv_x_d (unsigned int dest, unsigned int src) __attribute__((unused))
 
static uint32_t fmv_x_w (unsigned int dest, unsigned int src) __attribute__((unused))
 
static uint32_t fsd (unsigned int src, unsigned int base, uint16_t offset) __attribute__((unused))
 
static uint32_t fsw (unsigned int src, unsigned int base, uint16_t offset) __attribute__((unused))
 
static uint32_t imm_b (uint32_t imm) __attribute__((unused))
 
static uint32_t imm_i (uint32_t imm) __attribute__((unused))
 
static uint32_t imm_j (uint32_t imm) __attribute__((unused))
 
static uint32_t imm_s (uint32_t imm) __attribute__((unused))
 
static uint32_t imm_u (uint32_t imm) __attribute__((unused))
 
static uint32_t inst_rd (uint32_t r) __attribute__((unused))
 
static uint32_t inst_rs1 (uint32_t r) __attribute__((unused))
 
static uint32_t inst_rs2 (uint32_t r) __attribute__((unused))
 
static uint32_t jal (unsigned int rd, uint32_t imm) __attribute__((unused))
 
static uint32_t lb (unsigned int rd, unsigned int base, uint16_t offset) __attribute__((unused))
 
static uint32_t ld (unsigned int rd, unsigned int base, uint16_t offset) __attribute__((unused))
 
static uint32_t lh (unsigned int rd, unsigned int base, uint16_t offset) __attribute__((unused))
 
static uint32_t lui (unsigned int dest, uint32_t imm) __attribute__((unused))
 
static uint32_t lw (unsigned int rd, unsigned int base, uint16_t offset) __attribute__((unused))
 
static uint32_t sb (unsigned int src, unsigned int base, uint16_t offset) __attribute__((unused))
 
static uint32_t sd (unsigned int src, unsigned int base, uint16_t offset) __attribute__((unused))
 
static uint32_t sh (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 sw (unsigned int src, unsigned int base, uint16_t offset) __attribute__((unused))
 
static uint32_t vmv_s_x (unsigned int vd, unsigned int vs2) __attribute__((unused))
 
static uint32_t vmv_x_s (unsigned int rd, unsigned int vs2) __attribute__((unused))
 
static uint32_t vsetvli (unsigned int dest, unsigned int src, uint16_t imm) __attribute__((unused))
 
static uint32_t vslide1down_vx (unsigned int vd, unsigned int vs2, unsigned int rs1, unsigned int vm) __attribute__((unused))
 
static uint32_t wfi (void) __attribute__((unused))
 
static uint32_t xori (unsigned int dest, unsigned int src, uint16_t imm) __attribute__((unused))
 

Macro Definition Documentation

◆ S0

#define S0   8

Definition at line 7 of file opcodes.h.

◆ S1

#define S1   9

Definition at line 8 of file opcodes.h.

◆ T0

#define T0   5

Definition at line 6 of file opcodes.h.

◆ ZERO

#define ZERO   0

Definition at line 5 of file opcodes.h.

Function Documentation

◆ addi()

static uint32_t addi ( unsigned int  dest,
unsigned int  src,
uint16_t  imm 
)
static

Definition at line 135 of file opcodes.h.

References imm_i(), inst_rd(), inst_rs1(), and MATCH_ADDI.

Referenced by riscv_program_addi(), and setup_write_memory().

◆ auipc()

static uint32_t auipc ( unsigned int  dest)
static

Definition at line 304 of file opcodes.h.

References inst_rd(), and MATCH_AUIPC.

Referenced by examine_progbuf().

◆ bit()

◆ bits()

static uint32_t bits ( uint32_t  value,
unsigned int  hi,
unsigned int  lo 
)
static

Definition at line 10 of file opcodes.h.

Referenced by imm_b(), imm_i(), imm_j(), imm_s(), imm_u(), inst_rd(), inst_rs1(), inst_rs2(), and vsetvli().

◆ csrr()

static uint32_t csrr ( unsigned int  rd,
unsigned int  csr 
)
static

◆ csrrci()

static uint32_t csrrci ( unsigned int  rd,
unsigned int  zimm,
unsigned int  csr 
)
static

Definition at line 159 of file opcodes.h.

References csr, imm_i(), inst_rd(), inst_rs1(), and MATCH_CSRRCI.

Referenced by riscv_program_csrrci().

◆ csrrs()

static uint32_t csrrs ( unsigned int  rd,
unsigned int  rs,
unsigned int  csr 
)
static

Definition at line 147 of file opcodes.h.

References csr, imm_i(), inst_rd(), inst_rs1(), MATCH_CSRRS, and rs.

Referenced by riscv_program_csrr().

◆ csrrsi()

static uint32_t csrrsi ( unsigned int  rd,
unsigned int  zimm,
unsigned int  csr 
)
static

Definition at line 165 of file opcodes.h.

References csr, imm_i(), inst_rd(), inst_rs1(), and MATCH_CSRRSI.

Referenced by riscv_program_csrrsi().

◆ csrrw()

static uint32_t csrrw ( unsigned int  rd,
unsigned int  rs,
unsigned int  csr 
)
static

Definition at line 153 of file opcodes.h.

References csr, imm_i(), inst_rd(), inst_rs1(), MATCH_CSRRW, and rs.

Referenced by riscv_program_csrw().

◆ csrsi()

static uint32_t csrsi ( unsigned int  csr,
uint16_t  imm 
)
static

Definition at line 75 of file opcodes.h.

References csr, imm_i(), inst_rs1(), and MATCH_CSRRSI.

Referenced by halt().

◆ csrw()

static uint32_t csrw ( unsigned int  source,
unsigned int  csr 
)
static

◆ ebreak()

static uint32_t ebreak ( void  )
static

Definition at line 219 of file opcodes.h.

References MATCH_EBREAK.

Referenced by riscv_add_breakpoint(), and riscv_program_ebreak().

◆ ebreak_c()

static uint32_t ebreak_c ( void  )
static

Definition at line 224 of file opcodes.h.

References MATCH_C_EBREAK.

Referenced by riscv_add_breakpoint().

◆ fence()

static uint32_t fence ( void  )
static

Definition at line 298 of file opcodes.h.

References MATCH_FENCE.

Referenced by riscv_program_fence().

◆ fence_i()

static uint32_t fence_i ( void  )
static

Definition at line 233 of file opcodes.h.

References MATCH_FENCE_I.

Referenced by execute_resume(), and riscv_program_fence_i().

◆ fld()

static uint32_t fld ( unsigned int  dest,
unsigned int  base,
uint16_t  offset 
)
static

Definition at line 189 of file opcodes.h.

References imm_i(), inst_rd(), inst_rs1(), MATCH_FLD, and offset.

Referenced by register_write(), and register_write_direct().

◆ flw()

static uint32_t flw ( unsigned int  dest,
unsigned int  base,
uint16_t  offset 
)
static

Definition at line 183 of file opcodes.h.

References imm_i(), inst_rd(), inst_rs1(), MATCH_FLW, and offset.

Referenced by register_write().

◆ fmv_d_x()

static uint32_t fmv_d_x ( unsigned int  dest,
unsigned int  src 
)
static

Definition at line 213 of file opcodes.h.

References inst_rd(), inst_rs1(), and MATCH_FMV_D_X.

Referenced by register_write_direct().

◆ fmv_w_x()

static uint32_t fmv_w_x ( unsigned int  dest,
unsigned int  src 
)
static

Definition at line 207 of file opcodes.h.

References inst_rd(), inst_rs1(), and MATCH_FMV_W_X.

Referenced by register_write_direct().

◆ fmv_x_d()

static uint32_t fmv_x_d ( unsigned int  dest,
unsigned int  src 
)
static

Definition at line 201 of file opcodes.h.

References inst_rd(), inst_rs1(), and MATCH_FMV_X_D.

Referenced by register_read_direct().

◆ fmv_x_w()

static uint32_t fmv_x_w ( unsigned int  dest,
unsigned int  src 
)
static

Definition at line 195 of file opcodes.h.

References inst_rd(), inst_rs1(), and MATCH_FMV_X_W.

Referenced by register_read_direct().

◆ fsd()

static uint32_t fsd ( unsigned int  src,
unsigned int  base,
uint16_t  offset 
)
static

Definition at line 177 of file opcodes.h.

References imm_s(), inst_rs1(), inst_rs2(), MATCH_FSD, and offset.

Referenced by get_register(), and register_read_direct().

◆ fsw()

static uint32_t fsw ( unsigned int  src,
unsigned int  base,
uint16_t  offset 
)
static

Definition at line 171 of file opcodes.h.

References imm_s(), inst_rs1(), inst_rs2(), MATCH_FSW, and offset.

Referenced by get_register().

◆ imm_b()

static uint32_t imm_b ( uint32_t  imm)
static

Definition at line 51 of file opcodes.h.

References bit(), and bits().

◆ imm_i()

static uint32_t imm_i ( uint32_t  imm)
static

Definition at line 39 of file opcodes.h.

References bits().

Referenced by addi(), csrr(), csrrci(), csrrs(), csrrsi(), csrrw(), csrsi(), csrw(), fld(), flw(), lb(), ld(), lh(), lw(), and xori().

◆ imm_j()

static uint32_t imm_j ( uint32_t  imm)
static

Definition at line 63 of file opcodes.h.

References bit(), and bits().

Referenced by jal().

◆ imm_s()

static uint32_t imm_s ( uint32_t  imm)
static

Definition at line 45 of file opcodes.h.

References bits().

Referenced by fsd(), fsw(), sb(), sd(), sh(), and sw().

◆ imm_u()

static uint32_t imm_u ( uint32_t  imm)
static

Definition at line 57 of file opcodes.h.

References bits().

Referenced by lui().

◆ inst_rd()

static uint32_t inst_rd ( uint32_t  r)
static

◆ inst_rs1()

static uint32_t inst_rs1 ( uint32_t  r)
static

◆ inst_rs2()

static uint32_t inst_rs2 ( uint32_t  r)
static

Definition at line 33 of file opcodes.h.

References bits().

Referenced by fsd(), fsw(), sb(), sd(), sh(), srli(), sw(), vmv_x_s(), and vslide1down_vx().

◆ jal()

static uint32_t jal ( unsigned int  rd,
uint32_t  imm 
)
static

Definition at line 69 of file opcodes.h.

References imm_j(), inst_rd(), and MATCH_JAL.

Referenced by cache_set_jump(), dram_write_jump(), and scans_add_write_jump().

◆ lb()

static uint32_t lb ( unsigned int  rd,
unsigned int  base,
uint16_t  offset 
)
static

Definition at line 123 of file opcodes.h.

References imm_i(), inst_rd(), inst_rs1(), MATCH_LB, and offset.

Referenced by buf_set_buf(), read_memory(), riscv_program_lbr(), and setup_write_memory().

◆ ld()

static uint32_t ld ( unsigned int  rd,
unsigned int  base,
uint16_t  offset 
)
static

Definition at line 105 of file opcodes.h.

References imm_i(), inst_rd(), inst_rs1(), MATCH_LD, and offset.

Referenced by load(), and riscv_program_ldr().

◆ lh()

◆ lui()

static uint32_t lui ( unsigned int  dest,
uint32_t  imm 
)
static

Definition at line 239 of file opcodes.h.

References imm_u(), inst_rd(), and MATCH_LUI.

◆ lw()

static uint32_t lw ( unsigned int  rd,
unsigned int  base,
uint16_t  offset 
)
static

◆ sb()

static uint32_t sb ( unsigned int  src,
unsigned int  base,
uint16_t  offset 
)
static

Definition at line 99 of file opcodes.h.

References imm_s(), inst_rs1(), inst_rs2(), MATCH_SB, and offset.

Referenced by buf_set_buf(), riscv_program_sbr(), and setup_write_memory().

◆ sd()

static uint32_t sd ( unsigned int  src,
unsigned int  base,
uint16_t  offset 
)
static

Definition at line 87 of file opcodes.h.

References imm_s(), inst_rs1(), inst_rs2(), MATCH_SD, and offset.

Referenced by riscv_program_sdr(), and store().

◆ sh()

static uint32_t sh ( unsigned int  src,
unsigned int  base,
uint16_t  offset 
)
static

Definition at line 93 of file opcodes.h.

References imm_s(), inst_rs1(), inst_rs2(), MATCH_SH, and offset.

Referenced by riscv_program_shr(), and setup_write_memory().

◆ srli()

static uint32_t srli ( unsigned int  dest,
unsigned int  src,
uint8_t  shamt 
)
static

Definition at line 292 of file opcodes.h.

References inst_rd(), inst_rs1(), inst_rs2(), and MATCH_SRLI.

Referenced by examine().

◆ sw()

static uint32_t sw ( unsigned int  src,
unsigned int  base,
uint16_t  offset 
)
static

◆ vmv_s_x()

static uint32_t vmv_s_x ( unsigned int  vd,
unsigned int  vs2 
)
static

Definition at line 322 of file opcodes.h.

References inst_rd(), inst_rs1(), and MATCH_VMV_S_X.

◆ vmv_x_s()

static uint32_t vmv_x_s ( unsigned int  rd,
unsigned int  vs2 
)
static

Definition at line 316 of file opcodes.h.

References inst_rd(), inst_rs2(), and MATCH_VMV_X_S.

Referenced by riscv013_get_register_buf().

◆ vsetvli()

static uint32_t vsetvli ( unsigned int  dest,
unsigned int  src,
uint16_t  imm 
)
static

Definition at line 310 of file opcodes.h.

References bits(), inst_rd(), inst_rs1(), and MATCH_VSETVLI.

Referenced by register_write_direct().

◆ vslide1down_vx()

static uint32_t vslide1down_vx ( unsigned int  vd,
unsigned int  vs2,
unsigned int  rs1,
unsigned int  vm 
)
static

◆ wfi()

static uint32_t wfi ( void  )
static

Definition at line 230 of file opcodes.h.

References MATCH_WFI.

◆ xori()

static uint32_t xori ( unsigned int  dest,
unsigned int  src,
uint16_t  imm 
)
static

Definition at line 286 of file opcodes.h.

References imm_i(), inst_rd(), inst_rs1(), and MATCH_XORI.

Referenced by examine().