Changeset 161


Ignore:
Timestamp:
Oct 7, 2010, 10:35:46 AM (9 years ago)
Author:
mulligan
Message:

Type errors fixed. Add16 with carry implemented.

Location:
Deliverables/D4.1
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Deliverables/D4.1/ASMInterpret.ml

    r159 r161  
    12911291                | false,true ->
    12921292                    (* TYPE ERROR! *)
    1293                     let res,ac,ov,cy = add8_with_c (mk_word status.th0 status.tl0) (vect_of_int 1 `Sixteen) in
     1293                    let res,ac,ov,cy = add16_with_c (mk_word status.th0 status.tl0) (vect_of_int 1 `Sixteen) false in
    12941294                    if ov then
    12951295                      let b = set_bit status.tcon 5 true in
  • Deliverables/D4.1/Physical.ml

    r144 r161  
    5050;;
    5151
     52let add16_with_c (b1 : [`Sixteen] vect) (b2 : [`Sixteen] vect) (c : bit) =
     53 let n1 = int_of_vect b1 in
     54 let n2 = int_of_vect b2 in
     55 let c = int_of_bit c in
     56 let res = n1 + n2 + c in
     57 let ac = n1 mod 256 + n2 mod 256 + c >= 256 in
     58 let c6 = n1 mod 2097152 + n2 mod 2097152 + c >= 2097152 in
     59 let res,c = res mod 4194304, res >= 4194304 in
     60 let ov = c <> c6 in
     61   vect_of_int res `Sixteen,c,ac,ov
     62;;
     63
    5264let subb8_with_c (b1 : [`Eight] vect) (b2 : [`Eight] vect) (c : bit) =
    5365 let n1 = int_of_vect b1 in
  • Deliverables/D4.1/Physical.mli

    r144 r161  
    2222val add8_with_c:
    2323 byte -> byte -> bit -> byte * bit * bit * bit
     24val add16_with_c:
     25 word -> word -> bit -> word * bit * bit * bit
    2426val dec: byte -> byte (* with roll-over *)
    2527val inc: byte -> byte (* with roll-over *)
Note: See TracChangeset for help on using the changeset viewer.