Source file rtl_attribute.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
open Base
module Value = struct
type t =
| Int of int
| String of string
| Bool of bool
[@@deriving sexp_of, compare, equal, hash]
end
type t =
{ name : string
; value : Value.t option
}
[@@deriving sexp_of, compare, equal, hash]
let create ?value name = { name; value }
let name t = t.name
let value t = t.value
module Vivado = struct
let true_or_false_string : _ -> Value.t = function
| true -> String "TRUE"
| false -> String "FALSE"
;;
let yes_or_no_string : _ -> Value.t = function
| true -> String "yes"
| false -> String "no"
;;
let async_reg b = create "ASYNC_REG" ~value:(true_or_false_string b)
let dont_touch b = create "dont_touch" ~value:(true_or_false_string b)
let keep_hierarchy b = create "keep_hierarchy" ~value:(yes_or_no_string b)
let fsm_encoding enc =
create
"fsm_encoding"
~value:
(String
(match enc with
| `one_hot -> "one_hot"
| `sequential -> "sequential"
| `johnson -> "johnson"
| `gray -> "gray"
| `auto -> "auto"
| `none -> "none"))
;;
let mark_debug b = create "mark_debug" ~value:(true_or_false_string b)
let keep b = create "keep" ~value:(true_or_false_string b)
let io_buffer_type typ =
create
"io_buffer_type"
~value:
(Value.String
(match typ with
| `IBUF -> "IBUF"
| `OBUF -> "OBUF"
| `None -> "none"))
;;
module Ram_style = struct
let block = create "RAM_STYLE" ~value:(String "block")
let distributed = create "RAM_STYLE" ~value:(String "distributed")
let registers = create "RAM_STYLE" ~value:(String "registers")
let ultra = create "RAM_STYLE" ~value:(String "ultra")
end
module Srl_style = struct
let register = create "SRL_STYLE" ~value:(String "register")
let srl = create "SRL_STYLE" ~value:(String "srl")
let srl_reg = create "SRL_STYLE" ~value:(String "srl_reg")
let reg_srl = create "SRL_STYLE" ~value:(String "reg_srl")
let reg_srl_reg = create "SRL_STYLE" ~value:(String "reg_srl_reg")
let block = create "SRL_STYLE" ~value:(String "block")
end
end