作者Pash77 (数位逻辑之绳)
看板Electronics
标题Re: [问题] 用 single port 的 RAM 实现 FIFO
时间Thu Mar 3 02:21:06 2011
现在的 IC 应该都不能接受 read/write 会 lose data
如果因为 single port 比 two port 的 SRAM 省面积 (通常,not always)
最简单的情况是,同步,read N bits, write N bits
那你的 single port SRAM 要用 N*2 bits 采分时多工
这样的 bandwidth 才能应付同时 read/write
频宽是最基本第一个要卡关的
再来 write 2次才写入 sram 一次,从 sram 读一次要应付 2 次 read
read/write signal 跟着 data 作 pipeline
不妨前後各有 read/write 自己的 counter (你所谓的 tag?)
如果没有非同步,或其它不同速率的问题,上面的电路可以参考一下
※ 引述《ccjin (半年之後你会变怎样)》之铭言:
: 先请问有相关的参考文件吗
: 我找了 google 但是都没有比较明确的资料
: 请教各位板友 为了实现标题
: 我的设计是想 当 write enable 跟 read enable
: 有冲突的时候 当然是先写入
: 但是 control unit 会顺便纪录少读了一笔
: read tag 会被累加 1
: 它会等待 writing is idle 的情况下
: 才开始读的动作 每读一笔 read tag 就会被减少
: 直到把 read tag 清为零
: 这样的设计理念 会有什麽缺失吗
: 譬如说 read 连续送出四个 request
: 结果我的设计 在送出第四个 request的时候
: FIFO 才回第二个 data valid
: 这样接收端会错乱吗
: 请指教 谢谢
--
`timescale 1s/1s module life(input t,born);parameter year=31557600,incom=year/31
,payout=incom;integer age,money,gf,wife,marry,child;always@(posedge t)if(!born)
begin{age,money,gf,marry,child}<=0;end else if(t%year)begin age<=age+1;money<=
money+incom-payout;if((age>35&gf)|gf>5)begin gf<=gf-1;wife<=1;end else if(money/
10>incom)gf<=gf+1;if(wife&age<40)child<=child+1;end endmodule module I;reg t,b;
always#0.5 t=~t;initial t=0;initial#1 b=1;life pash(t,b);endmodule/* by Pash */
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 123.204.207.55
1F:→ colinshih:这麽麻烦? 03/05 00:14
2F:→ Pash77:你的解答没有考虑到 Cost 03/08 02:34
3F:→ Pash77:而且原po所需要的 read/write 只需 2-port 不需 dual-port 03/08 02:35
4F:→ colinshih:都自称"绳"了 我还有啥好说 ......... 03/09 21:07