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

Error "SolveBeforeMustBeRand" while Elaborating with Dsim tool #967

Open
magnetworks opened this issue Feb 5, 2024 · 2 comments
Open

Error "SolveBeforeMustBeRand" while Elaborating with Dsim tool #967

magnetworks opened this issue Feb 5, 2024 · 2 comments

Comments

@magnetworks
Copy link

Hi,
I'm trying to build & run the repo using DSIM.
I'm get the following error -

=E:[SolveBeforeMustBeRand]:
    The variables mentioned in a solve-before constraint
    must be simple variables (no indexes or members)
    and must be rand (not state or randc).

    ./src/riscv_pmp_cfg.sv:106:7
    Included from src/riscv_instr_pkg.sv:1529:12

Any help with this would be great.

@pdhakal-metrics
Copy link

Here's the problematic line:
solve mseccfg.mml before pmp_cfg[i].w, pmp_cfg[i].r;

mseccfg is a rand variable of a packed struct. dsim does not currently allow slices/members of packed structs in the "solve before" directive. It would be a substantive rewrite of the code, which is not in the immediate pipeline. Would solving for mseccfg instead of a specific bit within it be an acceptable workaround?
solve mseccfg before pmp_cfg[i].w, pmp_cfg[i].r;

@mcandress
Copy link

There should be an upcoming enhancement to DSim that will allow more slices/members to be used in solve/before constraints and will solve this issue.

Meanwhile, you can get the desired behaviour by adding a variable that is equal to mseccfg.mml and using it in the solve-before.


rand bit tmpVar;
...
constraint xwr_c {
    tmpVar == msccfg.mml; 
    foreach (pmp_cfg[i]) {
        solve tmpVar before pmp_cfg[i].w, pmp_cfg[i].r
      }
     ...
  }

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