当前位置:网站首页>数字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
边栏推荐
- Paper reading - jukebox: a generic model for music
- regular expression
- 哈夫曼树及其应用
- 小程序 input,textarea组件权重比fixed的z-index都高
- [data analysis and visualization] key points of data drawing 3- spaghetti map
- An image is word 16x16 words: transformers for image recognition at scale
- redis
- 冲刺强基计划数学物理专题一
- Chapter7-12_ Controllable Chatbot
- 遍历数组,删除某元素,直到删除为止
猜你喜欢

微信云开发粗糙理解
![PCR validation of basic biological experiments in [life sciences]](/img/92/1cecb7cb4728937bd18b336ba4e606.jpg)
PCR validation of basic biological experiments in [life sciences]

Introduction and download of common data sets for in-depth learning (with network disk link)

0- blog notes guide directory (all)

Understand CRF

Opencv 15 face recognition and eye recognition

Port mapping between two computers on different LANs (anydesk)
![[data analysis and visualization] key points of data drawing 5- the problem of error line](/img/d7/a54129d2c7bdf7caf764f6f8db9fc1.jpg)
[data analysis and visualization] key points of data drawing 5- the problem of error line
![[reading papers] visual convolution zfnet](/img/01/4181f19b2d24b842488522c2001970.jpg)
[reading papers] visual convolution zfnet

Why does it feel that most papers still use RESNET as the backbone network rather than densenet?
随机推荐
Detailed explanation of data processing in machine learning (I) -- missing value processing (complete code attached)
Think about the possibility of attacking secure memory through mmu/tlb/cache
How did you spend your winter vacation perfectly?
Hstack, vstack and dstack in numpy
What are the differences in cache/tlb?
Use of OpenCV 11 kmeans clustering
[reading paper] generate confrontation network Gan
如何挑选基金产品?什么样的基金是好基金?
The precision of C language printf output floating point numbers
[data analysis and visualization] key points of data drawing 3- spaghetti map
redis. Conf general configuration details
[reading papers] deepface: closing the gap to human level performance in face verification. Deep learning starts with the face
Bi modal progressive mask attention for fine graded recognition
[common tools] pyautogui tutorial
House raiding
Introduction to armv8/armv9 - learning this article is enough
Leetcode 926. 将字符串翻转到单调递增 [前缀和]
Opencv 15 face recognition and eye recognition
Deep learning the principle of armv8/armv9 cache
Priority queue with dynamically changing priority