AXI中wrap边界的计算

在AXI中,主要是三种猝发模式,FIXED,INCR,WRAP。前两种比较容易理解,第三种的边界计算如下。

WRAP猝发类似于INCR猝发。在WRAP中,地址将根据SiZE递增,但是达到地址上限时,地址将换到地址下限。
在WRAP地址计算过程中有两个注意事项,

  1. 计算WRAP的地址上限

  2. 低位地址回旋到WRAP


WRAP突发有限制:

  • 起始地址必须与每次传输的大小对齐

  • 突发长度必须为2、4、8或16个传输


计算方式如下:

地址下界:

地址上界:

Ex1:

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

Start_Address   = 0x04
Burst_Length    = 4
Number_Bytes  = 2^2=4
因此地址下界
              = (0x04/(4x4)) x (4x4)
              = 0
地址上界
              = 0 + (4 x 4)
              = 16

Address_0 = 4
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

因为上界为16,因此地址Address_3 = 0。

因此地址为4,8,12,0。


Ex2:

AxADDR = 0x38,  AxLEN = 3, AxSIZE = 2, AxBURST = 3。
Start_Address   = 0x38
Burst_Length    = 4
Number_Bytes  =  2^2=4
因此地址下界
              = (0x38/(4x4)) x (4x4)
              = 0x30
地址上界
              = 0x30 + (4 x 4)
              = 0x40

Address_0 = 0x38
Address_1 = Address_0 + Number_Bytes = 0x38 + 0x4 = 0x3C
Address_2 = Address_1 + Number_Bytes = 0x3C + 0x4 = 0x40
因为Address_2 == 0x40, 达到上边界,因此Address_2 = 0x30
Address_3 = Address_2 + Number_Bytes = 0x30 + 0x4 = 0x34
因此地址为 0x38, 0x3C, 0x30, 0x34。


Ex3:

AxADDR = 0x34,  AxLEN = 7, AxSIZE = 2, AxBURST = 3。
Start_Address = 0x34
Burst_Length  = 8
Number_Bytes  = 2^2=4

因此地址下界
              = (0x34/(4x8)) x (4x8)
              = 0x20
地址
              = 0x20 + (4 x 8)
              = 0x40

Address_0 = 0x34
Address_1 = Address_0 + Number_Bytes = 0x34 + 4 = 0x38
Address_2 = Address_1 + Number_Bytes = 0x38 + 4 = 0x3C
Address_3 = Address_2 + Number_Bytes = 0x3C + 4 = 0x40
因为Address_3 == 0x40,达到上边界,因此 Address_3 = 0x20
Address_4 = Address_3 + Number_Bytes = 0x20 + 4 = 0x24
Address_5 = Address_4 + Number_Bytes = 0x24 + 4 = 0x28
Address_6 = Address_5 + Number_Bytes = 0x28 + 4 = 0x2C
Address_7 = Address_6 + Number_Bytes = 0x2C + 4 = 0x30
因此地址为 0x34, 0x38, 0x3C, 0x20, 0x24, 0x28, 0x2C, 0x30

全部评论
学到了,感谢楼主的分享啊
点赞 回复 分享
发布于 2022-07-26 18:18
期待楼主更新
点赞 回复 分享
发布于 2022-07-28 20:32

相关推荐

2 3 评论
分享
牛客网
牛客企业服务