Digital_components.Component
module type S = sig ... end
t
is mostly abstract, but we expose is as a constructor so that the type checker knows that t
is injective.
val sexp_of_t :
( 'i -> Sexplib0.Sexp.t ) ->
( 'o -> Sexplib0.Sexp.t ) ->
( 'i, 'o ) t ->
Sexplib0.Sexp.t
val sexp_of_input : ( 'i, _ ) t -> 'i -> Digital_components__.Import.Sexp.t
val sexp_of_output : ( _, 'o ) t -> 'o -> Digital_components__.Import.Sexp.t
val output : ( 'i, 'o ) t -> 'i -> 'o
output
returns the output based on an input and its current state, but does not update the state. A component is called "combinational" if output t i
ignores t
. A component is called "sequential" if output t i
uses t
. A sequential component is called a "moore machine" if it ignores i
and a "mealy machine" if it uses i
.
val update_state : ( 'i, _ ) t -> 'i -> Digital_components__Import.Unit.t
update_state
updates t
's state based on an input and its current state
val run_with_inputs :
( 'i, 'o ) t ->
'i Digital_components__Import.List.t ->
('i * 'o) Digital_components__Import.List.t
run_with_inputs t is
runs length is
steps with t
, on each step calling update_state
and then output
, pairing the input of that step with the output.
module Next_input : sig ... end
val run_until_finished :
?show_steps:Digital_components__Import.Bool.t ->
( 'i, 'o ) t ->
first_input:'i ->
next_input:( 'o -> 'i Next_input.t ) ->
Digital_components__Import.Unit.t
module Combinational : sig ... end
val create_combinational : ( 'i, 'o ) Combinational.t -> ( 'i, 'o ) t
val and_ :
( Digital_components__Import.Bool.t * Digital_components__Import.Bool.t,
Digital_components__Import.Bool.t )
t
val or_ :
( Digital_components__Import.Bool.t * Digital_components__Import.Bool.t,
Digital_components__Import.Bool.t )
t
val not_ :
( Digital_components__Import.Bool.t, Digital_components__Import.Bool.t ) t
val flip_flop :
Digital_components__Import.Unit.t ->
( Digital_components__Import.Bool.t, Digital_components__Import.Bool.t ) t
module Flip_flop_with_load_enable : sig ... end
module Flip_flop_with_load_enable_and_reset : sig ... end