Source file fifo_async.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
open! Base
open Hardcaml
let create
?(showahead = false)
?(build_mode = Build_mode.Synthesis)
?fifo_memory_type
()
~capacity
~read_clock
~write_clock
~clear
~write
~d
~read
=
Option.iter fifo_memory_type ~f:(fun fifo_memory_type ->
match fifo_memory_type with
| Fifo_memory_type.Ultra ->
raise_s [%message "Cannot create async fifo with [Ultra] memory type."]
| Block | Auto | Distributed -> ());
match (build_mode : Build_mode.t) with
| Simulation ->
Fifo.create ~showahead () ~capacity ~clock:read_clock ~clear ~rd:read ~wr:write ~d
| Synthesis ->
Xpm_fifo_async.create
?fifo_memory_type
~showahead
()
~latency:(if showahead then 0 else 1)
~capacity
~rd_clk:read_clock
~wr_clk:write_clock
~clr:clear
~wr:write
~rd:read
~d
;;