Changeset 90 for Deliverables/D4.1/physical.ml
 Timestamp:
 Sep 20, 2010, 1:45:10 PM (9 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

Deliverables/D4.1/physical.ml
r88 r90 1 open Bit _vectors1 open BitVectors;; 2 2 3 3 exception Byte7_conversion … … 14 14 15 15 let add8_with_c b1 b2 c = 16 let n1 = int_of_ byteb1 in17 let n2 = int_of_ byteb2 in18 let c = int_of_ bit c in16 let n1 = int_of_vect b1 in 17 let n2 = int_of_vect b2 in 18 let c = int_of_vect c in 19 19 let res = n1 + n2 + c in 20 20 let ac = n1 mod 16 + n2 mod 16 + c >= 16 in … … 22 22 let res,c = res mod 256, res >= 256 in 23 23 let ov = c <> c6 in 24 byte_of_int res,c,ac,ov24 vect_of_int res,c,ac,ov 25 25 ;; 26 26 27 27 let subb8_with_c b1 b2 c = 28 let n1 = int_of_ byteb1 in29 let n2 = int_of_ byteb2 in30 let c = int_of_ bit c in28 let n1 = int_of_vect b1 in 29 let n2 = int_of_vect b2 in 30 let c = int_of_vect c in 31 31 let res = n1  n2  c in 32 32 let ac = n1 mod 16  n2 mod 16  c < 0 in … … 36 36 else n1 + 256  n2  c, true in 37 37 let ov = c <> c6 in 38 byte_of_int res,c,ac,ov38 (vect_of_int res `Eight,c,ac,ov) 39 39 ;; 40 40 41 41 let dec b = 42 let res = int_of_ byteb  1 in43 if res < 0 then byte_of_int 25544 else byte_of_int res42 let res = int_of_vect b  1 in 43 if res < 0 then vect_of_int 255 `Eight 44 else vect_of_int res `Eight 45 45 ;; 46 46 47 47 let inc b = 48 let res = int_of_ byteb + 1 in49 if res > 255 then byte_of_int 050 else byte_of_int res48 let res = int_of_vect b + 1 in 49 if res > 255 then vect_of_int 0 `Eight 50 else vect_of_int res `Eight 51 51 ;; 52 52
Note: See TracChangeset
for help on using the changeset viewer.