Changeset 742 for Deliverables/D2.2
- Timestamp:
- Apr 6, 2011, 11:16:43 AM (9 years ago)
- 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"1 let parser_lib = "/home/dpm/Projects/Cerco/Deliverables/D2.2/8051/lib" -
Deliverables/D2.2/8051/src/ASM/ASMInterpret.ml
r740 r742 1649 1649 ;; 1650 1650 1651 let execute1 status=1651 let execute1' cycle_count status transform = 1652 1652 let instr,pc,ticks = fetch status.code_memory status.pc in 1653 1653 let status = { status with clock = status.clock + ticks; pc = pc } in … … 1935 1935 let status = serial_port_output status out_cont in 1936 1936 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 1943 let execute1 status transform = execute1' 0 status transform;; 1940 1944 1941 1945 (* … … 1959 1963 *) 1960 1964 1961 let rec execute f s =1965 let rec execute transform f s = 1962 1966 let cont = 1963 1967 try f s; true 1964 1968 with Halt -> false 1965 1969 in 1966 if cont then execute f (execute1 s)1970 if cont then execute transform f (execute1 s transform) 1967 1971 else s 1968 1972 ;; 1969 1970 1973 1971 1974 let load_program p = … … 1985 1988 IntValue.Int8.of_int i 1986 1989 1990 let 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 1987 1997 let interpret print_result p = 1988 1998 if print_result then Printf.printf "8051: %!" ; … … 1991 2001 let trace = ref [] in 1992 2002 let callback = observe_trace trace in 1993 let st = execute callback st in2003 let st = execute example_transform callback st in 1994 2004 let res = result st in 1995 2005 if print_result then -
Deliverables/D2.2/8051/src/ASM/ASMInterpret.mli
r631 r742 123 123 trace; it can raise Hold to stop execution. Otherwise 124 124 the processor never halts. *) 125 val execute: ( status -> unit) -> status -> status125 val execute: (int -> (status -> status)) -> (status -> unit) -> status -> status 126 126 127 127 val fetch: Physical.WordMap.map -> word -> ASM.instruction * word * int
Note: See TracChangeset
for help on using the changeset viewer.