当前位置:网站首页>Digital IC Design -- FIFO design
Digital IC Design -- FIFO design
2022-06-13 02:41:00 【Dragonfly captain 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
边栏推荐
- Change the topic of change tax
- wx.createSelectorQuery()在components获取Dom节点的使用
- Basic principle of bilateral filtering
- Pycharm and Anaconda ultra detailed installation and configuration tutorial
- Useful websites for writing papers and studying at ordinary times
- Detailed explanation of data processing in machine learning (I) -- missing value processing (complete code attached)
- 在IDEA使用C3P0连接池连接SQL数据库后却不能显示数据库内容
- Data processing in detailed machine learning (II) -- Feature Normalization
- Several articles on norms
- 遍历数组,删除某元素,直到删除为止
猜你喜欢

05 tabbar navigation bar function

Is space time attention all you need for video understanding?

OneNote User Guide (1)

How can intelligent safe power distribution devices reduce the occurrence of electrical fire accidents?

微信云开发粗糙理解

Graph theory, tree based concept

Bi modal progressive mask attention for fine graded recognition

Use of OpenCV 12 findcircuits and drawcircuits

01 初识微信小程序

How did you spend your winter vacation perfectly?
随机推荐
Welcome to blog navigation
[dest0g3 520 orientation] dest0g3, which has been a long time since we got WP_ heap
C # illustrated tutorial (Fourth Edition) chapter7-7.2 accessing inherited members
Termux SSH first shell start
Exam23 named windows and simplified paths, grayscale conversion
Matlab: obtain the figure edge contour and divide the figure n equally
L1 regularization and its sparsity
Paper reading - joint beat and downbeat tracking with recurrent neural networks
Ffmpeg principle
Leetcode 450. 删除二叉搜索树中的节点 [二叉搜索树]
[reading papers] deep learning face representation from predicting 10000 classes. deepID
How to destroy a fragment- How to destroy Fragment?
如何挑选基金产品?什么样的基金是好基金?
Huffman tree and its application
Model prediction of semantic segmentation
redis. Conf general configuration details
Change tax for 2
[reading papers] deep learning face representation by joint identification verification, deep learning applied to optimization problems, deepid2
Basic principle of bilateral filtering
[data analysis and visualization] key points of data drawing 3- spaghetti map