Line 55... |
Line 55... |
module wbm2axisp #(
|
module wbm2axisp #(
|
parameter C_AXI_ID_WIDTH = 6, // The AXI id width used for R&W
|
parameter C_AXI_ID_WIDTH = 6, // The AXI id width used for R&W
|
// This is an int between 1-16
|
// This is an int between 1-16
|
parameter C_AXI_DATA_WIDTH = 128,// Width of the AXI R&W data
|
parameter C_AXI_DATA_WIDTH = 128,// Width of the AXI R&W data
|
parameter AW = 28, // Wishbone address width
|
parameter AW = 28, // Wishbone address width
|
parameter DW = 32, // Wishbone data width
|
parameter DW = 128, // Wishbone data width
|
parameter STRICT_ORDER = 0 // Reorder, or not? 0 -> Reorder
|
parameter STRICT_ORDER = 0 // Reorder, or not? 0 -> Reorder
|
) (
|
) (
|
input i_clk, // System clock
|
input i_clk, // System clock
|
input i_reset,// Wishbone reset signal
|
input i_reset,// Wishbone reset signal
|
|
|
Line 113... |
Line 113... |
input i_wb_cyc,
|
input i_wb_cyc,
|
input i_wb_stb,
|
input i_wb_stb,
|
input i_wb_we,
|
input i_wb_we,
|
input [AW-1:0] i_wb_addr,
|
input [AW-1:0] i_wb_addr,
|
input [DW-1:0] i_wb_data,
|
input [DW-1:0] i_wb_data,
|
input [3:0] i_wb_sel,
|
input [(DW/8-1):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 [DW-1:0] o_wb_data,
|
output reg [DW-1:0] o_wb_data,
|
output reg o_wb_err
|
output reg o_wb_err
|
);
|
);
|
Line 203... |
Line 203... |
||(o_wb_stall)&&(o_axi_rvalid)&&(!i_axi_rready);
|
||(o_wb_stall)&&(o_axi_rvalid)&&(!i_axi_rready);
|
|
|
|
|
// Write data logic
|
// Write data logic
|
assign o_axi_wd_wid = transaction_id;
|
assign o_axi_wd_wid = transaction_id;
|
|
|
|
generate
|
|
if (DW == 32)
|
|
begin
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
if (!o_wb_stall)
|
if (!o_wb_stall)
|
o_axi_wd_data <= { i_wb_data, i_wb_data, i_wb_data, i_wb_data };
|
o_axi_wd_data <= { i_wb_data, i_wb_data, i_wb_data, i_wb_data };
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
if (!o_wb_stall)
|
if (!o_wb_stall)
|
Line 214... |
Line 218... |
2'b00:o_axi_wd_strb<={ 4'h0, 4'h0, 4'h0, i_wb_sel };
|
2'b00:o_axi_wd_strb<={ 4'h0, 4'h0, 4'h0, i_wb_sel };
|
2'b01:o_axi_wd_strb<={ 4'h0, 4'h0, i_wb_sel, 4'h0 };
|
2'b01:o_axi_wd_strb<={ 4'h0, 4'h0, i_wb_sel, 4'h0 };
|
2'b10:o_axi_wd_strb<={ 4'h0, i_wb_sel, 4'h0, 4'h0 };
|
2'b10:o_axi_wd_strb<={ 4'h0, i_wb_sel, 4'h0, 4'h0 };
|
2'b11:o_axi_wd_strb<={ i_wb_sel, 4'h0, 4'h0, 4'h0 };
|
2'b11:o_axi_wd_strb<={ i_wb_sel, 4'h0, 4'h0, 4'h0 };
|
endcase
|
endcase
|
|
end else if (DW == 128)
|
|
begin
|
|
always @(posedge i_clk)
|
|
if (!o_wb_stall)
|
|
o_axi_wd_data <= i_wb_data;
|
|
always @(posedge i_clk)
|
|
if (!o_wb_stall)
|
|
o_axi_wd_strb <= i_wb_sel;
|
|
end endgenerate
|
|
|
assign o_axi_wd_last = 1'b1;
|
assign o_axi_wd_last = 1'b1;
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
o_axi_wd_valid <= ((!o_wb_stall)&&(i_wb_stb)&&(i_wb_we))
|
o_axi_wd_valid <= ((!o_wb_stall)&&(i_wb_stb)&&(i_wb_we))
|
||(o_wb_stall)&&(o_axi_wd_valid)&&(!i_axi_wd_wready);
|
||(o_wb_stall)&&(o_axi_wd_valid)&&(!i_axi_wd_wready);
|
|
|
Line 236... |
Line 250... |
// FIFO reorder buffer
|
// FIFO reorder buffer
|
reg [(LGFIFOLN-1):0] fifo_tail;
|
reg [(LGFIFOLN-1):0] fifo_tail;
|
reg [(C_AXI_DATA_WIDTH-1):0] reorder_fifo_data [0:(FIFOLN-1)];
|
reg [(C_AXI_DATA_WIDTH-1):0] reorder_fifo_data [0:(FIFOLN-1)];
|
reg [(FIFOLN-1):0] reorder_fifo_valid;
|
reg [(FIFOLN-1):0] reorder_fifo_valid;
|
reg [(FIFOLN-1):0] reorder_fifo_err;
|
reg [(FIFOLN-1):0] reorder_fifo_err;
|
|
|
|
if (DW == 32)
|
|
begin
|
reg [1:0] reorder_fifo_addr [0:(FIFOLN-1)];
|
reg [1:0] reorder_fifo_addr [0:(FIFOLN-1)];
|
|
|
|
|
reg [1:0] low_addr;
|
reg [1:0] low_addr;
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
Line 247... |
Line 264... |
low_addr <= i_wb_addr[1:0];
|
low_addr <= i_wb_addr[1:0];
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
if ((o_axi_rvalid)&&(i_axi_rready))
|
if ((o_axi_rvalid)&&(i_axi_rready))
|
reorder_fifo_addr[o_axi_rid] <= low_addr;
|
reorder_fifo_addr[o_axi_rid] <= low_addr;
|
|
|
|
always @(posedge i_clk)
|
|
case(reorder_fifo_addr[1:0])
|
|
2'b00: o_wb_data <=reorder_fifo_data[fifo_tail][ 31: 0];
|
|
2'b01: o_wb_data <=reorder_fifo_data[fifo_tail][ 63:32];
|
|
2'b10: o_wb_data <=reorder_fifo_data[fifo_tail][ 95:64];
|
|
2'b11: o_wb_data <=reorder_fifo_data[fifo_tail][127:96];
|
|
endcase
|
|
|
|
end else if (DW == 128)
|
|
begin
|
|
always @(posedge i_clk)
|
|
o_wb_data <= reorder_fifo_data[fifo_tail];
|
|
end
|
|
|
|
|
wire [(LGFIFOLN-1):0] fifo_head;
|
wire [(LGFIFOLN-1):0] fifo_head;
|
assign fifo_head = transaction_id;
|
assign fifo_head = transaction_id;
|
|
|
// Let's do some math to figure out where the FIFO head will
|
// Let's do some math to figure out where the FIFO head will
|
Line 273... |
Line 304... |
begin
|
begin
|
reorder_fifo_valid[i_axi_wd_bid] <= 1'b1;
|
reorder_fifo_valid[i_axi_wd_bid] <= 1'b1;
|
reorder_fifo_err[i_axi_wd_bid] <= i_axi_wd_bresp[1];
|
reorder_fifo_err[i_axi_wd_bid] <= i_axi_wd_bresp[1];
|
end
|
end
|
|
|
case(reorder_fifo_addr[1:0])
|
|
2'b00: o_wb_data <=reorder_fifo_data[fifo_tail][ 31: 0];
|
|
2'b01: o_wb_data <=reorder_fifo_data[fifo_tail][ 63:32];
|
|
2'b10: o_wb_data <=reorder_fifo_data[fifo_tail][ 95:64];
|
|
2'b11: o_wb_data <=reorder_fifo_data[fifo_tail][127:96];
|
|
endcase
|
|
|
|
if (reorder_fifo_valid[fifo_tail])
|
if (reorder_fifo_valid[fifo_tail])
|
begin
|
begin
|
o_wb_ack <= 1'b1;
|
o_wb_ack <= 1'b1;
|
o_wb_err <= reorder_fifo_err[fifo_tail];
|
o_wb_err <= reorder_fifo_err[fifo_tail];
|
fifo_tail <= fifo_tail + 6'h1;
|
fifo_tail <= fifo_tail + 6'h1;
|