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

module Architecture = struct
  type t =
    | Combinational
    | Pipelined
    | Iterative
  [@@deriving sexp_of, enumerate]
end

module Config = struct
  type t =
    { architecture : Architecture.t
    ; iterations : int
    }
  [@@deriving sexp_of]
end

module type S = sig
  module I : sig
    type 'a t =
      { clk : 'a
      ; clr : 'a
      ; enable : 'a
      ; ld : 'a
      ; system : 'a
      ; mode : 'a
      ; c : 'a
      ; x : 'a
      ; y : 'a
      ; z : 'a
      }
    [@@deriving sexp_of, hardcaml]
  end

  module O : sig
    type 'a t =
      { xo : 'a
      ; yo : 'a
      ; zo : 'a
      }
    [@@deriving sexp_of, hardcaml]
  end

  val create : Config.t -> Signal.t I.t -> Signal.t O.t
end

module type Cordic = sig
  module type S = S

  module Architecture = Architecture
  module Config = Config

  module System : sig
    include module type of struct
      include Cordic_reference.System
    end

    val to_signal : t -> Signal.t
  end

  module Mode : sig
    include module type of struct
      include Cordic_reference.Mode
    end

    val to_signal : t -> Signal.t
  end

  module Make (Fixnum_spec : Fixnum.Spec) : S
end