Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Integrate rv32i conformance tests #6

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

eriktai
Copy link

@eriktai eriktai commented Jan 22, 2020

I have modified the simulator which is compatible with the riscv-compliance tests procedure.

@jserv
Copy link
Contributor

jserv commented Jan 22, 2020

Again, use git rebase -i to rework the commits. Minimize the changes and ensure fully corresponding to conformance tests as the subject claimed.

@jserv
Copy link
Contributor

jserv commented Jan 23, 2020

Remove compressed instruction related commits in this pull request.

.gitignore Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
emu-rv32i.c Outdated Show resolved Hide resolved
test1.c Show resolved Hide resolved
f74064054@mail.ncku.edu.tw added 2 commits January 24, 2020 13:39
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.
@jserv
Copy link
Contributor

jserv commented Feb 6, 2020

Can you rebase upstream/master again?

CSRs.h Outdated
@@ -0,0 +1,93 @@
/* Modified by Nober <s0913768710@gmail.com>
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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.

Copy link
Author

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?

Copy link
Contributor

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)
Copy link
Contributor

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.

Copy link
Author

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 and INSN.
  • In this branch, I will restore the function to the original one.

Copy link
Contributor

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
Copy link
Contributor

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.

@jserv
Copy link
Contributor

jserv commented Feb 15, 2020

Any progress?

@jserv jserv changed the title The new pull request for rv32i conformance tests Integrate rv32i conformance tests Feb 15, 2020
@eriktai
Copy link
Author

eriktai commented Feb 16, 2020

Sorry, I finished it but didn't push up. I changed the flow of the conformance test, which was better.
No need for the operation of copying any more.

@eriktai
Copy link
Author

eriktai commented Feb 16, 2020

$ 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*/
Copy link
Contributor

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];


Copy link
Contributor

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
Copy link
Contributor

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>

Copy link
Contributor

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?

@jserv
Copy link
Contributor

jserv commented Feb 24, 2020

any progress?

@eriktai
Copy link
Author

eriktai commented Mar 7, 2020

Sorry, It's been a while for not updating this PR.
Except I will delete the CSR.h file which is not necessary for this conformance test.
My integrity of conformance tests is doing right?
After this, I want to output a detailed log file the same as other simulators.

@jserv
Copy link
Contributor

jserv commented Mar 7, 2020

Sorry, It's been a while for not updating this PR.
Except I will delete the CSR.h file which is not necessary for this conformance test.
My integrity of conformance tests is doing right?
After this, I want to output a detailed log file the same as other simulators.

So far, your changes work out-of-box except the inconsistency I mentioned earlier.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants