【vhdl 程序举例大全-存储器举例:(注3)】

【vhdl 程序举例大全-存储器举例:(注3)】

ID:15905759

大小:73.36 KB

页数:2页

时间:2018-08-06

【vhdl 程序举例大全-存储器举例:(注3)】_第1页
【vhdl 程序举例大全-存储器举例:(注3)】_第2页
资源描述:

《【vhdl 程序举例大全-存储器举例:(注3)】》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库

1、【VHDL程序举例大全-存储器举例:(注3)】--AFirst-inFirst-outMemory--afirst-infirstoutmemory,usesasynchronisingclock--genericsallowfifosofdifferentsizestobeinstantiatedlibraryIEEE;useIEEE.Std_logic_1164.all;entityFIFOMXNisgeneric(m,n:Positive:=8);--misfifodepth,nisfifowidthpor

2、t(RESET,WRREQ,RDREQ,CLOCK:inStd_logic;DATAIN:inStd_logic_vector((n-1)downto0);DATAOUT:outStd_logic_vector((n-1)downto0);FULL,EMPTY:inoutStd_logic);endFIFOMXN;architectureV2ofFIFOMXNistypeFifo_arrayisarray(0to(m-1))ofBit_vector((n-1)downto0);signalFifo_memory:

3、Fifo_array;signalWraddr,Rdaddr,Offset:Naturalrange0to(m-1);signalRdpulse,Wrpulse,Q1,Q2,Q3,Q4:Std_logic;signalDatabuffer:Bit_vector((n-1)downto0);begin--pulsesynchronisersforWRREQandRDREQ--modifiedforSynplifytoaprocesssync_ffs:processbeginwaituntilrising_edge(

4、CLOCK);Q1<=WRREQ;Q2<=Q1;Q3<=RDREQ;Q4<=Q3;endprocess;--concurrentlogictogeneratepulsesWrpulse<=Q2andnot(Q1);Rdpulse<=Q4andnot(Q3);Fifo_read:processbeginwaituntilrising_edge(CLOCK);ifRESET='1'thenRdaddr<=0;Databuffer<=(others=>'0');elsif(Rdpulse='1'andEMPTY='0'

5、)thenDatabuffer<=Fifo_memory(Rdaddr);Rdaddr<=(Rdaddr+1)modm;endif;endprocess;Fifo_write:processbeginwaituntilrising_edge(CLOCK);ifRESET='1'thenWraddr<=0;elsif(Wrpulse='1'andFULL='0')thenFifo_memory(Wraddr)<=To_Bitvector(DATAIN);Wraddr<=(Wraddr+1)modm;endif;en

6、dprocess;Offset<=(Wraddr-Rdaddr)when(Wraddr>Rdaddr)else(m-(Rdaddr-Wraddr))when(Rdaddr>Wraddr)else0;EMPTY<='1'when(Offset=0)else'0';FULL<='1'when(Offset=(m-1))else'0';DATAOUT<=To_Stdlogicvector(Databuffer)whenRDREQ='0'else(others=>'Z');endV2;

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。