Skip to content

Commit

Permalink
axi_dmac: Use localparam instead of parameter
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
larsclausen authored and Lars-Peter Clausen committed Jun 5, 2018
1 parent cf52081 commit 67600f9
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions library/axi_dmac/request_arb.v
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 67600f9

Please sign in to comment.