1 |
25 |
mikel262 |
-------------------------------------------------------------------------------
|
2 |
|
|
-- File Name : DC_ROM.vhd
|
3 |
|
|
--
|
4 |
|
|
-- Project : JPEG_ENC
|
5 |
|
|
--
|
6 |
|
|
-- Module : DC_ROM
|
7 |
|
|
--
|
8 |
|
|
-- Content : DC_ROM Luminance
|
9 |
|
|
--
|
10 |
|
|
-- Description :
|
11 |
|
|
--
|
12 |
|
|
-- Spec. :
|
13 |
|
|
--
|
14 |
|
|
-- Author : Michal Krepa
|
15 |
|
|
--
|
16 |
|
|
-------------------------------------------------------------------------------
|
17 |
|
|
-- History :
|
18 |
|
|
-- 20090228: (MK): Initial Creation.
|
19 |
|
|
-------------------------------------------------------------------------------
|
20 |
|
|
|
21 |
|
|
-------------------------------------------------------------------------------
|
22 |
|
|
-------------------------------------------------------------------------------
|
23 |
|
|
----------------------------------- LIBRARY/PACKAGE ---------------------------
|
24 |
|
|
-------------------------------------------------------------------------------
|
25 |
|
|
-------------------------------------------------------------------------------
|
26 |
|
|
|
27 |
|
|
-------------------------------------------------------------------------------
|
28 |
|
|
-- generic packages/libraries:
|
29 |
|
|
-------------------------------------------------------------------------------
|
30 |
|
|
library ieee;
|
31 |
|
|
use ieee.std_logic_1164.all;
|
32 |
|
|
use ieee.numeric_std.all;
|
33 |
|
|
|
34 |
|
|
-------------------------------------------------------------------------------
|
35 |
|
|
-- user packages/libraries:
|
36 |
|
|
-------------------------------------------------------------------------------
|
37 |
|
|
|
38 |
|
|
-------------------------------------------------------------------------------
|
39 |
|
|
-------------------------------------------------------------------------------
|
40 |
|
|
----------------------------------- ENTITY ------------------------------------
|
41 |
|
|
-------------------------------------------------------------------------------
|
42 |
|
|
-------------------------------------------------------------------------------
|
43 |
|
|
entity DC_ROM is
|
44 |
|
|
port
|
45 |
|
|
(
|
46 |
|
|
CLK : in std_logic;
|
47 |
|
|
RST : in std_logic;
|
48 |
|
|
VLI_size : in std_logic_vector(3 downto 0);
|
49 |
|
|
|
50 |
|
|
VLC_DC_size : out std_logic_vector(3 downto 0);
|
51 |
|
|
VLC_DC : out unsigned(8 downto 0)
|
52 |
|
|
);
|
53 |
|
|
end entity DC_ROM;
|
54 |
|
|
|
55 |
|
|
-------------------------------------------------------------------------------
|
56 |
|
|
-------------------------------------------------------------------------------
|
57 |
|
|
----------------------------------- ARCHITECTURE ------------------------------
|
58 |
|
|
-------------------------------------------------------------------------------
|
59 |
|
|
-------------------------------------------------------------------------------
|
60 |
|
|
architecture RTL of DC_ROM is
|
61 |
|
|
|
62 |
|
|
|
63 |
|
|
|
64 |
|
|
-------------------------------------------------------------------------------
|
65 |
|
|
-- Architecture: begin
|
66 |
|
|
-------------------------------------------------------------------------------
|
67 |
|
|
begin
|
68 |
|
|
|
69 |
|
|
-------------------------------------------------------------------
|
70 |
|
|
-- DC-ROM
|
71 |
|
|
-------------------------------------------------------------------
|
72 |
|
|
p_dc_rom : process(CLK, RST)
|
73 |
|
|
begin
|
74 |
|
|
if RST = '1' then
|
75 |
|
|
VLC_DC_size <= X"0";
|
76 |
|
|
VLC_DC <= (others => '0');
|
77 |
|
|
elsif CLK'event and CLK = '1' then
|
78 |
|
|
case VLI_size is
|
79 |
|
|
when X"0" =>
|
80 |
|
|
VLC_DC_size <= X"2";
|
81 |
|
|
VLC_DC <= resize("00", VLC_DC'length);
|
82 |
|
|
when X"1" =>
|
83 |
|
|
VLC_DC_size <= X"3";
|
84 |
|
|
VLC_DC <= resize("010", VLC_DC'length);
|
85 |
|
|
when X"2" =>
|
86 |
|
|
VLC_DC_size <= X"3";
|
87 |
|
|
VLC_DC <= resize("011", VLC_DC'length);
|
88 |
|
|
when X"3" =>
|
89 |
|
|
VLC_DC_size <= X"3";
|
90 |
|
|
VLC_DC <= resize("100", VLC_DC'length);
|
91 |
|
|
when X"4" =>
|
92 |
|
|
VLC_DC_size <= X"3";
|
93 |
|
|
VLC_DC <= resize("101", VLC_DC'length);
|
94 |
|
|
when X"5" =>
|
95 |
|
|
VLC_DC_size <= X"3";
|
96 |
|
|
VLC_DC <= resize("110", VLC_DC'length);
|
97 |
|
|
when X"6" =>
|
98 |
|
|
VLC_DC_size <= X"4";
|
99 |
|
|
VLC_DC <= resize("1110", VLC_DC'length);
|
100 |
|
|
when X"7" =>
|
101 |
|
|
VLC_DC_size <= X"5";
|
102 |
|
|
VLC_DC <= resize("11110", VLC_DC'length);
|
103 |
|
|
when X"8" =>
|
104 |
|
|
VLC_DC_size <= X"6";
|
105 |
|
|
VLC_DC <= resize("111110", VLC_DC'length);
|
106 |
|
|
when X"9" =>
|
107 |
|
|
VLC_DC_size <= X"7";
|
108 |
|
|
VLC_DC <= resize("1111110", VLC_DC'length);
|
109 |
|
|
when X"A" =>
|
110 |
|
|
VLC_DC_size <= X"8";
|
111 |
|
|
VLC_DC <= resize("11111110", VLC_DC'length);
|
112 |
|
|
when X"B" =>
|
113 |
|
|
VLC_DC_size <= X"9";
|
114 |
|
|
VLC_DC <= resize("111111110", VLC_DC'length);
|
115 |
|
|
when others =>
|
116 |
|
|
VLC_DC_size <= X"0";
|
117 |
|
|
VLC_DC <= (others => '0');
|
118 |
|
|
end case;
|
119 |
|
|
end if;
|
120 |
|
|
end process;
|
121 |
|
|
|
122 |
|
|
|
123 |
|
|
|
124 |
|
|
end architecture RTL;
|
125 |
|
|
-------------------------------------------------------------------------------
|
126 |
|
|
-- Architecture: end
|
127 |
|
|
-------------------------------------------------------------------------------
|