package hardcaml

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file bits_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
open Base

module type Bits = sig
  type t [@@deriving compare, sexp_of]

  include Comb.S with type t := t
  include Comparator.S with type t := t

  (** The number of bytes used to represent the data in [t]. This excludes
      any bytes used to represent any associated metadata.
  *)
  val number_of_data_bytes : t -> int

  (** Get the i-th 64-bit word within the underlying representation. *)
  val unsafe_get_int64 : t -> int -> int64

  (** Set the i-th 64-bit word within the underlying representation. *)
  val unsafe_set_int64 : t -> int -> int64 -> unit

  module Expert : sig
    (** Access the underlying data representation. Note that this is unstable,
        and may change over time.
    *)
    val unsafe_underlying_repr : t -> bytes

    (** Offset to access actual data within in the underlying repr. *)
    val offset_for_data : int
  end

  (** [Mutable] is a mutable bits used by [Cyclesim] for efficiency. *)
  module Mutable : sig
    type bits
    type t = private bytes

    val empty : t
    val width : t -> int
    val to_string : t -> string

    (** Create a [t] of given width, initially set to [0]. *)
    val create : int -> t

    val copy : src:t -> dst:t -> unit
    val copy_bits : src:bits -> dst:t -> unit

    (** A [Bits.Mutable.t] can be accessed as an array of 64 bit words. *)
    val num_words : t -> int

    val unsafe_get_int64 : t -> int -> int64
    val unsafe_set_int64 : t -> int -> int64 -> unit
    val to_bits : t -> bits
    val of_constant : Constant.t -> t
    val to_constant : t -> Constant.t
    val vdd : t
    val gnd : t
    val wire : int -> t
    val ( -- ) : t -> string -> t
    val ( &: ) : t -> t -> t -> unit
    val ( |: ) : t -> t -> t -> unit
    val ( ^: ) : t -> t -> t -> unit
    val ( ~: ) : t -> t -> unit
    val ( +: ) : t -> t -> t -> unit
    val ( -: ) : t -> t -> t -> unit
    val ( ==: ) : t -> t -> t -> unit
    val ( <>: ) : t -> t -> t -> unit
    val ( <: ) : t -> t -> t -> unit
    val mux : t -> t -> t list -> unit
    val concat : t -> t list -> unit
    val concat_rev_array : t -> t array -> unit
    val select : t -> t -> int -> int -> unit
    val ( *: ) : t -> t -> t -> unit
    val ( *+ ) : t -> t -> t -> unit

    (** Mask the unused bits to zero. *)
    val mask : t -> unit

    module Comb : Comb.S with type t = t
  end
  with type bits := t

  (** Pretty printer. *)
  val pp : Formatter.t -> t -> unit
end
OCaml

Innovation. Community. Security.