-
Notifications
You must be signed in to change notification settings - Fork 18
Integrate rv32i conformance tests #6
base: master
Are you sure you want to change the base?
Conversation
Add the method of how to test file
Again, use |
Remove compressed instruction related commits in this pull request. |
I have modified the emu-rv32i for supporting riscv-compliance test-suite. However, it is needed to copy the makefile.include to the specified directory which is explained in README.md.
Can you rebase upstream/master again? |
CSRs.h
Outdated
@@ -0,0 +1,93 @@ | |||
/* Modified by Nober <s0913768710@gmail.com> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't leave such modification message. Instead, your name will be mentioned as a contributor once this pull request is merged.
emu-rv32i.c
Outdated
/* uncomment this for an instruction trace and other debug outputs */ | ||
// #define DEBUG_OUTPUT | ||
// #define DEBUG_EXTRA | ||
#define DEBUG_OUTPUT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't change DEBUG_OUTPUT
or DEBUG_EXTRA
.
emu-rv32i.c
Outdated
#ifdef DEBUG_OUTPUT | ||
printf("address %08x\n", p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24)); | ||
#endif | ||
#ifdef RV32C |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't put RV32C specific code here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean my completing of the conformance test of rv32i first in this branch by restoring the emu_rv32i back to the original vision without the support for rv32c? After finishing this PR, do I need to open another new PR for rv32c or just update in here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Up to you.
emu-rv32i.c
Outdated
@@ -703,7 +709,7 @@ int raise_interrupt() | |||
|
|||
/* read 32-bit instruction from memory by PC */ | |||
|
|||
uint32_t get_insn32(uint32_t pc) | |||
unsigned char get_insn32(uint32_t pc, uint32_t *insn) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure why you would change the type of return values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- In order to support the rv32c, I change the mechanism of this function to get instructions by the pointer and return the type of instruction through number, 1 or 0, which is why I change the type of return values. I have set the macro for this, which is
CINSN
andINSN
. - In this branch, I will restore the function to the original one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pull request should minimize the changes and ensure everything is dedicated to compliance tests.
emu-rv32i.c
Outdated
rs2 = (insn >> 20) & 0x1f; | ||
} | ||
|
||
#ifdef RV32C |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto. No RV32C related code in this pull request.
Any progress? |
Sorry, I finished it but didn't push up. I changed the flow of the conformance test, which was better. |
$ make RISCV_PREFIX=riscv-none-embed- RISCV_DEVICE=rv32i TARGET_SIM=/abs/to/emu-rv32i RISCV_TARGET=rv32emu TARGETDIR=/abs/to/riscv-target variant
...
make[1]: Leaving directory '/path/to/riscv-compliance/riscv-test-suite/rv32i'
riscv-test-env/verify.sh
Compare to reference files ...
Check comb ... OK
Check I-ADD-01 ... OK
Check I-ADDI-01 ... OK
Check I-AND-01 ... OK
Check I-ANDI-01 ... OK
Check I-AUIPC-01 ... OK
Check I-BEQ-01 ... OK
Check I-BGE-01 ... OK
Check I-BGEU-01 ... OK
Check I-BLT-01 ... OK
Check I-BLTU-01 ... OK
Check I-BNE-01 ... OK
Check I-DELAY_SLOTS-01 ... OK
Check I-EBREAK-01 ... OK
Check I-ECALL-01 ... OK
Check I-ENDIANESS-01 ... OK
Check I-IO ... OK
Check I-JAL-01 ... OK
Check I-JALR-01 ... OK
Check I-LB-01 ... OK
Check I-LBU-01 ... OK
Check I-LH-01 ... OK
Check I-LHU-01 ... OK
Check I-LUI-01 ... OK
Check I-LW-01 ... OK
Check I-MISALIGN_JMP-01 ... OK
Check I-MISALIGN_LDST-01 ... OK
Check I-NOP-01 ... OK
Check I-OR-01 ... OK
Check I-ORI-01 ... OK
Check I-RF_size-01 ... OK
Check I-RF_width-01 ... OK
Check I-RF_x0-01 ... OK
Check I-SB-01 ... OK
Check I-SH-01 ... OK
Check I-SLL-01 ... OK
Check I-SLLI-01 ... OK
Check I-SLT-01 ... OK
Check I-SLTI-01 ... OK
Check I-SLTIU-01 ... OK
Check I-SLTU-01 ... OK
Check I-SRA-01 ... OK
Check I-SRAI-01 ... OK
Check I-SRL-01 ... OK
Check I-SRLI-01 ... OK
Check I-SUB-01 ... OK
Check I-SW-01 ... OK
Check I-XOR-01 ... OK
Check I-XORI-01 ... OK
--------------------------------
OK: 49/49 |
emu-rv32i.c
Outdated
@@ -160,12 +160,18 @@ int machine_running = TRUE; | |||
#define PRV_H 2 | |||
#define PRV_M 3 | |||
|
|||
/* Instruction state*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't change here.
/* CPU state */ | ||
uint32_t pc; | ||
uint32_t next_pc; | ||
uint32_t insn; | ||
uint32_t reg[32]; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't do this.
- RV32M and RV32A instructions may be enabled by commenting `#define STRICT_RV32I`. | ||
|
||
|
||
Passed RV32C compliance tests from https://github.com/riscv/riscv-compliance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't mention RV32C within this pull request.
@@ -0,0 +1,22 @@ | |||
#include <stdint.h> | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose it is necessary to have file CSRs.h
for conformance test, right?
any progress? |
Sorry, It's been a while for not updating this PR. |
So far, your changes work out-of-box except the inconsistency I mentioned earlier. |
I have modified the simulator which is compatible with the riscv-compliance tests procedure.