Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LINT] Index out of bounds warning when compiling new PMP code #235

Open
calebofearth opened this issue Sep 20, 2024 · 0 comments
Open

[LINT] Index out of bounds warning when compiling new PMP code #235

calebofearth opened this issue Sep 20, 2024 · 0 comments

Comments

@calebofearth
Copy link
Contributor

In this file: https://github.com/chipsalliance/Cores-VeeR-EL2/blob/main/design/dec/el2_dec_pmp_ctl.sv#L147-L150

Use of (entry_idx+1) generates a compiler warning (in VCS) due to index out of bounds. The conditional statement protects against this index being used illegally, but the lint error should be fixed.

Suggestion:
Change

      assign pmpaddr_lock_next = ((entry_idx+1 < pt.PMP_ENTRIES)
                                  ? (entry_lock_eff[entry_idx+1]
                                     & pmp_pmpcfg[entry_idx+1].mode == TOR)
                                  : 1'b0);

to

    if ((entry_idx+1 < mcu_pt.PMP_ENTRIES))
        assign pmpaddr_lock_next = (entry_lock_eff[entry_idx+1] & pmp_pmpcfg[entry_idx+1].mode == TOR);
    else
        assign pmpaddr_lock_next = 1'b0;
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

No branches or pull requests

1 participant