OSDN Git Service

altera works, xilinx works with trivial bugs
[fpga-leon-mjpeg/leon-mjpeg.git] / grlib-gpl-1.0.22-b4095 / lib / kuri / mjpeg / mjpeg.vhd
1 library ieee;
2 use ieee.std_logic_1164.all;
3 use ieee.numeric_std.all;
4
5 library grlib;
6 use grlib.stdlib.all;
7 use grlib.amba.all;
8 use grlib.devices.all;
9
10 library techmap;
11 use techmap.gencomp.all;
12
13 package mjpeg is
14
15 type jpg_set_type is record
16   samp_fact : std_logic;
17   xmcumax   : std_logic_vector(5 downto 0);
18   ymcumax   : std_logic_vector(4 downto 0);
19   incaddy   : std_logic_vector(15 downto 0);
20   incaddmcux : std_logic_vector(15 downto 0);
21   incaddmcuy : std_logic_vector(10 downto 0);
22   fbstartadd : std_logic_vector(31 downto 0);
23 end record;
24
25 component huffdctycc is
26    generic (
27       memtech : integer := DEFMEMTECH;
28       shindex : integer := 0;
29       haddr  : integer := 0;
30       hmask  : integer := 16#fff#;
31       hirq   : integer := 0;      
32       pindex : integer := 0;
33       paddr  : integer := 0;
34       pmask  : integer := 16#fff#;
35       mhindex : integer := 0;
36       chprot : integer := 3);      
37
38    port (
39       rst   : in std_ulogic;
40       clk   : in std_ulogic;
41       ahbmi : in ahb_mst_in_type;
42       ahbmo : out ahb_mst_out_type;
43       ahbsi : in ahb_slv_in_type;
44       ahbso : out ahb_slv_out_type;
45       apbi  : in apb_slv_in_type;
46       apbo  : out apb_slv_out_type
47    );
48 end component;
49
50 component huff  is
51    generic (
52       memtech : integer := DEFMEMTECH;
53       shindex : integer := 0;
54       haddr  : integer := 0;
55       hmask  : integer := 16#fff#;
56       hirq   : integer := 0;      
57       pindex : integer := 0;
58       paddr  : integer := 0;
59       pmask  : integer := 16#fff#;
60       mhindex : integer := 0;
61       chprot : integer := 3);      
62    port (
63       rst   : in std_ulogic;
64       clk   : in std_ulogic;
65       ahbsi : in ahb_slv_in_type;
66       ahbso : out ahb_slv_out_type;
67       apbi  : in apb_slv_in_type;
68       apbo  : out apb_slv_out_type;
69       kready : in std_logic;
70       kstrobe : out std_logic;
71       kdata   : out std_logic_vector(11 downto 0);
72       kaddress : out std_logic_vector(5 downto 0);
73       jpg_setting : out jpg_set_type;
74       error : in std_logic_vector(2 downto 0);
75       startgen : out std_logic;
76       kstrobeq : out std_logic;
77       kdataq : out std_logic_vector(7 downto 0);
78       kaddq : out std_logic_vector(7 downto 0);
79       krddataq : in std_logic_vector(7 downto 0);
80       krdq : out std_logic      
81    );
82 end component;
83
84 component huffmemcont is
85    generic (
86       memtech : integer := DEFMEMTECH);
87    port (
88       rst   : in std_ulogic;
89       clk   : in std_ulogic;
90       kready1  : out std_logic;
91       kstrobe1 : in std_logic;
92       kaddress1 : in std_logic_vector(5 downto 0);
93       kdata1   : in std_logic_vector(11 downto 0);
94       kready2  : in std_logic;
95       kstrobe2 : out std_logic;
96       kdata2   : out std_logic_vector(11 downto 0);
97       error    : out std_logic;
98
99       samp_fact : in std_logic;
100       kstrobeq1 : in std_logic;
101       kdataq1   : in std_logic_vector(7 downto 0);
102       kdataq2   : out std_logic_vector(7 downto 0);
103       
104       kaddq : in std_logic_vector(7 downto 0);
105       krdq : in std_logic;
106       krddataq : out std_logic_vector(7 downto 0)
107    );
108 end component;
109
110 component dctmem1cont is
111    generic (
112       memtech : integer := DEFMEMTECH);
113    port (
114       rst   : in std_ulogic;
115       clk   : in std_ulogic;
116       kready1  : out std_logic;
117       kstrobe1 : in std_logic;
118       kdata1   : in std_logic_vector(11 downto 0);
119       kready2  : in std_logic;
120       kstrobe2 : out std_logic;
121       kdata2   : out std_logic_vector(11 downto 0);
122       error    : out std_logic;
123       samp_fact : in std_logic;
124       kstrobeq1 : in std_logic;
125       kdataq1   : in std_logic_vector(7 downto 0);
126       kdataq2   : out std_logic_vector(7 downto 0)
127    );
128 end component;
129
130 component dctmem2cont is
131    generic (
132       memtech : integer := DEFMEMTECH);
133    port (
134       rst   : in std_ulogic;
135       clk   : in std_ulogic;
136       kready1  : out std_logic;
137       kstrobe1 : in std_logic;
138       kdata1   : in std_logic_vector(15 downto 0);
139       kready2  : in std_logic;
140       kstrobe2 : out std_logic;
141       kdata2   : out std_logic_vector(15 downto 0);
142       error     : out std_logic
143    );
144 end component;
145
146 component idct1 is
147     port ( rst : in  std_ulogic;
148            clk : in  std_ulogic;
149            ready1 : out std_logic;
150            strobe1 : in std_logic;
151            coeffin : in  std_logic_vector (11 downto 0);
152            quantin : in  std_logic_vector (7 downto 0);
153            outdata : out  std_logic_vector (15 downto 0);
154            ready2 : in std_logic;
155            strobe2 : out std_logic
156            );
157 end component;
158
159 component idct2 is
160     port ( rst : in  std_ulogic;
161            clk : in  std_ulogic;
162            ready1 : out std_logic;
163            strobe1 : in std_logic;
164            coeffin : in  std_logic_vector (15 downto 0);
165            outdata : out  std_logic_vector (7 downto 0);
166            ready2 : in std_logic;
167            strobe2 : out std_logic
168            );
169 end component;
170
171 component yccambaif
172      generic (
173       memtech : integer := DEFMEMTECH;
174       shindex : integer := 0;
175       haddr  : integer := 0;
176       hmask  : integer := 16#fff#;
177       hirq   : integer := 0;      
178       pindex : integer := 0;
179       paddr  : integer := 0;
180       pmask  : integer := 16#fff#);
181    port (
182       rst   : in std_ulogic;
183       clk   : in std_ulogic;
184       ahbsi : in ahb_slv_in_type;
185       ahbso : out ahb_slv_out_type;
186       apbi  : in apb_slv_in_type;
187       apbo  : out apb_slv_out_type;
188       kready : in std_logic;
189       kstrobe : out std_logic;
190       kdata   : out std_logic_vector(11 downto 0);
191       samp_fact : out std_logic;
192       error : in std_logic_vector(2 downto 0);
193       xmcumax : out std_logic_vector(5 downto 0);
194       ymcumax : out std_logic_vector(4 downto 0);
195       incaddy  : out std_logic_vector(15 downto 0);
196       incaddmcux : out std_logic_vector(15 downto 0);
197       incaddmcuy : out std_logic_vector(10 downto 0);
198       fbstartadd : out std_logic_vector(31 downto 0);
199       startgen : out std_logic;
200       kstrobeq : out std_logic;
201       kdataq : out std_logic_vector(7 downto 0)
202    );
203 end component;
204
205 component yccmemcont
206    generic (
207       memtech : integer := DEFMEMTECH);
208    port (
209       rst   : in std_ulogic;
210       clk   : in std_ulogic;
211       kready1  : out std_logic;
212       kstrobe1 : in std_logic;
213       kdata1   : in std_logic_vector(7 downto 0);
214       kready2  : in std_logic;
215       kstrobe2 : out std_logic;
216       kdata2   : out std_logic_vector(23 downto 0);
217       samp_fact : in std_logic;
218       error     : out std_logic
219    );
220 end component;
221
222 component yccrgb
223    generic (
224       memtech : integer := DEFMEMTECH;
225       hirq   : integer := 0;       
226       mhindex : integer := 0;
227       chprot : integer := 3);
228    port (
229       rst   : in std_ulogic;
230       clk   : in std_ulogic;
231       ahbmi : in ahb_mst_in_type;
232       ahbmo : out ahb_mst_out_type;
233       kready  : out std_logic;
234       kstrobe : in std_logic;
235       kdata   : in std_logic_vector(23 downto 0);
236       xmcumax : in std_logic_vector(5 downto 0);
237       ymcumax : in std_logic_vector(4 downto 0);
238       incaddy  : in std_logic_vector(15 downto 0);
239       incaddmcux : in std_logic_vector(15 downto 0);      
240       incaddmcuy : in std_logic_vector(10 downto 0);
241       fbstartadd : in std_logic_vector(31 downto 0);
242       startgen   : in std_logic
243    );
244 end component;
245
246 end;