-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lean: Adding features to support structs and bitfields (#817)
- Loading branch information
Showing
9 changed files
with
164 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import Out.Sail.Sail | ||
|
||
open Sail | ||
|
||
def cr_type := (BitVec 8) | ||
|
||
def undefined_cr_type (lit : Unit) : SailM (BitVec 8) := | ||
return ((undefined_bitvector 8) : (BitVec 8)) | ||
|
||
def Mk_cr_type (v : (BitVec 8)) : (BitVec 8) := | ||
v | ||
|
||
def _get_cr_type_bits (v : (BitVec 8)) : (BitVec 8) := | ||
(Sail.BitVec.extractLsb v (HSub.hSub 8 1) 0) | ||
|
||
def _update_cr_type_bits (v : (BitVec 8)) (x : (BitVec 8)) : (BitVec 8) := | ||
(Sail.BitVec.updateSubrange v (HSub.hSub 8 1) 0 x) | ||
|
||
def _set_cr_type_bits (r_ref : RegisterRef Unit Unit (BitVec 8)) (v : (BitVec 8)) : SailM Unit := | ||
return sorry | ||
|
||
def _get_cr_type_CR0 (v : (BitVec 8)) : (BitVec 4) := | ||
(Sail.BitVec.extractLsb v 7 4) | ||
|
||
def _update_cr_type_CR0 (v : (BitVec 8)) (x : (BitVec 4)) : (BitVec 8) := | ||
(Sail.BitVec.updateSubrange v 7 4 x) | ||
|
||
def _set_cr_type_CR0 (r_ref : RegisterRef Unit Unit (BitVec 8)) (v : (BitVec 4)) : SailM Unit := | ||
return sorry | ||
|
||
def _get_cr_type_CR1 (v : (BitVec 8)) : (BitVec 2) := | ||
(Sail.BitVec.extractLsb v 3 2) | ||
|
||
def _update_cr_type_CR1 (v : (BitVec 8)) (x : (BitVec 2)) : (BitVec 8) := | ||
(Sail.BitVec.updateSubrange v 3 2 x) | ||
|
||
def _set_cr_type_CR1 (r_ref : RegisterRef Unit Unit (BitVec 8)) (v : (BitVec 2)) : SailM Unit := | ||
return sorry | ||
|
||
def _get_cr_type_CR3 (v : (BitVec 8)) : (BitVec 2) := | ||
(Sail.BitVec.extractLsb v 1 0) | ||
|
||
def _update_cr_type_CR3 (v : (BitVec 8)) (x : (BitVec 2)) : (BitVec 8) := | ||
(Sail.BitVec.updateSubrange v 1 0 x) | ||
|
||
def _set_cr_type_CR3 (r_ref : RegisterRef Unit Unit (BitVec 8)) (v : (BitVec 2)) : SailM Unit := | ||
return sorry | ||
|
||
def _get_cr_type_GT (v : (BitVec 8)) : (BitVec 1) := | ||
(Sail.BitVec.extractLsb v 6 6) | ||
|
||
def _update_cr_type_GT (v : (BitVec 8)) (x : (BitVec 1)) : (BitVec 8) := | ||
(Sail.BitVec.updateSubrange v 6 6 x) | ||
|
||
def _set_cr_type_GT (r_ref : RegisterRef Unit Unit (BitVec 8)) (v : (BitVec 1)) : SailM Unit := | ||
return sorry | ||
|
||
def _get_cr_type_LT (v : (BitVec 8)) : (BitVec 1) := | ||
(Sail.BitVec.extractLsb v 7 7) | ||
|
||
def _update_cr_type_LT (v : (BitVec 8)) (x : (BitVec 1)) : (BitVec 8) := | ||
(Sail.BitVec.updateSubrange v 7 7 x) | ||
|
||
def _set_cr_type_LT (r_ref : RegisterRef Unit Unit (BitVec 8)) (v : (BitVec 1)) : SailM Unit := | ||
return sorry | ||
|
||
def initialize_registers : Unit := | ||
() | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
default Order dec | ||
|
||
$include <prelude.sail> | ||
|
||
bitfield cr_type : bits(8) = { | ||
CR0 : 7 .. 4, | ||
LT : 7, | ||
GT : 6, | ||
CR1 : 3 .. 2, | ||
CR3 : 1 .. 0 | ||
} |
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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