axi_dmac: Use localparam instead of parameter

Xilinx tools don't allow to use $clog2() when computing the value of a
localparam, even though it is valid Verilog.

For this reason a parameter was used for BYTES_PER_BURST_WIDTH so far. But
that generates warnings from both Quartus and Vivado since the parameter is
not part of the parameter list.

Fix this by changing it to a localparam and computing the log2() manually.
The upper limit for the burst length is known to be 4k, so values larger
than that don't have to be supported.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
main
Lars-Peter Clausen 2018-06-04 14:10:28 +02:00 committed by Lars-Peter Clausen
parent cf5208122a
commit 67600f9831
1 changed files with 12 additions and 2 deletions

View File

@ -172,8 +172,18 @@ localparam DMA_DATA_WIDTH = DMA_DATA_WIDTH_SRC < DMA_DATA_WIDTH_DEST ?
// Bytes per burst is the same for both dest and src, but bytes per beat may
// differ, so beats per burst may also differ
parameter BYTES_PER_BURST_WIDTH = $clog2(MAX_BYTES_PER_BURST);
localparam BYTES_PER_BURST_WIDTH =
MAX_BYTES_PER_BURST > 2048 ? 12 :
MAX_BYTES_PER_BURST > 1024 ? 11 :
MAX_BYTES_PER_BURST > 512 ? 10 :
MAX_BYTES_PER_BURST > 256 ? 9 :
MAX_BYTES_PER_BURST > 128 ? 8 :
MAX_BYTES_PER_BURST > 64 ? 7 :
MAX_BYTES_PER_BURST > 32 ? 6 :
MAX_BYTES_PER_BURST > 16 ? 5 :
MAX_BYTES_PER_BURST > 8 ? 4 :
MAX_BYTES_PER_BURST > 4 ? 3 :
MAX_BYTES_PER_BURST > 2 ? 2 : 1;
localparam BEATS_PER_BURST_WIDTH_SRC = BYTES_PER_BURST_WIDTH - BYTES_PER_BEAT_WIDTH_SRC;
localparam BEATS_PER_BURST_WIDTH_DEST = BYTES_PER_BURST_WIDTH - BYTES_PER_BEAT_WIDTH_DEST;