[BUG] Incorrect result for aes32esi instruction
Is there an existing CVA6 bug for this?
-
I have searched the existing bug issues
Bug Description
Dear CVA6 team,
Let me report an issue with aes32esi instruction. I had prepared small testcase and run it on Verilator and Spike to demonstrate issue and difference.
Here is the snippet on C:
...
int main(void)
{
uint32_t r_a2 = 0x16157e2a;
uint32_t r_t3 = 0x093c4fcf;
__asm__ volatile ("aes32esi %0,%0,%1,0x0\n" \
"aes32esi %0,%0,%1,0x1\n" \
"aes32esi %0,%0,%1,0x2\n" \
"aes32esi %0,%0,%1,0x3\n" \
: "+r"(r_a2) : "r"(r_t3) : );
printf("r_a2 = 0x%x\n", r_a2);
return 0;
}
I’m building it with ISA set to rv32imc_zba_zbb_zbc_zbs_zkn and running it on target cv32a6_imac_sv32.
I had run the application on Verilator and it produces incorrect result. From the other hand, the Spike produces correct expected result. I had set DV_SIMULATORS=veri-testharness,spike to get a diff.
And here is the diff:
...
spike : /path/to/cva6/verif/sim/out_2025-11-18/spike_sim/cva6-aes-test.cv32a6_imac_sv32.csv
veri-testharness : / path/to/cva6/verif/sim/out_2025-11-18/veri-testharness_sim/cva6-aes-test.cv32a6_imac_sv32.csv
Mismatch[1]:
spike[94] : pc[80002748] aes32esi t0, t0, t1, 1: t0:1615faa0
veri-testharness[94] : pc[0000000080002748] aes32esi t0, t0, t1, 1: t0:16157e2a
Mismatch[2]:
spike[95] : pc[8000274c] aes32esi t0, t0, t1, 2: t0:16fefaa0
veri-testharness[95] : pc[000000008000274c] aes32esi t0, t0, t1, 2: t0:16157ea0
Mismatch[3]:
spike[96] : pc[80002750] aes32esi t0, t0, t1, 3: t0:17fefaa0
veri-testharness[96] : pc[0000000080002750] aes32esi t0, t0, t1, 3: t0:16157e2a
[FAILED]: 62 matched, 3 mismatch
0 PASSED, 1 FAILED
[FAILED]: 62 matched, 3 mismatch
...
Could you please look into issue?
The reproducer is attached cva6-aes-issue.tar.gz, you could extract files to cva6 folder structure
└── cva6
└── verif
├── regress
│ └── cva6-aes-test.sh – shell script to run reproducer
└── tests
└── custom
└── cva6-aes-test
├── cva6-aes-test.c – reproducer main file
├── uart.c – UART support, for prints (if enabled)
└── uart.h – UART support, for prints (if enabled)
Best regards, Alexander