source: Deliverables/D4.1/ASMInterpret.mli @ 209

Last change on this file since 209 was 209, checked in by mulligan, 9 years ago

Compiled again.

File size: 2.6 KB
Line 
1open BitVectors;;
2open Physical;;
3
4exception CodeTooLarge
5
6type time = int;;
7type line = [ `P1 of byte
8            | `P3 of byte
9            | `SerialBuff of [ `Eight of byte
10                             | `Nine of BitVectors.bit * byte
11                             ]
12            ];;
13
14val string_of_line: line -> string;;
15
16type epsilon = int;;
17
18(* In:  reception time, line of input, new continuation,
19   Out: transmission time, output line, expected duration until reply,
20        new continuation.
21*)
22type continuation =
23  [`In of time * line * epsilon * continuation] option *
24  [`Out of (time -> line -> time * continuation) ];;
25
26type status =
27{
28  (* Memory *)
29  code_memory: WordMap.map;        (* can be reduced *)
30  low_internal_ram: Byte7Map.map;
31  high_internal_ram: Byte7Map.map;
32  external_ram: WordMap.map;
33
34  (* Program counter *)
35  pc: word;
36
37  (* SFRs *)
38  sp: byte;
39  dpl: byte;
40  dph: byte;
41  pcon: byte;
42  tcon: byte;
43  tmod: byte;
44  tl0: byte;
45  tl1: byte;
46  th0: byte;
47  th1: byte;
48  p1: byte;
49  scon: byte;
50  sbuf: byte;
51  ie: byte;
52  p3: byte;
53  ip: byte;
54  psw: byte;
55  acc: byte;
56  b: byte;
57  t2con: byte;   (* 8052 only *)
58  rcap2l: byte;  (* 8052 only *)
59  rcap2h: byte;  (* 8052 only *)
60  tl2: byte;     (* 8052 only *)
61  th2: byte;     (* 8052 only *)
62
63  (* Latches for the output lines *)
64  p1_latch: byte;
65  p3_latch: byte;
66
67  (* Fields for tracking the state of the processor. *)
68 
69  (* IO specific *)
70  previous_p1_val: bool;
71  previous_p3_val: bool;
72
73  serial_epsilon_out: epsilon option;
74  serial_epsilon_in: epsilon option;
75
76  serial_v_in: [`Eight of byte | `Nine of (BitVectors.bit * byte) ] option;
77  serial_v_out: [`Eight of byte | `Nine of (BitVectors.bit * byte) ] option;
78
79  serial_k_out: continuation option;
80
81  io: continuation;
82  expected_out_time: [ `None | `Now | `At of time ];
83
84  (* Timer and clock specific *)
85  clock: time;
86  timer0: word;
87  timer1: word;
88  timer2: word  (* can be missing *)
89}
90
91val string_of_status: status -> string
92
93module IntMap: Map.S with type key = int
94
95val assembly:
96 ASM.assembly_program -> BitVectors.byte list (*ASM.instruction list * symbol_table *) * string IntMap.t
97
98(*
99val link:
100 (ASM.instruction list * symbol_table * cost_map) list -> BitVectors.byte list
101*)
102
103val initialize: status
104
105val load_mem: Physical.WordMap.map -> status -> status
106val load: BitVectors.byte list -> status -> status
107
108exception Halt  (* to be raised to stop execution *)
109
110(* the callback function is used to observe the execution
111   trace; it can raise Hold to stop execution. Otherwise
112   the processor never halts. *)
113val execute: (status -> unit) -> status -> status
114
115val fetch: Physical.WordMap.map -> word -> ASM.instruction * word * int
Note: See TracBrowser for help on using the repository browser.