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

Subversion Repositories dct_idct

[/] [dct_idct/] [trunk/] [dct/] [Bench/] [bmp_generator.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 unicore
---------------------------------------------------------------------
2
----                                                             ----
3
----  DCT IP core                                                ----
4
----                                                             ----
5
----  Authors: Anatoliy Sergienko, Volodya Lepeha                ----
6
----  Company: Unicore Systems http://unicore.co.ua              ----
7
----                                                             ----
8
----  Downloaded from: http://www.opencores.org                  ----
9
----                                                             ----
10
---------------------------------------------------------------------
11
----                                                             ----
12
---- Copyright (C) 2006-2010 Unicore Systems LTD                 ----
13
---- www.unicore.co.ua                                           ----
14
---- o.uzenkov@unicore.co.ua                                     ----
15
----                                                             ----
16
---- This source file may be used and distributed without        ----
17
---- restriction provided that this copyright statement is not   ----
18
---- removed from the file and that any derivative work contains ----
19
---- the original copyright notice and the associated disclaimer.----
20
----                                                             ----
21
---- THIS SOFTWARE IS PROVIDED "AS IS"                           ----
22
---- AND ANY EXPRESSED OR IMPLIED WARRANTIES,                    ----
23
---- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED                  ----
24
---- WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT              ----
25
---- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.        ----
26
---- IN NO EVENT SHALL THE UNICORE SYSTEMS OR ITS                ----
27
---- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,            ----
28
---- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL            ----
29
---- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT         ----
30
---- OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,               ----
31
---- DATA, OR PROFITS; OR BUSINESS INTERRUPTION)                 ----
32
---- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,              ----
33
---- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT              ----
34
---- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING                 ----
35
---- IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,                 ----
36
---- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.          ----
37
----                                                             ----
38
---------------------------------------------------------------------
39
 
40
 
41
library IEEE;
42
use IEEE.std_logic_1164.all;
43
use IEEE.std_logic_arith.all;
44
use IEEE.math_real.all;
45
 
46
entity BMP_GENERATOR is
47
        generic(  SIGNED_DATA : integer:= 0;   --  input data - 0 - unsigned, 1 - signed
48
                RANDOM:integer:=1 );
49
        port (
50
                CLK: in STD_LOGIC;
51
                RST: in STD_LOGIC;
52
                START: out STD_LOGIC;
53
                DATA: out STD_LOGIC_VECTOR (7 downto 0):=x"01"
54
                );
55
end BMP_GENERATOR;
56
 
57
 
58
architecture BMP_GENERATOR of BMP_GENERATOR is
59
        type TLUT is array(0 to 2047 ) of integer;
60
        Constant ROMBMP:Tlut:=( (
61
 
62
 
63
        -- data patterns                
64
        108,-25,-127,-72,72,127, 25,-109,
65
        108,-25,-127,-72,72,127, 25,-109,
66
        108,-25,-127,-72,72,127, 25,-109,
67
        108,-25,-127,-72,72,127, 25,-109,
68
        108,-25,-127,-72,72,127, 25,-109,
69
        108,-25,-127,-72,72,127, 25,-109,
70
        108,-25,-127,-72,72,127, 25,-109,
71
        108,-25,-127,-72,72,127, 25,-109,
72
 
73
        127,127,127,127, 127,127,127,127,
74
        52,52,52,52,52,52,52,52,
75
        -52,-52,-52,-52,-52,-52,-52,-52,
76
        -127,-127,-127,-127,-127,-127,-127,-127,
77
        -127,-127,-127,-127,-127,-127,-127,-127,
78
        -52,-52,-52,-52,-52,-52,-52,-52,
79
        52,52,52,52,52,52,52,52,
80
        127,127,127,127, 127,127,127,127,
81
 
82
 
83
        127,52,-52,-127,-127,-52,52, 127,
84
        127,52,-52,-127,-127,-52,52, 127,
85
        127,52,-52,-127,-127,-52,52, 127,
86
        127,52,-52,-127,-127,-52,52, 127,
87
        127,52,-52,-127,-127,-52,52, 127,
88
        127,52,-52,-127,-127,-52,52, 127,
89
        127,52,-52,-127,-127,-52,52, 127,
90
        127,52,-52,-127,-127,-52,52, 127,
91
 
92
 
93
 
94
        52,-127,127,-52,-52,127,-127,52,
95
        52,-127,127,-52,-52,127,-127,52,
96
        52,-127,127,-52,-52,127,-127,52,
97
        52,-127,127,-52,-52,127,-127,52,
98
        52,-127,127,-52,-52,127,-127,52,
99
        52,-127,127,-52,-52,127,-127,52,
100
        52,-127,127,-52,-52,127,-127,52,
101
        52,-127,127,-52,-52,127,-127,52,
102
 
103
 
104
        127,90,0,-90,-127,-90,0,90,
105
        127,90,0,-90,-127,-90,0,90,
106
        127,90,0,-90,-127,-90,0,90,
107
        127,90,0,-90,-127,-90,0,90,
108
        127,90,0,-90,-127,-90,0,90,
109
        127,90,0,-90,-127,-90,0,90,
110
        127,90,0,-90,-127,-90,0,90,
111
        127,90,0,-90,-127,-90,0,90,
112
 
113
 
114
        127,-127,127,-127,127,-127,127,-127,
115
        127,-127,127,-127,127,-127,127,-127,
116
        127,-127,127,-127,127,-127,127,-127,
117
        127,-127,127,-127,127,-127,127,-127,
118
        127,-127,127,-127,127,-127,127,-127,
119
        127,-127,127,-127,127,-127,127,-127,
120
        127,-127,127,-127,127,-127,127,-127,
121
        127,-127,127,-127,127,-127,127,-127,
122
 
123
        127,-117,90,-49,0,-49,90,117,
124
        127,-117,90,-49,0,-49,90,117,
125
        127,-117,90,-49,0,-49,90,117,
126
        127,-117,90,-49,0,-49,90,117,
127
        127,-117,90,-49,0,-49,90,117,
128
        127,-117,90,-49,0,-49,90,117,
129
        127,-117,90,-49,0,-49,90,117,
130
        127,-117,90,-49,0,-49,90,117,
131
 
132
        0,117,90,-49,-127,-49,90,117,
133
        0,117,90,-49,-127,-49,90,117,
134
        0,117,90,-49,-127,-49,90,117,
135
        0,117,90,-49,-127,-49,90,117,
136
        0,117,90,-49,-127,-49,90,117,
137
        0,117,90,-49,-127,-49,90,117,
138
        0,117,90,-49,-127,-49,90,117,
139
        0,117,90,-49,-127,-49,90,117,
140
 
141
 
142
        127,-90, 0,90,-127,90,0,-90,
143
        127,-90, 0,90,-127,90,0,-90,
144
        127,-90, 0,90,-127,90,0,-90,
145
        127,-90, 0,90,-127,90,0,-90,
146
        127,-90, 0,90,-127,90,0,-90,
147
        127,-90, 0,90,-127,90,0,-90,
148
        127,-90, 0,90,-127,90,0,-90,
149
        127,-90, 0,90,-127,90,0,-90,
150
 
151
        127,-90,-90,127,-90,-90,127,-90,
152
        127,-90,-90,127,-90,-90,127,-90,
153
        127,-90,-90,127,-90,-90,127,-90,
154
        127,-90,-90,127,-90,-90,127,-90,
155
        127,-90,-90,127,-90,-90,127,-90,
156
        127,-90,-90,127,-90,-90,127,-90,
157
        127,-90,-90,127,-90,-90,127,-90,
158
        127,-90,-90,127,-90,-90,127,-90,
159
 
160
        127,90,0,-90,-127,-90,0,90,
161
        127,90,0,-90,-127,-90,0,90,
162
        127,90,0,-90,-127,-90,0,90,
163
        127,90,0,-90,-127,-90,0,90,
164
        127,90,0,-90,-127,-90,0,90,
165
        127,90,0,-90,-127,-90,0,90,
166
        127,90,0,-90,-127,-90,0,90,
167
        127,90,0,-90,-127,-90,0,90,
168
 
169
        128,128,128,128, 128,128,128,128,
170
        128,128,128,128, 128,128,128,128,
171
        128,128,128,128, 128,128,128,128,
172
        128,128,128,128, 128,128,128,128,
173
        128,128,128,128, 128,128,128,128,
174
        128,128,128,128, 128,128,128,128,
175
        128,128,128,128, 128,128,128,128,
176
        128,128,128,128, 128,128,128,128,
177
 
178
        127,127,127,127, 127,127,127,127,
179
        127,127,127,127, 127,127,127,127,
180
        127,127,127,127, 127,127,127,127,
181
        127,127,127,127, 127,127,127,127,
182
        127,127,127,127, 127,127,127,127,
183
        127,127,127,127, 127,127,127,127,
184
        127,127,127,127, 127,127,127,127,
185
        127,127,127,127, 127,127,127,127,
186
 
187
        127,127,127,127,127,127,127,127,
188
        117,117,117,117,117,117,117,117,
189
        90,90,90,90, 90,90,90,90,
190
        49,49,49,49,49,49,49,49,
191
        0,0,0,0,0,0,0,0,
192
        49,49,49,49,49,49,49,49,
193
        90,90,90,90, 90,90,90,90,
194
        117,117,117,117,117,117,117,117,
195
 
196
        127, 117,       90, 49,00,49,90,117,
197
        127, 117,       90, 49,00,49,90,117,
198
        127, 117,       90, 49,00,49,90,117,
199
        127, 117,       90, 49,00,49,90,117,
200
        127, 117,       90, 49,00,49,90,117,
201
        127, 117,       90, 49,00,49,90,117,
202
        127, 117,       90, 49,00,49,90,117,
203
        127, 117,       90, 49,00,49,90,117,
204
 
205
        127,127,127,127,127,127,127,127,
206
        90,90,90,90, 90,90,90,90,
207
        0,0,0,0,0,0,0,0,
208
        -90,-90,-90,-90, -90,-90,-90,-90,
209
        -127,-127,-127,-127,-127,-127,-127,-127,
210
        -90,-90,-90,-90, -90,-90,-90,-90,
211
        0,0,0,0,0,0,0,0,
212
        90,90,90,90, 90,90,90,90,
213
 
214
 
215
 
216
        255, 255, 255, 255, 255, 255, 255, 255,
217
        255, 255, 255, 255, 255, 255, 255, 255,
218
        255, 255, 255, 255, 255, 255, 255, 255,
219
        255, 255, 255, 255, 255, 255, 255, 255,
220
        255, 255, 255, 255, 255, 255, 255, 255,
221
        255, 255, 255, 255, 255, 255, 255, 255,
222
        255, 255, 255, 255, 255, 255, 255, 255,
223
        255, 255, 255, 255, 255, 255, 255, 255,
224
        --
225
        0,255,0,255,0,255,0,255,
226
        0,255,0,255,0,255,0,255,
227
        0,255,0,255,0,255,0,255,
228
        0,255,0,255,0,255,0,255,
229
        0,255,0,255,0,255,0,255,
230
        0,255,0,255,0,255,0,255,
231
        0,255,0,255,0,255,0,255,
232
        0,255,0,255,0,255,0,255,
233
 
234
 
235
 
236
        0,127,0,127, 0,127,0,127,
237
        0,127,0,127, 0,127,0,127,
238
        0,127,0,127, 0,127,0,127,
239
        0,127,0,127, 0,127,0,127,
240
        0,127,0,127, 0,127,0,127,
241
        0,127,0,127, 0,127,0,127,
242
        0,127,0,127, 0,127,0,127,
243
        0,127,0,127,0,127,0,127,
244
 
245
 
246
 
247
 
248
 
249
 
250
 
251
        0,0,0,0,0,0,0,0,                                                                                          --3
252
        255,255,255,255,255,255,255,255,
253
        0,0,0,0,0,0,0,0,
254
        255,255,255,255,255,255,255,255,
255
        0,0,0,0,0,0,0,0,
256
        255,255,255,255,255,255,255,255,
257
        0,0,0,0,0,0,0,0,
258
        255,255,255,255,255,255,255,255,
259
 
260
 
261
        255, 255, 255, 255, 255, 255, 255, 255,
262
        255, 255, 255, 255, 255, 255, 255, 255,
263
        255, 255, 255, 255, 255, 255, 255, 255,
264
        255, 255, 255, 255, 255, 255, 255, 255,
265
        0,0,0,0,0,0,0,0,
266
        0,0,0,0,0,0,0,0,
267
        0,0,0,0,0,0,0,0,
268
        0,0,0,0,0,0,0,0,
269
 
270
 
271
        183, 160, 94, 153, 194, 163, 132, 165,
272
        183, 153, 116, 176, 187, 166, 130, 169,
273
        179, 168, 171, 182, 179, 165, 131, 167,
274
        177, 177, 179, 177, 179, 165, 131, 167,
275
        178, 178, 179, 176, 182, 164, 130, 171,
276
        179, 180, 180, 179, 183, 169, 132, 169,
277
        179, 179, 180, 182, 183, 170, 129, 172,
278
        180, 179, 181, 179, 181, 170, 130, 169,
279
 
280
        0,32,64,96,128, 160,192,224,
281
        224,192,160,128,96, 64,32, 0,
282
        0,32,64,96,128, 160,192,224,
283
        224,192,160,128,96, 64,32, 0,
284
        0,32,64,96,128, 160,192,224,
285
        224,192,160,128,96, 64,32, 0,
286
        0,32,64,96,128, 160,192,224,
287
        224,192,160,128,96, 64,32, 0,
288
 
289
        128, 128, 128, 128, 128, 128, 128, 128,
290
        128, 128, 128, 128, 128, 128, 128, 128,
291
        128, 128, 192, 192, 192, 192, 128, 128,
292
        128, 128, 192, 192, 192, 192, 128, 128,
293
        128, 128, 192, 192, 192, 192, 128, 128,
294
        128, 128, 192, 192, 192, 192, 128, 128,
295
        128, 128, 128, 128, 128, 128, 128, 128,
296
        128, 128, 128, 128, 128, 128, 128, 128,
297
 
298
        90,100,110,120,130,140,150,160,
299
        91,101,111,121,131,141,151,161,
300
        92,102,112,122,132,142,152,162,
301
        93,103,113,123,133,143,153,163,
302
        90,100,110,120,130,140,150,160,
303
        91,101,111,121,131,141,151,161,
304
        92,102,112,122,132,142,152,162,
305
        93,103,113,123,133,143,153,163,
306
 
307
        0,32,64,96,128, 160,192,224,
308
        0,32,64,96,128, 160,192,224,
309
        0,32,64,96,128, 160,192,224,
310
        0,32,64,96,128, 160,192,224,
311
        0,32,64,96,128, 160,192,224,
312
        0,32,64,96,128, 160,192,224,
313
        0,32,64,96,128, 160,192,224,
314
        0,32,64,96,128, 160,192,224,
315
 
316
        183, 160, 94, 153, 194, 163, 132, 165,
317
        183, 153, 116, 176, 187, 166, 130, 169,
318
        179, 168, 171, 182, 179, 165, 131, 167,
319
        177, 177, 179, 177, 179, 165, 131, 167,
320
        178, 178, 179, 176, 182, 164, 130, 171,
321
        179, 180, 180, 179, 183, 169, 132, 169,
322
        179, 179, 180, 182, 183, 170, 129, 173,
323
        180, 179, 181, 179, 181, 170, 130, 169,
324
 
325
 
326
        159, 128, 198, 128, 128, 128, 140, 128,
327
        128, 128, 128, 128, 128, 128, 128, 128,
328
        198, 128, 155, 128, 128, 128, 166, 128,
329
        128, 128, 128, 128, 128, 128, 128, 128,
330
        128, 128, 128, 128, 128, 128, 128, 128,
331
        128, 128, 128, 128, 128, 128, 128, 128,
332
        140, 128, 156, 128, 128, 128, 132, 128,
333
        128, 128, 128, 128, 128, 128, 128, 128,
334
 
335
        others=>127
336
 
337
        ));
338
 
339
        signal dr,DATAi: STD_LOGIC_VECTOR (7 downto 0);
340
        signal  index: integer range 0 to 2048;
341
 
342
begin
343
 
344
        process(clk)  --Generator of random images
345
                variable a,b:integer:=333;
346
                variable s:real;
347
                variable d,d1,d2,d3,d4,do:integer:=0;
348
        begin
349
                if clk='1' then
350
                        UNIFORM(        a,b,s);
351
                        d4:=d3;
352
                        d3:=d2;
353
                        d2:=d1;
354
                        d1:=d;
355
                        d:=integer(s*2.0**8);
356
                        --some LP filtering
357
                        do :=(d +4*d1+ 6*d2+4*d3+d4)/16;
358
                        dr<=conv_std_logic_vector(do,8) ;
359
                end if;
360
 
361
        end process;
362
 
363
 
364
        DATA_OUTPUT:process(CLK,RST)
365
 
366
                variable delay: integer;
367
                variable STARTi: STD_LOGIC;
368
                variable startdel:boolean;
369
        begin
370
                if       RST='1'  then
371
                        startdel:=false;
372
                        STARTi:='0';
373
                        delay:=0;
374
                elsif  CLK='1' and CLK'event and delay<10000 then
375
                        delay:=delay+1;
376
                        if delay=10 or delay=11 then--or delay=500 or delay= 501  or delay=800 or delay= 801 then
377
                                STARTi:='1' ;
378
                        elsif delay=12  then --or delay= 502 or delay= 802 then          
379
                                STARTi:='0';
380
                                startdel:=true;
381
                        end if;
382
                end if;
383
 
384
                if RST='1'  then
385
                        index<=0;
386
                elsif CLK='1' and CLK'event and startdel  then
387
                        if RANDOM=0 then
388
 
389
                                DATAi<=CONV_STD_LOGIC_VECTOR(INTEGER(ROMBMP(index)),8) after 7 ns;
390
                                index<=(index+1) mod 2048;
391
                        else
392
                                DATAi<=dr;
393
                        end if;
394
                end if;
395
                START<=STARTi after 5 ns;
396
 
397
        end process;
398
 
399
        DATA<= unsigned(DATAi)-UNSIGNED(X"80") when SIGNED_DATA=0 else DATAi;
400
 
401
end BMP_GENERATOR;

powered by: WebSVN 2.1.0

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