forked from OpenXiangShan/NEMU
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'refactor-decode' into 'master'
Refactor decode See merge request projectn/nemu!114
- Loading branch information
Showing
10 changed files
with
390 additions
and
461 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,29 @@ | ||
#ifdef CONFIG_DEBUG | ||
def_THelper(atomic) { | ||
uint32_t funct5 = s->isa.instr.r.funct7 >> 2; | ||
int funct3 = s->isa.instr.r.funct3; | ||
assert((funct3 == 2) || (funct3 == 3)); | ||
int width = funct3 & 1; | ||
#define pair(x, y) (((x) << 1) | (y)) | ||
switch (pair(funct5, width)) { | ||
TAB(pair(0b00000, 0), amoadd_w) TAB(pair(0b00001, 0), amoswap_w) | ||
TAB(pair(0b00010, 0), lr_w) TAB(pair(0b00011, 0), sc_w) | ||
TAB(pair(0b00100, 0), amoxor_w) TAB(pair(0b01000, 0), amoor_w) | ||
TAB(pair(0b01100, 0), amoand_w) | ||
TAB(pair(0b10000, 0), amomin_w) TAB(pair(0b10100, 0), amomax_w) | ||
TAB(pair(0b11000, 0), amominu_w) TAB(pair(0b11100, 0), amomaxu_w) | ||
def_INSTR_TAB("00010 ?? 00000 ????? 011 ????? ????? ??", lr_d); | ||
def_INSTR_TAB("00011 ?? ????? ????? 011 ????? ????? ??", sc_d); | ||
def_INSTR_TAB("00001 ?? ????? ????? 011 ????? ????? ??", amoswap_d); | ||
def_INSTR_TAB("00000 ?? ????? ????? 011 ????? ????? ??", amoadd_d); | ||
def_INSTR_TAB("00100 ?? ????? ????? 011 ????? ????? ??", amoxor_d); | ||
def_INSTR_TAB("01100 ?? ????? ????? 011 ????? ????? ??", amoand_d); | ||
def_INSTR_TAB("01000 ?? ????? ????? 011 ????? ????? ??", amoor_d); | ||
def_INSTR_TAB("10000 ?? ????? ????? 011 ????? ????? ??", amomin_d); | ||
def_INSTR_TAB("10100 ?? ????? ????? 011 ????? ????? ??", amomax_d); | ||
def_INSTR_TAB("11000 ?? ????? ????? 011 ????? ????? ??", amominu_d); | ||
def_INSTR_TAB("11100 ?? ????? ????? 011 ????? ????? ??", amomaxu_d); | ||
|
||
def_INSTR_TAB("00010 ?? 00000 ????? 010 ????? ????? ??", lr_w); | ||
def_INSTR_TAB("00011 ?? ????? ????? 010 ????? ????? ??", sc_w); | ||
def_INSTR_TAB("00001 ?? ????? ????? 010 ????? ????? ??", amoswap_w); | ||
def_INSTR_TAB("00000 ?? ????? ????? 010 ????? ????? ??", amoadd_w); | ||
def_INSTR_TAB("00100 ?? ????? ????? 010 ????? ????? ??", amoxor_w); | ||
def_INSTR_TAB("01100 ?? ????? ????? 010 ????? ????? ??", amoand_w); | ||
def_INSTR_TAB("01000 ?? ????? ????? 010 ????? ????? ??", amoor_w); | ||
def_INSTR_TAB("10000 ?? ????? ????? 010 ????? ????? ??", amomin_w); | ||
def_INSTR_TAB("10100 ?? ????? ????? 010 ????? ????? ??", amomax_w); | ||
def_INSTR_TAB("11000 ?? ????? ????? 010 ????? ????? ??", amominu_w); | ||
def_INSTR_TAB("11100 ?? ????? ????? 010 ????? ????? ??", amomaxu_w); | ||
|
||
TAB(pair(0b00000, 1), amoadd_d) TAB(pair(0b00001, 1), amoswap_d) | ||
TAB(pair(0b00010, 1), lr_d) TAB(pair(0b00011, 1), sc_d) | ||
TAB(pair(0b00100, 1), amoxor_d) TAB(pair(0b01000, 1), amoor_d) | ||
TAB(pair(0b01100, 1), amoand_d) | ||
TAB(pair(0b10000, 1), amomin_d) TAB(pair(0b10100, 1), amomax_d) | ||
TAB(pair(0b11000, 1), amominu_d) TAB(pair(0b11100, 1), amomaxu_d) | ||
} | ||
#undef pair | ||
return EXEC_ID_inv; | ||
} | ||
#endif |
Oops, something went wrong.