From 4c51224696de124c41a3ce7a11b3f617a6a16c86 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Fri, 18 Sep 2015 11:46:44 +0200 Subject: [PATCH] axi_dmac: Configure AXI master bus properties according to core configuration Configure the maximum burst size as well as the maximum number of active requests on the AXI master interfaces according to the core configuration. This allows connected slaves to know what kind of requests to expect and allows them to configure themselves accordingly. Signed-off-by: Lars-Peter Clausen --- library/axi_dmac/bd/bd.tcl | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/library/axi_dmac/bd/bd.tcl b/library/axi_dmac/bd/bd.tcl index dd5eb2bfb..d32d55afa 100644 --- a/library/axi_dmac/bd/bd.tcl +++ b/library/axi_dmac/bd/bd.tcl @@ -18,6 +18,36 @@ proc init {cellpath otherInfo} { set_property "CONFIG.DMA_AXI_PROTOCOL_DEST" $axi_protocol $ip } +proc post_config_ip {cellpath otherinfo} { + set ip [get_bd_cells $cellpath] + + # Update AXI interface properties according to configuration + set max_bytes_per_burst [get_property "CONFIG.MAX_BYTES_PER_BURST" $ip] + set fifo_size [get_property "CONFIG.FIFO_SIZE" $ip] + + foreach dir {"SRC" "DEST"} { + set type [get_property "CONFIG.DMA_TYPE_$dir" $ip] + if {$type != 0} { + continue + } + + set data_width [get_property "CONFIG.DMA_DATA_WIDTH_$dir" $ip] + set max_beats_per_burst [expr {int(ceil($max_bytes_per_burst * 8.0 / $data_width))}] + + set intf [get_bd_intf_pins [format "%s/m_%s_axi" $cellpath [string tolower $dir]]] + set_property CONFIG.MAX_BURST_LENGTH $max_beats_per_burst $intf + + # The core issues as many requests as the amount of data the FIFO can hold + if {$dir == "SRC"} { + set_property CONFIG.NUM_WRITE_OUTSTANDING 0 $intf + set_property CONFIG.NUM_READ_OUTSTANDING $fifo_size $intf + } else { + set_property CONFIG.NUM_WRITE_OUTSTANDING $fifo_size $intf + set_property CONFIG.NUM_READ_OUTSTANDING 0 $intf + } + } +} + proc axi_dmac_detect_async_clk { cellpath ip param_name clk_a clk_b } { set param_src [get_property "CONFIG.$param_name.VALUE_SRC" $ip] if {[string equal $param_src "USER"]} {