1. 程式人生 > >ISE中FIFO IP核的Standard FIFO和First-word-Fall-Through模式的模擬比較

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

ISE下的FIFO IP核有Standard FIFO和First-word-Fall-Through兩種模式,相對於標準模式FWFT(First-word-Fall-Through)可以不需要讀命令,自動的將最新資料放在dout上。

接下來分別對兩種模式下的FIFO進行模擬,testbench如下

 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.

 

圖一為標準FIFO的模擬截圖,圖二為FWFT模式的模擬截圖

圖二中在讀訊號有效之前,dout即輸出了最新的資料。

另外需要注意的有:

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

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