Line 144... |
Line 144... |
`define TXCLK i_wb_clk
|
`define TXCLK i_wb_clk
|
`else
|
`else
|
`define TXCLK i_net_tx_clk
|
`define TXCLK i_net_tx_clk
|
`endif
|
`endif
|
module enetpackets(i_wb_clk, i_reset,
|
module enetpackets(i_wb_clk, i_reset,
|
i_wb_cyc, i_wb_stb, i_wb_we, i_wb_addr, i_wb_data,
|
i_wb_cyc, i_wb_stb, i_wb_we, i_wb_addr, i_wb_data, i_wb_sel,
|
o_wb_ack, o_wb_stall, o_wb_data,
|
o_wb_ack, o_wb_stall, o_wb_data,
|
//
|
//
|
o_net_reset_n,
|
o_net_reset_n,
|
i_net_rx_clk, i_net_col, i_net_crs, i_net_dv, i_net_rxd, i_net_rxerr,
|
i_net_rx_clk, i_net_col, i_net_crs, i_net_dv, i_net_rxd, i_net_rxerr,
|
i_net_tx_clk, o_net_tx_en, o_net_txd,
|
i_net_tx_clk, o_net_tx_en, o_net_txd,
|
Line 163... |
Line 163... |
input i_wb_clk, i_reset;
|
input i_wb_clk, i_reset;
|
//
|
//
|
input i_wb_cyc, i_wb_stb, i_wb_we;
|
input i_wb_cyc, i_wb_stb, i_wb_we;
|
input [(MAW+1):0] i_wb_addr; // 1-bit for ctrl/data, 1 for tx/rx
|
input [(MAW+1):0] i_wb_addr; // 1-bit for ctrl/data, 1 for tx/rx
|
input [31:0] i_wb_data;
|
input [31:0] i_wb_data;
|
|
input [3:0] i_wb_sel;
|
//
|
//
|
output reg o_wb_ack;
|
output reg o_wb_ack;
|
output wire o_wb_stall;
|
output wire o_wb_stall;
|
output reg [31:0] o_wb_data;
|
output reg [31:0] o_wb_data;
|
//
|
//
|
Line 185... |
Line 186... |
output wire [31:0] o_debug;
|
output wire [31:0] o_debug;
|
|
|
reg wr_ctrl;
|
reg wr_ctrl;
|
reg [2:0] wr_addr;
|
reg [2:0] wr_addr;
|
reg [31:0] wr_data;
|
reg [31:0] wr_data;
|
|
reg [3:0] wr_sel;
|
always @(posedge i_wb_clk)
|
always @(posedge i_wb_clk)
|
begin
|
begin
|
wr_ctrl<=((i_wb_stb)&&(i_wb_we)&&(i_wb_addr[(MAW+1):MAW] == 2'b00));
|
wr_ctrl<=((i_wb_stb)&&(i_wb_we)&&(i_wb_addr[(MAW+1):MAW] == 2'b00));
|
wr_addr <= i_wb_addr[2:0];
|
wr_addr <= i_wb_addr[2:0];
|
wr_data <= i_wb_data;
|
wr_data <= i_wb_data;
|
|
wr_sel <= i_wb_sel;
|
end
|
end
|
|
|
reg [31:0] txmem [0:((1<<MAW)-1)];
|
reg [31:0] txmem [0:((1<<MAW)-1)];
|
reg [31:0] rxmem [0:((1<<MAW)-1)];
|
reg [31:0] rxmem [0:((1<<MAW)-1)];
|
|
|
Line 241... |
Line 244... |
initial rx_clear = 1'b0;
|
initial rx_clear = 1'b0;
|
always @(posedge i_wb_clk)
|
always @(posedge i_wb_clk)
|
begin
|
begin
|
// if (i_wb_addr[(MAW+1):MAW] == 2'b10)
|
// if (i_wb_addr[(MAW+1):MAW] == 2'b10)
|
// Writes to rx memory not allowed here
|
// Writes to rx memory not allowed here
|
if ((i_wb_stb)&&(i_wb_we)&&(i_wb_addr[(MAW+1):MAW] == 2'b11))
|
if ((i_wb_stb)&&(i_wb_we)&&(i_wb_addr[(MAW+1):MAW] == 2'b11)
|
txmem[i_wb_addr[(MAW-1):0]] <= i_wb_data;
|
&&(i_wb_sel[3]))
|
|
txmem[i_wb_addr[(MAW-1):0]][31:24] <= i_wb_data[31:24];
|
|
if ((i_wb_stb)&&(i_wb_we)&&(i_wb_addr[(MAW+1):MAW] == 2'b11)
|
|
&&(i_wb_sel[2]))
|
|
txmem[i_wb_addr[(MAW-1):0]][23:16] <= i_wb_data[23:16];
|
|
if ((i_wb_stb)&&(i_wb_we)&&(i_wb_addr[(MAW+1):MAW] == 2'b11)
|
|
&&(i_wb_sel[1]))
|
|
txmem[i_wb_addr[(MAW-1):0]][15:8] <= i_wb_data[15:8];
|
|
if ((i_wb_stb)&&(i_wb_we)&&(i_wb_addr[(MAW+1):MAW] == 2'b11)
|
|
&&(i_wb_sel[0]))
|
|
txmem[i_wb_addr[(MAW-1):0]][7:0] <= i_wb_data[7:0];
|
|
|
// Set the err bits on these conditions (filled out below)
|
// Set the err bits on these conditions (filled out below)
|
if (rx_err_stb)
|
if (rx_err_stb)
|
rx_err <= 1'b1;
|
rx_err <= 1'b1;
|
if (rx_miss_stb)
|
if (rx_miss_stb)
|