1 |
49 |
qaztronic |
//////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// Copyright (C) 2019 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 |
|
|
module
|
29 |
|
|
avf_kernel_1x_buffer #(N, U, L, AW)
|
30 |
|
|
(
|
31 |
|
|
axis_if axis_in,
|
32 |
|
|
axis_if axis_out,
|
33 |
|
|
input aclk,
|
34 |
|
|
input aresetn
|
35 |
|
|
);
|
36 |
|
|
|
37 |
|
|
// --------------------------------------------------------------------
|
38 |
|
|
axis_if #(.N(N*L*L), .U(U+1)) a_buffer(.*);
|
39 |
|
|
|
40 |
|
|
avf_kernel_buffer #(N, U, L, AW)
|
41 |
|
|
kernel_i(.axis_out(a_buffer), .*);
|
42 |
|
|
|
43 |
|
|
// --------------------------------------------------------------------
|
44 |
|
|
reg [(N*8)-1:0] kernel[L][L];
|
45 |
|
|
|
46 |
|
|
generate
|
47 |
|
|
for(genvar j = 0; j < L * L; j++)
|
48 |
|
|
begin: kernel_gen
|
49 |
|
|
assign kernel[j/L][j%L] = a_buffer.tdata[j*N*8 +: N*8];
|
50 |
|
|
end
|
51 |
|
|
endgenerate
|
52 |
|
|
|
53 |
|
|
// --------------------------------------------------------------------
|
54 |
|
|
axis_if #(.N(N), .U(U+1)) a_out(.*);
|
55 |
|
|
|
56 |
|
|
axis_alias alias_i(.axis_in(a_out), .*);
|
57 |
|
|
|
58 |
|
|
// --------------------------------------------------------------------
|
59 |
|
|
assign a_buffer.tuser[3] = a_buffer.tvalid & a_buffer.tready;
|
60 |
|
|
// EOF SOL SOF
|
61 |
|
|
localparam logic[U:0] TUSER_MASK[3] = '{ {1'b0, 1'b0, 1'b1, 1'b1}, // first
|
62 |
|
|
{1'b0, 1'b0, 1'b0, 1'b0}, // middle
|
63 |
|
|
{1'b1, 1'b1, 1'b0, 1'b0} }; // last
|
64 |
|
|
|
65 |
|
|
axis_down_shift #(.N(N*L*L), .S(L*L), .U(U+1), .TUSER_MASK(TUSER_MASK))
|
66 |
|
|
down_i(.axis_in(a_buffer), .axis_out(a_out), .*);
|
67 |
|
|
|
68 |
|
|
// --------------------------------------------------------------------
|
69 |
|
|
endmodule
|