text
stringlengths
0
601k
let bprint_ignored_flag buf ign_flag = if ign_flag then buffer_add_char buf ' _ '
let bprint_pad_opt buf pad_opt = match pad_opt with | None -> ( ) | Some width -> buffer_add_string buf ( Int . to_string width )
let bprint_padding : type a b . buffer -> ( a , b ) padding -> unit = fun buf pad -> match pad with | No_padding -> ( ) | Lit_padding ( padty , n ) -> bprint_padty buf padty ; buffer_add_string buf ( Int . to_string n ) | Arg_padding padty -> bprint_padty buf padty ; buffer_add_char buf ' ' *
let bprint_precision : type a b . buffer -> ( a , b ) precision -> unit = fun buf prec -> match prec with | No_precision -> ( ) | Lit_precision n -> buffer_add_char buf ' . ' ; buffer_add_string buf ( Int . to_string n ) | Arg_precision -> buffer_add_string buf " . " *
let bprint_iconv_flag buf iconv = match iconv with | Int_pd | Int_pi -> buffer_add_char buf ' ' + | Int_sd | Int_si -> buffer_add_char buf ' ' | Int_Cx | Int_CX | Int_Co | Int_Cd | Int_Ci | Int_Cu -> buffer_add_char buf ' ' # | Int_d | Int_i | Int_x | Int_X | Int_o | Int_u -> ( )
let bprint_int_fmt buf ign_flag iconv pad prec = buffer_add_char buf ' ' ; % bprint_ignored_flag buf ign_flag ; bprint_iconv_flag buf iconv ; bprint_padding buf pad ; bprint_precision buf prec ; buffer_add_char buf ( char_of_iconv iconv )
let bprint_altint_fmt buf ign_flag iconv pad prec c = buffer_add_char buf ' ' ; % bprint_ignored_flag buf ign_flag ; bprint_iconv_flag buf iconv ; bprint_padding buf pad ; bprint_precision buf prec ; buffer_add_char buf c ; buffer_add_char buf ( char_of_iconv iconv )
let bprint_fconv_flag buf fconv = match fst fconv with | Float_flag_p -> buffer_add_char buf ' ' + | Float_flag_s -> buffer_add_char buf ' ' | Float_flag_ -> ( )
let bprint_float_fmt buf ign_flag fconv pad prec = buffer_add_char buf ' ' ; % bprint_ignored_flag buf ign_flag ; bprint_fconv_flag buf fconv ; bprint_padding buf pad ; bprint_precision buf prec ; buffer_add_char buf ( char_of_fconv fconv )
let string_of_formatting_lit formatting_lit = match formatting_lit with | Close_box -> " ] " @ | Close_tag -> " } " @ | Break ( str , _ , _ ) -> str | FFlush -> " " @? | Force_newline -> " @\ n " | Flush_newline -> " . " @ | Magic_size ( str , _ ) -> str | Escaped_at -> " " @@ | Escaped_percent -> " " @% | Scan_indic c...
let string_of_formatting_gen : type a b c d e f . ( a , b , c , d , e , f ) formatting_gen -> string = fun formatting_gen -> match formatting_gen with | Open_tag ( Format ( _ , str ) ) -> str | Open_box ( Format ( _ , str ) ) -> str
let bprint_char_literal buf chr = match chr with | ' ' % -> buffer_add_string buf " " %% | _ -> buffer_add_char buf chr
let bprint_string_literal buf str = for i = 0 to String . length str - 1 do bprint_char_literal buf str . [ i ] done
let rec bprint_fmtty : type a b c d e f g h i j k l . buffer -> ( a , b , c , d , e , f , g , h , i , j , k , l ) fmtty_rel -> unit = fun buf fmtty -> match fmtty with | Char_ty rest -> buffer_add_string buf " % c " ; bprint_fmtty buf rest | String_ty rest -> buffer_add_string buf " % s " ; bprint_fmtty buf rest | Int_...
let rec int_of_custom_arity : type a b c . ( a , b , c ) custom_arity -> int = function | Custom_zero -> 0 | Custom_succ x -> 1 + int_of_custom_arity x
let bprint_fmt buf fmt = let rec fmtiter : type a b c d e f . ( a , b , c , d , e , f ) fmt -> bool -> unit = fun fmt ign_flag -> match fmt with | String ( pad , rest ) -> buffer_add_char buf ' ' ; % bprint_ignored_flag buf ign_flag ; bprint_padding buf pad ; buffer_add_char buf ' s ' ; fmtiter rest false | Caml_string...
let string_of_fmt fmt = let buf = buffer_create 16 in bprint_fmt buf fmt ; buffer_contents buf
type ( _ , _ ) eq = Refl : ( ' a , ' a ) eq
let rec symm : type a1 b1 c1 d1 e1 f1 a2 b2 c2 d2 e2 f2 . ( a1 , b1 , c1 , d1 , e1 , f1 , a2 , b2 , c2 , d2 , e2 , f2 ) fmtty_rel -> ( a2 , b2 , c2 , d2 , e2 , f2 , a1 , b1 , c1 , d1 , e1 , f1 ) fmtty_rel = function | Char_ty rest -> Char_ty ( symm rest ) | Int_ty rest -> Int_ty ( symm rest ) | Int32_ty rest -> Int32_t...
let rec fmtty_rel_det : type a1 b c d1 e1 f1 a2 d2 e2 f2 . ( a1 , b , c , d1 , e1 , f1 , a2 , b , c , d2 , e2 , f2 ) fmtty_rel -> ( ( f1 , f2 ) eq -> ( a1 , a2 ) eq ) * ( ( a1 , a2 ) eq -> ( f1 , f2 ) eq ) * ( ( e1 , e2 ) eq -> ( d1 , d2 ) eq ) * ( ( d1 , d2 ) eq -> ( e1 , e2 ) eq ) = function | End_of_fmtty -> ( fun R...
let rec fmtty_of_formatting_gen : type a b c d e f . ( a , b , c , d , e , f ) formatting_gen -> ( a , b , c , d , e , f ) fmtty = fun formatting_gen -> match formatting_gen with | Open_tag ( Format ( fmt , _ ) ) -> fmtty_of_fmt fmt | Open_box ( Format ( fmt , _ ) ) -> fmtty_of_fmt fmt type a b c d e f . ( a , b , c , ...
let type_padding : type a b c d e f x y . ( x , y ) padding -> ( a , b , c , d , e , f ) fmtty -> ( a , b , c , d , e , f ) padding_fmtty_ebb = fun pad fmtty -> match pad , fmtty with | No_padding , _ -> Padding_fmtty_EBB ( No_padding , fmtty ) | Lit_padding ( padty , w ) , _ -> Padding_fmtty_EBB ( Lit_padding ( padty ...
let type_padprec : type a b c d e f x y z . ( x , y ) padding -> ( y , z ) precision -> ( a , b , c , d , e , f ) fmtty -> ( a , b , c , d , e , f ) padprec_fmtty_ebb = fun pad prec fmtty -> match prec , type_padding pad fmtty with | No_precision , Padding_fmtty_EBB ( pad , rest ) -> Padprec_fmtty_EBB ( pad , No_precis...
let rec type_format : type a1 b1 c1 d1 e1 f1 a2 b2 c2 d2 e2 f2 . ( a1 , b1 , c1 , d1 , e1 , f1 ) fmt -> ( a2 , b2 , c2 , d2 , e2 , f2 ) fmtty -> ( a2 , b2 , c2 , d2 , e2 , f2 ) fmt = fun fmt fmtty -> match type_format_gen fmt fmtty with | Fmt_fmtty_EBB ( fmt ' , End_of_fmtty ) -> fmt ' | _ -> raise Type_mismatch type a...
let recast : type a1 b1 c1 d1 e1 f1 a2 b2 c2 d2 e2 f2 . ( a1 , b1 , c1 , d1 , e1 , f1 ) fmt -> ( a1 , b1 , c1 , d1 , e1 , f1 , a2 , b2 , c2 , d2 , e2 , f2 ) fmtty_rel -> ( a2 , b2 , c2 , d2 , e2 , f2 ) fmt = fun fmt fmtty -> type_format fmt ( erase_rel ( symm fmtty ) )
let fix_padding padty width str = let len = String . length str in let width , padty = ( abs width , if width < 0 then Left else padty ) in if width <= len then str else let res = Bytes . make width ( if padty = Zeros then ' 0 ' else ' ' ) in begin match padty with | Left -> String . blit str 0 res 0 len | Right -> Str...
let fix_int_precision prec str = let prec = abs prec in let len = String . length str in match str . [ 0 ] with | ( ' ' + | ' ' - | ' ' ) as c when prec + 1 > len -> let res = Bytes . make ( prec + 1 ) ' 0 ' in Bytes . set res 0 c ; String . blit str 1 res ( prec - len + 2 ) ( len - 1 ) ; Bytes . unsafe_to_string res |...
let string_to_caml_string str = let str = String . escaped str in let l = String . length str in let res = Bytes . make ( l + 2 ) ' " ' \ in String . unsafe_blit str 0 res 1 l ; Bytes . unsafe_to_string res
let format_of_iconv = function | Int_d | Int_Cd -> " % d " | Int_pd -> " %+ d " | Int_sd -> " % d " | Int_i | Int_Ci -> " % i " | Int_pi -> " %+ i " | Int_si -> " % i " | Int_x -> " % x " | Int_Cx -> " %# x " | Int_X -> " % X " | Int_CX -> " %# X " | Int_o -> " % o " | Int_Co -> " %# o " | Int_u | Int_Cu -> " % u "
let format_of_iconvL = function | Int_d | Int_Cd -> " % Ld " | Int_pd -> " %+ Ld " | Int_sd -> " % Ld " | Int_i | Int_Ci -> " % Li " | Int_pi -> " %+ Li " | Int_si -> " % Li " | Int_x -> " % Lx " | Int_Cx -> " %# Lx " | Int_X -> " % LX " | Int_CX -> " %# LX " | Int_o -> " % Lo " | Int_Co -> " %# Lo " | Int_u | Int_Cu -...
let format_of_iconvl = function | Int_d | Int_Cd -> " % ld " | Int_pd -> " %+ ld " | Int_sd -> " % ld " | Int_i | Int_Ci -> " % li " | Int_pi -> " %+ li " | Int_si -> " % li " | Int_x -> " % lx " | Int_Cx -> " %# lx " | Int_X -> " % lX " | Int_CX -> " %# lX " | Int_o -> " % lo " | Int_Co -> " %# lo " | Int_u | Int_Cu -...
let format_of_iconvn = function | Int_d | Int_Cd -> " % nd " | Int_pd -> " %+ nd " | Int_sd -> " % nd " | Int_i | Int_Ci -> " % ni " | Int_pi -> " %+ ni " | Int_si -> " % ni " | Int_x -> " % nx " | Int_Cx -> " %# nx " | Int_X -> " % nX " | Int_CX -> " %# nX " | Int_o -> " % no " | Int_Co -> " %# no " | Int_u | Int_Cu -...
let format_of_fconv fconv prec = let prec = abs prec in let symb = char_of_fconv ~ cF ' : g ' fconv in let buf = buffer_create 16 in buffer_add_char buf ' ' ; % bprint_fconv_flag buf fconv ; buffer_add_char buf ' . ' ; buffer_add_string buf ( Int . to_string prec ) ; buffer_add_char buf symb ; buffer_contents buf
let transform_int_alt iconv s = match iconv with | Int_Cd | Int_Ci | Int_Cu -> let digits = let n = ref 0 in for i = 0 to String . length s - 1 do match String . unsafe_get s i with ' 0 ' . . ' 9 ' -> incr n | _ -> ( ) done ; ! n in let buf = Bytes . create ( String . length s + ( ( digits - 1 ) / 3 ) ) in let pos = re...
let convert_int iconv n = transform_int_alt iconv ( format_int ( format_of_iconv iconv ) n )
let convert_int32 iconv n = transform_int_alt iconv ( format_int32 ( format_of_iconvl iconv ) n )
let convert_nativeint iconv n = transform_int_alt iconv ( format_nativeint ( format_of_iconvn iconv ) n )
let convert_int64 iconv n = transform_int_alt iconv ( format_int64 ( format_of_iconvL iconv ) n )
let convert_float fconv prec x = match snd fconv with | Float_h | Float_H -> ( let sign = match fst fconv with | Float_flag_p -> ' ' + | Float_flag_s -> ' ' | _ -> ' ' - in let str = hexstring_of_float x prec sign in match snd fconv with Float_H -> String . uppercase_ascii str | _ -> str ) | _ -> ( let str = format_flo...
let format_caml_char c = let str = Char . escaped c in let l = String . length str in let res = Bytes . make ( l + 2 ) ' ' ' \ in String . unsafe_blit str 0 res 1 l ; Bytes . unsafe_to_string res
let string_of_fmtty fmtty = let buf = buffer_create 16 in bprint_fmtty buf fmtty ; buffer_contents buf
let rec make_printf : type a b c d e f . ( ( b , c ) acc -> f ) -> ( b , c ) acc -> ( a , b , c , d , e , f ) fmt -> a = fun k acc fmt -> match fmt with | Char rest -> fun c -> let new_acc = Acc_data_char ( acc , c ) in make_printf k new_acc rest | Caml_char rest -> fun c -> let new_acc = Acc_data_string ( acc , format...
let const x _ = x
let rec make_iprintf : type a b c d e f state . ( state -> f ) -> state -> ( a , b , c , d , e , f ) fmt -> a = fun k o fmt -> match fmt with | Char rest -> const ( make_iprintf k o rest ) | Caml_char rest -> const ( make_iprintf k o rest ) | String ( No_padding , rest ) -> const ( make_iprintf k o rest ) | String ( Li...
let rec output_acc o acc = match acc with | Acc_formatting_lit ( p , fmting_lit ) -> let s = string_of_formatting_lit fmting_lit in output_acc o p ; output_string o s | Acc_formatting_gen ( p , Acc_open_tag acc ' ) -> output_acc o p ; output_string o " { " ; @ output_acc o acc ' | Acc_formatting_gen ( p , Acc_open_box ...
let rec bufput_acc b acc = match acc with | Acc_formatting_lit ( p , fmting_lit ) -> let s = string_of_formatting_lit fmting_lit in bufput_acc b p ; Buffer . add_string b s | Acc_formatting_gen ( p , Acc_open_tag acc ' ) -> bufput_acc b p ; Buffer . add_string b " { " ; @ bufput_acc b acc ' | Acc_formatting_gen ( p , A...
let rec strput_acc b acc = match acc with | Acc_formatting_lit ( p , fmting_lit ) -> let s = string_of_formatting_lit fmting_lit in strput_acc b p ; Buffer . add_string b s | Acc_formatting_gen ( p , Acc_open_tag acc ' ) -> strput_acc b p ; Buffer . add_string b " { " ; @ strput_acc b acc ' | Acc_formatting_gen ( p , A...
let failwith_message ( Format ( fmt , _ ) ) = let buf = Buffer . create 256 in let k acc = strput_acc buf acc ; failwith ( Buffer . contents buf ) in make_printf k End_of_acc fmt
let open_box_of_string str = if str = " " then 0 , Pp_box else let len = String . length str in let invalid_box ( ) = failwith_message " invalid box description % S " str in let rec parse_spaces i = if i = len then i else match str . [ i ] with ' ' | ' \ t ' -> parse_spaces ( i + 1 ) | _ -> i and parse_lword i j = if j...
let make_padding_fmt_ebb : type x y . ( x , y ) padding -> ( _ , _ , _ , _ , _ , _ ) fmt -> ( _ , _ , _ , _ , _ ) padding_fmt_ebb = fun pad fmt -> match pad with | No_padding -> Padding_fmt_EBB ( No_padding , fmt ) | Lit_padding ( s , w ) -> Padding_fmt_EBB ( Lit_padding ( s , w ) , fmt ) | Arg_padding s -> Padding_fmt...
let make_precision_fmt_ebb : type x y . ( x , y ) precision -> ( _ , _ , _ , _ , _ , _ ) fmt -> ( _ , _ , _ , _ , _ ) precision_fmt_ebb = fun prec fmt -> match prec with | No_precision -> Precision_fmt_EBB ( No_precision , fmt ) | Lit_precision p -> Precision_fmt_EBB ( Lit_precision p , fmt ) | Arg_precision -> Precisi...
let make_padprec_fmt_ebb : type x y z t . ( x , y ) padding -> ( z , t ) precision -> ( _ , _ , _ , _ , _ , _ ) fmt -> ( _ , _ , _ , _ , _ ) padprec_fmt_ebb = fun pad prec fmt -> let ( Precision_fmt_EBB ( prec , fmt ' ) ) = make_precision_fmt_ebb prec fmt in match pad with | No_padding -> Padprec_fmt_EBB ( No_padding ,...
let fmt_ebb_of_string ? legacy_behavior str = let legacy_behavior = match legacy_behavior with Some flag -> flag | None -> true in let invalid_format_message str_ind msg = failwith_message " invalid format % S : at character number % d , % s " str str_ind msg in let unexpected_end_of_format end_ind = invalid_format_mes...
let format_of_string_fmtty str fmtty = let ( Fmt_EBB fmt ) = fmt_ebb_of_string str in try Format ( type_format fmt fmtty , str ) with Type_mismatch -> failwith_message " bad input : format type mismatch between % S and % S " str ( string_of_fmtty fmtty )
let format_of_string_format str ( Format ( fmt ' , str ' ) ) = let ( Fmt_EBB fmt ) = fmt_ebb_of_string str in try Format ( type_format fmt ( fmtty_of_fmt fmt ' ) , str ) with Type_mismatch -> failwith_message " bad input : format type mismatch between % S and % S " str str '
module Signal_map = struct type t = Signal . t Map . M ( Signal . Uid ) . t [ @@ deriving sexp_of ] let create graph = let add_signal map signal = let uid = Signal . uid signal in Map . add_exn map ~ key : uid ~ data : signal in Signal_graph . depth_first_search graph ~ init ( : Map . empty ( module Signal . Uid ) ) ~ ...
type t = { name : string ; signal_by_uid : Signal_map . t ; inputs : Signal . t list ; outputs : Signal . t list ; phantom_inputs : ( string * int ) list ; signal_graph : Signal_graph . t ; fan_out : Signal . Uid_set . t Map . M ( Signal . Uid ) . t Lazy . t ; fan_in : Signal . Uid_set . t Map . M ( Signal . Uid ) . t ...
module Summary = struct let sexp_of_signal signal = Signal . sexp_of_signal_recursive ~ depth : 0 signal let sexp_of_t t = [ % message " " ~ name ( : t . name : string ) ~ input_ports ( : t . inputs : signal list ) ~ output_ports ( : t . outputs : signal list ) ] ; ; end
module Port_checks = struct type t = | Relaxed | Port_sets | Port_sets_and_widths end
module Config = struct type t = { detect_combinational_loops : bool ; normalize_uids : bool ; assertions : Assertion_manager . t option ; port_checks : Port_checks . t ; add_phantom_inputs : bool ; modify_outputs : Signal . t list -> Signal . t list } let default = { detect_combinational_loops = true ; normalize_uids =...
let check_ports_in_one_direction direction ports = let find_repeated_names ports = let rec find seen repeated = function | [ ] -> seen , repeated | name :: ports -> if Set . mem seen name then find seen ( Set . add repeated name ) ports else find ( Set . add seen name ) repeated ports in let empty = Set . empty ( modul...
let check_port_names_are_well_formed inputs outputs = let inputs = check_ports_in_one_direction " Input " inputs in let outputs = check_ports_in_one_direction " Output " outputs in let input_and_output_names = Set . inter inputs outputs in if not ( Set . is_empty input_and_output_names ) then raise_s [ % message " Port...
let create_exn ( ? config = Config . default ) ~ name outputs = let assertions = match config . assertions with | Some assertions -> Assertion_manager . finalize assertions | None -> Map . empty ( module String ) in let output_names = List . concat_map outputs ~ f ( : fun signal -> if Signal . is_empty signal then [ ] ...
let set_phantom_inputs circuit phantom_inputs = let module Port = struct module T = struct type t = string * int [ @@ deriving sexp_of ] let compare ( n0 , _ ) ( n1 , _ ) = String . compare n0 n1 end include T include Comparable . Make ( T ) let of_signal port = let name = match Signal . names port with | [ name ] -> n...
let with_name t ~ name = { t with name }
let uid_equal a b = Int64 . equal ( Signal . uid a ) ( Signal . uid b )
let is_input t signal = List . mem t . inputs signal ~ equal : uid_equal
let is_output t signal = List . mem t . outputs signal ~ equal : uid_equal
let find_signal_exn t uid = Map . find_exn t . signal_by_uid uid
let fan_out_map t = Lazy . force t . fan_out
let fan_in_map t = Lazy . force t . fan_in
let signal_map c = c . signal_by_uid
let assertions t = t . assertions
let structural_compare ? check_names c0 c1 = let num_ports_match which_ports = List . length ( which_ports c0 ) = List . length ( which_ports c1 ) in let ports_match which_ports = let names_or_empty = function | Signal . Empty -> [ ] | s -> Signal . names s in match List . fold2 ( which_ports c0 ) ( which_ports c1 ) ~ ...
let instantiations t = let instantiations = ref [ ] in Signal_graph . iter ( signal_graph t ) ~ f ( : function | Signal . Inst inst -> instantiations := inst . instantiation :: ! instantiations | _ -> ( ) ) ; ! instantiations ; ;
module With_interface ( I : Interface . S_Of_signal ) ( O : Interface . S_Of_signal ) = struct type create = I . Of_signal . t -> O . Of_signal . t let check_io_port_sets_match circuit = let actual_ports ports = List . map ports ~ f : Signal . names |> List . concat |> Set . of_list ( module String ) in let actual_inpu...
let create_with_interface ( type i o ) ( module I : Interface . S_Of_signal with type Of_signal . t = i ) ( module O : Interface . S_Of_signal with type Of_signal . t = o ) = let module C = With_interface ( I ) ( O ) in C . create_exn ; ;
module Entry = struct type t = { name : string ; mangled_name : string ; circuit : Circuit . t } [ @@ deriving fields ] end
type t = { mangler : Mangler . t ; entry_by_mangled_name : ( string , Entry . t ) Hashtbl . t }
let sexp_of_t t = let mapping = List . map ( Hashtbl . data t . entry_by_mangled_name ) ~ f ( : fun e -> e . name , e . mangled_name ) |> List . sort ~ compare [ :% compare : string * string ] in [ % sexp ( mapping : ( string * string ) list ) ] ; ;
let create ( ) = let mangler = Mangler . create ~ case_sensitive : false in List . iter Reserved_words . ( verilog @ vhdl ) ~ f ( : fun r -> ignore ( Mangler . add_identifier mangler r : [ ` Ok | ` Duplicate ] ) ) ; { mangler ; entry_by_mangled_name = Hashtbl . create ( module String ) } ; ;
let add t circuit = let name = Circuit . name circuit in let mangled_name = Mangler . mangle t . mangler name in let entry = { Entry . name ; mangled_name ; circuit = Circuit . with_name circuit ~ name : mangled_name } in Hashtbl . add_exn t . entry_by_mangled_name ~ key : mangled_name ~ data : entry ; mangled_name ; ;
let add_if_unique t circuit = match List . find ( Hashtbl . data t . entry_by_mangled_name ) ~ f ( : fun entry -> String . equal entry . name ( Circuit . name circuit ) && Circuit . structural_compare entry . circuit circuit ) with | Some e -> e . mangled_name | None -> add t circuit ; ;
let insert ( ? share = true ) database circuit = if share then add_if_unique database circuit else add database circuit ; ;
let find t ~ mangled_name = Hashtbl . find t . entry_by_mangled_name mangled_name |> Option . map ~ f : Entry . circuit ; ;
let get_circuits ( t : t ) = List . map ( Hashtbl . data t . entry_by_mangled_name ) ~ f ( : fun ( e : Entry . t ) -> e . circuit ) ; ;
module Total_bits = struct type t = { count : int ; total_bits : int } [ @@ deriving sexp_of ] let none = { count = 0 ; total_bits = 0 } let add ( ? u = none ) s = Some { count = u . count + 1 ; total_bits = u . total_bits + Signal . width s } ; ; end
module Total_and_max_bits = struct type t = { count : int ; total_bits : int ; max_instance_bits : int } [ @@ deriving sexp_of ] let none = { count = 0 ; total_bits = 0 ; max_instance_bits = 0 } let add ( ? u = none ) s = let w = Signal . width s in Some { count = u . count + 1 ; total_bits = u . total_bits + w ; max_i...
module Multiplexer = struct type t = { max_instance_bits : int ; total_bits : int ; count : int } [ @@ deriving sexp_of ] end
module Multiplexers = struct module Mux_map = struct type t = Multiplexer . t Map . M ( Int ) . t let sexp_of_elt ( number_of_data_elements , ( m : Multiplexer . t ) ) = let max_instance_bits = m . max_instance_bits in let total_bits = m . total_bits in let count = m . count in [ % message ( number_of_data_elements : i...
module Memory = struct module T = struct type t = { data_width : int ; depth : int ; total_bits : int } [ @@ deriving sexp_of , compare ] end include T include Comparable . Make ( T ) end
module Memories = struct module Mem_map = struct type t = int Map . M ( Memory ) . t let sexp_of_elt ( { Memory . data_width ; depth ; total_bits } , count ) = [ % message ( data_width : int ) ( depth : int ) ( total_bits : int ) ( count : int ) ] ; ; let sexp_of_t t = [ % sexp ( Map . to_alist t : elt list ) ] end typ...
module rec Instantiation : sig type t = | Instantiation of string | Submodule of T . t [ @@ deriving sexp_of ] type t = | Instantiation of string | Submodule of T . t [ @@ deriving sexp_of ] end type t = Instantiation . t list [ @@ deriving sexp_of ] val add : ? u : t -> Signal . t -> t option type t = Instantiation . ...
type t = T . t [ @@ deriving sexp_of ]
let rec create ? database circuit = let expand_submodules t = match database with | None -> t | Some database -> { t with T . instantiations = Option . map t . T . instantiations ~ f ( : fun instantiations -> List . map instantiations ~ f ( : function | Instantiation . Instantiation name as inst -> ( match Circuit_data...
type arity = Lambda . function_kind * int
type apply_kind = Lambda . region_close * Lambda . alloc_mode
type ustructured_constant = | Uconst_float of float | Uconst_int32 of int32 | Uconst_int64 of int64 | Uconst_nativeint of nativeint | Uconst_block of int * uconstant list | Uconst_float_array of float list | Uconst_string of string | Uconst_closure of ufunction list * string * uconstant list | Uconst_ref of string * us...
type function_description = { fun_label : function_label ; fun_arity : arity ; mutable fun_closed : bool ; mutable fun_inline : ( Backend_var . With_provenance . t list * ulambda ) option ; mutable fun_float_const_prop : bool ; fun_region : bool ; }
type value_approximation = Value_closure of alloc_mode * function_description * value_approximation | Value_tuple of alloc_mode * value_approximation array | Value_unknown | Value_const of uconstant | Value_global_field of string * int