From 4d8008e64cc533f18710d8cb9bc7d01a9af19688 Mon Sep 17 00:00:00 2001 From: Laszlo Nagy Date: Fri, 20 Jul 2018 07:44:04 +0100 Subject: [PATCH] axi_dmac: fix address width detection The round function from tcl is a rounding to nearest. Using it in address width calculation produces incorrect values. e.g. round(log(0xAF000000)/log(2)) will produce 31 instead of 32 The fix is to replace the rounding function with ceiling that guarantees rounding up. --- library/axi_dmac/bd/bd.tcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/axi_dmac/bd/bd.tcl b/library/axi_dmac/bd/bd.tcl index b5ba161691..54dc8e7628 100644 --- a/library/axi_dmac/bd/bd.tcl +++ b/library/axi_dmac/bd/bd.tcl @@ -149,7 +149,7 @@ proc post_propagate {cellpath otherinfo} { foreach addr_seg $addr_segs { set range [get_property "range" $addr_seg] set offset [get_property "offset" $addr_seg] - set addr_width [expr max(round(log($range + $offset) / log(2)), $addr_width)] + set addr_width [expr max(int(ceil(log($range - 1 + $offset) / log(2))), $addr_width)] } } else { set addr_width 32