|Current status||Proposal submitted|
|Author submission||Bhasker Jayaram|
A fifo is a collection of elements of the same type that can only be accessed by either pushing data into the fifo or by popping the data out of the fifo. If no data is available in the fifo during a pop, the enclosing process may optionally suspend until a value is pushed in into the fifo by another process. A fifo may also be used to model a mailbox.
type fifo_type is fifo (<> or size) of any_data_type;
Examples of fifo types:
Type f_a is fifo (<>) of INTEGER; Type f_b is fifo (20) of BIT_VECTOR(3 downto 0);
When <> is specified, the fifo is of arbitrary length (unconstrained fifo). If an explicit size is specified, it specifies the max number of elements that can be held in the fifo (constrained fifo).
Examples of object declarations:
Signal A: f_a; Variable B: f_b := (“001”, “110”, “111”, “111”); -- Initializes the fifo. Signal C: f_a := (33, 54, 66);
The following fifo operations can be performed on a fifo-type object:
The following attributes can be applied to fifo objects to perform the intended operation.
Fifo_object’push (value): pushes the value into the fifo_object. Returns false if fifo is full, true otherwise.
Fifo_object’pop(remove_flag, wait_flag): pops the value at the top of the fifo_object. If remove_flag is true, then the item is also deleted from the fifo (the default behavior). If the value is false, then the item is NOT deleted from the fifo. If wait_flag is true and fifo is empty, enclosing process suspends (this attribute can only be used in contexts where wait statements are allowed).
Fifo_object’size: Returns number of elements in the fifo.