OpenCores
URL https://opencores.org/ocsvn/qaz_libs/qaz_libs/trunk

Subversion Repositories qaz_libs

[/] [qaz_libs/] [trunk/] [axi4_stream_lib/] [src/] [axis_catenate.sv] - Blame information for rev 36

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 36 qaztronic
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
//// Copyright (C) 2017 Authors and OPENCORES.ORG                 ////
4
////                                                              ////
5
//// This source file may be used and distributed without         ////
6
//// restriction provided that this copyright statement is not    ////
7
//// removed from the file and that any derivative work contains  ////
8
//// the original copyright notice and the associated disclaimer. ////
9
////                                                              ////
10
//// This source file is free software; you can redistribute it   ////
11
//// and/or modify it under the terms of the GNU Lesser General   ////
12
//// Public License as published by the Free Software Foundation; ////
13
//// either version 2.1 of the License, or (at your option) any   ////
14
//// later version.                                               ////
15
////                                                              ////
16
//// This source is distributed in the hope that it will be       ////
17
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
18
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
19
//// PURPOSE.  See the GNU Lesser General Public License for more ////
20
//// details.                                                     ////
21
////                                                              ////
22
//// You should have received a copy of the GNU Lesser General    ////
23
//// Public License along with this source; if not, download it   ////
24
//// from http://www.opencores.org/lgpl.shtml                     ////
25
////                                                              ////
26
//////////////////////////////////////////////////////////////////////
27
 
28
 
29
module
30
  axis_catenate
31
  #(
32
    N, // data bus width in bytes
33
    I = 1, // TID width
34
    D = 1, // TDEST width
35
    U = 1, // TUSER width
36
    U_IS_EOP = -1
37
  )
38
  (
39
    axis_if axis_in [1:0],
40
    axis_if axis_out,
41
    input   aclk,
42
    input   aresetn
43
  );
44
 
45
  // --------------------------------------------------------------------
46
  //
47
  wire select;
48
  wire axis_eop;
49
 
50
  defparam axis_eop_mux_i.U_IS_EOP = U_IS_EOP; // why are needed these for recursive modules?
51
  defparam axis_eop_mux_i.MA = 1;
52
  axis_eop_mux
53
  // axis_eop_mux #(.U_IS_EOP(U_IS_EOP), .MA(1))
54
    axis_eop_mux_i(.axis_in(axis_in), .*);
55
 
56
 
57
  // --------------------------------------------------------------------
58
  //  state machine binary definitions
59
  enum reg [1:0]
60
    {
61
      HEAD  = 2'b01,
62
      TAIL  = 2'b10
63
    } state, next_state;
64
 
65
 
66
  // --------------------------------------------------------------------
67
  //  state machine flop
68
  always_ff @(posedge aclk)
69
    if(~aresetn)
70
      state <= HEAD;
71
    else
72
      state <= next_state;
73
 
74
 
75
  // --------------------------------------------------------------------
76
  //  state machine
77
  always_comb
78
    case(state)
79
      HEAD:     if(axis_eop)
80
                  next_state <= TAIL;
81
                else
82
                  next_state <= HEAD;
83
 
84
      TAIL:     if(axis_eop)
85
                  next_state <= HEAD;
86
                else
87
                  next_state <= TAIL;
88
 
89
      default:  next_state <= HEAD;
90
    endcase
91
 
92
 
93
  // --------------------------------------------------------------------
94
  //
95
  defparam axis_mux_i.N = N; // why are needed these for recursive modules?
96
  defparam axis_mux_i.I = I;
97
  defparam axis_mux_i.D = D;
98
  defparam axis_mux_i.U = U;
99
  axis_mux
100
  // axis_mux #(.N(N), .I(I), .D(D), .U(U))
101
    axis_mux_i(.axis_in(axis_in), .*);
102
 
103
 
104
  // --------------------------------------------------------------------
105
  //
106
  assign select = (state == HEAD) ? 0 : 1;
107
 
108
 
109
// --------------------------------------------------------------------
110
//
111
endmodule
112
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.