Skip to content

Commit e6473dd

Browse files
Fix aes32esi bug (#3243)
The PR attempts to fix this aes32esi bug - which seems to be caused by orig_instr_o (raw instruction word) being assigned only if CVA6Cfg.CvxifEn || CVA6Cfg.RVF are enabled, though it's used downstream by the ZKN features as well (not only aes32esi, but also other instructions). I.e. the bug is manifested if ZKN is enabled, but CvxifEn and RVF are not; otherwise the AES implementation seems to work correctly. Also because ZKN seems to depend on RVB being enabled as well, the PR also auto-enables RVB when ZKN is present (if it make sense a warning can be added in case it gets auto-enabled). --------- Co-authored-by: JeanRochCoulon <jean-roch.coulon@thalesgroup.com>
1 parent 37e2cb2 commit e6473dd

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

core/decoder.sv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1846,7 +1846,7 @@ module decoder
18461846
if (~ex_i.valid) begin
18471847
// if we didn't already get an exception save the instruction here as we may need it
18481848
// in the commit stage if we got a access exception to one of the CSR registers
1849-
if (CVA6Cfg.CvxifEn || CVA6Cfg.RVF)
1849+
if (CVA6Cfg.CvxifEn || CVA6Cfg.RVF || CVA6Cfg.ZKN)
18501850
orig_instr_o = (is_compressed_i) ? {{CVA6Cfg.XLEN-16{1'b0}}, compressed_instr_i} : {{CVA6Cfg.XLEN-32{1'b0}}, instruction_i};
18511851
if (CVA6Cfg.TvalEn)
18521852
instruction_o.ex.tval = (is_compressed_i) ? {{CVA6Cfg.XLEN-16{1'b0}}, compressed_instr_i} : {{CVA6Cfg.XLEN-32{1'b0}}, instruction_i};

core/include/build_config_pkg.sv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ package build_config_pkg;
6767
cfg.XF16ALT = CVA6Cfg.XF16ALT;
6868
cfg.XF8 = CVA6Cfg.XF8;
6969
cfg.RVA = CVA6Cfg.RVA;
70-
cfg.RVB = CVA6Cfg.RVB;
70+
cfg.RVB = CVA6Cfg.RVB || CVA6Cfg.ZKN; // ZKN requires RVB
7171
cfg.ZKN = CVA6Cfg.ZKN;
7272
cfg.RVV = CVA6Cfg.RVV;
7373
cfg.RVC = CVA6Cfg.RVC;

0 commit comments

Comments
 (0)