1 |
31 |
qaztronic |
//////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// Copyright (C) 2015 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_checker
|
31 |
|
|
#(
|
32 |
|
|
N, // data bus width in bytes
|
33 |
|
|
I = 1, // TID width
|
34 |
|
|
D = 1, // TDEST width
|
35 |
|
|
U = 1, // TUSER width
|
36 |
|
|
MAXWAITS = 16,
|
37 |
|
|
RecommendOn = 1'b1,
|
38 |
|
|
RecMaxWaitOn = 1'b1
|
39 |
|
|
)
|
40 |
|
|
(
|
41 |
|
|
axis_if axis_in
|
42 |
|
|
);
|
43 |
|
|
|
44 |
|
|
//---------------------------------------------------
|
45 |
|
|
//
|
46 |
|
|
localparam DATA_WIDTH_BYTES = N; // data bus width
|
47 |
|
|
localparam DEST_WIDTH = D; // TDEST width
|
48 |
|
|
|
49 |
|
|
// Select the number of ID bits required
|
50 |
|
|
localparam ID_WIDTH = I; // (T)ID width
|
51 |
|
|
|
52 |
|
|
// Select the size of the USER buses
|
53 |
|
|
localparam USER_WIDTH = U; // width of the user sideband field
|
54 |
|
|
|
55 |
|
|
|
56 |
|
|
//---------------------------------------------------
|
57 |
|
|
//
|
58 |
|
|
// INDEX: - Calculated (user should not override)
|
59 |
|
|
// =====
|
60 |
|
|
// Do not override the following parameters: they must be calculated exactly
|
61 |
|
|
// as shown below
|
62 |
|
|
// data max index
|
63 |
|
|
localparam DATA_MAX = DATA_WIDTH_BYTES ? (DATA_WIDTH_BYTES*8)-1:0;
|
64 |
|
|
localparam DEST_MAX = DEST_WIDTH ? DEST_WIDTH-1:0; // dest max index
|
65 |
|
|
localparam STRB_WIDTH = DATA_WIDTH_BYTES; // TSTRB width
|
66 |
|
|
localparam STRB_MAX = STRB_WIDTH ? STRB_WIDTH-1:0; // TSTRB max index
|
67 |
|
|
localparam KEEP_MAX = STRB_WIDTH ? STRB_WIDTH-1:0; // TKEEP max index
|
68 |
|
|
localparam ID_MAX = ID_WIDTH ? ID_WIDTH-1:0; // ID max index
|
69 |
|
|
localparam TUSER_MAX = USER_WIDTH? USER_WIDTH-1:0; // TUSER max index
|
70 |
|
|
|
71 |
|
|
|
72 |
|
|
//---------------------------------------------------
|
73 |
|
|
//
|
74 |
|
|
// INDEX: - Global Signals
|
75 |
|
|
// =====
|
76 |
|
|
wire ACLK = axis_in.aclk; // AXI Clock
|
77 |
|
|
wire ARESETn = axis_in.aresetn; // AXI Reset
|
78 |
|
|
|
79 |
|
|
|
80 |
|
|
// INDEX: - AXI4-Stream Interface
|
81 |
|
|
// =====
|
82 |
|
|
wire [DATA_MAX:0] TDATA = axis_in.tdata;
|
83 |
|
|
wire [STRB_MAX:0] TSTRB = axis_in.tstrb;
|
84 |
|
|
wire [KEEP_MAX:0] TKEEP = axis_in.tkeep;
|
85 |
|
|
wire TLAST = axis_in.tlast;
|
86 |
|
|
wire [ID_MAX:0] TID = axis_in.tid;
|
87 |
|
|
wire [DEST_MAX:0] TDEST = axis_in.tdest;
|
88 |
|
|
wire [TUSER_MAX:0] TUSER = axis_in.tuser;
|
89 |
|
|
wire TVALID = axis_in.tvalid;
|
90 |
|
|
wire TREADY = axis_in.tready;
|
91 |
|
|
|
92 |
|
|
|
93 |
|
|
//---------------------------------------------------
|
94 |
|
|
//
|
95 |
|
|
Axi4StreamPC
|
96 |
|
|
#(
|
97 |
|
|
// Set DATA_WIDTH to the data-bus width required
|
98 |
|
|
.DATA_WIDTH_BYTES(DATA_WIDTH_BYTES), // data bus width
|
99 |
|
|
.DEST_WIDTH(DEST_WIDTH), // TDEST width
|
100 |
|
|
|
101 |
|
|
// Select the number of ID bits required
|
102 |
|
|
.ID_WIDTH(ID_WIDTH), // (T)ID width
|
103 |
|
|
|
104 |
|
|
// Select the size of the USER buses
|
105 |
|
|
.USER_WIDTH(USER_WIDTH), // width of the user sideband field
|
106 |
|
|
|
107 |
|
|
// Maximum number of cycles between VALID -> READY high before a warning is
|
108 |
|
|
// generated
|
109 |
|
|
.MAXWAITS(MAXWAITS),
|
110 |
|
|
|
111 |
|
|
// Recommended Rules Enable
|
112 |
|
|
// enable/disable reporting of all AXI4STREAM_REC*_* rules
|
113 |
|
|
.RecommendOn(RecommendOn),
|
114 |
|
|
// enable/disable reporting of just AXI4STREAM_REC*_MAX_WAIT rules
|
115 |
|
|
.RecMaxWaitOn(RecMaxWaitOn)
|
116 |
|
|
)
|
117 |
|
|
Axi4StreamPC_i(.*);
|
118 |
|
|
|
119 |
|
|
|
120 |
|
|
//---------------------------------------------------
|
121 |
|
|
//
|
122 |
|
|
endmodule
|
123 |
|
|
|