ISE中FIFO IP核的Standard FIFO和First-word-Fall-Through模式的仿真比較

ISE下的FIFO IP核有Standard FIFO和First-word-Fall-Through兩種模式,相對於標準模式FWFT(First-word-Fall-Through)能夠不須要讀命令,自動的將最新數據放在dout上。spa

接下來分別對兩種模式下的FIFO進行仿真,testbench以下code

 1 module fifo_test;  2 
 3     // Inputs
 4     reg rst;  5     reg wr_clk;  6     reg rd_clk;  7     reg [15:0] din;  8     reg wr_en;  9     reg rd_en; 10 
11     // Outputs
12     wire [7:0] dout; 13     wire full; 14     wire empty; 15     wire [13:0] rd_data_count; 16 
17     // Instantiate the Unit Under Test (UUT)
18  write_fifo uut ( 19  .rst(rst), 20  .wr_clk(wr_clk), 21  .rd_clk(rd_clk), 22  .din(din), 23  .wr_en(wr_en), 24  .rd_en(rd_en), 25  .dout(dout), 26  .full(full), 27  .empty(empty), 28  .rd_data_count(rd_data_count) 29  ); 30     
31     always #5 wr_clk = ~wr_clk; 32     always #5 rd_clk = ~rd_clk; 33     
34 
35     initial begin
36         // Initialize Inputs
37         rst = 0; 38         wr_clk = 0; 39         rd_clk = 0; 40         din = 0; 41         wr_en = 0; 42         rd_en = 0; 43 
44         // Wait 100 ns for global reset to finish
45         #100; 46         din = 8193; 47         wr_en = 1; 48         repeat(8192) 49         #10 din = din - 1; 50         #10
51         wr_en = 0; 52         #100
53         rd_en = 1; 54         #163840
55         rd_en = 0; 56         #10; 57  $stop; 58         
59         
60         // Add stimulus here
61 
62     end
63       
64 endmodule

兩次仿真FIFO的配置都同樣,寫位寬爲16,寫深度爲8192,讀位寬爲8,讀深度爲16384.blog

 

圖一爲標準FIFO的仿真截圖,圖二爲FWFT模式的仿真截圖it

圖二中在讀信號有效以前,dout即輸出了最新的數據。class

另外須要注意的有:test

1,FIFO的實際有效深度爲理論深度減。。module

2,FIFO中的rd_data_count信號指示的是FIFO前幾拍時的狀態,即在連續寫入2個數據時,rd_data_count依然爲0.配置

相關文章
相關標籤/搜索