# AHB AXI WRAP Burst

A WRAP burst is similar to INCR burst. In WRAP the address will be incremented based the SiZE,
but on reaching the upper address limit address will wrap to lower address.

From the above statement, we could see  that there are two considerations during WRAP address calculation,

1. Upper address limit to make WRAP
2. Lower address to WRAP to

There are restrictions on WRAP bursts,

• The start address must be aligned to the size of each transfer
• The length of the burst must be 2, 4, 8, or 16 transfers

## Equations for WRA Address Calculation

Below equations are used for WRAP address calculation,

• Lower address to WRAP to

• Upper address limit to make WRAP

Address_N = Wrap_Boundary + (Number_Bytes × Burst_Length)

## WRAP Address calculation examples

### WRAP Example-1

AxADDR = 0x04,  AxLEN = 3, AxSIZE = 2, AxBURST = 3

Burst_Length    = 4
Number_Bytes  = 4

= (0x04/(4×4)) x (4×4)
= 0

Address_N = Wrap_Boundary + (Number_Bytes × Burst_Length)
= 0 + (4 x 4)
= 16

As Burst_Length is 4, Burst consists of 4 Address,

Condition, If the Address_n == 16, Address_n = wrap_boundary = 0

Address_1 = Address_0 + Number_Bytes =  4 + 4 = 8
Address_2 = Address_1 + Number_Bytes =  8 + 4 = 12
Address_3 = Address_2 + Number_Bytes = 12 + 4 = 16

As per condition, Address_3 == 16, so Address_3 = 0

Therefore, ADDRESSES are 4, 8, 12, 0.

### WRAP Example-2

AxADDR = 0x38,  AxLEN = 3, AxSIZE = 2, AxBURST = 3

Burst_Length    = 4
Number_Bytes  = 4

= (0x38/(4×4)) x (4×4)
= 0x30

Address_N = Wrap_Boundary + (Number_Bytes × Burst_Length)
= 0x30 + (4 x 4)
= 0x40

As Burst_Length is 4, Burst consists of 4 Address,

Condition, If the Address_n == 0x34, Address_n = wrap_boundary = 0x30

Address_1 = Address_0 + Number_Bytes = 0x38 + 0x4 = 0x3C
Address_2 = Address_1 + Number_Bytes = 0x3C + 0x4 = 0x40

As per condition, Address_2 == 0x40, so Address_2 = 0x30

Address_3 = Address_2 + Number_Bytes = 0x30 + 0x4 = 0x34

Therefore, ADDRESSES are 0x38, 0x3C, 0x30, 0x34.

### WRAP Example-3

Lets consider an example,
AxADDR = 0x34,  AxLEN = 7, AxSIZE = 2, AxBURST = 3

Burst_Length  = 8
Number_Bytes  = 4

= (0x34/(4×8)) x (4×8)
= 0x20

Address_N = Wrap_Boundary + (Number_Bytes × Burst_Length)
= 0x20 + (4 x 8)
= 0x40

As Burst_Length is 4, Burst consists of 4 Address,

Condition, If the Address_n == 0x40, Address_n = wrap_boundary = 0x20