diff --git a/library/util_adcfifo/util_adcfifo.v b/library/util_adcfifo/util_adcfifo.v index 4192d3cd5..b16e77696 100644 --- a/library/util_adcfifo/util_adcfifo.v +++ b/library/util_adcfifo/util_adcfifo.v @@ -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