Skip to content

[RTL] Register file output ports DCLS comparison#482

Open
nasahlpa wants to merge 1 commit into
mainfrom
dev/nasahlpa/rf_dcls
Open

[RTL] Register file output ports DCLS comparison#482
nasahlpa wants to merge 1 commit into
mainfrom
dev/nasahlpa/rf_dcls

Conversation

@nasahlpa

Copy link
Copy Markdown
Collaborator

When DCLS and lockstep_regfile_enable is enabled, previously, a subset of registers were directly compared. This has two drawbacks:

  • Area overhead is quite large as multiple registers need to be compared
  • No comprehensive protection as only a subset of registers were covered.

This commit switches from a comparison of a subset of registers to the comparison of the read output ports of the main and the shadow core. This:

  • Saves area as only the output ports need to be compared
  • Covers all registers

The detection latency is a bit higher as a fault injected into a registes is only detected when the register is read from the RF. However, this is fine as we are interested in detecting a fault when we are consuming the register file value.

When DCLS and `lockstep_regfile_enable` is enabled, previously, a
subset of registers were directly compared. This has two drawbacks:
- Area overhead is quite large as multiple registers need to be
  compared
- No comprehensive protection as only a subset of registers were
  covered.

This commit switches from a comparison of a subset of registers to
the comparison of the read output ports of the main and the shadow
core. This:
- Saves area as only the output ports need to be compared
- Covers all registers

The detection latency is a bit higher as a fault injected into a
registes is only detected when the register is read from the RF.
However, this is fine as we are interested in detecting a fault
when we are consuming the register file value.

Signed-off-by: Pascal Nasahl <nasahlpa@lowrisc.org>
@nasahlpa nasahlpa force-pushed the dev/nasahlpa/rf_dcls branch from ec1d774 to 4971ac0 Compare June 30, 2026 14:33
@nasahlpa nasahlpa marked this pull request as ready for review June 30, 2026 14:34

@kgugala kgugala left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we have this as another configuration option? Possibility to compare the registers is used in a few cases.

We can add the option to compare register file, but I'd prefer to add it as a configuration option and do not drop CSRs comparison

@moidx

moidx commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

@kgugala is there a reason to maintain the previous implementation?

Based on testing and security evaluation we have determined there are coverage gaps. The changes included in this PR will improve overall FI detection while at the same time reducing area cost.

@nasahlpa

Copy link
Copy Markdown
Collaborator Author

Thanks for the review @kgugala!

We can add the option to compare register file, but I'd prefer to add it as a configuration option and do not drop CSRs comparison

Regarding the CSR comparison: it's unchanged in this PR - el2_regfile_tlu_pkt_t still exists and the tlu field is still compared. The only change is on the GPR side: instead of comparing a subset of GPRs (ra, sp, fp, a0–a7), we now compare the main vs. shadow read ports (rd0/rd1), which covers all 31 GPRs - a fault is caught the moment the register is read.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants