基于verilog hdl 硬件描语言的fifo设计

基于verilog hdl 硬件描语言的fifo设计

ID:3153159

大小:187.50 KB

页数:24页

时间:2017-11-20

基于verilog hdl 硬件描语言的fifo设计_第1页
基于verilog hdl 硬件描语言的fifo设计_第2页
基于verilog hdl 硬件描语言的fifo设计_第3页
基于verilog hdl 硬件描语言的fifo设计_第4页
基于verilog hdl 硬件描语言的fifo设计_第5页
资源描述:

《基于verilog hdl 硬件描语言的fifo设计》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、RTLschematic基于verilogHDL硬件描语言的FIFO设计一、设计描述设计一个宽度为32位,深度为8的FIFO,要求根据读写控制输入输出32位数据,并在输出端以低电平有效给出空态(empyt_n),满态(full_n),几乎空(first_n),几乎满(last_n),以及差2位满(slast_n)的标志信号。二、RTLschematic24RTL源代码三、RTL源代码//--------------------------------------------------------------------

2、-----------------------------//Filename:fifo_ctrl.v--------xjy//------------------------------------------------------------------------------------------------//`timescale1ns/1psmodulefifo_ctrl(clk,rst_n,wrt_strobe_n,rd_strobe_n,//clr_n,rd_ptr,wrt_ptr,full_n,emp

3、ty_n,last_n,slast_n,first_n);inputclk;//FIFOclockdomaininputrst_n;//FIFOreset,activelowinputwrt_strobe_n;//fifowritestrobe,activelowinputrd_strobe_n;//fiforeadstrobe,activelow//inputclr_n;//clearsignal,activelowoutput[2:0]rd_ptr;//readpointertoregfileoutput[2:0]w

4、rt_ptr;//writepointertoregfileoutputfull_n;//fifofullindicator,activelowoutputempty_n;//fifoemptyindicator,activelowoutputlast_n;//indicateonespaceinfifo,activelowoutputslast_n;//indicatetwospaceinfifo,activelowoutputfirst_n;//indicateonlyonedatainfifo,activelowr

5、eg[2:0]rd_ptr;reg[2:0]wrt_ptr;wirefull_n,empty_n,last_n,slast_n,first_n;reg[3:0]reg_count;///////////////////writepointer////////////////////////always@(posedgeclkornegedgerst_n)beginif(!rst_n)wrt_ptr<=3'b0;elseif(wrt_ptr==3'b111)wrt_ptr<=0;elseif((!wrt_strobe_n)

6、&&(full_n)&&(rd_strobe_n))begin24RTL源代码wrt_ptr<=(wrt_ptr+1);//wr_mark<=1;endelsebeginwrt_ptr<=wrt_ptr;//wr_mark<=0;endend///////////////////readpointer/////////////////////always@(posedgeclkornegedgerst_n)beginif(!rst_n)rd_ptr<=3'b0;elseif(rd_ptr==3'b111)rd_ptr<=

7、0;elseif((!rd_strobe_n)&&(empty_n)&&(wrt_strobe_n))beginrd_ptr<=(rd_ptr+1);//rd_mark<=1;endelsebeginrd_ptr<=rd_ptr;//rd_mark<=0;endend//////////registercounter:from0(empty)to8(full)////////always@(posedgeclkornegedgerst_n)beginif(!rst_n)reg_count<=0;elsecasez({wr

8、t_strobe_n,rd_strobe_n})2'b01:reg_count<=(full_n)?(reg_count+1):reg_count;//write---count+12'b10:reg_count<=(empty_n)?(reg_count-1):reg_count;//read---count-1d

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

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

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