2 // RX side of flow control -- when we are running out of RX space, send a PAUSE
\r
7 input pause_frame_send_en,
\r
8 input [15:0] pause_quanta_set,
\r
9 input [15:0] fc_hwmark,
\r
10 input [15:0] fc_lwmark,
\r
11 input [15:0] fc_padtime,
\r
14 input [15:0] rx_fifo_space,
\r
17 output reg xoff_gen,
\r
19 input xoff_gen_complete,
\r
20 input xon_gen_complete
\r
23 // ******************************************************************************
\r
24 // Force our TX to send a PAUSE frame because our RX is nearly full
\r
25 // ******************************************************************************
\r
27 reg xon_int, xoff_int;
\r
28 reg [21:0] countdown;
\r
30 always @(posedge rx_clk or posedge rst)
\r
40 if(pause_frame_send_en)
\r
42 if(rx_fifo_space < fc_lwmark)
\r
47 if(rx_fifo_space > fc_hwmark)
\r
49 end // else: !if(rst)
\r
51 reg xoff_int_d1, xon_int_d1;
\r
53 always @(posedge rx_clk)
\r
54 xon_int_d1 <= xon_int;
\r
55 always @(posedge rx_clk)
\r
56 xoff_int_d1 <= xoff_int;
\r
58 always @ (posedge tx_clk or posedge rst)
\r
61 else if (xoff_gen_complete)
\r
63 else if (xoff_int | xoff_int_d1)
\r
66 always @ (posedge tx_clk or posedge rst)
\r
69 else if (xon_gen_complete)
\r
71 else if (xon_int | xon_int_d1)
\r
74 wire [21:0] pq_reduced = {pause_quanta_set,6'd0} - {6'd0,fc_padtime};
\r
76 always @(posedge tx_clk or posedge rst)
\r
80 countdown <= pq_reduced;
\r
83 else if(countdown != 0)
\r
84 countdown <= countdown - 1;
\r
86 endmodule // flow_ctrl
\r