Hardcaml_step_testbench_monadic.Imperativeinclude module type of struct include Imperative endmodule I_data : sig ... endmodule O_data : sig ... endtype 'a t =
('a, O_data.t, I_data.t) Hardcaml_step_testbench_kernel.Step_monad.tinclude Core.Monad.S with type 'a t := 'a tval return : 'a 'i 'p 'q. 'a -> 'a tConvert a value to a t.
Sequences computations. bind t ~f computes f v for value(s) v in t. Well-behaved monads satisfy these "laws" (where ( >>= ) is the infix bind operator):
map t ~f is equivalent to bind t ~f:(fun x -> return (f x))return x >>= f is equivalent to f xt >>= return is equivalent to t(t >>= f) >>= g is equivalent to t >>= fun x -> f x >>= gCombines nested t into just one layer. Equivalent to bind t ~f:Fn.id.
Ignores contained values of t. Equivalent to map t ~f:ignore.
module Monad_infix : sig ... endmodule Let_syntax : sig ... endval cycle : ?num_cycles:int -> unit -> unit tcycle i_data ~num_cycles waits for num_cycles cycles of the simulator to run. cycle raises if num_cycles < 1.
for_ i j f does f i, f (i+1), ... f j in sequence. If j < i, then for_ i j immediately returns unit.
val start :
('a -> 'b t) ->
'a ->
('b, I_data.t) Hardcaml_step_testbench_kernel.Step_monad.Component_finished.t
ttype ('a, 'i) finished_event =
('a, 'i) Hardcaml_step_testbench_kernel.Step_monad.Component_finished.t
Hardcaml_step_testbench_kernel.Step_monad.Event.tval spawn : ?period:int -> (unit -> 'a t) -> ('a, unit) finished_event tLaunch a new task within the current simulation step.
val wait_for : ('a, 'i) finished_event -> 'a tWait for the given event to occur, and extract its return value.
val wait_for_with_timeout :
('a, 'i) finished_event ->
timeout_in_cycles:int ->
'a option tLike wait_for except it stops waiting after timeout_in_cycles and returns None. Note that the spawned task continues to execute.
val forever : (unit -> unit t) -> Core.never_returns tRuns the given step function forever.
val run_effectful_computation :
((O_data.t, I_data.t) Hardcaml_step_testbench_kernel.Step_effect.Handler.t @ local ->
'a) ->
'a tmodule List : sig ... endmodule Array : sig ... endmodule Cyclesim : sig ... endmodule Event_driven_sim : sig ... end