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

Avoid redundant extends/truncations during normalization #16

Open
danmatichuk opened this issue Apr 7, 2020 · 0 comments
Open

Avoid redundant extends/truncations during normalization #16

danmatichuk opened this issue Apr 7, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@danmatichuk
Copy link
Collaborator

Part of normalization post-processing step is to strip all integers out of the final specification. This is done fairly naively by representing all integers as 65-bit bitvectors (capable of representing a 64-bit value that is unambiguously meant to be signed or unsigned).

Often arithmetic on bitvector values is performed in the ASL by first casting a bitvector to an unsigned integer, performing the necessary arithmetic on the integers, and then casting the final result back into a bitvector. After normalization, this then has the odd structure of extending a bitvector to 65 bits, performing some arithmetic, then truncating back down to its original length.

let r2085 := (uext _R11_0 65)
    r2087 := (bv_add r2085 (0xfffffffc :: [65]))
    r2088 := (trunc r2087 32)

The resulting expression becomes cumbersome during verification (i.e. in macaw). In many cases, it should be possible to instead avoid this pattern and represent the above as a single bv_add.

r2088 := (bv_add _R11_0 (0xfffffffc :: [32]))

This can likely be handled during translation/normalization by more carefully choosing the bitwidth of an integer-as-bitvector based on its usage.

@danmatichuk danmatichuk added the enhancement New feature or request label Apr 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant