I have small doubts in wrap calculation
for suppose I have start address 0x04 and HSIZE = 0(one byte) and HBURST = 2(4 beat wrapping burst)
for suppose I have start address 0x38 and HSIZE = 1(two byte) and HBURST = 2(4 beat wrapping burst)
can any one help me to calculate the wrap for above number with detailed calculations
An address is 4 byte aligned if it can be divided by 4, so any address ending 0x0, 0x4, 0x8 or 0xC. Similarly 8 byte aligned if it can be divided by 8, so ending 0x0 or 0x8.
But if we are looking at typical uses of wrapping bursts, they are using in cache related accesses, where a critical data entity is accessed first, and then a longer cache line if filled up around the critical entity. Here we would usually be looking at an HSIZE value of at least word (4 byte), and cache line lengths of at least 4, and more likely 8 or 16, so the wrapping boundary for a 4-word cache line is 16 byte aligned, so addresses divisible by 16 (ending 0x0).
I've never liked those calculations you have quoted from the AXI spec as I think they are more complex than just simply understanding what a wrapping burst is and where it should wrap.
But if we try to use them, the "Wrap_Boundary" calculation gives you the address the wrapping burst will wrap back to. It doesn't tell you the address at which you would then wrap back. So that is why the text in the spec says if Address_N =Wrap_Boundary + (Number_Bytes X Burst_Length), which does tell you the incremented address that you would instead have wrapped back to Wrap_Boundary.
At that point you use "Wrap_Boundary" as this transfer address, and then subsequent addresses use the Address_N = Start Address + ((N-1) x Number_Bytes) - (Number_Bytes x Burst_Length).
Where you are using a WRAP burst that starts from a burst aligned address, there isn't any wrapping, so the "if Address_N = Wrap_Boundary + (Number_Bytes x Burst_Length)" test is never true, so all the equations still work.
For example if we take your very first example, start address HADDR=0x4, HSIZE=0x0 (byte) and HBURST=0x2 (WRAP4), we have Number_Bytes =1 and Burst_Length=4, so...
Wrap_Boundary = (INT(0x4 / (1 * 4))) x (1 x 4) = 4.
The "if Address_N = Wrap_Boundary + (Number_Bytes x Burst_Length)" test then tests for the address reaching 0x4 + (1 x 4), so 0x8. This address will never be reached because we know the incrementing address will be 0x4, 0x5, 0x6 and finally 0x7 after the 4th transfer. Burst has ended, so wrapping point never reached.
The calculations do work in all cases if you read the full text in this section of the AXI spec.