Changeset 742


Ignore:
Timestamp:
Apr 6, 2011, 11:16:43 AM (9 years ago)
Author:
mulligan
Message:

Added extra debugging feature for Nicolas

Location:
Deliverables/D2.2/8051
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Deliverables/D2.2/8051/myocamlbuild_config.ml

    r685 r742  
    1 let parser_lib = "/home/ayache/Downloads/Bol/Deliverables/D2.2/8051/lib"
     1let parser_lib = "/home/dpm/Projects/Cerco/Deliverables/D2.2/8051/lib"
  • Deliverables/D2.2/8051/src/ASM/ASMInterpret.ml

    r740 r742  
    16491649;;
    16501650
    1651 let execute1 status =
     1651let execute1' cycle_count status transform =
    16521652  let instr,pc,ticks = fetch status.code_memory status.pc in
    16531653  let status = { status with clock = status.clock + ticks; pc = pc } in
     
    19351935  let status = serial_port_output status out_cont in
    19361936  let status = interrupts status in
    1937   { status with previous_p1_val = get_bit status.p3 4;
    1938     previous_p3_val = get_bit status.p3 5 }
    1939 ;;
     1937  let status = { status with previous_p1_val = get_bit status.p3 4;
     1938                   previous_p3_val = get_bit status.p3 5 } in
     1939  let status = transform cycle_count status in
     1940    status
     1941;;
     1942
     1943let execute1 status transform = execute1' 0 status transform;;
    19401944
    19411945(*
     
    19591963*)
    19601964
    1961 let rec execute f s =
     1965let rec execute transform f s =
    19621966  let cont =
    19631967    try f s; true
    19641968    with Halt -> false
    19651969  in
    1966   if cont then execute f (execute1 s)
     1970  if cont then execute transform f (execute1 s transform)
    19671971  else s
    19681972;;
    1969 
    19701973
    19711974let load_program p =
     
    19851988  IntValue.Int8.of_int i
    19861989
     1990let example_transform cycle_count status =
     1991  if cycle_count = 3 then
     1992    { status with dpl = vect_of_int 5 `Eight }
     1993  else
     1994    status
     1995;;
     1996
    19871997let interpret print_result p =
    19881998  if print_result then Printf.printf "8051: %!" ;
     
    19912001    let trace = ref [] in
    19922002    let callback = observe_trace trace in
    1993     let st = execute callback st in
     2003    let st = execute example_transform callback st in
    19942004    let res = result st in
    19952005    if print_result then
  • Deliverables/D2.2/8051/src/ASM/ASMInterpret.mli

    r631 r742  
    123123   trace; it can raise Hold to stop execution. Otherwise
    124124   the processor never halts. *)
    125 val execute: (status -> unit) -> status -> status
     125val execute: (int -> (status -> status)) -> (status -> unit) -> status -> status
    126126
    127127val fetch: Physical.WordMap.map -> word -> ASM.instruction * word * int
Note: See TracChangeset for help on using the changeset viewer.