OpenCores
URL https://opencores.org/ocsvn/xge_mac/xge_mac/trunk

Subversion Repositories xge_mac

[/] [xge_mac/] [trunk/] [rtl/] [verilog/] [tx_dequeue.v] - Diff between revs 21 and 23

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 21 Rev 23
Line 40... Line 40...
 
 
module tx_dequeue(/*AUTOARG*/
module tx_dequeue(/*AUTOARG*/
  // Outputs
  // Outputs
  txdfifo_ren, txhfifo_ren, txhfifo_wdata, txhfifo_wstatus,
  txdfifo_ren, txhfifo_ren, txhfifo_wdata, txhfifo_wstatus,
  txhfifo_wen, xgmii_txd, xgmii_txc, status_txdfifo_udflow_tog,
  txhfifo_wen, xgmii_txd, xgmii_txc, status_txdfifo_udflow_tog,
 
  status_good_frame_tx_tog, status_good_frame_tx_size,
  // Inputs
  // Inputs
  clk_xgmii_tx, reset_xgmii_tx_n, ctrl_tx_enable_ctx,
  clk_xgmii_tx, reset_xgmii_tx_n, ctrl_tx_enable_ctx,
  status_local_fault_ctx, status_remote_fault_ctx, txdfifo_rdata,
  status_local_fault_ctx, status_remote_fault_ctx, txdfifo_rdata,
  txdfifo_rstatus, txdfifo_rempty, txdfifo_ralmost_empty,
  txdfifo_rstatus, txdfifo_rempty, txdfifo_ralmost_empty,
  txhfifo_rdata, txhfifo_rstatus, txhfifo_rempty,
  txhfifo_rdata, txhfifo_rstatus, txhfifo_rempty,
Line 85... Line 86...
output [63:0] xgmii_txd;
output [63:0] xgmii_txd;
output [7:0]  xgmii_txc;
output [7:0]  xgmii_txc;
 
 
output        status_txdfifo_udflow_tog;
output        status_txdfifo_udflow_tog;
 
 
 
output        status_good_frame_tx_tog;
 
output [13:0] status_good_frame_tx_size;
 
 
 
 
 
 
/*AUTOREG*/
/*AUTOREG*/
// Beginning of automatic regs (for this module's undeclared outputs)
// Beginning of automatic regs (for this module's undeclared outputs)
 
reg [13:0]              status_good_frame_tx_size;
 
reg                     status_good_frame_tx_tog;
reg                     status_txdfifo_udflow_tog;
reg                     status_txdfifo_udflow_tog;
reg                     txdfifo_ren;
reg                     txdfifo_ren;
reg                     txhfifo_ren;
reg                     txhfifo_ren;
reg [63:0]              txhfifo_wdata;
reg [63:0]              txhfifo_wdata;
reg                     txhfifo_wen;
reg                     txhfifo_wen;
Line 159... Line 164...
reg   [7:0]     next_txhfifo_wstatus;
reg   [7:0]     next_txhfifo_wstatus;
reg             next_txhfifo_wen;
reg             next_txhfifo_wen;
 
 
reg             txdfifo_ren_d1;
reg             txdfifo_ren_d1;
 
 
 
reg             frame_end;
 
 
parameter [2:0]
parameter [2:0]
             SM_IDLE      = 3'd0,
             SM_IDLE      = 3'd0,
             SM_PREAMBLE  = 3'd1,
             SM_PREAMBLE  = 3'd1,
             SM_TX        = 3'd2,
             SM_TX        = 3'd2,
             SM_EOP       = 3'd3,
             SM_EOP       = 3'd3,
Line 243... Line 250...
        xgxs_txd <= {8{`IDLE}};
        xgxs_txd <= {8{`IDLE}};
        xgxs_txc <= 8'hff;
        xgxs_txc <= 8'hff;
 
 
        status_txdfifo_udflow_tog <= 1'b0;
        status_txdfifo_udflow_tog <= 1'b0;
 
 
 
        status_good_frame_tx_tog <= 1'b0;
 
        status_good_frame_tx_size <= 14'b0;
 
 
    end
    end
    else begin
    else begin
 
 
        curr_state_enc <= next_state_enc;
        curr_state_enc <= next_state_enc;
 
 
Line 288... Line 298...
 
 
        if (txdfifo_ren && txdfifo_rempty) begin
        if (txdfifo_ren && txdfifo_rempty) begin
            status_txdfifo_udflow_tog <= ~status_txdfifo_udflow_tog;
            status_txdfifo_udflow_tog <= ~status_txdfifo_udflow_tog;
        end
        end
 
 
 
        //---
 
        // Frame count and size
 
 
 
        if (frame_end) begin
 
            status_good_frame_tx_tog <= ~status_good_frame_tx_tog;
 
            status_good_frame_tx_size <= byte_cnt;
 
        end
 
 
    end
    end
 
 
end
end
 
 
always @(/*AS*/crc32_tx or ctrl_tx_enable_ctx or curr_state_enc or eop
always @(/*AS*/crc32_tx or ctrl_tx_enable_ctx or curr_state_enc or eop
Line 742... Line 760...
 
 
              // On EOP, decide if padding is required for this packet.
              // On EOP, decide if padding is required for this packet.
 
 
              if (txdfifo_rstatus[`TXSTATUS_EOP]) begin
              if (txdfifo_rstatus[`TXSTATUS_EOP]) begin
 
 
                  if (byte_cnt < 14'd56) begin
                  if (byte_cnt < 14'd60) begin
 
 
                      next_txhfifo_wstatus = `TXSTATUS_NONE;
                      next_txhfifo_wstatus = `TXSTATUS_NONE;
                      txdfifo_ren = 1'b0;
                      txdfifo_ren = 1'b0;
                      next_state_pad = SM_PAD_PAD;
                      next_state_pad = SM_PAD_PAD;
 
 
                  end
                  end
                  else if (byte_cnt == 14'd56 &&
                  else if (byte_cnt == 14'd60 &&
                           (txdfifo_rstatus[2:0] == 3'd1 ||
                           (txdfifo_rstatus[2:0] == 3'd1 ||
                            txdfifo_rstatus[2:0] == 3'd2 ||
                            txdfifo_rstatus[2:0] == 3'd2 ||
                            txdfifo_rstatus[2:0] == 3'd3)) begin
                            txdfifo_rstatus[2:0] == 3'd3)) begin
 
 
                      // Pad up to LANE3, keep the other 4 bytes for crc that will
                      // Pad up to LANE3, keep the other 4 bytes for crc that will
Line 794... Line 812...
 
 
              next_txhfifo_wdata = 64'b0;
              next_txhfifo_wdata = 64'b0;
              next_txhfifo_wstatus = `TXSTATUS_NONE;
              next_txhfifo_wstatus = `TXSTATUS_NONE;
              next_txhfifo_wen = 1'b1;
              next_txhfifo_wen = 1'b1;
 
 
              if (byte_cnt == 14'd56) begin
              if (byte_cnt == 14'd60) begin
 
 
 
 
                  // Pad up to LANE3, keep the other 4 bytes for crc that will
                  // Pad up to LANE3, keep the other 4 bytes for crc that will
                  // be inserted by dequeue engine.
                  // be inserted by dequeue engine.
 
 
Line 843... Line 861...
 
 
        crc32_d64 <= 32'b0;
        crc32_d64 <= 32'b0;
        crc32_d8 <= 32'b0;
        crc32_d8 <= 32'b0;
        crc32_tx <= 32'b0;
        crc32_tx <= 32'b0;
 
 
 
        frame_end <= 1'b0;
 
 
    end
    end
    else begin
    else begin
 
 
        curr_state_pad <= next_state_pad;
        curr_state_pad <= next_state_pad;
 
 
Line 854... Line 874...
 
 
        txhfifo_wdata <= next_txhfifo_wdata;
        txhfifo_wdata <= next_txhfifo_wdata;
        txhfifo_wstatus <= next_txhfifo_wstatus;
        txhfifo_wstatus <= next_txhfifo_wstatus;
        txhfifo_wen <= next_txhfifo_wen;
        txhfifo_wen <= next_txhfifo_wen;
 
 
 
        frame_end <= 1'b0;
 
 
        //---
        //---
        // Reset byte count on SOP
        // Reset byte count on SOP
 
 
        if (next_txhfifo_wen) begin
        if (next_txhfifo_wen) begin
 
 
            if (next_txhfifo_wstatus[`TXSTATUS_SOP]) begin
            if (next_txhfifo_wstatus[`TXSTATUS_SOP]) begin
 
 
                byte_cnt <= 14'd8;
                // Init byte count, 8-bytes + 4-bytes for CRC at the end of frame
 
 
 
                byte_cnt <= 14'd12;
 
 
 
            end
 
            else begin
 
 
 
                if (next_txhfifo_wstatus[`TXSTATUS_EOP] && next_txhfifo_wstatus[2:0] != 3'b0) begin
 
 
 
                    byte_cnt <= byte_cnt + {11'b0, next_txhfifo_wstatus[2:0]};
 
 
            end
            end
            else begin
            else begin
 
 
                byte_cnt <= byte_cnt + 14'd8;
                byte_cnt <= byte_cnt + 14'd8;
 
 
            end
            end
 
 
        end
        end
 
 
 
            frame_end <= next_txhfifo_wstatus[`TXSTATUS_EOP];
 
 
 
        end
 
 
 
 
        //---
        //---
        // Calculate CRC as data is written to holding fifo. The holding fifo creates
        // Calculate CRC as data is written to holding fifo. The holding fifo creates
        // a delay that allow the CRC calculation to complete before the end of the frame
        // a delay that allow the CRC calculation to complete before the end of the frame
        // is ready to be transmited.
        // is ready to be transmited.

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.