Skip to content

Commit 6d8b0a0

Browse files
committed
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 <jorge.marques@analog.com>
1 parent d105e07 commit 6d8b0a0

File tree

10 files changed

+60
-49
lines changed

10 files changed

+60
-49
lines changed

docs/library/axi_dmac/index.rst

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -696,26 +696,32 @@ The core can operate in two roles:
696696

697697
And two modes:
698698

699-
* Dynamic mode:
699+
* Frame conversion (dynamic mode):
700700

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

705-
* Simple mode:
705+
* Output delay (simple mode):
706706

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

711711
Also, in simple mode:
712712

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

719+
.. caution::
720+
721+
In dynamic mode, the reader can still read a buffer being currently accessed
722+
by the writer if the number of frames and distance are close.
723+
Still, the distance is mainly used in output delay mode.
724+
719725
The writer and reader DMAC cores must be connected through the dedicated
720726
"framelock" interface. They must be programmed with similar settings regarding
721727
the buffers size, start address and stride through the ``FRAMELOCK_CONFIG`` and

docs/regmap/adi_regmap_dmac.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,9 @@ FIELD
672672
DISTANCE
673673
RW
674674
Used mainly in output delay mode. Set the output delay in frames.
675-
Should be set in interval 0 to flock, FRAMENUM - 1.
675+
With a DISTANCE of 0, the reader is one frame behind with WAIT_WRITER set.
676+
In frame conversion mode, it will repeat reading frame 0 until frame 1 is fully written to
677+
memory.
676678
If ``AUTORUN`` is set, the default value of the field is ``AUTORUN_FRAMELOCK_CONFIG[23:16]``.
677679
ENDFIELD
678680

@@ -701,7 +703,13 @@ FIELD
701703
MODE
702704
RW
703705
Select operating mode of the framebuffer.
704-
(0 - Frame rate conversion mode (dynamic), 1 - Output delay mode (simple))
706+
707+
* 0 - Frame rate conversion mode (dynamic).
708+
* 1 - Output delay mode (simple).
709+
710+
In dynamic mode, the writer skip the current in-use reader buffer and the reader stay
711+
behind the writer's buffer by repeating or skipping buffers.
712+
705713
If ``AUTORUN`` is set, the default value of the field is ``AUTORUN_FRAMELOCK_CONFIG[8]``.
706714
ENDFIELD
707715

library/axi_dmac/axi_dmac.v

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ module axi_dmac #(
6767
parameter AXI_ID_WIDTH_DEST = 1,
6868
parameter AXI_ID_WIDTH_SG = 1,
6969
parameter DMA_AXIS_ID_W = 8,
70-
parameter DMA_AXIS_DEST_W = 4,
70+
parameter DMA_AXIS_DEST_W = 3,
7171
parameter DISABLE_DEBUG_REGISTERS = 0,
7272
parameter ENABLE_DIAGNOSTICS_IF = 0,
7373
parameter ALLOW_ASYM_MEM = 0,
@@ -76,8 +76,7 @@ module axi_dmac #(
7676
parameter [2:0] AXI_AXPROT = 3'b000,
7777
parameter DMA_2D_TLAST_MODE = 0,
7878
parameter FRAMELOCK = 0,
79-
parameter MAX_NUM_FRAMES = 8,
80-
parameter MAX_NUM_FRAMES_WIDTH = 3,
79+
parameter MAX_NUM_FRAMES_WIDTH = 4,
8180
parameter USE_EXT_SYNC = 0,
8281
parameter AUTORUN = 0,
8382
parameter AUTORUN_FLAGS = 0,
@@ -326,6 +325,8 @@ module axi_dmac #(
326325
localparam HAS_DEST_ADDR = DMA_TYPE_DEST == DMA_TYPE_AXI_MM;
327326
localparam HAS_SRC_ADDR = DMA_TYPE_SRC == DMA_TYPE_AXI_MM;
328327

328+
localparam MAX_NUM_FRAMES = 2**(MAX_NUM_FRAMES_WIDTH-1);
329+
329330
// Argh... "[Synth 8-2722] system function call clog2 is not allowed here"
330331
localparam BYTES_PER_BEAT_WIDTH_DEST = DMA_DATA_WIDTH_DEST > 1024 ? 8 :
331332
DMA_DATA_WIDTH_DEST > 512 ? 7 :
@@ -496,7 +497,7 @@ module axi_dmac #(
496497
.AXI_AXPROT(AXI_AXPROT),
497498
.FRAMELOCK(FRAMELOCK),
498499
.DMA_2D_TLAST_MODE(DMA_2D_TLAST_MODE),
499-
.MAX_NUM_FRAMES(MAX_NUM_FRAMES),
500+
.MAX_NUM_FRAMES_WIDTH(MAX_NUM_FRAMES_WIDTH),
500501
.USE_EXT_SYNC(USE_EXT_SYNC),
501502
.AUTORUN(AUTORUN),
502503
.AUTORUN_FLAGS(AUTORUN_FLAGS),
@@ -611,7 +612,7 @@ module axi_dmac #(
611612
.AXI_AXPROT(AXI_AXPROT),
612613
.FRAMELOCK(FRAMELOCK),
613614
.FRAMELOCK_MODE(FRAMELOCK_MODE),
614-
.MAX_NUM_FRAMES(MAX_NUM_FRAMES),
615+
.MAX_NUM_FRAMES_WIDTH(MAX_NUM_FRAMES_WIDTH),
615616
.USE_EXT_SYNC(USE_EXT_SYNC)
616617
) i_transfer (
617618
.ctrl_clk(s_axi_aclk),

library/axi_dmac/axi_dmac_framelock.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ module axi_dmac_framelock #(
3838
parameter BYTES_PER_BEAT_WIDTH_DEST = 3,
3939
parameter BYTES_PER_BEAT_WIDTH_SRC = 3,
4040
parameter FRAMELOCK_MODE = 0, // 0 - MM writer ; 1 - MM reader
41-
parameter MAX_NUM_FRAMES = 8,
42-
localparam MAX_NUM_FRAMES_WIDTH = $clog2(MAX_NUM_FRAMES)
41+
parameter MAX_NUM_FRAMES_WIDTH = 3
4342
) (
4443
input req_aclk,
4544
input req_aresetn,
@@ -80,6 +79,7 @@ module axi_dmac_framelock #(
8079
localparam BYTES_PER_BEAT_WIDTH = FRAMELOCK_MODE ?
8180
BYTES_PER_BEAT_WIDTH_SRC :
8281
BYTES_PER_BEAT_WIDTH_DEST;
82+
localparam MAX_NUM_FRAMES = 2**(MAX_NUM_FRAMES_WIDTH-1);
8383

8484
reg [DMA_AXI_ADDR_WIDTH-1:BYTES_PER_BEAT_WIDTH] req_address = 'h0;
8585
reg [MAX_NUM_FRAMES_WIDTH-1:0] transfer_id = 'h0;

library/axi_dmac/axi_dmac_hw.tcl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,11 @@ set_parameter_property ENABLE_FRAMELOCK DISPLAY_HINT boolean
252252
set_parameter_property ENABLE_FRAMELOCK HDL_PARAMETER true
253253
set_parameter_property ENABLE_FRAMELOCK GROUP $group_2d
254254

255-
add_parameter MAX_NUM_FRAMES INTEGER 8
256-
set_parameter_property MAX_NUM_FRAMES DISPLAY_NAME "Max Number Of Frame Buffers"
257-
set_parameter_property MAX_NUM_FRAMES HDL_PARAMETER true
258-
set_parameter_property MAX_NUM_FRAMES ALLOWED_RANGES {4 8 16 32}
259-
set_parameter_property MAX_NUM_FRAMES GROUP $group_2d
255+
add_parameter MAX_NUM_FRAMES_WIDTH INTEGER 4
256+
set_parameter_property MAX_NUM_FRAMES_WIDTH DISPLAY_NAME "Max Number Of Frame Buffers"
257+
set_parameter_property MAX_NUM_FRAMES_WIDTH HDL_PARAMETER true
258+
set_parameter_property MAX_NUM_FRAMES_WIDTH ALLOWED_RANGES {"2:4" "3:8" "4:16" "5:32"}
259+
set_parameter_property MAX_NUM_FRAMES_WIDTH GROUP $group_2d
260260

261261
add_parameter USE_EXT_SYNC INTEGER 0
262262
set_parameter_property USE_EXT_SYNC DISPLAY_NAME "External Synchronization Support"
@@ -729,10 +729,10 @@ proc axi_dmac_elaborate {} {
729729
}
730730

731731
if {[get_parameter_value ENABLE_FRAMELOCK] == 1} {
732-
set_parameter_property MAX_NUM_FRAMES VISIBLE true
732+
set_parameter_property MAX_NUM_FRAMES_WIDTH VISIBLE true
733733

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

751751
} else {
752-
set_parameter_property MAX_NUM_FRAMES VISIBLE false
752+
set_parameter_property MAX_NUM_FRAMES_WIDTH VISIBLE false
753753
}
754754

755755
}

library/axi_dmac/axi_dmac_ip.tcl

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -357,11 +357,15 @@ set_property -dict [list \
357357
[ipx::get_user_parameters FRAMELOCK -of_objects $cc]
358358

359359
set_property -dict [list \
360-
"enablement_tcl_expr" "\$FRAMELOCK == true" \
361-
"value_validation_type" "list" \
362-
"value_validation_list" "4 8 16 32" \
360+
"value_validation_type" "pairs" \
361+
"value_validation_pairs" {\
362+
"4 buffers" "3" \
363+
"8 buffers" "4" \
364+
"16 buffers" "5" \
365+
"32 buffers" "6" \
366+
} \
363367
] \
364-
[ipx::get_user_parameters MAX_NUM_FRAMES -of_objects $cc]
368+
[ipx::get_user_parameters MAX_NUM_FRAMES_WIDTH -of_objects $cc]
365369

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

552-
set p [ipgui::get_guiparamspec -name "MAX_NUM_FRAMES" -component $cc]
556+
set p [ipgui::get_guiparamspec -name "MAX_NUM_FRAMES_WIDTH" -component $cc]
553557
ipgui::move_param -component $cc -order 2 $p -parent $feature_group_2d
554558
set_property -dict [list \
555559
"widget" "comboBox" \
556560
"display_name" "Max Number Of Frame Buffers" \
557561
] $p
558562

559-
set_property -dict [list \
560-
"enablement_value" "false" \
561-
"value_tcl_expr" {log($MAX_NUM_FRAMES)/log(2)} \
562-
] [ipx::get_user_parameters MAX_NUM_FRAMES_WIDTH -of_objects $cc]
563-
set p [ipgui::get_guiparamspec -name "MAX_NUM_FRAMES_WIDTH" -component $cc]
564-
ipgui::remove_param -component [ipx::current_core] $p
565-
566563
set p [ipgui::get_guiparamspec -name "USE_EXT_SYNC" -component $cc]
567564
ipgui::move_param -component $cc -order 3 $p -parent $feature_group
568565
set_property -dict [list \

library/axi_dmac/axi_dmac_pkg_sv.ttcl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<: set enable_diagnostics_if [get_property MODELPARAM_VALUE.ENABLE_DIAGNOSTICS_IF] :>
4343
<: set cache_coherent [get_property MODELPARAM_VALUE.CACHE_COHERENT] :>
4444
<: set framelock [get_property MODELPARAM_VALUE.FRAMELOCK] :>
45-
<: set max_num_frames [get_property MODELPARAM_VALUE.MAX_NUM_FRAMES] :>
45+
<: set max_num_frames_width [get_property MODELPARAM_VALUE.MAX_NUM_FRAMES_WIDTH] :>
4646
<: set use_ext_sync [get_property MODELPARAM_VALUE.USE_EXT_SYNC] :>
4747
<: set autorun [get_property MODELPARAM_VALUE.AUTORUN] :>
4848
<: set autorun_flags [get_property MODELPARAM_VALUE.AUTORUN_FLAGS] :>
@@ -102,7 +102,7 @@ package <=: ComponentName :>_pkg;
102102
parameter <=: ComponentName :>_ENABLE_DIAGNOSTICS_IF = <=: b2i $enable_diagnostics_if :>;
103103
parameter <=: ComponentName :>_CACHE_COHERENT = <=: b2i $cache_coherent :>;
104104
parameter <=: ComponentName :>_FRAMELOCK = <=: b2i $framelock :>;
105-
parameter <=: ComponentName :>_MAX_NUM_FRAMES = <=: $max_num_frames :>;
105+
parameter <=: ComponentName :>_MAX_NUM_FRAMES_WIDTH = <=: $max_num_frames_width :>;
106106
parameter <=: ComponentName :>_USE_EXT_SYNC = <=: b2i $use_ext_sync :>;
107107
parameter <=: ComponentName :>_AUTORUN = <=: b2i $autorun :>;
108108
parameter <=: ComponentName :>_AUTORUN_FLAGS = <=: h2i $autorun_flags :>;

library/axi_dmac/axi_dmac_regmap.v

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ module axi_dmac_regmap #(
5858
parameter [2:0] AXI_AXPROT = 3'b000,
5959
parameter FRAMELOCK = 0,
6060
parameter DMA_2D_TLAST_MODE = 0,
61-
parameter MAX_NUM_FRAMES = 8,
61+
parameter MAX_NUM_FRAMES_WIDTH = 3,
6262
parameter USE_EXT_SYNC = 0,
6363
parameter AUTORUN = 0,
6464
parameter AUTORUN_FLAGS = 0,
@@ -72,8 +72,7 @@ module axi_dmac_regmap #(
7272
parameter AUTORUN_FRAMELOCK_CONFIG = 0,
7373
parameter AUTORUN_FRAMELOCK_STRIDE = 0,
7474
parameter AUTORUN_CONTROL_HWDESC = AUTORUN ? AUTORUN_FLAGS[3] : 0,
75-
parameter AUTORUN_CONTROL_FLOCK = AUTORUN ? AUTORUN_FLAGS[4] : 0,
76-
localparam MAX_NUM_FRAMES_WIDTH = $clog2(MAX_NUM_FRAMES)
75+
parameter AUTORUN_CONTROL_FLOCK = AUTORUN ? AUTORUN_FLAGS[4] : 0
7776
) (
7877

7978
// Slave AXI interface
@@ -124,8 +123,8 @@ module axi_dmac_regmap #(
124123
output [DMA_LENGTH_WIDTH-1:0] request_dest_stride,
125124
output [DMA_LENGTH_WIDTH-1:0] request_src_stride,
126125
output [MAX_NUM_FRAMES_WIDTH:0] request_flock_framenum,
127-
output request_flock_mode,
128-
output request_flock_wait_writer,
126+
output request_flock_mode,
127+
output request_flock_wait_writer,
129128
output [MAX_NUM_FRAMES_WIDTH:0] request_flock_distance,
130129
output [DMA_AXI_ADDR_WIDTH-1:0] request_flock_stride,
131130
output request_sync_transfer_start,
@@ -152,6 +151,8 @@ module axi_dmac_regmap #(
152151
localparam HAS_ADDR_HIGH = DMA_AXI_ADDR_WIDTH > 32;
153152
localparam ADDR_LOW_MSB = HAS_ADDR_HIGH ? 31 : DMA_AXI_ADDR_WIDTH-1;
154153

154+
localparam MAX_NUM_FRAMES = 2**(MAX_NUM_FRAMES_WIDTH-1);
155+
155156
// Register interface signals
156157
reg [31:0] up_rdata = 32'h00;
157158
reg up_wack = 1'b0;
@@ -288,7 +289,7 @@ module axi_dmac_regmap #(
288289
.DMA_SG_TRANSFER(DMA_SG_TRANSFER),
289290
.SYNC_TRANSFER_START(SYNC_TRANSFER_START),
290291
.FRAMELOCK(FRAMELOCK),
291-
.MAX_NUM_FRAMES(MAX_NUM_FRAMES),
292+
.MAX_NUM_FRAMES_WIDTH(MAX_NUM_FRAMES_WIDTH),
292293
.AUTORUN(AUTORUN),
293294
.AUTORUN_FLAGS(AUTORUN_FLAGS),
294295
.AUTORUN_SRC_ADDR(AUTORUN_SRC_ADDR),

library/axi_dmac/axi_dmac_regmap_request.v

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ module axi_dmac_regmap_request #(
5151
parameter DMA_SG_TRANSFER = 0,
5252
parameter SYNC_TRANSFER_START = 0,
5353
parameter FRAMELOCK = 0,
54-
parameter MAX_NUM_FRAMES = 8,
54+
parameter MAX_NUM_FRAMES_WIDTH = 3,
5555
parameter AUTORUN = 0,
5656
parameter AUTORUN_FLAGS = 0,
5757
parameter AUTORUN_SRC_ADDR = 0,
@@ -62,8 +62,7 @@ module axi_dmac_regmap_request #(
6262
parameter AUTORUN_DEST_STRIDE = 0,
6363
parameter AUTORUN_SG_ADDRESS = 0,
6464
parameter AUTORUN_FRAMELOCK_CONFIG = 0,
65-
parameter AUTORUN_FRAMELOCK_STRIDE = 0,
66-
localparam MAX_NUM_FRAMES_WIDTH = $clog2(MAX_NUM_FRAMES)
65+
parameter AUTORUN_FRAMELOCK_STRIDE = 0
6766
) (
6867
input clk,
6968
input reset,

library/axi_dmac/axi_dmac_transfer.v

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,8 @@ module axi_dmac_transfer #(
7070
parameter [2:0] AXI_AXPROT = 3'b000,
7171
parameter FRAMELOCK = 0,
7272
parameter FRAMELOCK_MODE = 0,
73-
parameter MAX_NUM_FRAMES = 8,
74-
parameter USE_EXT_SYNC = 0,
75-
localparam MAX_NUM_FRAMES_WIDTH = $clog2(MAX_NUM_FRAMES)
73+
parameter MAX_NUM_FRAMES_WIDTH = 3,
74+
parameter USE_EXT_SYNC = 0
7675
) (
7776
input ctrl_clk,
7877
input ctrl_resetn,
@@ -463,7 +462,7 @@ module axi_dmac_transfer #(
463462
.BYTES_PER_BEAT_WIDTH_DEST (BYTES_PER_BEAT_WIDTH_DEST),
464463
.BYTES_PER_BEAT_WIDTH_SRC (BYTES_PER_BEAT_WIDTH_SRC),
465464
.FRAMELOCK_MODE (FRAMELOCK_MODE),
466-
.MAX_NUM_FRAMES (MAX_NUM_FRAMES)
465+
.MAX_NUM_FRAMES_WIDTH (MAX_NUM_FRAMES_WIDTH)
467466
) i_dmac_flock (
468467
.req_aclk (req_clk),
469468
.req_aresetn (req_resetn),

0 commit comments

Comments
 (0)