opentitan icon indicating copy to clipboard operation
opentitan copied to clipboard

BN.MULQACC arguments inconsistent in documentation and snippets in sw/otbn

Open sydgibs opened this issue 6 years ago • 2 comments

https://github.com/lowRISC/opentitan/blob/aa8ed45826b570acf2b9716b9dc3895ced45325a/sw/otbn/code-snippets/modexp.S#L17

The BN.MULQACC instructions in this snippet are inconsistent with the current documentation, which gives the acceptable range of values for the acc_shift_imm argument as 0..3. This snippet appears to implement an instruction that takes the number of bits to shift the result by, rather than the number of quarter-words.

sydgibs avatar Aug 19 '20 23:08 sydgibs

Nice catch, thanks! This is a bug in the documentation: the assembler follows the RISC-V assembler so things that are encoded with a shift get their "shifted" values in the assembly. I'll try to fix it today.

Note to self: Need to add the shift to ImmOperandType.markdown_doc in operand.py.

rswarbrick avatar Aug 20 '20 07:08 rswarbrick

The linked PR should fix things, I think. The documentation will now look like this:

ss

rswarbrick avatar Aug 20 '20 14:08 rswarbrick