Merged
Conversation
This was referenced Oct 4, 2024
Closed
Closed
f9f6040 to
822b023
Compare
mmcloughlin
added a commit
that referenced
this pull request
Oct 26, 2025
Experimental support for symbolic opcodes in ASLp.
Opcode semantics generation now accepts an "opcode" template, for
example:
```
ASLi> :sem A64 0x122:9|sh:1|imm:12|0xa4:10
Decoding instruction A64 0x122:9|sh:1|imm:12|0xa4:10
bits ( 64 ) imm__3 ;
if eq_bits.0 {{ 1 }} ( sh [ 0 +: 1 ],'0' ) then {
imm__3 = ZeroExtend.0 {{ 12,64 }} ( imm [ 0 +: 12 ],64 ) ;
} else {
if eq_bits.0 {{ 1 }} ( sh [ 0 +: 1 ],'1' ) then {
imm__3 = ZeroExtend.0 {{ 24,64 }} ( append_bits.0 {{ 12,12 }} ( imm [ 0 +: 12 ],'000000000000' ),64 ) ;
} else {
assert FALSE ;
}
}
__array _R [ 4 ] = add_bits.0 {{ 64 }} ( __array _R [ 5 ],imm__3 ) ;
```
mmcloughlin
added a commit
that referenced
this pull request
Jan 23, 2026
* symbolic opcodes (#4) Experimental support for symbolic opcodes in ASLp. Opcode semantics generation now accepts an "opcode" template, for example: ``` ASLi> :sem A64 0x122:9|sh:1|imm:12|0xa4:10 Decoding instruction A64 0x122:9|sh:1|imm:12|0xa4:10 bits ( 64 ) imm__3 ; if eq_bits.0 {{ 1 }} ( sh [ 0 +: 1 ],'0' ) then { imm__3 = ZeroExtend.0 {{ 12,64 }} ( imm [ 0 +: 12 ],64 ) ; } else { if eq_bits.0 {{ 1 }} ( sh [ 0 +: 1 ],'1' ) then { imm__3 = ZeroExtend.0 {{ 24,64 }} ( append_bits.0 {{ 12,12 }} ( imm [ 0 +: 12 ],'000000000000' ),64 ) ; } else { assert FALSE ; } } __array _R [ 4 ] = add_bits.0 {{ 64 }} ( __array _R [ 5 ],imm__3 ) ; ``` * fix symbolic field handling by `CommonSubExprElim` (#5) Fix a problem with the treatment of symbolic field variables by common-subexpression-elimination. When a common subexpression has been identified, it needs to place it in the statement list. It does this by placing it in the first position after all its dependencies have been assigned. The problem comes because a common subexpression that depends on a symbolic field won't ever find an assignment to the symbolic field. This is what the algorithm was probably supposed to do, but as they explain in a comment what they actually do is place the definition of the common subexpression in the first place after all its dependencies have _appeared_ (whether assigned to or not). Therefore in practice, common expressions involving symbolic fields would end up placed after their first use. This PR fixes it by: * Passing a list of globals into CSE which are treated as predefined * Appending symbolic fields to the global identifier set * resolve merge conflict markers * dis_decode_entry_sym * sym_and_bits: use sym_slice and sym_append_bits * tests/test_asl.ml: fix call to dis_decode_entry
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Experimental support for symbolic opcodes in ASLp.
Opcode semantics generation now accepts an "opcode" template, for example: