fixed FIFO implementation
Stefan Schuermans

Stefan Schuermans commited on 2012-03-06 20:47:36
Showing 1 changed files, with 4 additions and 4 deletions.

... ...
@@ -70,7 +70,7 @@ BEGIN
70 70
 
71 71
     s_ram_rd_addr <= std_logic_vector(to_unsigned(r_begin, addr_width));
72 72
 
73
-    s_rd_rdy <= '0' WHEN r_begin = r_end OR r_begin_chgd = '1' ELSE '1';
73
+    s_rd_rdy <= '0' WHEN r_begin = r_end_dly2 OR r_begin_chgd = '1' ELSE '1';
74 74
     s_wr_rdy <= '0' WHEN r_begin = next_pos(r_end)                  ELSE '1';
75 75
 
76 76
     o_rd_rdy <= s_rd_rdy;
... ...
@@ -114,13 +114,13 @@ BEGIN
114 114
                 r_ram_wr_addr <= std_logic_vector(to_unsigned(r_end, addr_width));
115 115
                 r_ram_wr_data <= i_wr_data;
116 116
                 r_ram_wr_en   <= '1';
117
-                r_end_dly2    <= next_pos(r_end);
117
+                r_end         <= next_pos(r_end);
118 118
             ELSE
119 119
                 r_ram_wr_en  <= '0';
120 120
             END IF;
121 121
             -- delay r_end 2 cycles: 1 for writing to RAM, 1 to read RAM
122
-            r_end_dly1 <= r_end_dly2;
123
-            r_end      <= r_end_dly1;
122
+            r_end_dly1 <= r_end;
123
+            r_end_dly2 <= r_end_dly1;
124 124
         END IF;
125 125
     END PROCESS p_fifo;
126 126
 
127 127