Changeset 741


Ignore:
Timestamp:
Apr 4, 2011, 6:24:22 PM (9 years ago)
Author:
ayache
Message:

Bug fix in LINToASM in D2.2's 8051 (negative integers).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Deliverables/D2.2/8051/src/LIN/LINToASM.ml

    r685 r741  
    22(** This module translates a [LIN] program into a [ASM] program. *)
    33
     4
     5(* Fetch the labels found in a LIN program. *)
    46
    57let statement_labels = function
     
    1618  | _ -> Label.Set.empty
    1719
    18 (* Fetch the labels found in a LIN program. *)
    19 
    2020let prog_labels p =
    2121  let f labels funct = Label.Set.union labels (funct_labels funct) in
     
    2323
    2424
    25 let byte_of_int i = BitVectors.vect_of_int i `Eight
     25let size_of_vect_size = function
     26  | `Four -> 4
     27  | `Seven -> 7
     28  | `Eight -> 8
     29  | `Eleven -> 11
     30  | `Sixteen -> 16
     31
     32let vect_of_int i size =
     33  let i' =
     34    if i < 0 then (MiscPottier.pow 2 (size_of_vect_size size)) + i else i in
     35  BitVectors.vect_of_int i' size
     36
     37let byte_of_int i = vect_of_int i `Eight
    2638let data_of_int i = `DATA (byte_of_int i)
    27 let data16_of_int i = `DATA16 (BitVectors.vect_of_int i `Sixteen)
     39let data16_of_int i = `DATA16 (vect_of_int i `Sixteen)
    2840let acc_addr = I8051.reg_addr I8051.a
    2941
Note: See TracChangeset for help on using the changeset viewer.