Source file render_intf.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
open Base
open Hardcaml
module type S = sig
module Data : Hardcaml.Wave_data.S
(** Functions for drawing waves, signal names and values *)
(** max width of name window *)
val get_max_signal_width_in_chars : Data.t Waves.t -> int
(** gets an estimate fo the max with of values. Inaccruate for the constructors [U], [S]
and [F]. *)
val get_estimated_max_value_width : Data.t Waves.t -> int
(** max no of wave cycles *)
val total_cycles_in_waveform : Data.t Waves.t -> int
(** max no of wave signals *)
val total_signals_in_waveform : Data.t Waves.t -> int
(** Turn the UI integer representation of wave_width into a the rendering form. *)
val wave_width_of_code : int -> [ `Cycles_per_char of int | `Chars_per_cycle of int ]
(** draws [cnt] clock cycles *)
val draw_clock_cycles
: ctx:Draw.ctx
-> style:Style.t
-> bounds:Rect.t
-> wave_width:[ `Cycles_per_char of int | `Chars_per_cycle of int ]
-> cnt:int
-> unit
(** draw binary waveform data *)
val draw_binary_data
: ctx:Draw.ctx
-> style:Style.t
-> bounds:Rect.t
-> wave_width:[ `Cycles_per_char of int | `Chars_per_cycle of int ]
-> data:Data.t
-> off:int
-> unit
(** draw arbitrary waveform data *)
val draw_data
: ctx:Draw.ctx
-> style:Style.t
-> bounds:Rect.t
-> to_str:(Bits.t -> string)
-> alignment:Text_alignment.t
-> wave_width:[ `Cycles_per_char of int | `Chars_per_cycle of int ]
-> data:Data.t
-> off:int
-> unit
type 'a draw_item =
?style:Style.t -> ctx:Draw.ctx -> bounds:Rect.t -> Data.t Waves.t -> 'a
val with_border : draw:'a draw_item -> label:string -> ?border:Style.t -> 'a draw_item
(** draw cursor *)
val draw_cursor
: ctx:Draw.ctx
-> bounds:Rect.t
-> wave_cursor:int
-> primary:bool
-> state:Data.t Waves.t
-> unit
(** draw waveforms *)
val draw_wave
: ?style:Style.t
-> ?wave_cursors:[ `Primary of int | `Secondary of int ] list
-> selected_wave_index:int option
-> ctx:Draw.ctx
-> bounds:Rect.t
-> Data.t Waves.t
-> unit
(** draw signal names *)
val draw_signals
: ?alignment:Text_alignment.t
-> ?style:Style.t
-> selected_wave_index:int option
-> ctx:Draw.ctx
-> bounds:Rect.t
-> Data.t Waves.t
-> unit
(** draw signal values *)
val draw_values
: ?style:Style.t
-> ?wave_cursor:int
-> selected_wave_index:int option
-> ctx:Draw.ctx
-> bounds:Rect.t
-> Data.t Waves.t
-> int
val draw_status
: ?style:Style.t
-> ?wave_cursor:int
-> ctx:Draw.ctx
-> bounds:Rect.t
-> Data.t Waves.t
-> unit
(** draw standard user inferface (names, values, waveforms left to right *)
val draw_ui
: ?signals_alignment:Text_alignment.t
-> ?style:Window_styles.t
-> ?bounds:Window_bounds.t
-> ctx:Draw.ctx
-> Data.t Waves.t
-> unit
val draw_help
: ?style:Style.t
-> ctx:Draw.ctx
-> bounds:Rect.t
-> Key_help.t list
-> offset:int
-> unit
type pick =
| Wave of
{ cycle : int
; signal_index : int option
}
| Value of { signal_index : int option }
| Signal of { signal_index : int option }
| Status
| No_pick
val pick : bounds:Window_bounds.t -> r:int -> c:int -> Data.t Waves.t -> pick
module Static : sig
val draw
: ?signals_alignment:Text_alignment.t
-> ?signals:bool
-> ?values:bool
-> ?waves:bool
-> ?style:Window_styles.t
-> ?rows:int
-> ?cols:int
-> ?signals_width:int
-> Data.t Waves.t
-> Draw.ctx
val draw_full
: ?signals_alignment:Text_alignment.t
-> ?style:Window_styles.t
-> Data.t Waves.t
-> Draw.ctx * Draw.ctx * Draw.ctx
end
module To_render : sig
type 'a t =
{ at_most_one_transition : bool
; first : 'a
; last : 'a
}
end
module For_testing : sig
val get_transition_data
: prev_bits:Bits.t option
-> data:Data.t
-> chars_per_cycle:int
-> off:int
-> Bits.t To_render.t
end
end
module M (Data : Hardcaml.Wave_data.S) = struct
module type S = S with module Data := Data
end
module type Render = sig
module type S = S
module M = M
module Make (Data : Hardcaml.Wave_data.S) : M(Data).S
end