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

Subversion Repositories mkjpeg

[/] [mkjpeg/] [trunk/] [design/] [quantizer/] [ROMR.vhd] - Blame information for rev 31

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 25 mikel262
--------------------------------------------------------------------------------
2
--                                                                            --
3
--                          V H D L    F I L E                                --
4
--                          COPYRIGHT (C) 2009                                --
5
--                                                                            --
6
--------------------------------------------------------------------------------
7
--
8
-- Title       : ROMR
9
-- Design      : EV_JPEG_ENC
10
-- Author      : Michal Krepa
11
--
12
--------------------------------------------------------------------------------
13
--
14
-- File        : ROMR.VHD
15
-- Created     : Wed Mar 19 21:09 2009
16
--
17
--------------------------------------------------------------------------------
18
--
19
--  Description : Reciprocal of 1/X where X is 1..255
20
--
21
--------------------------------------------------------------------------------
22
 
23
library IEEE;
24
  use IEEE.STD_LOGIC_1164.all;
25
  use ieee.numeric_std.all;
26
 
27
entity ROMR is
28
  generic
29
    (
30
      ROMADDR_W     : INTEGER := 8;
31
      ROMDATA_W     : INTEGER := 16
32
    );
33
  port(
34
       addr         : in  STD_LOGIC_VECTOR(ROMADDR_W-1 downto 0);
35
       clk          : in  STD_LOGIC;
36
 
37
       datao        : out STD_LOGIC_VECTOR(ROMDATA_W-1 downto 0)
38
  );
39
 
40
end ROMR;
41
 
42
architecture RTL of ROMR is
43
 
44
  constant CK : integer := 256*256;
45
  type ROMQ_TYPE is array (0 to 2**ROMADDR_W-1)
46
            of INTEGER range 0 to 2**ROMDATA_W-1;
47
 
48
  constant rom : ROMQ_TYPE :=
49
  (
50
           0,
51
       65535,
52
       32768,
53
       21845,
54
       16384,
55
       13107,
56
       10923,
57
        9362,
58
        8192,
59
        7282,
60
        6554,
61
        5958,
62
        5461,
63
        5041,
64
        4681,
65
        4369,
66
        4096,
67
        3855,
68
        3641,
69
        3449,
70
        3277,
71
        3121,
72
        2979,
73
        2849,
74
        2731,
75
        2621,
76
        2521,
77
        2427,
78
        2341,
79
        2260,
80
        2185,
81
        2114,
82
        2048,
83
        1986,
84
        1928,
85
        1872,
86
        1820,
87
        1771,
88
        1725,
89
        1680,
90
        1638,
91
        1598,
92
        1560,
93
        1524,
94
        1489,
95
        1456,
96
        1425,
97
        1394,
98
        1365,
99
        1337,
100
        1311,
101
        1285,
102
        1260,
103
        1237,
104
        1214,
105
        1192,
106
        1170,
107
        1150,
108
        1130,
109
        1111,
110
        1092,
111
        1074,
112
        1057,
113
        1040,
114
        1024,
115
        1008,
116
         993,
117
         978,
118
         964,
119
         950,
120
         936,
121
         923,
122
         910,
123
         898,
124
         886,
125
         874,
126
         862,
127
         851,
128
         840,
129
         830,
130
         819,
131
         809,
132
         799,
133
         790,
134
         780,
135
         771,
136
         762,
137
         753,
138
         745,
139
         736,
140
         728,
141
         720,
142
         712,
143
         705,
144
         697,
145
         690,
146
         683,
147
         676,
148
         669,
149
         662,
150
         655,
151
         649,
152
         643,
153
         636,
154
         630,
155
         624,
156
         618,
157
         612,
158
         607,
159
         601,
160
         596,
161
         590,
162
         585,
163
         580,
164
         575,
165
         570,
166
         565,
167
         560,
168
         555,
169
         551,
170
         546,
171
         542,
172
         537,
173
         533,
174
         529,
175
         524,
176
         520,
177
         516,
178
         512,
179
         508,
180
         504,
181
         500,
182
         496,
183
         493,
184
         489,
185
         485,
186
         482,
187
         478,
188
         475,
189
         471,
190
         468,
191
         465,
192
         462,
193
         458,
194
         455,
195
         452,
196
         449,
197
         446,
198
         443,
199
         440,
200
         437,
201
         434,
202
         431,
203
         428,
204
         426,
205
         423,
206
         420,
207
         417,
208
         415,
209
         412,
210
         410,
211
         407,
212
         405,
213
         402,
214
         400,
215
         397,
216
         395,
217
         392,
218
         390,
219
         388,
220
         386,
221
         383,
222
         381,
223
         379,
224
         377,
225
         374,
226
         372,
227
         370,
228
         368,
229
         366,
230
         364,
231
         362,
232
         360,
233
         358,
234
         356,
235
         354,
236
         352,
237
         350,
238
         349,
239
         347,
240
         345,
241
         343,
242
         341,
243
         340,
244
         338,
245
         336,
246
         334,
247
         333,
248
         331,
249
         329,
250
         328,
251
         326,
252
         324,
253
         323,
254
         321,
255
         320,
256
         318,
257
         317,
258
         315,
259
         314,
260
         312,
261
         311,
262
         309,
263
         308,
264
         306,
265
         305,
266
         303,
267
         302,
268
         301,
269
         299,
270
         298,
271
         297,
272
         295,
273
         294,
274
         293,
275
         291,
276
         290,
277
         289,
278
         287,
279
         286,
280
         285,
281
         284,
282
         282,
283
         281,
284
         280,
285
         279,
286
         278,
287
         277,
288
         275,
289
         274,
290
         273,
291
         272,
292
         271,
293
         270,
294
         269,
295
         267,
296
         266,
297
         265,
298
         264,
299
         263,
300
         262,
301
         261,
302
         260,
303
         259,
304
         258,
305
         257
306
  );
307
 
308
 
309
 
310
  signal addr_reg : STD_LOGIC_VECTOR(ROMADDR_W-1 downto 0);
311
begin
312
 
313
  datao <= STD_LOGIC_VECTOR(TO_UNSIGNED( rom( TO_INTEGER(UNSIGNED(addr_reg)) ), ROMDATA_W));
314
 
315
  process(clk)
316
  begin
317
   if clk = '1' and clk'event then
318
     addr_reg <= addr;
319
   end if;
320
  end process;
321
 
322
end RTL;

powered by: WebSVN 2.1.0

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