improve ethernet busmaster (TX) critical path
Stefan Schuermans

Stefan Schuermans commited on 2012-04-03 20:23:25
Showing 1 changed files, with 7 additions and 2 deletions.

... ...
@@ -533,6 +533,7 @@ BEGIN
533 533
     -- TX busmaster read state machine
534 534
     p_tx_rd_next: PROCESS(r_tx_pos, r_tx_rem, r_tx_start, r_tx_end,
535 535
                           s_txframe_en, s_txbuf_wr_en)
536
+       VARIABLE v_rem: signed(31 DOWNTO 0);
536 537
     BEGIN
537 538
         n_tx_pos <= r_tx_pos;
538 539
         n_tx_rem <= r_tx_rem;
... ...
@@ -541,7 +542,11 @@ BEGIN
541 542
             n_tx_rem <= signed(r_tx_end) - signed(r_tx_start);
542 543
         ELSIF s_txbuf_wr_en = '1' THEN
543 544
             n_tx_pos <= std_logic_vector(unsigned(r_tx_pos) + X"00000004");
544
-            n_tx_rem <= r_tx_rem - X"00000004";
545
+            v_rem := r_tx_rem - X"00000004";
546
+            IF v_rem < X"00000000" THEN
547
+                v_rem := X"00000000";
548
+            END IF;
549
+            n_tx_rem <= v_rem;
545 550
         END IF;
546 551
     END PROCESS p_tx_rd_next;
547 552
 
... ...
@@ -597,7 +602,7 @@ BEGIN
597 602
         --         space in buffer
598 603
         --   write: write request in write buffer
599 604
         v_read  := r_bm_rd = '0' AND r_tx_en = '1' AND
600
-                   r_tx_rem > X"00000000" AND s_txbuf_wr_rdy = '1';
605
+                   r_tx_rem /= X"00000000" AND s_txbuf_wr_rdy = '1';
601 606
         v_write := s_wrbuf_rd_rdy = '1';
602 607
         -- read access
603 608
         IF v_read THEN
604 609