Hi, I am not so clear about the concept of transfer size in AMBA AXI. My question is how to calculate wrap_boundary in wrap based data transfer when Number_Bytes (The maximum number of bytes in each data transfer) is changing in each transfer within a burst. There is a possibility of memory overwrite within a burst transfer for both increment or wrap based addressing if Number_Bytes changes for each transfer. Is this comment write? Please explain. Thanks.
For a given burst, the Number_Bytes property, as applied to each individual data transfer within that burst, is the same. The pseudo-code description of the transfers, within the specification, shows as much.
As Asurati says, AWSIZE or ARSIZE doesn't change during a transaction (it is signalled once at the start of the transaction), so the Number_Bytes value is fixed for all transfers in the transaction.
So as you know the number of transfers in the transaction (AWLEN or ARLEN), and the width of each transfer in the transaction (AWSIZE or ARSIZE), you can work out the lowest and highest address boundaries (the wrap boundaries) for the transaction based on the AWADDR or ARADDR start address aligned to the AWSIZE/AWLEN or ARSIZE/ARLEN total transaction data sizes.
For example if you have a 4-beat WRAP write transaction with AWSIZE indicating 32-bit transfers, and a start address of 0x28...
the number_bytes per transfer is 4
the burst_length is 4
so the total number of bytes in the transaction is 16 (0x10)
the aligned start address for the transaction is (INT(start_address/(number_bytes x burst_length)) x (number_bytes x burst_length)
= (INT(0x28/0x10) x 0x10 = 0x20
and then looking at the addresses of each transfer in the transaction, if address_n = (wrap_boundary + (number_bytesxburst_length)
= 0x20+0x10 = 0x30
then address_n = wrap_boundary = 0x20
So the addresses accessed are start address 0x28, then 0x2C, then as the next AWSIZE increment would be 0x30 (the upper wrap boundary) the address wraps down to the calculated wrap_boundary of 0x20, and finally the nth transfer to 0x24.
I must admit I don't like these equations as they seem too complicated, but they do work to help initially understand the addresses used in a wrapping burst.