FIFO 深度问题

上传人:豆浆 文档编号:8146150 上传时间:2017-09-01 格式:PDF 页数:4 大小:92.48KB
返回 下载 相关 举报
FIFO 深度问题_第1页
第1页 / 共4页
FIFO 深度问题_第2页
第2页 / 共4页
FIFO 深度问题_第3页
第3页 / 共4页
FIFO 深度问题_第4页
第4页 / 共4页
亲,该文档总共4页,全部预览完了,如果喜欢就下载吧!
资源描述

《FIFO 深度问题》由会员分享,可在线阅读,更多相关《FIFO 深度问题(4页珍藏版)》请在金锄头文库上搜索。

1、FIFO 深度问题 写时钟周期 w_clk, 读时钟周期 r_clk, 写时钟周期里,每 B 个时钟周期会有 A 个数据写入 FIFO 读时钟周期里,每 Y 个时钟周期会有 X 个数据读出 FIFO 则, FIFO 的最小深度是? w_clk,r_clk/ns f_wr,f_rd/mhz 1,首先考虑有解条件 平均写入速率 =平均读取速率 平均写入速率: A/(B*w_clk)=(A*f_wr)/B -(data/s) 平均读取速率 : X/(Y*r_clk)=(X*f_rd)/Y -(data/s) 由上式可推出 A/B=(X*Y)/(f_rd*f_wr) 表达的含义就是 fifo 的输入和

2、输出带宽要匹配,其中 A/B 表示链路利用率, f_wr width 表示带宽,这里大概是默认输入输出的数据宽度相同,所以以 f_wr 来代替带宽。 X/Y 和 f_rd 的含义也是这样。在带宽匹配的前提下数据不会无限积累。 2, 其次算出写数据的最大 burst_length。考虑最坏情况,即不考虑写入空闲,采用背靠背突发传输 比如, 如果条件给出, 每 100 个写时钟, 写入 80 个数据, 那么在背靠背的情况下, burst_length = 2*80=160 3,有 fifo_depth 公式如下 fifo_depth = burst_length - burst_length *

3、(X/Y) * (f_rd/f_wr) = burst_length(1-A/B) 4, EXAMPLE 如果 100 个写时钟周期可以写入 80 个数据, 10 个读时钟可以读出 8 个数据 其中 w_ck=5ns,r_ck=10ns 所举的那个例子, 如果呼入 fifo 的数据宽度和呼出相同的话,都设为 w bit。那么呼如 fifo 的带宽就是 200wbps,呼出 fifo 的带宽是 100wbps。考虑链路利用率都是 80。那么呼入 fifo 的有效带宽是 160wbps。呼出 fifo 的带宽是 80wbps。现在看到矛盾了,由于输入输出带宽不相等,进来永远比出去多,那么 FIFO

4、 总是处于不断积累数据的状态。所以所举的这个例子并不合适。 应该提高读时钟的速率, 使 fifo 两端的带宽匹配, 在这个前提下才能计算出有解的 fifo 深度。 如果令 wclk rclk (以下内容中的 clk 表示时钟的频率,不是周期) 。可使得读写带宽匹配。那么这个例子的答案是 32 原因如下: 考虑背靠背的情况, 160 个 wclk 连续都写入了 160 个数据。而这 160 个 wclk时间内,由于 wclk rclk,那么读出了( 160/10 ) 8 128 个数据。有 32 个数据会被留在fifo 里。那么 fifo 的最小深度就是 32。如果令 wclk 200mhz,改

5、为 100 个 wclk 里写入 40个, rclk 100mhz, 10 个 rclk 里读出 8 个。那么 fifo 深度为 48 5, fifo_depth = burst_length - burst_length * (X/Y) * (f_rd/f_wr) 作个变形 , 得到 fifo_depth = burst_length - ( burst_length /f_wr)*f_rd*(x/y) 其中 ( burst_length /f_wr) 表示这个 burst 的持续时间 , f_rd*(x/y)表示读的实际速度。 两者的乘积自然就是这段时间读出的数据量。 显然 burst_l

6、ength 表示这段时间写入的数据量,两者的差为 fifo 中残留的数据,这个也就是理论上的 fifo 的最小深度。 实际应用中往往是以半空半满信号来指示 fifo 的空满状态的, 所以实际设计 fifo 的时候会至少留下一个数据空间的深度裕量 这里,我们没有考虑由于异步读写需要同步,所引入的延时。越大的延时,需要越大的 FIFO 来缓冲更多和写数据。 计算FIFO深度翻译英汉对照版 ntroduction One of the most common questions in interviews is how to calculate the depth of a FIFO. 在而试过程中

7、,经常被问及的问题之一就是如何计算一 个 FIFO 的深度。 Fifo is used as buffering element or queueing element in the system, which is by common sense is required only when you slow at reading than the write operation. FIFO 在统中用来作缓冲或者队列 ,通常情况下,当读速率比写速率慢的时候,需要采用 FIFO。 So size of the FIFO basically implies the amount of data r

8、equired to buffer, which depends upon data rate at which data is written and the data rate at which data is read. 所以 FIFO的深度取决于需要缓冲的数据量,缓冲的数据量取决于写速率和读速率。 Statistically, Data rate varies in the system majorily depending upon the load in the system. So to obtain safer FIFO size we need to consider the

9、 worst case scenario for the data transfer across the FIFO under consideration. 统计表明,系统中数据率的变化主要依赖于系 统的负载。所以,为了得到安全的 FIFO,在设计时,我们需要考虑最坏情形下的通过 FIFO 进行的数据传输。 For worst case scenario, Difference between the data rate between write and read should be maximum. Hence, for write operation maximum data rate

10、 should be considered and for read operation minimum data rate should be considered. 最坏情况下,读写数据间的速率差,应该为最 大值。也就是说,写操作速率应该取最大的写速率,而读操作应该取选小的读速率。 So in the question itself, data rate of read operation is specified by the number of idle cycles and for write operation, maximum data rate should be consid

11、ered with no idle cycle. 如问题本身,读操作的数据速率是由空闲周期 决定的,而对于写操作,最大的写数据率,应该不考虑空闲周期。 So for write operation, we need to know Data rate = Number of data * rate of clock. Writing side is the source and reading side becomes sink, data rate of reading side depends upon the writing side data rate and its own read

12、ing rate which is Frd/Idle_cycle_rd. 因而,对于读操作,我们有 Data rate = Number of data * rate of clock。写方是数据流入的方,而读方是数据露出方。 读方的速率取决于写方的速率和自身的读速率(Frd/Idl e_cycle_rd.) In order to know the data rate of write operation, we need to know Number of data in a Burst which we have assumed to be B. 为了获知写方数据速率,我们需要知道在突发

13、 模式下的数据量,我们假设其为B. So following up with the equation as explained below: Fifo size = Size to be buffered = B - B * Frd / (Fwr* Idle_cycle _rd ). 参考如下的等式: Fifo size = Size to be buffered = B - B * Frd / (Fwr* Idle_cycle _rd ). Here we have not considered the sychnronizing latency if Write and Read clo

14、cks are Asynchronous. Greater the Synchronizing latency, higher the FIFO size requirement to buffer more additional data written. 这里,我们没有考虑由于异步读写需要同步, 所引入的延时。越大的延时,需要越大的 FIFO 来缓冲更多和写数据。 Example : FIFO Depth Calculation 例子:计算FIFO深度 Assume that we have to design a FIFO with following requirements and

15、We want to calculate minumum FIFO depth, 假充我们需要设计如下需求的 FIF O,我们需要计算它的最小深度。 Asynchronized fifo 异就 FIFO Writing clock 30MHz - F1 写时钟 Reading clock 40MHz - F2 读时钟 Writing Burst Size - B 突发数据量 Case 1 : There is 1 idle clock cycle for reading side - I 读方一个空闲周期 Case 2 : There is 10 idle clock cycle for re

16、ading side - I 读方 1 0个空闲周期 FIFO depth calculation = B - B *F2/(F1*I) If if we have alternate read cycles i.e between two read cycle there is IDLE cycle. 如果我们已经改变了读周期,比如,两个读周 期中有一个空闲周期。 FIFO depth calculation = B - B * F2/(F1*2) In our present problem FIFO depth = B - B *40/(30*2) = B(1-2/3) = B/3 That means if our Burst amount of data is 10 , FIFO DEPTH = 10/3 = 3.333 = 4 (approximatly) If B = 20 FIFO depth = 2

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 行业资料 > 其它行业文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号