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

Negative parameter indexes #39

Closed
MikeOpenHWGroup opened this issue Apr 28, 2021 · 3 comments
Closed

Negative parameter indexes #39

MikeOpenHWGroup opened this issue Apr 28, 2021 · 3 comments
Assignees

Comments

@MikeOpenHWGroup
Copy link
Member

A recent addition to the CV32E40X (sha 4206fff on 2021-04-27) introduced "negative indexes" for the PMA_CFG parameter. An example of this is bhv/cv32e40x_wrapper.sv:

module cv32e40x_wrapper
  import cv32e40x_pkg::*;
#(
  parameter NUM_MHPMCOUNTERS             =  1,
  parameter int unsigned PMA_NUM_REGIONS =  0,
  parameter pma_region_t PMA_CFG [PMA_NUM_REGIONS-1:0] = '{default:PMA_R_DEFAULT}
)

The default value of PMA_NUM_REGIONS is zero which means the range of PMA_CFG is [-1:0]. Most SV simulators will accept this, but Metrics DSIM interprets SV parameters as unsigned values (which, I believe is correct) and therefore the size of PMA_CFG is (2**31)-1 which exceeds a built-in DSIM limit.

@Silabs-ArjanB
Copy link
Contributor

Hi @silabs-oivind I believe my original proposal would prevent this.

@silabs-oivind
Copy link
Contributor

Hi @MikeOpenHWGroup,
I've updated the CV32E40X RTL to work around this.
However, if I read the section about range specification in the SystemVerilog LRM correctly, range boundaries are allowed to be any integer value, "positive, negative, or zero".

@MikeOpenHWGroup
Copy link
Member Author

Thanks @silabs-oivind, that did the trick. Just for safety's sake it would also be good to do the same for the 40x_wrapper.

FWIW, I've looked into this and agree with you that the LRM supports negative range boundaries. The Metrics DSIM simulator supports these as expected, so I was in error thinking this was the issue. It turns out the problem is that DSIM interprets parameters as unsigned values, so if PUM_NUM_REGIONS is zero, then PMA_NUM_REGIONS-1 is resolved as a very large positive number, not -1.

silabs-oivind added a commit to silabs-oivind/cv32e40x that referenced this issue Aug 19, 2021
Silabs-ArjanB added a commit that referenced this issue Aug 19, 2021
Address github issue #39. Make parameter PMA_NUM_REGIONS int (not uns…
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

3 participants