scarv / xcrypto

XCrypto: a cryptographic ISE for RISC-V
MIT License
91 stars 10 forks source link

xc.msub.3 - crs3 not sourced properly #48

Closed ben-marshall closed 5 years ago

ben-marshall commented 5 years ago

Expected Behaviour

xc.msub.3 (crd2, crd1), crs1, crs2, crs3
   t   <- (crs1 - crs2) - crs3[0]
  crd1 <- t[31:0]
  crd2 <- t[63:32]

Actual Behaviour

All of CRS3 is subtracted, rather than just the LSB.

xc.msub.3 (crd2, crd1), crs1, crs2, crs3
   t   <- (crs1 - crs2) - crs3
  crd1 <- t[31:0]
  crd2 <- t[63:32]

Bug appears consistently in implementation and verification environment (as might happen when one person does both :-1: )

Fix:

xc.msub.3 should sample only the LSB of crs3 operand.