util_adcfifo: Avoid implicit signal truncation warning

The width of a ternary operator expression is the width of the wider of the
two selectable expression. This means depending on the selected DMA_RATIO
the right side expression of the dma_waddr_rel_s assignment can be up to
three bits wider than the dma_waddr_rel_s signal. This generates an
implicit truncation warning.

Slightly reformulate the expression without the use of the ternary operator
to avoid this warning.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
main
Lars-Peter Clausen 2017-07-31 21:00:47 +02:00
parent 26641576d4
commit 99a08a7b90
1 changed files with 5 additions and 8 deletions

View File

@ -62,10 +62,10 @@ module util_adcfifo #(
localparam DMA_MEM_RATIO = ADC_DATA_WIDTH/DMA_DATA_WIDTH;
localparam ADC_ADDRESS_WIDTH = (DMA_MEM_RATIO == 1) ? (DMA_ADDRESS_WIDTH) :
(DMA_MEM_RATIO == 2) ? (DMA_ADDRESS_WIDTH - 1) :
((DMA_MEM_RATIO == 4) ? (DMA_ADDRESS_WIDTH - 2) :
(DMA_ADDRESS_WIDTH - 3));
localparam ADDRESS_PADDING_WIDTH = (DMA_MEM_RATIO == 1) ? 0 :
(DMA_MEM_RATIO == 2) ? 1 :
(DMA_MEM_RATIO == 4) ? 2 : 3;
localparam ADC_ADDRESS_WIDTH = DMA_ADDRESS_WIDTH - ADDRESS_PADDING_WIDTH;
localparam ADC_ADDR_LIMIT = (2**ADC_ADDRESS_WIDTH)-1;
localparam DMA_ADDR_LIMIT = (2**DMA_ADDRESS_WIDTH)-1;
@ -152,10 +152,7 @@ module util_adcfifo #(
assign dma_xfer_status = 4'd0;
assign dma_waddr_rel_t_s = dma_waddr_rel_t_m[2] ^ dma_waddr_rel_t_m[1];
assign dma_waddr_rel_s = (DMA_MEM_RATIO == 1) ? dma_waddr_rel :
(DMA_MEM_RATIO == 2) ? {dma_waddr_rel, 1'd0} :
((DMA_MEM_RATIO == 4) ? {dma_waddr_rel, 2'd0} :
{dma_waddr_rel, 3'd0});
assign dma_waddr_rel_s = {dma_waddr_rel,{ADDRESS_PADDING_WIDTH{1'b0}}};
always @(posedge dma_clk) begin
if (dma_xfer_req == 1'b0) begin