Skip to content

Changes for RISC-V support#139

Merged
ncough merged 19 commits intopartial_evalfrom
riscv
Jul 8, 2025
Merged

Changes for RISC-V support#139
ncough merged 19 commits intopartial_evalfrom
riscv

Conversation

@ncough
Copy link
Collaborator

@ncough ncough commented Jun 26, 2025

We have a reasonable RISC-V model by translation from Sail. A few changes are necessary to get ASLi to accept these models though, as the Sail type system is more complex. Even with these changes, there are a number of functions that do not type check due to a reliance on if-statement guards to prove type correctness.

Changes include:

  • Not assuming PSTATE, etc. exists in the model.
  • More robust Z3 translation, including Expr_If, pow2_int, and more (unsound) heuristics around fdiv_int.
  • Including the conditions on Stmt_Assert when reasoning over types.
  • Substituting global constants in type constraints.

ncough added 18 commits June 26, 2025 21:01
* Use asserts when type checking
* Subst global constants in constraints
* Support integer comparisons
* Support ite
* More aggressive (and unsound) fdiv reasoning
* Support pow2
* Path constraints are scoped and informed by:
  * Literal pattern matches
  * If conditions
  * Asserts

* Only expressions that can be shown constant are considered

* Constant checking logic is currently broken for local vars
* Unroll pow2 to a finite bound to avoid reasoning over reals
* Mark Expr_If as supported
* Allow casting of unknown value back to expression.
  Maybe this is indicative of some greater problem, but these unknowns
  have been so abused, don't really care at this point.
* Allow comparison over enums when integers would be expected.
* Support emitting zdiv_int as sdiv_bits.
  This is actually the easy case, but never came up in ARMv8.
* Disable the collection of cse terms under an If.
  Injection of the common var def is not quite right.
* Support extracting boolean literals when building syms
* Support extracting values from an Expr_Tuple
RISCV has many wide fields that are tested down to ~10 values at most.
These are a pain for the coverage, which wants to enumerate the
whole field. Added a quick script to extract these values and generate
case statements for coverage automatically.
* Generalised encoding of all division tricks
* Common path for uninterp
@ncough ncough merged commit 345cf07 into partial_eval Jul 8, 2025
4 checks passed
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.

1 participant