Asllib.BitvectorSourceThis module provide an interface to ASL bitvector, and main operations on it.
Represent a bitvector.
of_string s interpretes s as a right-indexed representation of a bitvector. Characters others than '0' or '1' are ignored. The length of of_string s is equal to the number of such characters in s.
of_int i is the bitvector of length Sys.int_size (e.g. 63) that corresponds to i in little-endian, i.e. index 0 (for slicing operations corresponds to i mod 2.
of_int n i is the bitvector of length n that corresponds to i in little-endian, i.e. index 0 (for slicing operations corresponds to i mod 2.
of_int i is the bitvector of length 64 that corresponds to i in little-endian, i.e. index 0 (for slicing operations corresponds to i mod 2.
of_int sz i is the bitvector of length sz that corresponds to i in little-endian.
Print the bitvector, indexed from the right, as a serie of '0' and '1', delimited by apostrophes. Inside a horizontal box.
Returns a string representing the bitvector, indexed from the right and delimited by apostrophes.
Returns a string representing the bitvector in hexadecimal, indexed from the right and preceded by '0x'.
Returns an integer representing the bitvector, little-endian. Result unspecified if length > Sys.int_size.
Returns an integer representing the bitvector, little-endian. Result unspecified if length > 64.
Returns an integer representing the bitvector, little-endian. Result unspecified if length > 64.
The comparison function for bitvectors, with the same specification as Stdlib.compare.
sign_extend nbytes bv returns a copy of bv of length 8*nbytes, left-padded with bv's bit-sign.
prefix src len returns the prefix of size len of bitvector src. Will crash if len is strictly more then the size of src.
extract_slice src positions returns a bitvector whose i-th bit is the bit of src whose index is the i-th element of positions.
write_slice dst src positions is a copy of dst where each bit at index i in src has been written in dst at the index given by the i-th element of positions.
concat [bv2; bv1; bv0] is the concatenation of bv0, bv1, and bv2, in this order, i.e. if bv0 is not empty, the following is true:
equal (extract_slice (concat [bv1; bv0]) [ 0 ]) (extract_slice bv0 [ 0 ])Bitvector in ASL can be matched against masks, that have the same syntax than bitvectors, with an extra possible bit: 'x'. This bits indicates that the mask would match against any bit at this position.
For example:
assert ('01' IN {'01'}) == TRUE;
assert ('01' IN {'0x'}) == TRUE;
assert ('10' IN {'0x'}) == FALSE;Internal representation of a mask.