Skip to content

Commit

Permalink
V11: Remove MAX_NUM_FRAMES parameter
Browse files Browse the repository at this point in the history
Use MAX_NUM_FRAMES_WIDTH parameter on IP.
Update doc to clarify valid distance values.

Signed-off-by: Jorge Marques <[email protected]>
  • Loading branch information
gastmaier committed Nov 5, 2024
1 parent d105e07 commit 174ce93
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 48 deletions.
14 changes: 10 additions & 4 deletions docs/library/axi_dmac/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -696,26 +696,32 @@ The core can operate in two roles:

And two modes:

* Dynamic mode:
* Frame conversion (dynamic mode):

- Writer mode - the writer will always skip the current in-use reader's buffer.
- Reader mode - the reader will stay behind the writer's buffer by either
repeating or skipping buffers according to the speed relationship of the two cores.

* Simple mode:
* Output delay (simple mode):

- Writer mode - the writer will cycle through the buffers regardless of the reader.
- Reader mode - the reader will always read a buffer at a predefined distance
from the one currently accessed by the writer.

Also, in simple mode:

* If 'wait for master' is enabled the reader will output a frame only after
* If 'wait for writer' is enabled the reader will output a frame only after
the master wrote one to the memory
* If the 'wait for master' is not enabled the slave will start reading a
* If the 'wait for writer' is not enabled the slave will start reading a
buffer whenever it completed a previous buffer and receives an external sync
signal if the external synchronization support is enabled.

.. caution::

In dynamic mode, the reader can still read a buffer being currently accessed
by the writer if the number of frames and distance are close.
Still, the distance is mainly used in output delay mode.

The writer and reader DMAC cores must be connected through the dedicated
"framelock" interface. They must be programmed with similar settings regarding
the buffers size, start address and stride through the ``FRAMELOCK_CONFIG`` and
Expand Down
12 changes: 10 additions & 2 deletions docs/regmap/adi_regmap_dmac.txt
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,9 @@ FIELD
DISTANCE
RW
Used mainly in output delay mode. Set the output delay in frames.
Should be set in interval 0 to flock, FRAMENUM - 1.
With a DISTANCE of 0, the reader is one frame behind with WAIT_WRITER set.
In frame conversion mode, it will repeat reading frame 0 until frame 1 is fully written to
memory.
If ``AUTORUN`` is set, the default value of the field is ``AUTORUN_FRAMELOCK_CONFIG[23:16]``.
ENDFIELD

Expand Down Expand Up @@ -701,7 +703,13 @@ FIELD
MODE
RW
Select operating mode of the framebuffer.
(0 - Frame rate conversion mode (dynamic), 1 - Output delay mode (simple))

* 0 - Frame rate conversion mode (dynamic).
* 1 - Output delay mode (simple).

In dynamic mode, the writer skip the current in-use reader buffer and the reader stay
behind the writer's buffer by repeating or skipping buffers.

If ``AUTORUN`` is set, the default value of the field is ``AUTORUN_FRAMELOCK_CONFIG[8]``.
ENDFIELD

Expand Down
9 changes: 5 additions & 4 deletions library/axi_dmac/axi_dmac.v
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ module axi_dmac #(
parameter AXI_ID_WIDTH_DEST = 1,
parameter AXI_ID_WIDTH_SG = 1,
parameter DMA_AXIS_ID_W = 8,
parameter DMA_AXIS_DEST_W = 4,
parameter DMA_AXIS_DEST_W = 3,
parameter DISABLE_DEBUG_REGISTERS = 0,
parameter ENABLE_DIAGNOSTICS_IF = 0,
parameter ALLOW_ASYM_MEM = 0,
Expand All @@ -76,8 +76,7 @@ module axi_dmac #(
parameter [2:0] AXI_AXPROT = 3'b000,
parameter DMA_2D_TLAST_MODE = 0,
parameter FRAMELOCK = 0,
parameter MAX_NUM_FRAMES = 8,
parameter MAX_NUM_FRAMES_WIDTH = 3,
parameter MAX_NUM_FRAMES_WIDTH = 4,
parameter USE_EXT_SYNC = 0,
parameter AUTORUN = 0,
parameter AUTORUN_FLAGS = 0,
Expand Down Expand Up @@ -326,6 +325,8 @@ module axi_dmac #(
localparam HAS_DEST_ADDR = DMA_TYPE_DEST == DMA_TYPE_AXI_MM;
localparam HAS_SRC_ADDR = DMA_TYPE_SRC == DMA_TYPE_AXI_MM;

localparam MAX_NUM_FRAMES = 2**(MAX_NUM_FRAMES_WIDTH-1);

// Argh... "[Synth 8-2722] system function call clog2 is not allowed here"
localparam BYTES_PER_BEAT_WIDTH_DEST = DMA_DATA_WIDTH_DEST > 1024 ? 8 :
DMA_DATA_WIDTH_DEST > 512 ? 7 :
Expand Down Expand Up @@ -496,7 +497,7 @@ module axi_dmac #(
.AXI_AXPROT(AXI_AXPROT),
.FRAMELOCK(FRAMELOCK),
.DMA_2D_TLAST_MODE(DMA_2D_TLAST_MODE),
.MAX_NUM_FRAMES(MAX_NUM_FRAMES),
.MAX_NUM_FRAMES_WIDTH(MAX_NUM_FRAMES_WIDTH),
.USE_EXT_SYNC(USE_EXT_SYNC),
.AUTORUN(AUTORUN),
.AUTORUN_FLAGS(AUTORUN_FLAGS),
Expand Down
4 changes: 2 additions & 2 deletions library/axi_dmac/axi_dmac_framelock.v
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ module axi_dmac_framelock #(
parameter BYTES_PER_BEAT_WIDTH_DEST = 3,
parameter BYTES_PER_BEAT_WIDTH_SRC = 3,
parameter FRAMELOCK_MODE = 0, // 0 - MM writer ; 1 - MM reader
parameter MAX_NUM_FRAMES = 8,
localparam MAX_NUM_FRAMES_WIDTH = $clog2(MAX_NUM_FRAMES)
parameter MAX_NUM_FRAMES_WIDTH = 3
) (
input req_aclk,
input req_aresetn,
Expand Down Expand Up @@ -80,6 +79,7 @@ module axi_dmac_framelock #(
localparam BYTES_PER_BEAT_WIDTH = FRAMELOCK_MODE ?
BYTES_PER_BEAT_WIDTH_SRC :
BYTES_PER_BEAT_WIDTH_DEST;
localparam MAX_NUM_FRAMES = 2**(MAX_NUM_FRAMES_WIDTH-1);

reg [DMA_AXI_ADDR_WIDTH-1:BYTES_PER_BEAT_WIDTH] req_address = 'h0;
reg [MAX_NUM_FRAMES_WIDTH-1:0] transfer_id = 'h0;
Expand Down
18 changes: 9 additions & 9 deletions library/axi_dmac/axi_dmac_hw.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,11 @@ set_parameter_property ENABLE_FRAMELOCK DISPLAY_HINT boolean
set_parameter_property ENABLE_FRAMELOCK HDL_PARAMETER true
set_parameter_property ENABLE_FRAMELOCK GROUP $group_2d

add_parameter MAX_NUM_FRAMES INTEGER 8
set_parameter_property MAX_NUM_FRAMES DISPLAY_NAME "Max Number Of Frame Buffers"
set_parameter_property MAX_NUM_FRAMES HDL_PARAMETER true
set_parameter_property MAX_NUM_FRAMES ALLOWED_RANGES {4 8 16 32}
set_parameter_property MAX_NUM_FRAMES GROUP $group_2d
add_parameter MAX_NUM_FRAMES_WIDTH INTEGER 4
set_parameter_property MAX_NUM_FRAMES_WIDTH DISPLAY_NAME "Max Number Of Frame Buffers"
set_parameter_property MAX_NUM_FRAMES_WIDTH HDL_PARAMETER true
set_parameter_property MAX_NUM_FRAMES_WIDTH ALLOWED_RANGES {"2:4" "3:8" "4:16" "5:32"}
set_parameter_property MAX_NUM_FRAMES_WIDTH GROUP $group_2d

add_parameter USE_EXT_SYNC INTEGER 0
set_parameter_property USE_EXT_SYNC DISPLAY_NAME "External Synchronization Support"
Expand Down Expand Up @@ -729,10 +729,10 @@ proc axi_dmac_elaborate {} {
}

if {[get_parameter_value ENABLE_FRAMELOCK] == 1} {
set_parameter_property MAX_NUM_FRAMES VISIBLE true
set_parameter_property MAX_NUM_FRAMES_WIDTH VISIBLE true

set MAX_NUM_FRAMES [get_parameter_value MAX_NUM_FRAMES]
set flock_width [expr int(ceil(log($MAX_NUM_FRAMES)/log(2)))+1]
set flock_width [get_parameter_value MAX_NUM_FRAMES_WIDTH]
set flock_width [expr int($flock_width+1)]
# MM writer is master
if {[get_parameter_value DMA_TYPE_DEST] == 0 &&
[get_parameter_value DMA_TYPE_SRC] != 0} {
Expand All @@ -749,7 +749,7 @@ proc axi_dmac_elaborate {} {
}

} else {
set_parameter_property MAX_NUM_FRAMES VISIBLE false
set_parameter_property MAX_NUM_FRAMES_WIDTH VISIBLE false
}

}
Expand Down
21 changes: 9 additions & 12 deletions library/axi_dmac/axi_dmac_ip.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -357,11 +357,15 @@ set_property -dict [list \
[ipx::get_user_parameters FRAMELOCK -of_objects $cc]

set_property -dict [list \
"enablement_tcl_expr" "\$FRAMELOCK == true" \
"value_validation_type" "list" \
"value_validation_list" "4 8 16 32" \
"value_validation_type" "pairs" \
"value_validation_pairs" {\
"4" "3" \
"8" "4" \
"16" "5" \
"32" "6" \
} \
] \
[ipx::get_user_parameters MAX_NUM_FRAMES -of_objects $cc]
[ipx::get_user_parameters MAX_NUM_FRAMES_WIDTH -of_objects $cc]

# Set up page layout
set page0 [ipgui::get_pagespec -name "Page 0" -component $cc]
Expand Down Expand Up @@ -549,20 +553,13 @@ set_property -dict [list \
"tooltip" "Requires Cyclic mode" \
] $p

set p [ipgui::get_guiparamspec -name "MAX_NUM_FRAMES" -component $cc]
set p [ipgui::get_guiparamspec -name "MAX_NUM_FRAMES_WIDTH" -component $cc]
ipgui::move_param -component $cc -order 2 $p -parent $feature_group_2d
set_property -dict [list \
"widget" "comboBox" \
"display_name" "Max Number Of Frame Buffers" \
] $p

set_property -dict [list \
"enablement_value" "false" \
"value_tcl_expr" {log($MAX_NUM_FRAMES)/log(2)} \
] [ipx::get_user_parameters MAX_NUM_FRAMES_WIDTH -of_objects $cc]
set p [ipgui::get_guiparamspec -name "MAX_NUM_FRAMES_WIDTH" -component $cc]
ipgui::remove_param -component [ipx::current_core] $p

set p [ipgui::get_guiparamspec -name "USE_EXT_SYNC" -component $cc]
ipgui::move_param -component $cc -order 3 $p -parent $feature_group
set_property -dict [list \
Expand Down
4 changes: 2 additions & 2 deletions library/axi_dmac/axi_dmac_pkg_sv.ttcl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<: set enable_diagnostics_if [get_property MODELPARAM_VALUE.ENABLE_DIAGNOSTICS_IF] :>
<: set cache_coherent [get_property MODELPARAM_VALUE.CACHE_COHERENT] :>
<: set framelock [get_property MODELPARAM_VALUE.FRAMELOCK] :>
<: set max_num_frames [get_property MODELPARAM_VALUE.MAX_NUM_FRAMES] :>
<: set max_num_frames_width [get_property MODELPARAM_VALUE.MAX_NUM_FRAMES_WIDTH] :>
<: set use_ext_sync [get_property MODELPARAM_VALUE.USE_EXT_SYNC] :>
<: set autorun [get_property MODELPARAM_VALUE.AUTORUN] :>
<: set autorun_flags [get_property MODELPARAM_VALUE.AUTORUN_FLAGS] :>
Expand Down Expand Up @@ -102,7 +102,7 @@ package <=: ComponentName :>_pkg;
parameter <=: ComponentName :>_ENABLE_DIAGNOSTICS_IF = <=: b2i $enable_diagnostics_if :>;
parameter <=: ComponentName :>_CACHE_COHERENT = <=: b2i $cache_coherent :>;
parameter <=: ComponentName :>_FRAMELOCK = <=: b2i $framelock :>;
parameter <=: ComponentName :>_MAX_NUM_FRAMES = <=: $max_num_frames :>;
parameter <=: ComponentName :>_MAX_NUM_FRAMES_WIDTH = <=: $max_num_frames_width :>;
parameter <=: ComponentName :>_USE_EXT_SYNC = <=: b2i $use_ext_sync :>;
parameter <=: ComponentName :>_AUTORUN = <=: b2i $autorun :>;
parameter <=: ComponentName :>_AUTORUN_FLAGS = <=: h2i $autorun_flags :>;
Expand Down
13 changes: 7 additions & 6 deletions library/axi_dmac/axi_dmac_regmap.v
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ module axi_dmac_regmap #(
parameter [2:0] AXI_AXPROT = 3'b000,
parameter FRAMELOCK = 0,
parameter DMA_2D_TLAST_MODE = 0,
parameter MAX_NUM_FRAMES = 8,
parameter MAX_NUM_FRAMES_WIDTH = 3,
parameter USE_EXT_SYNC = 0,
parameter AUTORUN = 0,
parameter AUTORUN_FLAGS = 0,
Expand All @@ -72,8 +72,7 @@ module axi_dmac_regmap #(
parameter AUTORUN_FRAMELOCK_CONFIG = 0,
parameter AUTORUN_FRAMELOCK_STRIDE = 0,
parameter AUTORUN_CONTROL_HWDESC = AUTORUN ? AUTORUN_FLAGS[3] : 0,
parameter AUTORUN_CONTROL_FLOCK = AUTORUN ? AUTORUN_FLAGS[4] : 0,
localparam MAX_NUM_FRAMES_WIDTH = $clog2(MAX_NUM_FRAMES)
parameter AUTORUN_CONTROL_FLOCK = AUTORUN ? AUTORUN_FLAGS[4] : 0
) (

// Slave AXI interface
Expand Down Expand Up @@ -124,8 +123,8 @@ module axi_dmac_regmap #(
output [DMA_LENGTH_WIDTH-1:0] request_dest_stride,
output [DMA_LENGTH_WIDTH-1:0] request_src_stride,
output [MAX_NUM_FRAMES_WIDTH:0] request_flock_framenum,
output request_flock_mode,
output request_flock_wait_writer,
output request_flock_mode,
output request_flock_wait_writer,
output [MAX_NUM_FRAMES_WIDTH:0] request_flock_distance,
output [DMA_AXI_ADDR_WIDTH-1:0] request_flock_stride,
output request_sync_transfer_start,
Expand All @@ -152,6 +151,8 @@ module axi_dmac_regmap #(
localparam HAS_ADDR_HIGH = DMA_AXI_ADDR_WIDTH > 32;
localparam ADDR_LOW_MSB = HAS_ADDR_HIGH ? 31 : DMA_AXI_ADDR_WIDTH-1;

localparam MAX_NUM_FRAMES = 2**(MAX_NUM_FRAMES_WIDTH-1);

// Register interface signals
reg [31:0] up_rdata = 32'h00;
reg up_wack = 1'b0;
Expand Down Expand Up @@ -288,7 +289,7 @@ module axi_dmac_regmap #(
.DMA_SG_TRANSFER(DMA_SG_TRANSFER),
.SYNC_TRANSFER_START(SYNC_TRANSFER_START),
.FRAMELOCK(FRAMELOCK),
.MAX_NUM_FRAMES(MAX_NUM_FRAMES),
.MAX_NUM_FRAMES_WIDTH(MAX_NUM_FRAMES_WIDTH),
.AUTORUN(AUTORUN),
.AUTORUN_FLAGS(AUTORUN_FLAGS),
.AUTORUN_SRC_ADDR(AUTORUN_SRC_ADDR),
Expand Down
5 changes: 2 additions & 3 deletions library/axi_dmac/axi_dmac_regmap_request.v
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ module axi_dmac_regmap_request #(
parameter DMA_SG_TRANSFER = 0,
parameter SYNC_TRANSFER_START = 0,
parameter FRAMELOCK = 0,
parameter MAX_NUM_FRAMES = 8,
parameter MAX_NUM_FRAMES_WIDTH = 3,
parameter AUTORUN = 0,
parameter AUTORUN_FLAGS = 0,
parameter AUTORUN_SRC_ADDR = 0,
Expand All @@ -62,8 +62,7 @@ module axi_dmac_regmap_request #(
parameter AUTORUN_DEST_STRIDE = 0,
parameter AUTORUN_SG_ADDRESS = 0,
parameter AUTORUN_FRAMELOCK_CONFIG = 0,
parameter AUTORUN_FRAMELOCK_STRIDE = 0,
localparam MAX_NUM_FRAMES_WIDTH = $clog2(MAX_NUM_FRAMES)
parameter AUTORUN_FRAMELOCK_STRIDE = 0
) (
input clk,
input reset,
Expand Down
7 changes: 3 additions & 4 deletions library/axi_dmac/axi_dmac_transfer.v
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,8 @@ module axi_dmac_transfer #(
parameter [2:0] AXI_AXPROT = 3'b000,
parameter FRAMELOCK = 0,
parameter FRAMELOCK_MODE = 0,
parameter MAX_NUM_FRAMES = 8,
parameter USE_EXT_SYNC = 0,
localparam MAX_NUM_FRAMES_WIDTH = $clog2(MAX_NUM_FRAMES)
parameter MAX_NUM_FRAMES_WIDTH = 3,
parameter USE_EXT_SYNC = 0
) (
input ctrl_clk,
input ctrl_resetn,
Expand Down Expand Up @@ -463,7 +462,7 @@ module axi_dmac_transfer #(
.BYTES_PER_BEAT_WIDTH_DEST (BYTES_PER_BEAT_WIDTH_DEST),
.BYTES_PER_BEAT_WIDTH_SRC (BYTES_PER_BEAT_WIDTH_SRC),
.FRAMELOCK_MODE (FRAMELOCK_MODE),
.MAX_NUM_FRAMES (MAX_NUM_FRAMES)
.MAX_NUM_FRAMES_WIDTH (MAX_NUM_FRAMES_WIDTH)
) i_dmac_flock (
.req_aclk (req_clk),
.req_aresetn (req_resetn),
Expand Down

0 comments on commit 174ce93

Please sign in to comment.