Skip to content

Commit 8858e23

Browse files
committed
fix(PTC): fix counter of headers read from Storage FIFO
1 parent b894092 commit 8858e23

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

comp/pcie/ptc/comp/storage_fifo/ptc_storage_fifo.vhd

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ architecture FULL of PTC_STORAGE_FIFO is
153153
signal mvb_fifo_rd : std_logic_vector(MVB_ITEMS-1 downto 0);
154154
signal mvb_fifo_empty : std_logic_vector(MVB_ITEMS-1 downto 0);
155155
signal safe_mvb_items_reg : unsigned(log2(MAIN_FIFO_ITEMS*MFB_REGIONS+1)-1 downto 0);
156-
signal mvb_items_vld_cnt : unsigned(log2(MVB_ITEMS+1)-1 downto 0);
157156

158157
-- Main MFB FIFO input
159158
signal main_mfb_fifo_in_data : std_logic_vector(MFB_REGIONS*MFB_REG_SIZE*MFB_BLOCK_SIZE*MFB_ITEM_WIDTH-1 downto 0);
@@ -334,9 +333,11 @@ begin
334333

335334
-- substract 1 for every MVB item read from main MVB FIFO
336335
decrement := (others => '0');
337-
if (TX_MVB_SRC_RDY = '1' and TX_MVB_DST_RDY = '1') then
338-
decrement := mvb_items_vld_cnt;
339-
end if;
336+
for i in 0 to MVB_ITEMS-1 loop
337+
if (TX_MVB_SRC_RDY = '1' and TX_MVB_DST_RDY = '1' and TX_MVB_VLD(i) = '1') then
338+
decrement := decrement+1;
339+
end if;
340+
end loop;
340341

341342
-- set new register value
342343
safe_mvb_items_reg <= safe_mvb_items_reg + resize(increment,safe_mvb_items_reg'length) - resize(decrement,safe_mvb_items_reg'length);
@@ -417,21 +418,16 @@ begin
417418

418419
-- safe MVB items checking
419420
safe_mvb_items_check_pr : process (safe_mvb_items_reg,TX_MVB_DST_RDY,mvb_fifo_empty)
420-
variable items : unsigned(log2(MVB_ITEMS+1)-1 downto 0);
421421
begin
422422
-- read from FIFO, send TX MVB, count number of sent items
423423
mvb_fifo_rd <= (others => '0');
424424
TX_MVB_VLD <= (others => '0');
425-
items := (others => '0');
426425
for i in 0 to MVB_ITEMS-1 loop
427426
if (i < safe_mvb_items_reg) then
428427
mvb_fifo_rd(i) <= TX_MVB_DST_RDY;
429428
TX_MVB_VLD (i) <= not mvb_fifo_empty(i);
430-
items := items+1;
431429
end if;
432430
end loop;
433-
434-
mvb_items_vld_cnt <= items;
435431
end process;
436432

437433
TX_MVB_SRC_RDY <= (or TX_MVB_VLD);

0 commit comments

Comments
 (0)