From 174ce93b8ef1141fc4ebe77617791aba4c7bb1c3 Mon Sep 17 00:00:00 2001 From: Jorge Marques Date: Tue, 5 Nov 2024 18:36:45 -0300 Subject: [PATCH] V11: Remove MAX_NUM_FRAMES parameter Use MAX_NUM_FRAMES_WIDTH parameter on IP. Update doc to clarify valid distance values. Signed-off-by: Jorge Marques --- docs/library/axi_dmac/index.rst | 14 ++++++++++---- docs/regmap/adi_regmap_dmac.txt | 12 ++++++++++-- library/axi_dmac/axi_dmac.v | 9 +++++---- library/axi_dmac/axi_dmac_framelock.v | 4 ++-- library/axi_dmac/axi_dmac_hw.tcl | 18 +++++++++--------- library/axi_dmac/axi_dmac_ip.tcl | 21 +++++++++------------ library/axi_dmac/axi_dmac_pkg_sv.ttcl | 4 ++-- library/axi_dmac/axi_dmac_regmap.v | 13 +++++++------ library/axi_dmac/axi_dmac_regmap_request.v | 5 ++--- library/axi_dmac/axi_dmac_transfer.v | 7 +++---- 10 files changed, 59 insertions(+), 48 deletions(-) diff --git a/docs/library/axi_dmac/index.rst b/docs/library/axi_dmac/index.rst index d8c0d650bb7..e85767f3762 100644 --- a/docs/library/axi_dmac/index.rst +++ b/docs/library/axi_dmac/index.rst @@ -696,13 +696,13 @@ 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 @@ -710,12 +710,18 @@ And two modes: 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 diff --git a/docs/regmap/adi_regmap_dmac.txt b/docs/regmap/adi_regmap_dmac.txt index 969a28c78d5..2e1e2ca1f29 100644 --- a/docs/regmap/adi_regmap_dmac.txt +++ b/docs/regmap/adi_regmap_dmac.txt @@ -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 @@ -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 diff --git a/library/axi_dmac/axi_dmac.v b/library/axi_dmac/axi_dmac.v index c2bda59fd34..cadd0e702dc 100644 --- a/library/axi_dmac/axi_dmac.v +++ b/library/axi_dmac/axi_dmac.v @@ -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, @@ -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, @@ -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 : @@ -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), diff --git a/library/axi_dmac/axi_dmac_framelock.v b/library/axi_dmac/axi_dmac_framelock.v index de8ad7f7dae..40ac7fe60b7 100644 --- a/library/axi_dmac/axi_dmac_framelock.v +++ b/library/axi_dmac/axi_dmac_framelock.v @@ -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, @@ -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; diff --git a/library/axi_dmac/axi_dmac_hw.tcl b/library/axi_dmac/axi_dmac_hw.tcl index 043f200e782..01ac5f57220 100644 --- a/library/axi_dmac/axi_dmac_hw.tcl +++ b/library/axi_dmac/axi_dmac_hw.tcl @@ -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" @@ -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} { @@ -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 } } diff --git a/library/axi_dmac/axi_dmac_ip.tcl b/library/axi_dmac/axi_dmac_ip.tcl index 0c4cadcb584..6e4a112bb03 100644 --- a/library/axi_dmac/axi_dmac_ip.tcl +++ b/library/axi_dmac/axi_dmac_ip.tcl @@ -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] @@ -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 \ diff --git a/library/axi_dmac/axi_dmac_pkg_sv.ttcl b/library/axi_dmac/axi_dmac_pkg_sv.ttcl index 68af5f70088..0516f42e6e3 100644 --- a/library/axi_dmac/axi_dmac_pkg_sv.ttcl +++ b/library/axi_dmac/axi_dmac_pkg_sv.ttcl @@ -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] :> @@ -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 :>; diff --git a/library/axi_dmac/axi_dmac_regmap.v b/library/axi_dmac/axi_dmac_regmap.v index 1c43b91bb1e..8264064c0e2 100644 --- a/library/axi_dmac/axi_dmac_regmap.v +++ b/library/axi_dmac/axi_dmac_regmap.v @@ -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, @@ -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 @@ -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, @@ -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; @@ -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), diff --git a/library/axi_dmac/axi_dmac_regmap_request.v b/library/axi_dmac/axi_dmac_regmap_request.v index c732078d941..f18f34adefd 100644 --- a/library/axi_dmac/axi_dmac_regmap_request.v +++ b/library/axi_dmac/axi_dmac_regmap_request.v @@ -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, @@ -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, diff --git a/library/axi_dmac/axi_dmac_transfer.v b/library/axi_dmac/axi_dmac_transfer.v index 1a20cbf6ecc..db95f2bbe80 100644 --- a/library/axi_dmac/axi_dmac_transfer.v +++ b/library/axi_dmac/axi_dmac_transfer.v @@ -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, @@ -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),