Changeset 2779 for driver/IntelHex.ml
 Timestamp:
 Mar 5, 2013, 11:50:59 PM (8 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

driver/IntelHex.ml
r2778 r2779 7 7 type word = Extracted.BitVector.word 8 8 9 let size_ of_Size= function `Eight > 8  `Sixteen > 169 let size_lookup = function `Eight > 8  `Sixteen > 16 10 10 11 11 let zero size = 12 let size = size_ of_Sizesize in12 let size = size_lookup size in 13 13 Extracted.BitVector.zero (Extracted.Glue.matitanat_of_int size) 14 14 … … 22 22 let complement v = Extracted.Arithmetic.two_complement_negation (Extracted.Glue.matitanat_of_int 8) v 23 23 24 let divide_with_remainder x y = (x / y, x mod y) 25 26 let rec nat_to_bv n k = 27 match n with 28  Extracted.Nat.O > Extracted.Vector.VEmpty 29  Extracted.Nat.S n' > 30 let res,modu = divide_with_remainder k 2 in 31 Extracted.Vector.VCons (n', 32 (if modu = 1 then Extracted.Bool.True else Extracted.Bool.False), 33 nat_to_bv n' res) 34 24 35 let vect_of_int k n = 25 Extracted.BitVector.nat_to_bv (Extracted.Glue.matitanat_of_int (size_of_Size n)) (Extracted.Glue.matitanat_of_int k)36 nat_to_bv (Extracted.Glue.matitanat_of_int (size_lookup n)) k 26 37 27 38 let from_word v = 28 39 let {Extracted.Types.fst = fst ; snd = snd} = 29 Extracted.Vector.vsplit (Extracted.Glue.matitanat_of_int 16)40 Extracted.Vector.vsplit (Extracted.Glue.matitanat_of_int 8) 30 41 (Extracted.Glue.matitanat_of_int 8) v in 31 42 fst,snd
Note: See TracChangeset
for help on using the changeset viewer.