XUANTIE-RV / openc906

OpenXuantie - OpenC906 Core
Apache License 2.0
322 stars 99 forks source link

'ISA_INT' testcase 'simulation finished with error' #11

Closed npuwth closed 1 year ago

npuwth commented 1 year ago

Hello, I have followed the steps in 'README.md' and run simulation of the testcases. But unfortunately the 'ISA_INT' testcase showed 'simulation finished with error'.

I tried to locate the problem, and I found it in C906_INT_SMOKE.obj:

0000000000000ec0 <AUIPC>: 
     ec0:   00000117            auipc   x2,0x0   
     ec4:   61a9                    lui x3,0xa  
     ec6:   21b9                    addiw   x3,x3,14  
     ec8:   910e                    add x2,x2,x3    //00000000_0000aece
     eca:   0000a217            auipc   x4,0xa      //00000000_0000aeca -> not equal to 0000aece
     ece:   00410463            beq x2,x4,ed6 <AUIPC+0x16>  
     ed2:   1ab0206f            j   387c <TEST_FAIL>
     ed6:   00000117            auipc   x2,0x0 
     eda:   0010019b            addiw   x3,x0,1 
     ede:   01fe                    slli    x3,x3,0x1f
     ee0:   01d1                    addi    x3,x3,20
     ee2:   0021813b            addw    x2,x3,x2    //ffffffff_80000eea
     ee6:   80000217            auipc   x4,0x80000  //ffffffff_80000ee6 -> not equal to 80000eea
     eea:   00410463            beq x2,x4,ef2 <ADD>
     eee:   18f0206f            j   387c <TEST_FAIL>

These two inequalities lead to the jumps to , and then the simulation finished with error.

The corresponding C906_INT_SMOKE.s is:

.global AUIPC
AUIPC:
      auipc x2, 0x0
      li x3, 0xa00e
      c.add x2, x3
      auipc x4, 0xa
      bne x2, x4, TEST_FAIL
      auipc x2, 0x0
      li x3, 0x80000014
      addw x2, x3, x2
      auipc x4, 0x80000
      bne x2, x4, TEST_FAIL
      .option norvc

After I changed it into:

.global AUIPC
AUIPC:
      auipc x2, 0x0
      li x3, 0xa00a         //changed here
      c.add x2, x3
      auipc x4, 0xa
      bne x2, x4, TEST_FAIL
      auipc x2, 0x0
      li x3, 0x80000010 //changed here
      addw x2, x3, x2
      auipc x4, 0x80000
      bne x2, x4, TEST_FAIL
      .option norvc

the 'ISA_INT' simulation finished successfully. My question is: "Is it a bug in 'ISA_INT' testcase?"

Here is my operating environment: OS: Ubuntu 20.04 Tool: Xuantie-900-gcc-elf-newlib-x86_64-V2.4.0-20220428 Simulation: iverilog 10.3

predator2k commented 1 year ago

similar issue encountered using toolchain v2.6.1. should not write auipc testcase using li.

npuwth commented 1 year ago

yes, I agree with you