📄 sparc.c
字号:
typedef struct _proc_state {} proc_state;
typedef struct _insn_ldsb_struct {
/*Load|Store signed byte*/
int (*func) (struct _insn_ldsb_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int a: 2; /*Alternate space '1'=alternate space*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int i: 2; /*Select s2i '1'=sim13*/
unsigned int s2i: 14; /*op2: simm13 or rs2*/
} insn_ldsb_struct;
typedef struct _insn_ldsh_struct {
/*Load|Store signed halfword*/
int (*func) (struct _insn_ldsh_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int a: 2; /*Alternate space '1'=alternate space*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int i: 2; /*Select s2i '1'=sim13*/
unsigned int s2i: 14; /*op2: simm13 or rs2*/
} insn_ldsh_struct;
typedef struct _insn_ldst_ub_struct {
/*Load|Store unsigned byte*/
int (*func) (struct _insn_ldst_ub_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int a: 2; /*Alternate space '1'=alternate space*/
unsigned int ls: 2; /*Load/Store '1'=Store*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int i: 2; /*Select s2i '1'=sim13*/
unsigned int s2i: 14; /*op2: simm13 or rs2*/
} insn_ldst_ub_struct;
typedef struct _insn_ldst_uh_struct {
/*Load|Store unsigned halfword*/
int (*func) (struct _insn_ldst_uh_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int a: 2; /*Alternate space '1'=alternate space*/
unsigned int ls: 2; /*Load/Store '1'=Store*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int i: 2; /*Select s2i '1'=sim13*/
unsigned int s2i: 14; /*op2: simm13 or rs2*/
} insn_ldst_uh_struct;
typedef struct _insn_ldst_struct {
/*Load|Store word*/
int (*func) (struct _insn_ldst_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int a: 2; /*Alternate space '1'=alternate space*/
unsigned int ls: 2; /*Load/Store '1'=Store*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int i: 2; /*Select s2i '1'=sim13*/
unsigned int s2i: 14; /*op2: simm13 or rs2*/
} insn_ldst_struct;
typedef struct _insn_ldst_d_struct {
/*Load|Store doubleword*/
int (*func) (struct _insn_ldst_d_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int a: 2; /*Alternate space '1'=alternate space*/
unsigned int ls: 2; /*Load/Store '1'=Store*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int i: 2; /*Select s2i '1'=sim13*/
unsigned int s2i: 14; /*op2: simm13 or rs2*/
} insn_ldst_d_struct;
typedef struct _insn_ldst_f_struct {
/*Load|Sore floating point register*/
int (*func) (struct _insn_ldst_f_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int ls: 2; /*Load/Store '1'=Store*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int i: 2; /*Select s2i '1'=sim13*/
unsigned int s2i: 14; /*op2: simm13 or rs2*/
} insn_ldst_f_struct;
typedef struct _insn_ldst_df_struct {
/*Load|Sore double floating point register*/
int (*func) (struct _insn_ldst_df_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int ls: 2; /*Load/Store '1'=Store*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int i: 2; /*Select s2i '1'=sim13*/
unsigned int s2i: 14; /*op2: simm13 or rs2*/
} insn_ldst_df_struct;
typedef struct _insn_ldst_fsr_struct {
/*Load|Sore floating point state register*/
int (*func) (struct _insn_ldst_fsr_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int ls: 2; /*Load/Store '1'=Store*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int i: 2; /*Select s2i '1'=sim13*/
unsigned int s2i: 14; /*op2: simm13 or rs2*/
} insn_ldst_fsr_struct;
typedef struct _insn_stdfq_struct {
/*Store floating point deferred trap queue*/
int (*func) (struct _insn_stdfq_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int i: 2; /*Select s2i '1'=sim13*/
unsigned int s2i: 14; /*op2: simm13 or rs2*/
} insn_stdfq_struct;
typedef struct _insn_ldst_c_struct {
/*Load|Sore coprocessor register*/
int (*func) (struct _insn_ldst_c_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int ls: 2; /*Load/Store '1'=Store*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int i: 2; /*Select s2i '1'=sim13*/
unsigned int s2i: 14; /*op2: simm13 or rs2*/
} insn_ldst_c_struct;
typedef struct _insn_ldst_dc_struct {
/*Load|Sore double coprocessor register*/
int (*func) (struct _insn_ldst_dc_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int ls: 2; /*Load/Store '1'=Store*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int i: 2; /*Select s2i '1'=sim13*/
unsigned int s2i: 14; /*op2: simm13 or rs2*/
} insn_ldst_dc_struct;
typedef struct _insn_ldst_csr_struct {
/*Load|Sore double coprocessor state register*/
int (*func) (struct _insn_ldst_csr_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int ls: 2; /*Load/Store '1'=Store*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int i: 2; /*Select s2i '1'=sim13*/
unsigned int s2i: 14; /*op2: simm13 or rs2*/
} insn_ldst_csr_struct;
typedef struct _insn_stdcq_struct {
/*Store coprocessor deferred trap queue*/
int (*func) (struct _insn_stdcq_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int i: 2; /*Select s2i '1'=sim13*/
unsigned int s2i: 14; /*op2: simm13 or rs2*/
} insn_stdcq_struct;
typedef struct _insn_ldstb_struct {
/*Atomic Load-Store unsigned byte*/
int (*func) (struct _insn_ldstb_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int a: 2; /*Alternate space '1'=alternate space*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int i: 2; /*Select s2i '1'=sim13*/
unsigned int s2i: 14; /*op2: simm13 or rs2*/
} insn_ldstb_struct;
typedef struct _insn_swp_struct {
/*Swap register into memory*/
int (*func) (struct _insn_swp_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int a: 2; /*Alternate space '1'=alternate space*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int i: 2; /*Select s2i '1'=sim13*/
unsigned int s2i: 14; /*op2: simm13 or rs2*/
} insn_swp_struct;
typedef struct _insn_sethi_struct {
/*Set upper 22 bits*/
int (*func) (struct _insn_sethi_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int i22: 23; /*Immidiate 22*/
} insn_sethi_struct;
typedef struct _insn_nop_struct {
/*No op*/
int (*func) (struct _insn_nop_struct *s, proc_state *state);
unsigned int x: 23; /**/
} insn_nop_struct;
typedef struct _insn_and_struct {
/*logical and*/
int (*func) (struct _insn_and_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int cc: 2; /*Modify icc '1'=modify*/
unsigned int n: 2; /*Not '1'=not*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int i: 2; /*Select s2i '1'=sim13*/
unsigned int s2i: 14; /*op2: simm13 or rs2*/
} insn_and_struct;
typedef struct _insn_or_struct {
/*logical or*/
int (*func) (struct _insn_or_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int cc: 2; /*Modify icc '1'=modify*/
unsigned int n: 2; /*Not '1'=not*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int i: 2; /*Select s2i '1'=sim13*/
unsigned int s2i: 14; /*op2: simm13 or rs2*/
} insn_or_struct;
typedef struct _insn_xor_struct {
/*logical xor*/
int (*func) (struct _insn_xor_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int cc: 2; /*Modify icc '1'=modify*/
unsigned int n: 2; /*Not '1'=not*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int i: 2; /*Select s2i '1'=sim13*/
unsigned int s2i: 14; /*op2: simm13 or rs2*/
} insn_xor_struct;
typedef struct _insn_sll_struct {
/*shieft left logical*/
int (*func) (struct _insn_sll_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int i: 2; /*Select s2i '1'=sim13*/
unsigned int s2i: 14; /*op2: simm13 or rs2*/
} insn_sll_struct;
typedef struct _insn_srl_struct {
/*shieft right logical*/
int (*func) (struct _insn_srl_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int i: 2; /*Select s2i '1'=sim13*/
unsigned int s2i: 14; /*op2: simm13 or rs2*/
} insn_srl_struct;
typedef struct _insn_sra_struct {
/*shieft right arith*/
int (*func) (struct _insn_sra_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int i: 2; /*Select s2i '1'=sim13*/
unsigned int s2i: 14; /*op2: simm13 or rs2*/
} insn_sra_struct;
typedef struct _insn_sadd_struct {
/*Sub|Add*/
int (*func) (struct _insn_sadd_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int cc: 2; /*Modify icc '1'=modify*/
unsigned int xx: 2; /*Use carry '1'=use*/
unsigned int sa: 2; /*Sub/Add '1'=Sub*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int i: 2; /*Select s2i '1'=sim13*/
unsigned int s2i: 14; /*op2: simm13 or rs2*/
} insn_sadd_struct;
typedef struct _insn_tsadd_struct {
/*Tagged Sub|Add*/
int (*func) (struct _insn_tsadd_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int sa: 2; /*Sub/Add '1'=Sub*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int i: 2; /*Select s2i '1'=sim13*/
unsigned int s2i: 14; /*op2: simm13 or rs2*/
} insn_tsadd_struct;
typedef struct _insn_tsaddtv_struct {
/*Tagged Sub|Add with trap on overflow*/
int (*func) (struct _insn_tsaddtv_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int sa: 2; /*Sub/Add '1'=Sub*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int i: 2; /*Select s2i '1'=sim13*/
unsigned int s2i: 14; /*op2: simm13 or rs2*/
} insn_tsaddtv_struct;
typedef struct _insn_mulscc_struct {
/*Multiply*/
int (*func) (struct _insn_mulscc_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int cc: 2; /*Modify icc '1'=modify*/
unsigned int sig: 2; /*Signed '1'=Signed*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int i: 2; /*Select s2i '1'=sim13*/
unsigned int s2i: 14; /*op2: simm13 or rs2*/
} insn_mulscc_struct;
typedef struct _insn_divscc_struct {
/*Divide*/
int (*func) (struct _insn_divscc_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int cc: 2; /*Modify icc '1'=modify*/
unsigned int sig: 2; /*Signed '1'=Signed*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int i: 2; /*Select s2i '1'=sim13*/
unsigned int s2i: 14; /*op2: simm13 or rs2*/
} insn_divscc_struct;
typedef struct _insn_sv_struct {
/*Save*/
int (*func) (struct _insn_sv_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int i: 2; /*Select s2i '1'=sim13*/
unsigned int s2i: 14; /*op2: simm13 or rs2*/
} insn_sv_struct;
typedef struct _insn_rest_struct {
/*Restore*/
int (*func) (struct _insn_rest_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int i: 2; /*Select s2i '1'=sim13*/
unsigned int s2i: 14; /*op2: simm13 or rs2*/
} insn_rest_struct;
typedef struct _insn_bra_struct {
/*Branch on condition*/
int (*func) (struct _insn_bra_struct *s, proc_state *state);
unsigned int a: 2; /*Alternate space '1'=alternate space*/
unsigned int c: 5; /*Condition code*/
unsigned int d22: 23; /**/
} insn_bra_struct;
typedef struct _insn_fbra_struct {
/*Branch on floating point condition*/
int (*func) (struct _insn_fbra_struct *s, proc_state *state);
unsigned int a: 2; /*Alternate space '1'=alternate space*/
unsigned int c: 5; /*Condition code*/
unsigned int d22: 23; /**/
} insn_fbra_struct;
typedef struct _insn_cbra_struct {
/*Branch on coprocessor condition*/
int (*func) (struct _insn_cbra_struct *s, proc_state *state);
unsigned int a: 2; /*Alternate space '1'=alternate space*/
unsigned int c: 5; /*Condition code*/
unsigned int d22: 23; /**/
} insn_cbra_struct;
typedef struct _insn_jmp_struct {
/*Call and link offset*/
int (*func) (struct _insn_jmp_struct *s, proc_state *state);
unsigned int d30: 31; /*Offset 30bit*/
} insn_jmp_struct;
typedef struct _insn_jml_struct {
/*Jump and link*/
int (*func) (struct _insn_jml_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int i: 2; /*Select s2i '1'=sim13*/
unsigned int s2i: 14; /*op2: simm13 or rs2*/
} insn_jml_struct;
typedef struct _insn_ret_struct {
/*Return from trap*/
int (*func) (struct _insn_ret_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int i: 2; /*Select s2i '1'=sim13*/
unsigned int s2i: 14; /*op2: simm13 or rs2*/
} insn_ret_struct;
typedef struct _insn_trap_struct {
/*Trap on condition code*/
int (*func) (struct _insn_trap_struct *s, proc_state *state);
unsigned int rvd: 2; /**/
unsigned int c: 5; /*Condition code*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int i: 2; /*Select s2i '1'=sim13*/
unsigned int s2i: 14; /*op2: simm13 or rs2*/
} insn_trap_struct;
typedef struct _insn_rd_struct {
/*Read state registers*/
int (*func) (struct _insn_rd_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int x: 15; /**/
} insn_rd_struct;
typedef struct _insn_rdp_struct {
/*Read processor state register (rdpsr)*/
int (*func) (struct _insn_rdp_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int x: 15; /**/
} insn_rdp_struct;
typedef struct _insn_rdw_struct {
/*Read windows invalid mask*/
int (*func) (struct _insn_rdw_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int x: 15; /**/
} insn_rdw_struct;
typedef struct _insn_rdt_struct {
/*Read trap base register*/
int (*func) (struct _insn_rdt_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int x: 15; /**/
} insn_rdt_struct;
typedef struct _insn_wd_struct {
/*Write state registers*/
int (*func) (struct _insn_wd_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int x: 15; /**/
} insn_wd_struct;
typedef struct _insn_wdp_struct {
/*Write processor state register (rdpsr)*/
int (*func) (struct _insn_wdp_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int x: 15; /**/
} insn_wdp_struct;
typedef struct _insn_wdw_struct {
/*Write windows invalid mask*/
int (*func) (struct _insn_wdw_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int x: 15; /**/
} insn_wdw_struct;
typedef struct _insn_wdt_struct {
/*Write trap base register*/
int (*func) (struct _insn_wdt_struct *s, proc_state *state);
unsigned int rd: 6; /*Destination register*/
unsigned int rs1: 6; /*Source register 1*/
unsigned int x: 15; /**/
} insn_wdt_struct;
typedef struct _insn_stbar_struct {
/*Store barrier*/
int (*func) (struct _insn_stbar_struct *s, proc_state *state);
unsigned int x: 14; /**/
} insn_stbar_struct;
typedef struct _insn_unimp_struct {
/*Unimplemented*/
int (*func) (struct _insn_unimp_struct *s, proc_state *state);
unsigned int rvd: 6; /**/
unsigned int cst: 23; /**/
} insn_unimp_struct;
typedef union _insn_union {
insn_ldsb_struct insn_ldsb;
insn_ldsh_struct insn_ldsh;
insn_ldst_ub_struct insn_ldst_ub;
insn_ldst_uh_struct insn_ldst_uh;
insn_ldst_struct insn_ldst;
insn_ldst_d_struct insn_ldst_d;
insn_ldst_f_struct insn_ldst_f;
insn_ldst_df_struct insn_ldst_df;
insn_ldst_fsr_struct insn_ldst_fsr;
insn_stdfq_struct insn_stdfq;
insn_ldst_c_struct insn_ldst_c;
insn_ldst_dc_struct insn_ldst_dc;
insn_ldst_csr_struct insn_ldst_csr;
insn_stdcq_struct insn_stdcq;
insn_ldstb_struct insn_ldstb;
insn_swp_struct insn_swp;
insn_sethi_struct insn_sethi;
insn_nop_struct insn_nop;
insn_and_struct insn_and;
insn_or_struct insn_or;
insn_xor_struct insn_xor;
insn_sll_struct insn_sll;
insn_srl_struct insn_srl;
insn_sra_struct insn_sra;
insn_sadd_struct insn_sadd;
insn_tsadd_struct insn_tsadd;
insn_tsaddtv_struct insn_tsaddtv;
insn_mulscc_struct insn_mulscc;
insn_divscc_struct insn_divscc;
insn_sv_struct insn_sv;
insn_rest_struct insn_rest;
insn_bra_struct insn_bra;
insn_fbra_struct insn_fbra;
insn_cbra_struct insn_cbra;
insn_jmp_struct insn_jmp;
insn_jml_struct insn_jml;
insn_ret_struct insn_ret;
insn_trap_struct insn_trap;
insn_rd_struct insn_rd;
insn_rdp_struct insn_rdp;
insn_rdw_struct insn_rdw;
insn_rdt_struct insn_rdt;
insn_wd_struct insn_wd;
insn_wdp_struct insn_wdp;
insn_wdw_struct insn_wdw;
insn_wdt_struct insn_wdt;
insn_stbar_struct insn_stbar;
insn_unimp_struct insn_unimp;
} insn_union;
int func_insn_ldsb (struct _insn_ldsb_struct *s, proc_state *state) {
/*Load|Store signed byte*/
};
int func_insn_ldsh (struct _insn_ldsh_struct *s, proc_state *state) {
/*Load|Store signed halfword*/
};
int func_insn_ldst_ub (struct _insn_ldst_ub_struct *s, proc_state *state) {
/*Load|Store unsigned byte*/
};
int func_insn_ldst_uh (struct _insn_ldst_uh_struct *s, proc_state *state) {
/*Load|Store unsigned halfword*/
};
int func_insn_ldst (struct _insn_ldst_struct *s, proc_state *state) {
/*Load|Store word*/
};
int func_insn_ldst_d (struct _insn_ldst_d_struct *s, proc_state *state) {
/*Load|Store doubleword*/
};
int func_insn_ldst_f (struct _insn_ldst_f_struct *s, proc_state *state) {
/*Load|Sore floating point register*/
};
int func_insn_ldst_df (struct _insn_ldst_df_struct *s, proc_state *state) {
/*Load|Sore double floating point register*/
};
int func_insn_ldst_fsr (struct _insn_ldst_fsr_struct *s, proc_state *state) {
/*Load|Sore floating point state register*/
};
int func_insn_stdfq (struct _insn_stdfq_struct *s, proc_state *state) {
/*Store floating point deferred trap queue*/
};
int func_insn_ldst_c (struct _insn_ldst_c_struct *s, proc_state *state) {
/*Load|Sore coprocessor register*/
};
int func_insn_ldst_dc (struct _insn_ldst_dc_struct *s, proc_state *state) {
/*Load|Sore double coprocessor register*/
};
int func_insn_ldst_csr (struct _insn_ldst_csr_struct *s, proc_state *state) {
/*Load|Sore double coprocessor state register*/
};
int func_insn_stdcq (struct _insn_stdcq_struct *s, proc_state *state) {
/*Store coprocessor deferred trap queue*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -