摘要: 本应用笔记说明了如何计算DS31256 HDLC控制器的总线带宽。并展示了一个实验室实测的结果。同时演示了一个总线利用率速算表,该速算表如果需要可以索要。
DS31256 HDLC控制器通过PCI总线存取发送和收到的HDLC包。本应用笔记讨论如何计算DS31256正常工作所需的总线带宽。所涉及到的相关术语的定义在本文的开始部分给出。
根据本应用笔记所提供的信息,用户只需适当调整速算表(备索)中的一些数据,就可将它用于特定的应用中。
表1. 本应用笔记所涉及到的变量的定义
Variable | Definition | Valid Range |
B | Average number of packets processed before the host updates the receive free queue and transmit pending queue or reads the receive done queue and transmit done queue | 1, 2, 3, . . . . |
C | Average number of bus cycles required per packet | 1, 2, 3, . . . . |
D | Number of bus cycles needed for data to be transferred | 1, 2, 3, . . . . |
P | Packet size in bytes | 64 |
R | Average number of bus cycles added due to latency in RAM access | 0, 1, 2, . . . . |
X | Average number of bus accesses required to send or obtain packet data to, or from the data buffers | 1, 2, 3, . . . . |
DS31256或主机执行四种类型的总线访问,以支持DS31256内的直接存储器访问(DMA)。在下面的讨论中,变量D定义为数据周期数,变量R定义为由于RAM访问时间的关系,所需要的总线周期数。
当DMA突发读主机RAM时所需要的总线周期总数为[3+R+D]。这可由图1和表2得出。
表2. DMA读所需的总线周期总数
Cycle | No. Cycles Required |
Address Cycle | 1 |
Turnaround Cycle | 1 |
RAM Access Latency Cycle | R |
Data Cycle | D |
Turnaround Cycle | 1 |
图1. DS31256 PCI总线读
当DMA突发写主机RAM时所需的总线周期总数为[2+R+D]。这可从图2和表3得到。
表3. DMA写所需的总线周期总数
Cycle | No. Cycles Required |
Address Cycle | 1 |
RAM Access Latency Cycle | R |
Data Cycle | D |
Turnaround Cycle | 1 |
图2. DS31256 PCI总线写周期
主机写入DS31256时所需的总线周期总数为7。
主机读取DS31256时所需的总线周期总数为7。
注意:对于访问类型3和4,7个访问周期是DS31256所固有的,不能改变。
为计算总线利用率,首先必须知道所需要的总线周期数。为得到该数据,我们做了一些假设列于表4。图3给出了在收到或发出一个数据包时主机和DMA将要执行的标准流程。根据图3,我们有可能得出一个公式,来计算每个包所需要的平均总线周期数,即变量C。
发送侧周期 = 读等待队列 + 写水平描述符链 + 读描述符 + 从主机存储器读取包 + 写完成队列 + 读/写寄存器。
Ct = [(3 + R + 12)/12] + [2 + R + 1] + [3 + R + 4] + [(P/4) + (3 + R)X] + [(2 + R + 6)/6] + [4(7/B)]
接收侧周期 = 读自由队列 + 将包写入主机存储器 + 写描述符 + 写完成队列 + 读/写寄存器。
Cr = [(3 + R + 24)/12] + [(P/4) + (2 + R)X] + [2 + R + 3] + [(2 + R + 6)/6] + [4(7/B)]
Ct + Cr = 21.16 + 3.5R + 0.5P + (5 + 2R)X + 56/B
表4. 为了便于计算每个包所需总线周期数所作的假设
1 | All packets are 64 bytes (seen as worst case). |
2 | The Frame Check Sequence (FCS) of the HDLC packet is not transferred to, or from the PCI bus. |
3 | On the receive side, only large buffers are used (small buffers are disabled). |
4 | The receive DMA will burst read the free queue and burst write the done queue. |
5 | The transmit DMA will burst read the pending queue and burst write the done queue. |
6 | All packets fit within a single buffer (i.e., only one descriptor). This is reasonable because packets are 64 bytes. |
7 | All physical layer links are filled with packets; no idle codes are sent or received. |
8 | Interrupt routines and overhead (like accesses to the local bus) are not considered. |
图3. 每个包的总线处理流程
注:
12个描述符 x 1双字 = 12个发送等待队列描述符双字
包数据字节数 = 4字节/数据周期
6个描述符 x 1双字 = 6个发送完成队列描述符双字
图3. (续)
注:
12个描述符 x 2双字 = 24个接收自由队列描述符双字
包数据字节数 = 4字节/数据周期
6个描述符 x 1双字 = 6个接收完成队列描述符双字
总线利用率定义为DS31256每秒所需的总线周期数除以每秒可供使用的总线周期总数。总线利用率可按照特定的HDLC配置和业务量计算。计算中假定PCI总线时钟速率为33MHz (33,000,000Hz),并且只用一片DS31256。以下就是PCI总线利用率的详细计算方法。
公式1:
公式2:
注:
社群二维码
关注“华强商城“微信公众号
Copyright 2010-2023 hqbuy.com,Inc.All right reserved. 服务热线:400-830-6691 粤ICP备05106676号 经营许可证:粤B2-20210308