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
13 input [15:0] rx_fifo_space,
\r
16 output reg xoff_gen,
\r
18 input xoff_gen_complete,
\r
19 input xon_gen_complete
\r
22 // ******************************************************************************
\r
23 // Force our TX to send a PAUSE frame because our RX is nearly full
\r
24 // ******************************************************************************
\r
26 reg xon_int, xoff_int;
\r
27 reg [21:0] countdown;
\r
29 always @(posedge rx_clk or posedge rst)
\r
39 if(pause_frame_send_en)
\r
41 if(rx_fifo_space < fc_lwmark)
\r
46 if(rx_fifo_space > fc_hwmark)
\r
48 end // else: !if(rst)
\r
50 reg xoff_int_d1, xon_int_d1;
\r
52 always @(posedge rx_clk)
\r
53 xon_int_d1 <= xon_int;
\r
54 always @(posedge rx_clk)
\r
55 xoff_int_d1 <= xoff_int;
\r
57 always @ (posedge tx_clk or posedge rst)
\r
60 else if (xoff_gen_complete)
\r
62 else if (xoff_int | xoff_int_d1)
\r
65 always @ (posedge tx_clk or posedge rst)
\r
68 else if (xon_gen_complete)
\r
70 else if (xon_int | xon_int_d1)
\r
73 wire [15:0] pq_reduced = pause_quanta_set - 2;
\r
75 always @(posedge tx_clk or posedge rst)
\r
79 countdown <= {pq_reduced,6'd0};
\r
82 else if(countdown != 0)
\r
83 countdown <= countdown - 1;
\r
85 endmodule // flow_ctrl
\r