Ignore:
Timestamp:
Mar 4, 2011, 2:00:33 AM (10 years ago)
Author:
ayache
Message:

Some bugs fixed in D2.2.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Deliverables/D2.2/8051/src/ASM/ASMCosts.ml

    r630 r631  
    3838let treat mem costs pc =
    3939  let (inst, next_pc, inst_cost) = ASMInterpret.fetch mem pc in
     40(*
     41  (* <DEBUG> *)
     42  Printf.printf "%s%s: %s\n%!"
     43    (if BitVectors.WordMap.mem pc costs then
     44        BitVectors.WordMap.find pc costs ^ ": "
     45     else "")
     46    (BitVectors.string_of_vect pc)
     47    (Pretty.pp_instruction inst) ;
     48  (* </DEBUG> *)
     49*)
    4050  let next_pcs = match inst_nature pc inst with
    4151    | Return -> []
    4252    | Goto pc -> [pc]
    4353    | Branch pc2 ->
    44       let pc1 =
    45         snd (BitVectors.half_add pc (BitVectors.vect_of_int 1 `Sixteen)) in
    46       [pc1 ; pc2]
    47     | _ -> [next_pc] in
     54      [next_pc ; pc2]
     55    | Direct_fun_call _ | Other -> [next_pc] in
    4856  (inst_cost, next_pcs)
    4957
     
    6169  let rec aux = function
    6270    | [] -> 0
    63     | [pc] when BitVectors.WordMap.mem pc costs -> 0
     71    | [pc] when BitVectors.WordMap.mem pc costs ->0
    6472    | [pc] -> full_cost pc
    6573    | [pc1 ; pc2] when BitVectors.WordMap.mem pc1 costs &&
     
    8492let traverse_code mem p =
    8593  let rec aux pc code =
    86     let _,newpc,_ = ASMInterpret.fetch mem pc in
     94    let inst,newpc,_ = ASMInterpret.fetch mem pc in
     95(*
     96    (* <DEBUG> *)
     97    Printf.printf "Traversing %s: %s\n%!"
     98      (BitVectors.string_of_vect pc) (Pretty.pp_instruction inst) ;
     99    (* </DEBUG> *)
     100*)
    87101    match code with
    88102      | [] -> CostLabel.Map.empty
     
    129143
    130144let compute p =
     145(*
     146  (* <DEBUG> *)
     147  Printf.printf "%s\n\n%!" (Pretty.print_program p) ;
     148  (* </DEBUG> *)
     149*)
    131150  let mem = ASMInterpret.load_code_memory p.ASM.code in
    132151  let costs_mapping = traverse_code mem p in
Note: See TracChangeset for help on using the changeset viewer.