Skip to content

library/util_axis_fifo_asym: Updated IP #1719

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 17 additions & 33 deletions docs/library/util_axis_fifo_asym/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,8 @@ Configuration Parameters
- Enable ``TLAST`` logical port on the AXI streaming interface.
* - TKEEP_EN
- Enable ``TKEEP`` logical port on the AXI streaming interface.
* - FIFO_LIMITED
- Enable the address limit that is set to the FIFO with respect to the
specified address size
* - ADDRESS_WIDTH_PERSPECTIVE
- Sets address size from the perspective of Master (1) or Slave (0)
* - REDUCED_FIFO
- Reduce the FIFO size when master and slave data widths are not equal

Interface
--------------------------------------------------------------------------------
Expand Down Expand Up @@ -112,13 +109,11 @@ blocks are calculated as follows:
localparam RATIO_TYPE = (S_DATA_WIDTH >= M_DATA_WIDTH) ? 1 : 0;
// bus width ratio
localparam RATIO = (RATIO_TYPE) ? S_DATA_WIDTH/M_DATA_WIDTH : M_DATA_WIDTH/S_DATA_WIDTH;
// atomic parameters - NOTE: depth is defined by master or slave and limitation attributes
// atomic parameters
localparam A_WIDTH = (RATIO_TYPE) ? M_DATA_WIDTH : S_DATA_WIDTH;
localparam A_ADDRESS = (ADDRESS_WIDTH_PERSPECTIVE) ?
((FIFO_LIMITED) ? ((RATIO_TYPE) ? (ADDRESS_WIDTH-$clog2(RATIO)) : ADDRESS_WIDTH) : ADDRESS_WIDTH) :
((FIFO_LIMITED) ? ((RATIO_TYPE) ? ADDRESS_WIDTH : (ADDRESS_WIDTH-$clog2(RATIO))) : ADDRESS_WIDTH);
localparam A_ALMOST_FULL_THRESHOLD = (RATIO_TYPE) ? ALMOST_FULL_THRESHOLD : (ALMOST_FULL_THRESHOLD/RATIO);
localparam A_ALMOST_EMPTY_THRESHOLD = (RATIO_TYPE) ? (ALMOST_EMPTY_THRESHOLD/RATIO) : ALMOST_EMPTY_THRESHOLD;
localparam A_ADDRESS = (REDUCED_FIFO) ? (ADDRESS_WIDTH-$clog2(RATIO)) : ADDRESS_WIDTH;
localparam A_ALMOST_FULL_THRESHOLD = (REDUCED_FIFO) ? ((ALMOST_FULL_THRESHOLD+RATIO-1)/RATIO) : ALMOST_FULL_THRESHOLD;
localparam A_ALMOST_EMPTY_THRESHOLD = (REDUCED_FIFO) ? ((ALMOST_EMPTY_THRESHOLD+RATIO-1)/RATIO) : ALMOST_EMPTY_THRESHOLD;

Status Signal Delays
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -141,10 +136,10 @@ destination logic:
empty FIFO all the read operations are suspended.
- ALMOST_EMPTY/ALMOST_FULL - It can be used to foresee a potential FULL or
EMPTY state, asserting before the EMPTY/FULL before a predefined number of
word. The offset between ALMOST_EMPTY and EMPTY, and between ALMOST_FULL and
words. The offset between ALMOST_EMPTY and EMPTY, and between ALMOST_FULL and
FULL can be set by using the parameters ALMOST_EMPTY_THRESHOLD and
ALMOST_FULL_THRESHOLD. The offset values are automatically adjusted
according to M_DATA_WIDTH and S_DATA_WIDTH ratio.
ALMOST_FULL_THRESHOLD. The offset values are automatically adjusted according
to M_DATA_WIDTH and S_DATA_WIDTH ratio when REDUCED_FIFO is enabled.
- S_AXIS_ROOM - Indicate how many word can be written in the FIFO at the
current moment, until the FIFO become FULL.
- M_AXIS_LEVEL - Indicate how many word can be read from the FIFO at the
Expand All @@ -153,25 +148,14 @@ destination logic:
FIFO Depth Calculation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The FIFO Depth is calculated based on parameters M_DATA_WIDTH, S_DATA_WIDTH,
ADDRESS_WIDTH, FIFO_LIMITED and ADDRESS_WIDTH_PERSPECTIVE:

- ADDRESS_WIDTH_PERSPECTIVE is 1 and FIFO_LIMITED is 1 - This means that the
address specified is from the perspective of the Master interface. Since
the limit is enabled the FIFO size will be reduced if the S_DATA_WIDTH
is > M_DATA_WIDTH, leading to a smaller FIFO implementation.
- ADDRESS_WIDTH_PERSPECTIVE is 1 and FIFO_LIMITED is 0 - This means that the
address specified is from the perspective of the Master interface. Since
the limit is disabled the FIFO size will remain the same if the S_DATA_WIDTH
is > M_DATA_WIDTH, leading to a bigger FIFO implementation.
- ADDRESS_WIDTH_PERSPECTIVE is 0 and FIFO_LIMITED is 1 - This means that the
address specified is from the perspective of the Slave interface. Since
the limit is enabled the FIFO size will be reduced if the S_DATA_WIDTH
is < M_DATA_WIDTH, leading to a smaller FIFO implementation.
- ADDRESS_WIDTH_PERSPECTIVE is 0 and FIFO_LIMITED is 0 - This means that the
address specified is from the perspective of the Slave interface. Since
the limit is disabled the FIFO size will remain the same if the S_DATA_WIDTH
is < M_DATA_WIDTH, leading to a bigger FIFO implementation.
The FIFO Depth is calculated based on M_DATA_WIDTH, S_DATA_WIDTH,
ADDRESS_WIDTH and REDUCED_FIFO parameters:

- When M_DATA_WIDTH and S_DATA_WIDTH are equal or REDUCED_FIFO is disabled, the
ADDRESS_WIDTH specified is not changed.
- When M_DATA_WIDTH and S_DATA_WIDTH are not equal and the REDUCED_FIFO is
enabled, the ADDRESS_WIDTH is reduced by log2 ratio of the master and slave
data widths.

Software Support
--------------------------------------------------------------------------------
Expand Down
13 changes: 5 additions & 8 deletions library/util_axis_fifo_asym/util_axis_fifo_asym.v
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ module util_axis_fifo_asym #(
parameter ALMOST_FULL_THRESHOLD = 4,
parameter TLAST_EN = 0,
parameter TKEEP_EN = 0,
parameter FIFO_LIMITED = 0,
parameter ADDRESS_WIDTH_PERSPECTIVE = 0
parameter REDUCED_FIFO = 1
) (
input m_axis_aclk,
input m_axis_aresetn,
Expand Down Expand Up @@ -76,13 +75,11 @@ module util_axis_fifo_asym #(
// bus width ratio
localparam RATIO = (RATIO_TYPE) ? S_DATA_WIDTH/M_DATA_WIDTH : M_DATA_WIDTH/S_DATA_WIDTH;

// atomic parameters - NOTE: depth is always defined by the slave attributes
// atomic parameters
localparam A_WIDTH = (RATIO_TYPE) ? M_DATA_WIDTH : S_DATA_WIDTH;
localparam A_ADDRESS = (ADDRESS_WIDTH_PERSPECTIVE) ?
((FIFO_LIMITED) ? ((RATIO_TYPE) ? (ADDRESS_WIDTH-$clog2(RATIO)) : ADDRESS_WIDTH) : ADDRESS_WIDTH) :
((FIFO_LIMITED) ? ((RATIO_TYPE) ? ADDRESS_WIDTH : (ADDRESS_WIDTH-$clog2(RATIO))) : ADDRESS_WIDTH);
localparam A_ALMOST_FULL_THRESHOLD = (RATIO_TYPE) ? ALMOST_FULL_THRESHOLD : ((ALMOST_FULL_THRESHOLD+RATIO-1)/RATIO);
localparam A_ALMOST_EMPTY_THRESHOLD = (RATIO_TYPE) ? ((ALMOST_EMPTY_THRESHOLD+RATIO-1)/RATIO) : ALMOST_EMPTY_THRESHOLD;
localparam A_ADDRESS = (REDUCED_FIFO) ? (ADDRESS_WIDTH-$clog2(RATIO)) : ADDRESS_WIDTH;
localparam A_ALMOST_FULL_THRESHOLD = (REDUCED_FIFO) ? ((ALMOST_FULL_THRESHOLD+RATIO-1)/RATIO) : ALMOST_FULL_THRESHOLD;
localparam A_ALMOST_EMPTY_THRESHOLD = (REDUCED_FIFO) ? ((ALMOST_EMPTY_THRESHOLD+RATIO-1)/RATIO) : ALMOST_EMPTY_THRESHOLD;

// slave and master sequencers
reg [$clog2(RATIO)-1:0] s_axis_counter;
Expand Down
26 changes: 4 additions & 22 deletions library/util_axis_fifo_asym/util_axis_fifo_asym_ip.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -49,39 +49,21 @@ adi_add_bus_clock "s_axis_aclk" "s_axis" "s_axis_aresetn"

set cc [ipx::current_core]

# FIFO_LIMITED Property
# REDUCED_FIFO Property
set_property -dict [list \
"value_format" "bool" \
"value" "false" \
] [ipx::get_user_parameters FIFO_LIMITED -of_objects $cc]
] [ipx::get_user_parameters REDUCED_FIFO -of_objects $cc]

set_property -dict [list \
"value_format" "bool" \
"value" "false" \
] [ipx::get_hdl_parameters FIFO_LIMITED -of_objects $cc]
] [ipx::get_hdl_parameters REDUCED_FIFO -of_objects $cc]

set_property -dict [list \
"display_name" "FIFO Sample Limited" \
"tooltip" "Limit the amount of samples the FIFO can accumulate. Enabling this bit may reduce the size of Address, Almost Empty Threshold and Almost Full Threshold depending on the Slave and Master data width ratio." \
] [ipgui::get_guiparamspec -name "FIFO_LIMITED" -component $cc]


set_property -dict [list \
"value_format" "bool" \
"value" "false" \
] [ipx::get_user_parameters ADDRESS_WIDTH_PERSPECTIVE -of_objects $cc]

set_property -dict [list \
"value_format" "bool" \
"value" "false" \
] [ipx::get_hdl_parameters ADDRESS_WIDTH_PERSPECTIVE -of_objects $cc]

set_property -dict [list \
"display_name" "Address Width Perspective" \
"tooltip" "Sets the address width from the perspective of Master if True, or Slave if false." \
] [ipgui::get_guiparamspec -name "ADDRESS_WIDTH_PERSPECTIVE" -component $cc]

## TODO: Validate RD_ADDRESS_WIDTH
] [ipgui::get_guiparamspec -name "REDUCED_FIFO" -component $cc]

ipx::create_xgui_files $cc
ipx::save_core $cc
Loading