3 (input clk, input rst, input mac_clk,
8 output [31:0] Tx_mac_data,
9 output [1:0] Tx_mac_BE,
13 // To buffer interface
14 input [31:0] rd_dat_i,
22 output [15:0] fifo_occupied,
26 wire empty, full, sfifo_write, sfifo_read;
27 wire [33:0] sfifo_in, sfifo_out;
30 shortfifo #(.WIDTH(34)) txmac_sfifo
31 (.clk(clk),.rst(rst),.clear(0),
32 .datain(sfifo_in),.write(sfifo_write),.full(full),
33 .dataout(sfifo_out),.read(sfifo_read),.empty(empty));
35 fifo_xlnx_512x36_2clk mac_tx_fifo_2clk
37 .wr_clk(clk),.din({2'b0,sfifo_in}),.full(full),.wr_en(sfifo_write),.wr_data_count(fifo_occupied[8:0]),
38 .rd_clk(mac_clk),.dout(sfifo_out),.empty(empty),.rd_en(sfifo_read),.rd_data_count() );
39 assign fifo_occupied[15:9] = 0;
40 assign fifo_full = full;
41 assign fifo_empty = empty; // Note empty is in wrong clock domain
44 // We are allowed to do one more write after we are told the FIFO is full
45 // This allows us to register the _wa signal and speed up timing.
49 tx_mac_wa_d1 <= Tx_mac_wa;
51 assign sfifo_read = ~empty & tx_mac_wa_d1;
53 assign Tx_mac_wr = sfifo_read;
54 assign Tx_mac_data = sfifo_out[31:0];
55 assign Tx_mac_BE = 0; // Since we only deal with packets that are multiples of 32 bits long
56 assign Tx_mac_sop = sfifo_out[33];
57 assign Tx_mac_eop = sfifo_out[32];
60 // BUFFER side signals
65 else if(rd_eop_i & ~full)
70 assign sfifo_in = {rd_sop_i, rd_eop_i, rd_dat_i};
71 assign sfifo_write = xfer_active & ~full;
73 assign rd_read_o = sfifo_write;
74 assign rd_done_o = 0; // Always send everything we're given?
75 assign rd_error_o = 0; // No possible error situations?
77 endmodule // mac_txfifo_int