Contenuto principale

HDL FIFO

Store sequence of input samples in first in, first out register

  • HDL FIFO block

Libraries:
HDL Coder / HDL RAMs

Description

The HDL FIFO block stores a sequence of input samples in a first in, first out (FIFO) register. The block outputs data in the same order it was written. You can control the FIFO operations by using the Push and Pop input ports. When both control signals are asserted in the same time step, the block performs the pop operation before the push operation.

The HDL FIFO block is functionally and behaviorally similar to FIFO units on hardware platforms. Internally, the block uses the Simple Dual Port RAM System block. You can use this block to generate HDL code that maps to RAM resources on most FPGA devices.

Examples

Limitations

  • When you build the FPGA bitstream for the HDL FIFO block, the global reset logic does not reset the FIFO register in the block. To reset the FIFO register, you must implement a reset logic.

  • The HDL FIFO block does not support continuous sample time. You must specify a discrete sample time for the input to the HDL FIFO block.

Ports

Input

expand all

Data input signal, specified as scalar or vector. When you write data to the FIFO, the block pushes the newest data to the end of the FIFO register. The block places subsequent data entries after this entry.

Note

If the signal you connect to the In port is a vector, the data type must match the value specified by the Data input dimensions parameter.

Data Types: single | double | half | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | Boolean | fixed point
Complex Number Support: Yes

Write control signal, specified as a scalar of type Boolean. When this port receives a value of 1, the block pushes the current input at the In port to the end of the FIFO register.

Data Types: Boolean

Read control signal, specified as a scalar of type Boolean. When this port receives a value of 1, the block pops the first element from the FIFO register and outputs that value at the Out port.

Data Types: Boolean

Reset control signal, specified as a scalar of type Boolean. When this port receives a value of 1, the block resets the Empty, Full, and Num output ports to their initial states.

Dependencies

To enable this port, select the Local reset port block parameter.

Data Types: Boolean

Output

expand all

Data output signal, returned as a scalar or vector. This port outputs the earliest written data from the FIFO register and holds that value until the next valid read operation.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | Boolean | fixed point
Complex Number Support: Yes

Empty status signal, returned as a scalar. The block sets this signal to 1 when the FIFO register is empty and contains no data entries.

Dependencies

To enable this port, select the Show empty register indicator port (Empty) block parameter.

Data Types: Boolean

Full status signal, returned as a scalar. The block sets this signal to 1 when the FIFO register is full and cannot accept additional data entries.

Dependencies

To enable this port, select the Show full register indicator port (Full) block parameter.

Data Types: Boolean

Number of data entries, returned as a scalar. This signal indicates the number of data entries currently stored in the FIFO register. The block increments this value by 1 each time you write data to the FIFO, and decrements it by 1 each time you read from the FIFO.

Dependencies

To enable this port, select the Show number of entries register port (Num) block parameter.

Data Types: uint8 | uint16 | uint32 | uint64 | fixed point

Parameters

expand all

Specify the number of entries that the FIFO register can hold. The minimum value is 4.

Programmatic Use

Block parameter: fifo_size
Type: character vector
Value: Integer greater than or equal to four
Default: 10

Specify the operation mode of the block. By default, the Mode parameter is set to Classic, and the block icon displays Classic FIFO. If you set this parameter to FWFT, the block icon display FWFT FIFO. In FWFT mode, you can look ahead and view the first word written to the FIFO register without placing a read request. The FWFT mode is useful when applying back-pressure using AXI4-Stream interfaces.

Programmatic Use

Block parameter: mode
Type: character vector
Value: 'Classic' | 'FWFT'
Default: 'Classic'

Specify the ratio of output sample time to input sample time. The default ratio value is 1, which means that the In and Push input ports and Out and Pop output ports run at the same sample rate. You can configure the inputs and outputs to run at different sample times by entering a positive integer or a value in the form of 1/N, where N is a positive integer. For example, if you enter 1/2, the output sample time is half the input sample time, so the outputs run faster. The Full, Empty, and Num output ports run at the faster rate.

Programmatic Use

Block parameter: ratio
Type: character vector
Value: Integer greater than or equal to one
Default: 1

Since R2026a

Specify the dimension of the input data.

Note

The Data input dimensions parameter must match the vector length of the input signal at the In port.

Programmatic Use

Block parameter: dataDim
Type: character vector
Value: Integer greater than or equal to one
Default: 1

Specify how the block responds when you try to write to a FIFO that is full.

Programmatic Use

Block parameter: push_msg
Type: character vector
Value: 'Warning' | 'Ignore' | 'Error'
Default: 'Warning'

Specify how the block responds when you try to read from a FIFO that is empty.

Programmatic Use

Block parameter: pop_msg
Type: character vector
Value: 'Warning' | 'Ignore' | 'Error'
Default: 'Warning'

Specify whether to enable the Empty output port. This port outputs 1 when the FIFO register is empty and 0 when the FIFO contains one or more data entries.

Programmatic Use

Block parameter: show_empty
Type: character vector
Value: 'on' | 'off'
Default: 'on'

Specify whether to enable the Full output port. This port outputs 1 when the FIFO register is full.

Programmatic Use

Block parameter: show_full
Type: character vector
Value: 'on' | 'off'
Default: 'on'

Specify whether to enable the Num output port. This port outputs the number of data entries that are currently available in the FIFO queue.

Programmatic Use

Block parameter: show_num
Type: character vector
Value: 'on' | 'off'
Default: 'on'

Specify whether to enable the rst input port. When this port receives a value of 1, the block resets the Empty, Full, and Num output ports to their initial states.

Programmatic Use

Block parameter: rst_port
Type: character vector
Value: 'on' | 'off'
Default: 'off'

Algorithms

expand all

Extended Capabilities

expand all

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2014a

expand all