Line 23... |
Line 23... |
//// Public License along with this source; if not, download it ////
|
//// Public License along with this source; if not, download it ////
|
//// from http://www.opencores.org/lgpl.shtml ////
|
//// from http://www.opencores.org/lgpl.shtml ////
|
//// ////
|
//// ////
|
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
module
|
module
|
axis_catenate
|
axis_catenate
|
#(
|
#(
|
N, // data bus width in bytes
|
N, // data bus width in bytes
|
I = 1, // TID width
|
I = 1, // TID width
|
Line 39... |
Line 38... |
axis_if axis_in [1:0],
|
axis_if axis_in [1:0],
|
axis_if axis_out,
|
axis_if axis_out,
|
input aclk,
|
input aclk,
|
input aresetn
|
input aresetn
|
);
|
);
|
|
|
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
//
|
|
wire select;
|
wire select;
|
wire axis_eop;
|
wire axis_eop;
|
|
|
defparam axis_eop_mux_i.U_IS_EOP = U_IS_EOP; // why are these needed for recursive modules?
|
defparam axis_eop_mux_i.U_IS_EOP = U_IS_EOP; // why are these needed for recursive modules?
|
defparam axis_eop_mux_i.MA = 1;
|
defparam axis_eop_mux_i.MA = 1;
|
axis_eop_mux
|
axis_eop_mux
|
// axis_eop_mux #(.U_IS_EOP(U_IS_EOP), .MA(1))
|
// axis_eop_mux #(.U_IS_EOP(U_IS_EOP), .MA(1))
|
axis_eop_mux_i(.axis_in(axis_in), .*);
|
axis_eop_mux_i(.axis_in(axis_in), .*);
|
|
|
|
|
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
// state machine binary definitions
|
|
enum reg [1:0]
|
enum reg [1:0]
|
{
|
{ HEAD = 2'b01,
|
HEAD = 2'b01,
|
|
TAIL = 2'b10
|
TAIL = 2'b10
|
} state, next_state;
|
} state, next_state;
|
|
|
|
|
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
// state machine flop
|
|
always_ff @(posedge aclk)
|
always_ff @(posedge aclk)
|
if(~aresetn)
|
if(~aresetn)
|
state <= HEAD;
|
state <= HEAD;
|
else
|
else
|
state <= next_state;
|
state <= next_state;
|
|
|
|
|
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
// state machine
|
|
always_comb
|
always_comb
|
case(state)
|
case(state)
|
HEAD: if(axis_eop)
|
HEAD: if(axis_eop)
|
next_state <= TAIL;
|
next_state <= TAIL;
|
else
|
else
|
Line 87... |
Line 77... |
next_state <= TAIL;
|
next_state <= TAIL;
|
|
|
default: next_state <= HEAD;
|
default: next_state <= HEAD;
|
endcase
|
endcase
|
|
|
|
|
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
//
|
|
axis_if #(.N(N), .I(I), .D(D), .U(U)) axis_bus[1:0](.*);
|
axis_if #(.N(N), .I(I), .D(D), .U(U)) axis_bus[1:0](.*);
|
genvar j;
|
genvar j;
|
|
|
generate
|
generate
|
if(U_IS_EOP > -1)
|
if(U_IS_EOP > -1) begin: u_is_eop_gen
|
begin: u_is_eop_gen
|
for(j = 0; j < U; j++) begin: for_tuser_gen
|
for(j = 0; j < U; j++)
|
if(j == U_IS_EOP) begin: choped_tuser_gen
|
begin: for_tuser_gen
|
|
if(j == U_IS_EOP)
|
|
begin: choped_tuser_gen
|
|
assign axis_bus[0].tuser[j] = 0;
|
assign axis_bus[0].tuser[j] = 0;
|
end
|
end
|
else
|
else begin: tuser_gen
|
begin: tuser_gen
|
|
assign axis_bus[0].tuser[j] = axis_in[0].tuser[j];
|
assign axis_bus[0].tuser[j] = axis_in[0].tuser[j];
|
end
|
end
|
end
|
end
|
end
|
end
|
else
|
else begin: u_not_eop_gen
|
if(U_IS_EOP > -1)
|
assign axis_bus[0].tuser = axis_in[0].tuser;
|
begin: tlast_gen
|
end
|
|
|
|
if(U_IS_EOP > -1) begin: tlast_gen
|
assign axis_bus[0].tlast = axis_in[0].tlast;
|
assign axis_bus[0].tlast = axis_in[0].tlast;
|
end
|
end
|
else
|
else begin: choped_tlast_gen
|
begin: choped_tlast_gen
|
|
assign axis_bus[0].tlast = 0;
|
assign axis_bus[0].tlast = 0;
|
end
|
end
|
endgenerate
|
endgenerate
|
|
|
|
|
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
//
|
axis_alias #(.CONNECT_TLAST(0), .CONNECT_TUSER(0))
|
assign axis_in[0].tready = axis_bus[0].tready;
|
axis_alias(axis_in[0], axis_bus[0]);
|
assign axis_bus[0].tvalid = axis_in[0].tvalid;
|
|
assign axis_bus[0].tdata = axis_in[0].tdata;
|
|
assign axis_bus[0].tstrb = axis_in[0].tstrb;
|
|
assign axis_bus[0].tkeep = axis_in[0].tkeep;
|
|
assign axis_bus[0].tid = axis_in[0].tid;
|
|
assign axis_bus[0].tdest = axis_in[0].tdest;
|
|
|
|
|
|
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
//
|
|
axis_alias
|
axis_alias
|
axis_alias_i(axis_in[1], axis_bus[1]);
|
axis_alias_hi(axis_in[1], axis_bus[1]);
|
|
|
|
|
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
//
|
|
defparam axis_mux_i.N = N; // why are these needed for recursive modules?
|
defparam axis_mux_i.N = N; // why are these needed for recursive modules?
|
defparam axis_mux_i.I = I;
|
defparam axis_mux_i.I = I;
|
defparam axis_mux_i.D = D;
|
defparam axis_mux_i.D = D;
|
defparam axis_mux_i.U = U;
|
defparam axis_mux_i.U = U;
|
axis_mux
|
axis_mux
|
// axis_mux #(.N(N), .I(I), .D(D), .U(U))
|
// axis_mux #(.N(N), .I(I), .D(D), .U(U))
|
axis_mux_i(.axis_in(axis_bus), .*);
|
axis_mux_i(.axis_in(axis_bus), .*);
|
|
|
|
|
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
//
|
|
assign select = (state == HEAD) ? 0 : 1;
|
assign select = (state == HEAD) ? 0 : 1;
|
|
|
|
|
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
//
|
|
endmodule
|
endmodule
|
|
|