-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathColumnCountNeg.vhd
More file actions
367 lines (304 loc) · 14.1 KB
/
Copy pathColumnCountNeg.vhd
File metadata and controls
367 lines (304 loc) · 14.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
LIBRARY IEEE;
USE IEEE.std_logic_1164.ALL;
USE IEEE.numeric_std.ALL;
ENTITY ColumnCountNeg IS
PORT( clk : IN std_logic;
reset : IN std_logic;
enb : IN std_logic;
pixelIn : IN std_logic;
controlIn_hStart : IN std_logic;
controlIn_hEnd : IN std_logic;
controlIn_vStart : IN std_logic;
controlIn_vEnd : IN std_logic;
controlIn_valid : IN std_logic;
NegativeHistogramCount : OUT std_logic_vector(5 DOWNTO 0) -- ufix6
);
END ColumnCountNeg;
ARCHITECTURE rtl OF ColumnCountNeg IS
-- Component Declarations
COMPONENT TiledROIExractor
PORT( clk : IN std_logic;
reset : IN std_logic;
enb : IN std_logic;
controlIn_hStart : IN std_logic;
controlIn_hEnd : IN std_logic;
controlIn_vStart : IN std_logic;
controlIn_vEnd : IN std_logic;
controlIn_valid : IN std_logic;
pixelIn : IN std_logic;
regionStart : OUT std_logic;
pixelOut : OUT std_logic_vector(9 DOWNTO 0); -- ufix10
controlOut_hStart : OUT std_logic;
controlOut_hEnd : OUT std_logic;
controlOut_vStart : OUT std_logic;
controlOut_vEnd : OUT std_logic;
controlOut_valid : OUT std_logic
);
END COMPONENT;
COMPONENT Subsystem
PORT( Out1_hStart : OUT std_logic;
Out1_hEnd : OUT std_logic;
Out1_vStart : OUT std_logic;
Out1_vEnd : OUT std_logic;
Out1_valid : OUT std_logic
);
END COMPONENT;
COMPONENT Histogram2
PORT( clk : IN std_logic;
reset : IN std_logic;
enb : IN std_logic;
in0 : IN std_logic_vector(9 DOWNTO 0); -- ufix10
in1_hStart : IN std_logic;
in1_hEnd : IN std_logic;
in1_vStart : IN std_logic;
in1_vEnd : IN std_logic;
in1_valid : IN std_logic;
in2 : IN std_logic_vector(9 DOWNTO 0); -- ufix10
in3 : IN std_logic;
out0 : OUT std_logic_vector(5 DOWNTO 0); -- ufix6
out1 : OUT std_logic
);
END COMPONENT;
COMPONENT Subsystem1_block
PORT( Out1_hStart : OUT std_logic;
Out1_hEnd : OUT std_logic;
Out1_vStart : OUT std_logic;
Out1_vEnd : OUT std_logic;
Out1_valid : OUT std_logic
);
END COMPONENT;
COMPONENT Histogram1
PORT( clk : IN std_logic;
reset : IN std_logic;
enb : IN std_logic;
in0 : IN std_logic_vector(9 DOWNTO 0); -- ufix10
in1_hStart : IN std_logic;
in1_hEnd : IN std_logic;
in1_vStart : IN std_logic;
in1_vEnd : IN std_logic;
in1_valid : IN std_logic;
in2 : IN std_logic_vector(9 DOWNTO 0); -- ufix10
in3 : IN std_logic;
out0 : OUT std_logic_vector(5 DOWNTO 0); -- ufix6
out1 : OUT std_logic
);
END COMPONENT;
-- Component Configuration Statements
FOR ALL : TiledROIExractor
USE ENTITY work.TiledROIExractor(rtl);
FOR ALL : Subsystem
USE ENTITY work.Subsystem(rtl);
FOR ALL : Histogram2
USE ENTITY work.Histogram2(rtl);
FOR ALL : Subsystem1_block
USE ENTITY work.Subsystem1_block(rtl);
FOR ALL : Histogram1
USE ENTITY work.Histogram1(rtl);
-- Signals
SIGNAL TiledROIExractor_out1 : std_logic;
SIGNAL TiledROIExractor_out2 : std_logic_vector(9 DOWNTO 0); -- ufix10
SIGNAL TiledROIExractor_out3_hStart : std_logic;
SIGNAL TiledROIExractor_out3_hEnd : std_logic;
SIGNAL TiledROIExractor_out3_vStart : std_logic;
SIGNAL TiledROIExractor_out3_vEnd : std_logic;
SIGNAL TiledROIExractor_out3_valid : std_logic;
SIGNAL Delay4_out1 : std_logic;
SIGNAL Logical_Operator6_out1 : std_logic;
SIGNAL Logical_Operator4_out1 : std_logic;
SIGNAL Delay2_out1 : std_logic;
SIGNAL Subsystem_out1_hStart : std_logic;
SIGNAL Subsystem_out1_hEnd : std_logic;
SIGNAL Subsystem_out1_vStart : std_logic;
SIGNAL Subsystem_out1_vEnd : std_logic;
SIGNAL Subsystem_out1_valid : std_logic;
SIGNAL Pixel_Switch1_out1_hStart : std_logic;
SIGNAL Pixel_Switch1_out1_hEnd : std_logic;
SIGNAL Pixel_Switch1_out1_vStart : std_logic;
SIGNAL Pixel_Switch1_out1_vEnd : std_logic;
SIGNAL Pixel_Switch1_out1_valid : std_logic;
SIGNAL HistogramReadOut_out1 : unsigned(9 DOWNTO 0); -- ufix10
SIGNAL Compare_To_Constant3_out1 : std_logic;
SIGNAL Histogram2_out2 : std_logic;
SIGNAL Histogram2_out1 : std_logic_vector(5 DOWNTO 0); -- ufix6
SIGNAL Histogram2_out1_unsigned : unsigned(5 DOWNTO 0); -- ufix6
SIGNAL Logical_Operator7_out1 : std_logic;
SIGNAL Delay3_reg : std_logic_vector(0 TO 3); -- ufix1 [4]
SIGNAL Delay3_out1 : std_logic;
SIGNAL Subsystem1_out1_hStart : std_logic;
SIGNAL Subsystem1_out1_hEnd : std_logic;
SIGNAL Subsystem1_out1_vStart : std_logic;
SIGNAL Subsystem1_out1_vEnd : std_logic;
SIGNAL Subsystem1_out1_valid : std_logic;
SIGNAL Pixel_Switch3_out1_hStart : std_logic;
SIGNAL Pixel_Switch3_out1_hEnd : std_logic;
SIGNAL Pixel_Switch3_out1_vStart : std_logic;
SIGNAL Pixel_Switch3_out1_vEnd : std_logic;
SIGNAL Pixel_Switch3_out1_valid : std_logic;
SIGNAL HistogramReadOut1_out1 : unsigned(9 DOWNTO 0); -- ufix10
SIGNAL Compare_To_Constant4_out1 : std_logic;
SIGNAL Histogram1_out2 : std_logic;
SIGNAL Histogram1_out1 : std_logic_vector(5 DOWNTO 0); -- ufix6
SIGNAL Histogram1_out1_unsigned : unsigned(5 DOWNTO 0); -- ufix6
SIGNAL Pixel_Switch_out1 : unsigned(5 DOWNTO 0); -- ufix6
BEGIN
u_TiledROIExractor : TiledROIExractor
PORT MAP( clk => clk,
reset => reset,
enb => enb,
controlIn_hStart => controlIn_hStart,
controlIn_hEnd => controlIn_hEnd,
controlIn_vStart => controlIn_vStart,
controlIn_vEnd => controlIn_vEnd,
controlIn_valid => controlIn_valid,
pixelIn => pixelIn,
regionStart => TiledROIExractor_out1,
pixelOut => TiledROIExractor_out2, -- ufix10
controlOut_hStart => TiledROIExractor_out3_hStart,
controlOut_hEnd => TiledROIExractor_out3_hEnd,
controlOut_vStart => TiledROIExractor_out3_vStart,
controlOut_vEnd => TiledROIExractor_out3_vEnd,
controlOut_valid => TiledROIExractor_out3_valid
);
u_Subsystem : Subsystem
PORT MAP( Out1_hStart => Subsystem_out1_hStart,
Out1_hEnd => Subsystem_out1_hEnd,
Out1_vStart => Subsystem_out1_vStart,
Out1_vEnd => Subsystem_out1_vEnd,
Out1_valid => Subsystem_out1_valid
);
u_Histogram2 : Histogram2
PORT MAP( clk => clk,
reset => reset,
enb => enb,
in0 => TiledROIExractor_out2, -- ufix10
in1_hStart => Pixel_Switch1_out1_hStart,
in1_hEnd => Pixel_Switch1_out1_hEnd,
in1_vStart => Pixel_Switch1_out1_vStart,
in1_vEnd => Pixel_Switch1_out1_vEnd,
in1_valid => Pixel_Switch1_out1_valid,
in2 => std_logic_vector(HistogramReadOut_out1), -- ufix10
in3 => Compare_To_Constant3_out1,
out0 => Histogram2_out1, -- ufix6
out1 => Histogram2_out2
);
u_Subsystem1 : Subsystem1_block
PORT MAP( Out1_hStart => Subsystem1_out1_hStart,
Out1_hEnd => Subsystem1_out1_hEnd,
Out1_vStart => Subsystem1_out1_vStart,
Out1_vEnd => Subsystem1_out1_vEnd,
Out1_valid => Subsystem1_out1_valid
);
u_Histogram1 : Histogram1
PORT MAP( clk => clk,
reset => reset,
enb => enb,
in0 => TiledROIExractor_out2, -- ufix10
in1_hStart => Pixel_Switch3_out1_hStart,
in1_hEnd => Pixel_Switch3_out1_hEnd,
in1_vStart => Pixel_Switch3_out1_vStart,
in1_vEnd => Pixel_Switch3_out1_vEnd,
in1_valid => Pixel_Switch3_out1_valid,
in2 => std_logic_vector(HistogramReadOut1_out1), -- ufix10
in3 => Compare_To_Constant4_out1,
out0 => Histogram1_out1, -- ufix6
out1 => Histogram1_out2
);
Logical_Operator6_out1 <= NOT Delay4_out1;
Delay4_process : PROCESS (clk)
BEGIN
IF clk'EVENT AND clk = '1' THEN
IF reset = '1' THEN
Delay4_out1 <= '0';
ELSIF enb = '1' AND TiledROIExractor_out1 = '1' THEN
Delay4_out1 <= Logical_Operator6_out1;
END IF;
END IF;
END PROCESS Delay4_process;
Logical_Operator4_out1 <= NOT Delay4_out1;
Delay2_process : PROCESS (clk)
BEGIN
IF clk'EVENT AND clk = '1' THEN
IF reset = '1' THEN
Delay2_out1 <= '0';
ELSIF enb = '1' THEN
Delay2_out1 <= Delay4_out1;
END IF;
END IF;
END PROCESS Delay2_process;
Pixel_Switch1_out1_hStart <= TiledROIExractor_out3_hStart WHEN Delay2_out1 = '0' ELSE
Subsystem_out1_hStart;
Pixel_Switch1_out1_hEnd <= TiledROIExractor_out3_hEnd WHEN Delay2_out1 = '0' ELSE
Subsystem_out1_hEnd;
Pixel_Switch1_out1_vStart <= TiledROIExractor_out3_vStart WHEN Delay2_out1 = '0' ELSE
Subsystem_out1_vStart;
Pixel_Switch1_out1_vEnd <= TiledROIExractor_out3_vEnd WHEN Delay2_out1 = '0' ELSE
Subsystem_out1_vEnd;
Pixel_Switch1_out1_valid <= TiledROIExractor_out3_valid WHEN Delay2_out1 = '0' ELSE
Subsystem_out1_valid;
Compare_To_Constant3_out1 <= '1' WHEN HistogramReadOut_out1 = to_unsigned(16#2BC#, 10) ELSE
'0';
-- Free running, Unsigned Counter
-- initial value = 0
-- step value = 1
HistogramReadOut_process : PROCESS (clk)
BEGIN
IF clk'EVENT AND clk = '1' THEN
IF reset = '1' THEN
HistogramReadOut_out1 <= to_unsigned(16#000#, 10);
ELSIF enb = '1' THEN
IF Compare_To_Constant3_out1 = '1' THEN
HistogramReadOut_out1 <= to_unsigned(16#000#, 10);
ELSIF Histogram2_out2 = '1' THEN
HistogramReadOut_out1 <= HistogramReadOut_out1 + to_unsigned(16#001#, 10);
END IF;
END IF;
END IF;
END PROCESS HistogramReadOut_process;
Histogram2_out1_unsigned <= unsigned(Histogram2_out1);
Logical_Operator7_out1 <= NOT Delay4_out1;
Delay3_process : PROCESS (clk)
BEGIN
IF clk'EVENT AND clk = '1' THEN
IF reset = '1' THEN
Delay3_reg <= (OTHERS => '0');
ELSIF enb = '1' THEN
Delay3_reg(0) <= Logical_Operator7_out1;
Delay3_reg(1 TO 3) <= Delay3_reg(0 TO 2);
END IF;
END IF;
END PROCESS Delay3_process;
Delay3_out1 <= Delay3_reg(3);
Pixel_Switch3_out1_hStart <= TiledROIExractor_out3_hStart WHEN Delay3_out1 = '0' ELSE
Subsystem1_out1_hStart;
Pixel_Switch3_out1_hEnd <= TiledROIExractor_out3_hEnd WHEN Delay3_out1 = '0' ELSE
Subsystem1_out1_hEnd;
Pixel_Switch3_out1_vStart <= TiledROIExractor_out3_vStart WHEN Delay3_out1 = '0' ELSE
Subsystem1_out1_vStart;
Pixel_Switch3_out1_vEnd <= TiledROIExractor_out3_vEnd WHEN Delay3_out1 = '0' ELSE
Subsystem1_out1_vEnd;
Pixel_Switch3_out1_valid <= TiledROIExractor_out3_valid WHEN Delay3_out1 = '0' ELSE
Subsystem1_out1_valid;
Compare_To_Constant4_out1 <= '1' WHEN HistogramReadOut1_out1 = to_unsigned(16#2BC#, 10) ELSE
'0';
-- Free running, Unsigned Counter
-- initial value = 0
-- step value = 1
HistogramReadOut1_process : PROCESS (clk)
BEGIN
IF clk'EVENT AND clk = '1' THEN
IF reset = '1' THEN
HistogramReadOut1_out1 <= to_unsigned(16#000#, 10);
ELSIF enb = '1' THEN
IF Compare_To_Constant4_out1 = '1' THEN
HistogramReadOut1_out1 <= to_unsigned(16#000#, 10);
ELSIF Histogram1_out2 = '1' THEN
HistogramReadOut1_out1 <= HistogramReadOut1_out1 + to_unsigned(16#001#, 10);
END IF;
END IF;
END IF;
END PROCESS HistogramReadOut1_process;
Histogram1_out1_unsigned <= unsigned(Histogram1_out1);
Pixel_Switch_out1 <= Histogram2_out1_unsigned WHEN Logical_Operator4_out1 = '0' ELSE
Histogram1_out1_unsigned;
NegativeHistogramCount <= std_logic_vector(Pixel_Switch_out1);
END rtl;