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
(** A [Bits.t] is an immutable finite sequence of bits.  It can also be viewed as an
    non-negative integer. *)

open! Import

module type Bits = sig

  type t [@@deriving compare, sexp_of]
  include Comb.S       with type t := t
  include Comparator.S with type t := t

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

    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 get_word : t -> int -> int64
    val set_word : 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 select : t -> t -> int -> int -> unit

    val ( *: ) : t -> t -> t -> unit
    val ( *+ ) : t -> t -> 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.