Module Hardcaml.Fifo
Synchronous FIFO.
- type t- =- {- q : Signal.t;- full : Signal.t;- empty : Signal.t;- nearly_full : Signal.t;- nearly_empty : Signal.t;- used : Signal.t;- }
- val sexp_of_t : t -> Ppx_sexp_conv_lib.Sexp.t
- val create : ?nearly_empty:Hardcaml__.Import.int -> ?nearly_full:Hardcaml__.Import.int -> ?overflow_check:Hardcaml__.Import.bool -> ?reset:Signal.t -> ?showahead:Hardcaml__.Import.bool -> ?underflow_check:Hardcaml__.Import.bool -> Hardcaml__.Import.unit -> capacity:Hardcaml__.Import.int -> clock:Signal.t -> clear:Signal.t -> wr:Signal.t -> d:Signal.t -> rd:Signal.t -> t
- create ~clk ~clr ~wr ~d ~rd capacitybuilds a FIFO with- capacityelements which is written with- dwhen- wris high and read when- rdis high.- The default reset configuration is to use a synchronous - clrsignal. An asynchronous- rstmay be optionally provided. One of- clror- rstmust be non-empty.- Optional overflow and underflow checking may be used. Data will not be written(/read) when the fifo is - full(/- empty) regardles or the- wr/(- rd) signals.- nearly_emtpyand- nearly_fullmay be programmed to go high when the fifo is nearing an underflow or overflow state.- The - showaheadmode changes the read behaviour of the FIFO. When showahead is- falseread data is available 1 cycle after- rdis high. With showahead- truethe data is available on the same cycle as- rdis high. To support- showaheadbehaviour the timing of the- full/- emptyflag also changes (although they still correctly indicate when it is safe to read or write to the FIFO).- showaheadmode has some extra cost in terms of extra logic and reduced frequency.- Note; - showaheadis sometimes referred to as "first word fall through".- The - usedoutput indicates the number of elements currently in the FIFO.