Changeset 743 for Deliverables/D2.2/8051/src/ASM
- Timestamp:
- Apr 7, 2011, 11:11:26 AM (10 years ago)
- Location:
- Deliverables/D2.2/8051/src/ASM
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Deliverables/D2.2/8051/src/ASM/ASMInterpret.ml
r742 r743 1649 1649 ;; 1650 1650 1651 let execute1 ' cycle_count status transform=1651 let execute1 status = 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 … … 1937 1937 let status = { status with previous_p1_val = get_bit status.p3 4; 1938 1938 previous_p3_val = get_bit status.p3 5 } in 1939 let status = transform cycle_count status in1940 1939 status 1941 1940 ;; 1942 1943 let execute1 status transform = execute1' 0 status transform;;1944 1941 1945 1942 (* … … 1963 1960 *) 1964 1961 1965 let rec execute transformf s =1962 let rec execute f s = 1966 1963 let cont = 1967 1964 try f s; true 1968 1965 with Halt -> false 1969 1966 in 1970 if cont then execute transform f (execute1 s transform)1967 if cont then execute f (execute1 s) 1971 1968 else s 1972 1969 ;; … … 1988 1985 IntValue.Int8.of_int i 1989 1986 1990 let example_transform cycle_count status =1991 if cycle_count = 3 then1992 { status with dpl = vect_of_int 5 `Eight }1993 else1994 status1995 ;;1996 1997 1987 let interpret print_result p = 1998 1988 if print_result then Printf.printf "8051: %!" ; … … 2001 1991 let trace = ref [] in 2002 1992 let callback = observe_trace trace in 2003 let st = execute example_transformcallback st in1993 let st = execute callback st in 2004 1994 let res = result st in 2005 1995 if print_result then -
Deliverables/D2.2/8051/src/ASM/ASMInterpret.mli
r742 r743 123 123 trace; it can raise Hold to stop execution. Otherwise 124 124 the processor never halts. *) 125 val execute: ( int -> (status -> status)) -> (status -> unit) -> status -> status125 val execute: (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.