lowRISC / lowRISC/opentitan

[otbn] Issue a warning in tooling when using BN.ADDI _, _, 0

Open
#7,320 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Component:Tooling Earlgrey-PROD Triaged IP:otbn Priority:P3 Type:Enhancement Type:FutureRelease
Dominant language
SystemVerilog
Stars
3.6k
Forks
1.1k
Avg merge
2d 22h
Merged PRs (30d)
141

Description

`BN.ADDI` can be used to move data between two registers. It's nearly identical to `BN.MOV`, but also sets flags. Less visible is another difference: BN.ADDI moves data through the ALU and strips off integrity-protection, while BN.MOV maintains it.

In addition to recommending the use of BN.MOV for register-to-register transfers (see https://github.com/lowRISC/opentitan/issues/3314), we also should issue a warning to software developers when we encounter such code.

We could do that in the assembler (otbn-as), or introduce a linter or something like that.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the otbn-as tooling and the alternative of introducing a linter, then check issue #3314 for the related recommendation. Done means software using BN.ADDI with an immediate of 0 receives a warning, with the chosen location and behavior clarified.

Written by the indexing model from the issue text.

Assessment

Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.