当前位置:网站首页>数字IC设计——FIFO的设计
数字IC设计——FIFO的设计
2022-06-13 02:40:00 【蜻蜓队长c】
fifo.v
module fifo( input rstn , input clk , input wr_en , input rd_en , input [7:0] wr_dat , output reg [7:0] rd_dat , output empty , output full ); reg [7:0] mem [0:255]; reg [8:0] wr_addr; reg [8:0] rd_addr; always @(posedge clk or negedge rstn) begin if(!rstn) wr_addr <= 9'd0; else if(wr_en && ~full) wr_addr <= wr_addr + 9'd1; end always @(posedge clk or negedge rstn) begin if(!rstn) rd_addr <= 9'd0; else if(rd_en && ~empty) rd_addr <= rd_addr + 9'd1; end assign full = (wr_addr[8]^rd_addr[8])&(wr_addr[7:0] == rd_addr[7:0]); assign empty = (wr_addr==rd_addr); integer i; always @(posedge clk or negedge rstn) begin if(!rstn) begin for(i=0;i<=255;i=i+1) mem[i] <= 8'd0; end else if(wr_en && ~full) mem[wr_addr] <= wr_dat; end always @(posedge clk or negedge rstn) begin if(!rstn) rd_dat <= 8'd0; else if(rd_en && ~empty) rd_dat <= mem[rd_addr]; end endmodule
边栏推荐
- js多种判断写法
- Understand CRF
- [data and Analysis Visualization] data operation in D3 tutorial 3-d3
- 遍历数组,删除某元素,直到删除为止
- too old resource version,Code:410
- How to destroy a fragment- How to destroy Fragment?
- 0- blog notes guide directory (all)
- Opencvshare4 and vs2019 configuration
- GMM Gaussian mixture model
- [reading point paper] yolo9000:better, faster, stronger, (yolov2), integrating various methods to improve the idea of map and wordtree data fusion
猜你喜欢

How did you spend your winter vacation perfectly?

Detailed installation tutorial of MATLAB r2019 B-mode ultrasound (complete installation files are attached)

Chapter7-11_ Deep Learning for Question Answering (2/2)

Stm32f4 DMA Da sine wave generator keil5 Hal library cubemx

Paper reading - group normalization

在IDEA使用C3P0連接池連接SQL數據庫後卻不能顯示數據庫內容

regular expression

Queuing theory, game theory, analytic hierarchy process

02 优化微信开发者工具默认的结构
![Leetcode 926. 将字符串翻转到单调递增 [前缀和]](/img/ca/d23c1927bc32393cf023c748e4b449.png)
Leetcode 926. 将字符串翻转到单调递增 [前缀和]
随机推荐
A real-time target detection model Yolo
微信云开发粗糙理解
[reading papers] comparison of deeplobv1-v3 series, brief review
js 解构赋值
Several articles on norms
Stm32f4 DMA Da sine wave generator keil5 Hal library cubemx
Paper reading - jukebox: a generic model for music
Jump model between mirrors
Laravel 权限导出
02 optimize the default structure of wechat developer tools
Is space time attention all you need for video understanding?
Opencv 9 resize size change rotate rotate blur mean (blur)
Introduction and download of common data sets for in-depth learning (with network disk link)
Surpass the strongest variant of RESNET! Google proposes a new convolution + attention network: coatnet, with an accuracy of 89.77%!
[reading point paper] yolo9000:better, faster, stronger, (yolov2), integrating various methods to improve the idea of map and wordtree data fusion
Useful websites for writing papers and studying at ordinary times
如何挑选基金产品?什么样的基金是好基金?
[reading papers] dcgan, the combination of generating countermeasure network and deep convolution
[data analysis and visualization] key points of data drawing 8- use of circular bar chart
OpenCVSharpSample04WinForms