blob: abd773ca7908a1316296112dbbc96edc0ede4d8b [file] [log] [blame]
Andrew Attwood1d1e8c32021-11-26 15:05:07 +00001// SPDX-FileCopyrightText:
2// 2021 Nguyen Dao
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16// SPDX-License-Identifier: Apache-2.0
nguyendao-uom4b10c632021-11-25 11:23:15 +000017module DSP (top_N1BEG, top_N2BEG, top_N2BEGb, top_N4BEG, top_NN4BEG, top_S1END, top_S2MID, top_S2END, top_S4END, top_SS4END, top_E1BEG, top_E2BEG, top_E2BEGb, top_EE4BEG, top_E6BEG, top_E1END, top_E2MID, top_E2END, top_EE4END, top_E6END, top_W1BEG, top_W2BEG, top_W2BEGb, top_WW4BEG, top_W6BEG, top_W1END, top_W2MID, top_W2END, top_WW4END, top_W6END, bot_E1BEG, bot_E2BEG, bot_E2BEGb, bot_EE4BEG, bot_E6BEG, bot_E1END, bot_E2MID, bot_E2END, bot_EE4END, bot_E6END, bot_W1BEG, bot_W2BEG, bot_W2BEGb, bot_WW4BEG, bot_W6BEG, bot_W1END, bot_W2MID, bot_W2END, bot_WW4END, bot_W6END, bot_S1BEG, bot_S2BEG, bot_S2BEGb, bot_S4BEG, bot_SS4BEG, bot_N1END, bot_N2MID, bot_N2END, bot_N4END, bot_NN4END, UserCLK, UserCLKo, top_FrameData, top_FrameData_O, bot_FrameData, bot_FrameData_O, FrameStrobe, FrameStrobe_O);
18
19 parameter MaxFramesPerCol = 20;
20 parameter FrameBitsPerRow = 32;
21 parameter top_NoConfigBits = 406; // NOT 100% SURE HOW THIS WILL WORK OUT
22 parameter bot_NoConfigBits = 416; // NOT 100% SURE HOW THIS WILL WORK OUT
23
24 //top_NORTH
25 output [3:0] top_N1BEG; // wires:4 X_offset:0 Y_offset:1 source_name:N1BEG destination_name:N1END
26 output [7:0] top_N2BEG; // wires:8 X_offset:0 Y_offset:1 source_name:N2BEG destination_name:N2MID
27 output [7:0] top_N2BEGb; // wires:8 X_offset:0 Y_offset:1 source_name:N2BEGb destination_name:N2END
28 output [15:0] top_N4BEG; // wires:4 X_offset:0 Y_offset:4 source_name:N4BEG destination_name:N4END
29 output [15:0] top_NN4BEG; // wires:4 X_offset:0 Y_offset:4 source_name:NN4BEG destination_name:NN4END
30 // These do not exist in top wrapper top_bot2top[9:0]; // wires:10 X_offset:0 Y_offset:1 source_name:bot2top destination_name:NULL
31 // These do not exist in top wrapper input [3:0] top_N1END; // wires:4 X_offset:0 Y_offset:1 source_name:N1BEG destination_name:N1END
32 // These do not exist in top wrapper input [7:0] top_N2MID; // wires:8 X_offset:0 Y_offset:1 source_name:N2BEG destination_name:N2MID
33 // These do not exist in top wrapper input [7:0] top_N2END; // wires:8 X_offset:0 Y_offset:1 source_name:N2BEGb destination_name:N2END
34 // These do not exist in top wrapper input [15:0] top_N4END; // wires:4 X_offset:0 Y_offset:4 source_name:N4BEG destination_name:N4END
35 // These do not exist in top wrapper input [15:0] top_NN4END; // wires:4 X_offset:0 Y_offset:4 source_name:NN4BEG destination_name:NN4END
36
37 //top_SOUTH
38 // These do not exist in top wrapper top_S1BEG[3:0]; // wires:4 X_offset:0 Y_offset:-1 source_name:S1BEG destination_name:S1END
39 // These do not exist in top wrapper top_S2BEG[7:0]; // wires:8 X_offset:0 Y_offset:-1 source_name:S2BEG destination_name:S2MID
40 // These do not exist in top wrapper top_S2BEGb[7:0]; // wires:8 X_offset:0 Y_offset:-1 source_name:S2BEGb destination_name:S2END
41 // These do not exist in top wrapper top_S4BEG[15:0]; // wires:4 X_offset:0 Y_offset:-4 source_name:S4BEG destination_name:S4END
42 // These do not exist in top wrapper top_SS4BEG[15:0]; // wires:4 X_offset:0 Y_offset:-4 source_name:SS4BEG destination_name:SS4END
43 input [3:0] top_S1END; // wires:4 X_offset:0 Y_offset:-1 source_name:S1BEG destination_name:S1END
44 input [7:0] top_S2MID; // wires:8 X_offset:0 Y_offset:-1 source_name:S2BEG destination_name:S2MID
45 input [7:0] top_S2END; // wires:8 X_offset:0 Y_offset:-1 source_name:S2BEGb destination_name:S2END
46 input [15:0] top_S4END; // wires:4 X_offset:0 Y_offset:-4 source_name:S4BEG destination_name:S4END
47 input [15:0] top_SS4END; // wires:4 X_offset:0 Y_offset:-4 source_name:SS4BEG destination_name:SS4END
48 // These do not exist in top wrapper top_top2bot[17:0]; // wires:18 X_offset:0 Y_offset:-1 source_name:NULL destination_name:top2bot
49
50 //top_EAST
51 output [3:0] top_E1BEG; // wires:4 X_offset:1 Y_offset:0 source_name:E1BEG destination_name:E1END
52 output [7:0] top_E2BEG; // wires:8 X_offset:1 Y_offset:0 source_name:E2BEG destination_name:E2MID
53 output [7:0] top_E2BEGb; // wires:8 X_offset:1 Y_offset:0 source_name:E2BEGb destination_name:E2END
54 output [15:0] top_EE4BEG; // wires:4 X_offset:4 Y_offset:0 source_name:EE4BEG destination_name:EE4END
55 output [11:0] top_E6BEG; // wires:2 X_offset:6 Y_offset:0 source_name:E6BEG destination_name:E6END
56 input [3:0] top_E1END; // wires:4 X_offset:1 Y_offset:0 source_name:E1BEG destination_name:E1END
57 input [7:0] top_E2MID; // wires:8 X_offset:1 Y_offset:0 source_name:E2BEG destination_name:E2MID
58 input [7:0] top_E2END; // wires:8 X_offset:1 Y_offset:0 source_name:E2BEGb destination_name:E2END
59 input [15:0] top_EE4END; // wires:4 X_offset:4 Y_offset:0 source_name:EE4BEG destination_name:EE4END
60 input [11:0] top_E6END; // wires:2 X_offset:6 Y_offset:0 source_name:E6BEG destination_name:E6END
61
62 //top_WEST
63 output [3:0] top_W1BEG; // wires:4 X_offset:-1 Y_offset:0 source_name:W1BEG destination_name:W1END
64 output [7:0] top_W2BEG; // wires:8 X_offset:-1 Y_offset:0 source_name:W2BEG destination_name:W2MID
65 output [7:0] top_W2BEGb; // wires:8 X_offset:-1 Y_offset:0 source_name:W2BEGb destination_name:W2END
66 output [15:0] top_WW4BEG; // wires:4 X_offset:-4 Y_offset:0 source_name:WW4BEG destination_name:WW4END
67 output [11:0] top_W6BEG; // wires:2 X_offset:-6 Y_offset:0 source_name:W6BEG destination_name:W6END
68 input [3:0] top_W1END; // wires:4 X_offset:-1 Y_offset:0 source_name:W1BEG destination_name:W1END
69 input [7:0] top_W2MID; // wires:8 X_offset:-1 Y_offset:0 source_name:W2BEG destination_name:W2MID
70 input [7:0] top_W2END; // wires:8 X_offset:-1 Y_offset:0 source_name:W2BEGb destination_name:W2END
71 input [15:0] top_WW4END; // wires:4 X_offset:-4 Y_offset:0 source_name:WW4BEG destination_name:WW4END
72 input [11:0] top_W6END; // wires:2 X_offset:-6 Y_offset:0 source_name:W6BEG destination_name:W6END
73
74 //bot_NORTH
75 // These do not exist in top wrapper output [3:0] bot_N1BEG; // wires:4 X_offset:0 Y_offset:1 source_name:N1BEG destination_name:N1END
76 // These do not exist in top wrapper output [7:0] bot_N2BEG; // wires:8 X_offset:0 Y_offset:1 source_name:N2BEG destination_name:N2MID
77 // These do not exist in top wrapper output [7:0] bot_N2BEGb; // wires:8 X_offset:0 Y_offset:1 source_name:N2BEGb destination_name:N2END
78 // These do not exist in top wrapper output [15:0] bot_N4BEG; // wires:4 X_offset:0 Y_offset:4 source_name:N4BEG destination_name:N4END
79 // These do not exist in top wrapper output [15:0] bot_NN4BEG; // wires:4 X_offset:0 Y_offset:4 source_name:NN4BEG destination_name:NN4END
80 // These do not exist in top wrapper // These do not exist in top wrapper bot_bot2top[9:0]; // wires:10 X_offset:0 Y_offset:1 source_name:bot2top destination_name:NULL
81 input [3:0] bot_N1END; // wires:4 X_offset:0 Y_offset:1 source_name:N1BEG destination_name:N1END
82 input [7:0] bot_N2MID; // wires:8 X_offset:0 Y_offset:1 source_name:N2BEG destination_name:N2MID
83 input [7:0] bot_N2END; // wires:8 X_offset:0 Y_offset:1 source_name:N2BEGb destination_name:N2END
84 input [15:0] bot_N4END; // wires:4 X_offset:0 Y_offset:4 source_name:N4BEG destination_name:N4END
85 input [15:0] bot_NN4END; // wires:4 X_offset:0 Y_offset:4 source_name:NN4BEG destination_name:NN4END
86
87 //bot_SOUTH
88 output [3:0] bot_S1BEG; // wires:4 X_offset:0 Y_offset:-1 source_name:S1BEG destination_name:S1END
89 output [7:0] bot_S2BEG; // wires:8 X_offset:0 Y_offset:-1 source_name:S2BEG destination_name:S2MID
90 output [7:0] bot_S2BEGb; // wires:8 X_offset:0 Y_offset:-1 source_name:S2BEGb destination_name:S2END
91 output [15:0] bot_S4BEG; // wires:4 X_offset:0 Y_offset:-4 source_name:S4BEG destination_name:S4END
92 output [15:0] bot_SS4BEG; // wires:4 X_offset:0 Y_offset:-4 source_name:SS4BEG destination_name:SS4END
93 // These do not exist in top wrapper input [3:0] bot_S1END; // wires:4 X_offset:0 Y_offset:-1 source_name:S1BEG destination_name:S1END
94 // These do not exist in top wrapper input [7:0] bot_S2MID; // wires:8 X_offset:0 Y_offset:-1 source_name:S2BEG destination_name:S2MID
95 // These do not exist in top wrapper input [7:0] bot_S2END; // wires:8 X_offset:0 Y_offset:-1 source_name:S2BEGb destination_name:S2END
96 // These do not exist in top wrapper input [15:0] bot_S4END; // wires:4 X_offset:0 Y_offset:-4 source_name:S4BEG destination_name:S4END
97 // These do not exist in top wrapper input [15:0] bot_SS4END; // wires:4 X_offset:0 Y_offset:-4 source_name:SS4BEG destination_name:SS4END
98 // These do not exist in top wrapper bot_top2bot[17:0]; // wires:18 X_offset:0 Y_offset:-1 source_name:NULL destination_name:top2bot
99
100 // bot_EAST
101 output [3:0] bot_E1BEG; // wires:4 X_offset:1 Y_offset:0 source_name:E1BEG destination_name:E1END
102 output [7:0] bot_E2BEG; // wires:8 X_offset:1 Y_offset:0 source_name:E2BEG destination_name:E2MID
103 output [7:0] bot_E2BEGb; // wires:8 X_offset:1 Y_offset:0 source_name:E2BEGb destination_name:E2END
104 output [15:0] bot_EE4BEG; // wires:4 X_offset:4 Y_offset:0 source_name:EE4BEG destination_name:EE4END
105 output [11:0] bot_E6BEG; // wires:2 X_offset:6 Y_offset:0 source_name:E6BEG destination_name:E6END
106 input [3:0] bot_E1END; // wires:4 X_offset:1 Y_offset:0 source_name:E1BEG destination_name:E1END
107 input [7:0] bot_E2MID; // wires:8 X_offset:1 Y_offset:0 source_name:E2BEG destination_name:E2MID
108 input [7:0] bot_E2END; // wires:8 X_offset:1 Y_offset:0 source_name:E2BEGb destination_name:E2END
109 input [15:0] bot_EE4END; // wires:4 X_offset:4 Y_offset:0 source_name:EE4BEG destination_name:EE4END
110 input [11:0] bot_E6END; // wires:2 X_offset:6 Y_offset:0 source_name:E6BEG destination_name:E6END
111
112 //bot_WEST
113 output [3:0] bot_W1BEG; // wires:4 X_offset:-1 Y_offset:0 source_name:W1BEG destination_name:W1END
114 output [7:0] bot_W2BEG; // wires:8 X_offset:-1 Y_offset:0 source_name:W2BEG destination_name:W2MID
115 output [7:0] bot_W2BEGb; // wires:8 X_offset:-1 Y_offset:0 source_name:W2BEGb destination_name:W2END
116 output [15:0] bot_WW4BEG; // wires:4 X_offset:-4 Y_offset:0 source_name:WW4BEG destination_name:WW4END
117 output [11:0] bot_W6BEG; // wires:2 X_offset:-6 Y_offset:0 source_name:W6BEG destination_name:W6END
118 input [3:0] bot_W1END; // wires:4 X_offset:-1 Y_offset:0 source_name:W1BEG destination_name:W1END
119 input [7:0] bot_W2MID; // wires:8 X_offset:-1 Y_offset:0 source_name:W2BEG destination_name:W2MID
120 input [7:0] bot_W2END; // wires:8 X_offset:-1 Y_offset:0 source_name:W2BEGb destination_name:W2END
121 input [15:0] bot_WW4END; // wires:4 X_offset:-4 Y_offset:0 source_name:WW4BEG destination_name:WW4END
122 input [11:0] bot_W6END; // wires:2 X_offset:-6 Y_offset:0 source_name:W6BEG destination_name:W6END
123
124 // Tile IO ports from BELs
125 input UserCLK; // EXTERNAL // SHARED_PORT // ## the EXTERNAL keyword will send this sisgnal all the way to top and the //SHARED Allows multiple BELs using the same port (e.g. for exporting a clock to the top)
126 output UserCLKo; // EXTERNAL // SHARED_PORT // ## the EXTERNAL keyword will send this sisgnal all the way to top and the //SHARED Allows multiple BELs using the same port (e.g. for exporting a clock to the top)
127
128 input [FrameBitsPerRow-1:0] top_FrameData; // CONFIG_PORT this is a keyword needed to connect the tile to the bitstream frame register
129 output [FrameBitsPerRow-1:0] top_FrameData_O;
130 input [FrameBitsPerRow-1:0] bot_FrameData; // CONFIG_PORT this is a keyword needed to connect the tile to the bitstream frame register
131 output [FrameBitsPerRow-1:0] bot_FrameData_O;
132 input [MaxFramesPerCol-1:0] FrameStrobe; // CONFIG_PORT this is a keyword needed to connect the tile to the bitstream frame register
133 output [MaxFramesPerCol-1:0] FrameStrobe_O;
134
135 // global
136
137 // signal declarations
138
139 wire [3:0] N1BEG;
140 wire [7:0] N2BEG;
141 wire [7:0] N2BEGb;
142 wire [15:0] N4BEG;
143 wire [15:0] NN4BEG;
144 wire [9:0] bot2top;
145
146 wire [3:0] S1BEG;
147 wire [7:0] S2BEG;
148 wire [7:0] S2BEGb;
149 wire [15:0] S4BEG;
150 wire [15:0] SS4BEG;
151 wire [17:0] top2bot;
152
153 wire bot_UserCLKo;
154
155 wire [MaxFramesPerCol-1:0] bot2top_FrameStrobe;
156
157 DSP_top Inst_DSP_top(
158 .N1END(N1BEG), // internal
159 .N2MID(N2BEG), // internal
160 .N2END(N2BEGb), // internal
161 .N4END(N4BEG), // internal
162 .NN4END(NN4BEG), // internal
163 .bot2top(bot2top), // internal
164 .E1END(top_E1END),
165 .E2MID(top_E2MID),
166 .E2END(top_E2END),
167 .EE4END(top_EE4END),
168 .E6END(top_E6END),
169 .S1END(top_S1END),
170 .S2MID(top_S2MID),
171 .S2END(top_S2END),
172 .S4END(top_S4END),
173 .SS4END(top_SS4END),
174 .W1END(top_W1END),
175 .W2MID(top_W2MID),
176 .W2END(top_W2END),
177 .WW4END(top_WW4END),
178 .W6END(top_W6END),
179 .N1BEG(top_N1BEG),
180 .N2BEG(top_N2BEG),
181 .N2BEGb(top_N2BEGb),
182 .N4BEG(top_N4BEG),
183 .NN4BEG(top_NN4BEG),
184 .E1BEG(top_E1BEG),
185 .E2BEG(top_E2BEG),
186 .E2BEGb(top_E2BEGb),
187 .EE4BEG(top_EE4BEG),
188 .E6BEG(top_E6BEG),
189 .S1BEG(S1BEG), // internal
190 .S2BEG(S2BEG), // internal
191 .S2BEGb(S2BEGb), // internal
192 .S4BEG(S4BEG), // internal
193 .SS4BEG(SS4BEG), // internal
194 .top2bot(top2bot), // internal
195 .W1BEG(top_W1BEG),
196 .W2BEG(top_W2BEG),
197 .W2BEGb(top_W2BEGb),
198 .WW4BEG(top_WW4BEG),
199 .W6BEG(top_W6BEG),
200 .UserCLK(bot_UserCLKo),
201 .UserCLKo(UserCLKo),
202 .FrameData(top_FrameData),
203 .FrameData_O(top_FrameData_O),
204 .FrameStrobe(bot2top_FrameStrobe),
205 .FrameStrobe_O(FrameStrobe_O)
206 );
207
208 DSP_bot Inst_DSP_bot(
209 .N1END(bot_N1END),
210 .N2MID(bot_N2MID),
211 .N2END(bot_N2END),
212 .N4END(bot_N4END),
213 .NN4END(bot_NN4END),
214 .E1END(bot_E1END),
215 .E2MID(bot_E2MID),
216 .E2END(bot_E2END),
217 .EE4END(bot_EE4END),
218 .E6END(bot_E6END),
219 .S1END(S1BEG), // internal
220 .S2MID(S2BEG), // internal
221 .S2END(S2BEGb), // internal
222 .S4END(S4BEG), // internal
223 .SS4END(SS4BEG), // internal
224 .top2bot(top2bot), // internal
225 .W1END(bot_W1END),
226 .W2MID(bot_W2MID),
227 .W2END(bot_W2END),
228 .WW4END(bot_WW4END),
229 .W6END(bot_W6END),
230 .N1BEG(N1BEG), // internal
231 .N2BEG(N2BEG), // internal
232 .N2BEGb(N2BEGb), // internal
233 .N4BEG(N4BEG), // internal
234 .NN4BEG(NN4BEG), // internal
235 .bot2top(bot2top), // internal
236 .E1BEG(bot_E1BEG),
237 .E2BEG(bot_E2BEG),
238 .E2BEGb(bot_E2BEGb),
239 .EE4BEG(bot_EE4BEG),
240 .E6BEG(bot_E6BEG),
241 .S1BEG(bot_S1BEG),
242 .S2BEG(bot_S2BEG),
243 .S2BEGb(bot_S2BEGb),
244 .S4BEG(bot_S4BEG),
245 .SS4BEG(bot_SS4BEG),
246 .W1BEG(bot_W1BEG),
247 .W2BEG(bot_W2BEG),
248 .W2BEGb(bot_W2BEGb),
249 .WW4BEG(bot_WW4BEG),
250 .W6BEG(bot_W6BEG),
251 // tile IO port which gets directly connected to top-level tile entity
252 .UserCLK(UserCLK),
253 .UserCLKo(bot_UserCLKo),
254 .FrameData(bot_FrameData),
255 .FrameData_O(bot_FrameData_O),
256 .FrameStrobe(FrameStrobe),
257 .FrameStrobe_O(bot2top_FrameStrobe)
258 );
259
Andrew Attwood1d1e8c32021-11-26 15:05:07 +0000260endmodule