1 |
159 |
lanttu |
-- ***************************************************
|
2 |
|
|
-- File: hibi_dct.vhd
|
3 |
169 |
lanttu |
-- Creation date: 25.03.2013
|
4 |
|
|
-- Creation time: 13:53:33
|
5 |
|
|
-- Description: This block combines dct to hibi dctQidct block together
|
6 |
159 |
lanttu |
--
|
7 |
169 |
lanttu |
-- DCT_TO_HIBI Connects dctQidct block to HIBI Wrapper
|
8 |
159 |
lanttu |
--
|
9 |
|
|
-- Input:
|
10 |
169 |
lanttu |
-- 1. Address to send the results to quant
|
11 |
|
|
-- 2. Address to send the results to idct (set unused address if you don't use this)
|
12 |
159 |
lanttu |
-- 2. Control word for the current macroblock
|
13 |
169 |
lanttu |
-- Control word structure: bit 6: chroma(1)/luma(0) NOT USED,
|
14 |
|
|
-- 5: intra(1)/inter(0),
|
15 |
|
|
-- 4..0: quantizer parameter (QP)
|
16 |
159 |
lanttu |
-- 3. Then the DCT data ( 8x8x6 x 16-bit values = 384 x 16 bit )
|
17 |
|
|
--
|
18 |
169 |
lanttu |
-- Only 9b DCT data values are supported currently.
|
19 |
|
|
-- Send two DCT-values packed to upper and lower 16bits in the sigle hibi transmission.
|
20 |
159 |
lanttu |
--
|
21 |
169 |
lanttu |
-- <31------------------16--------------------0> BIT index
|
22 |
|
|
-- DCT_DATA_1 DCT_DATA_0 DATA
|
23 |
|
|
--
|
24 |
|
|
--
|
25 |
|
|
-- NOTE: If self release is used (use_self_rel_g=1) user gets the signal that dct_to_hibi is ready to receive data.
|
26 |
|
|
-- By default self release is disabled and you user can send data to dct_to_hibi after quant results are received.
|
27 |
|
|
--
|
28 |
|
|
--
|
29 |
159 |
lanttu |
-- Outputs:
|
30 |
|
|
-- Outputs are 16-bit words which are packed up to hibi. If hibi width is
|
31 |
|
|
-- 32b, then 2 16-bit words are combined into one hibi word.
|
32 |
|
|
-- 01. quant results: 1. 8*8 x 16bit values to quant result address
|
33 |
|
|
-- 02. idct results: 1. 8*8 x 16bit values to idct result address
|
34 |
|
|
-- 03. quant results: 2. 8*8 x 16bit values to quant result address
|
35 |
|
|
-- 04. idct results: 2. 8*8 x 16bit values to idct result address
|
36 |
|
|
-- 05. quant results: 3. 8*8 x 16bit values to quant result address
|
37 |
|
|
-- 06. idct results: 3. 8*8 x 16bit values to idct result address
|
38 |
|
|
-- 07. quant results: 4. 8*8 x 16bit values to quant result address
|
39 |
|
|
-- 08. idct results: 4. 8*8 x 16bit values to idct result address
|
40 |
|
|
-- 09. quant results: 5. 8*8 x 16bit values to quant result address
|
41 |
|
|
-- 10. idct results: 5. 8*8 x 16bit values to idct result address
|
42 |
|
|
-- 11. quant results: 6. 8*8 x 16bit values to quant result address
|
43 |
|
|
-- 12. quant results: 1 word with bits 5..0 determing if 8x8 quant blocks(1-6)
|
44 |
|
|
-- has all values zeros (except dc-component in intra)
|
45 |
|
|
-- 13. idct results: 6. 8*8 x 16bit values to idct result address
|
46 |
|
|
-- -
|
47 |
|
|
-- Total amount of 16-bit values is: 384 per result address + 1 hibi word to
|
48 |
|
|
-- quantization result address.
|
49 |
|
|
--
|
50 |
|
|
-- With default parameter:
|
51 |
|
|
-- Total of 193 words of data to quant address (if data_width_g = 32)
|
52 |
|
|
-- Total of 192 words of data to idct address (if data_width_g = 32)
|
53 |
|
|
--
|
54 |
|
|
-- Created by: matilail
|
55 |
|
|
-- This file was generated with Kactus2 vhdl generator.
|
56 |
|
|
-- ***************************************************
|
57 |
|
|
library IEEE;
|
58 |
|
|
library dct_to_hibi;
|
59 |
|
|
library work;
|
60 |
|
|
use dct_to_hibi.all;
|
61 |
|
|
use work.all;
|
62 |
|
|
use IEEE.std_logic_1164.all;
|
63 |
|
|
|
64 |
|
|
entity hibi_dct is
|
65 |
|
|
|
66 |
|
|
port (
|
67 |
|
|
|
68 |
|
|
-- Interface: clk
|
69 |
|
|
clk : in std_logic;
|
70 |
|
|
|
71 |
|
|
-- Interface: hibi_master
|
72 |
|
|
hibi_av_out : out std_logic;
|
73 |
|
|
hibi_comm_out : out std_logic_vector(4 downto 0);
|
74 |
|
|
hibi_data_out : out std_logic_vector(31 downto 0);
|
75 |
|
|
hibi_re_out : out std_logic;
|
76 |
|
|
hibi_we_out : out std_logic;
|
77 |
|
|
|
78 |
|
|
-- Interface: hibi_slave
|
79 |
|
|
hibi_av_in : in std_logic;
|
80 |
|
|
hibi_comm_in : in std_logic_vector(4 downto 0);
|
81 |
|
|
hibi_data_in : in std_logic_vector(31 downto 0);
|
82 |
|
|
hibi_empty_in : in std_logic;
|
83 |
|
|
hibi_full_in : in std_logic;
|
84 |
|
|
|
85 |
|
|
-- Interface: rst_n
|
86 |
|
|
rst_n : in std_logic
|
87 |
|
|
);
|
88 |
|
|
|
89 |
|
|
end hibi_dct;
|
90 |
|
|
|
91 |
|
|
|
92 |
|
|
architecture structural of hibi_dct is
|
93 |
|
|
|
94 |
|
|
signal dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifCHROMA_TO_ACC : std_logic;
|
95 |
|
|
signal dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifDATA_DCT_TO_ACC : std_logic_vector(8 downto 0);
|
96 |
|
|
signal dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifDATA_IDCT_FROM_ACC : std_logic_vector(8 downto 0);
|
97 |
|
|
signal dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifDATA_QUANT_FROM_ACC : std_logic_vector(7 downto 0);
|
98 |
|
|
signal dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifDCT_READY4COL_FROM_ACC : std_logic;
|
99 |
|
|
signal dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifIDCT_READY4COL_TO_ACC : std_logic;
|
100 |
|
|
signal dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifINTRA_TO_ACC : std_logic;
|
101 |
|
|
signal dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifLOAD_QP_TO_ACC : std_logic;
|
102 |
|
|
signal dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifQP_TO_ACC : std_logic_vector(4 downto 0);
|
103 |
|
|
signal dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifQUANT_READY4COL_TO_ACC : std_logic;
|
104 |
|
|
signal dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifWR_DCT_TO_ACC : std_logic;
|
105 |
|
|
signal dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifWR_IDCT_FROM_ACC : std_logic;
|
106 |
|
|
signal dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifWR_QUANT_FROM_ACC : std_logic;
|
107 |
|
|
|
108 |
|
|
-- DCT to Hibi. Connects dctQidct block to HIBI Wrapper
|
109 |
|
|
--
|
110 |
|
|
-- Input:
|
111 |
169 |
lanttu |
-- 1. Address to send the results to quant
|
112 |
|
|
-- 2. Address to send the results to idct (set unused address if you don't use this)
|
113 |
159 |
lanttu |
-- 2. Control word for the current macroblock
|
114 |
169 |
lanttu |
-- Control word structure: bit 6: chroma(1)/luma(0) (NOT USED),
|
115 |
|
|
-- 5: intra(1)/inter(0),
|
116 |
|
|
-- 4..0: quantizer parameter (QP)
|
117 |
159 |
lanttu |
-- 3. Then the DCT data ( 8x8x6 x 16-bit values = 384 x 16 bit )
|
118 |
|
|
--
|
119 |
169 |
lanttu |
-- Only 9b DCT data values are supported currently.
|
120 |
|
|
-- Send two DCT-values packed to upper and lower 16bits in the sigle hibi transmission.
|
121 |
159 |
lanttu |
--
|
122 |
169 |
lanttu |
-- <31------------------16--------------------0> BIT index
|
123 |
|
|
-- DCT_DATA_1 DCT_DATA_0 DATA
|
124 |
|
|
--
|
125 |
|
|
--
|
126 |
|
|
-- NOTE: If self release is used (use_self_rel_g=1) user gets the signal that dct_to_hibi is ready to receive data.
|
127 |
|
|
-- By default self release is disabled and you user can send data to dct_to_hibi after quant results are received.
|
128 |
|
|
--
|
129 |
|
|
--
|
130 |
159 |
lanttu |
-- Outputs:
|
131 |
|
|
-- Outputs are 16-bit words which are packed up to hibi. If hibi width is
|
132 |
|
|
-- 32b, then 2 16-bit words are combined into one hibi word.
|
133 |
|
|
-- 01. quant results: 1. 8*8 x 16bit values to quant result address
|
134 |
|
|
-- 02. idct results: 1. 8*8 x 16bit values to idct result address
|
135 |
|
|
-- 03. quant results: 2. 8*8 x 16bit values to quant result address
|
136 |
|
|
-- 04. idct results: 2. 8*8 x 16bit values to idct result address
|
137 |
|
|
-- 05. quant results: 3. 8*8 x 16bit values to quant result address
|
138 |
|
|
-- 06. idct results: 3. 8*8 x 16bit values to idct result address
|
139 |
|
|
-- 07. quant results: 4. 8*8 x 16bit values to quant result address
|
140 |
|
|
-- 08. idct results: 4. 8*8 x 16bit values to idct result address
|
141 |
|
|
-- 09. quant results: 5. 8*8 x 16bit values to quant result address
|
142 |
|
|
-- 10. idct results: 5. 8*8 x 16bit values to idct result address
|
143 |
|
|
-- 11. quant results: 6. 8*8 x 16bit values to quant result address
|
144 |
|
|
-- 12. quant results: 1 word with bits 5..0 determing if 8x8 quant blocks(1-6)
|
145 |
|
|
-- has all values zeros (except dc-component in intra)
|
146 |
|
|
-- 13. idct results: 6. 8*8 x 16bit values to idct result address
|
147 |
|
|
-- -
|
148 |
|
|
-- Total amount of 16-bit values is: 384 per result address + 1 hibi word to
|
149 |
|
|
-- quantization result address.
|
150 |
|
|
--
|
151 |
|
|
-- With default parameter:
|
152 |
|
|
-- Total of 193 words of data to quant address (if data_width_g = 32)
|
153 |
|
|
-- Total of 192 words of data to idct address (if data_width_g = 32)
|
154 |
|
|
--
|
155 |
|
|
component dct_to_hibi
|
156 |
|
|
generic (
|
157 |
|
|
comm_width_g : integer := 5;
|
158 |
|
|
data_width_g : integer := 32;
|
159 |
|
|
dct_width_g : integer := 9; -- Incoming data width(9b)
|
160 |
|
|
debug_w_g : integer := 1;
|
161 |
|
|
idct_width_g : integer := 9; -- Data width after IDCT(9b)
|
162 |
|
|
own_address_g : integer := 0; -- Used for self-release
|
163 |
|
|
quant_width_g : integer := 8; -- Quantizated data width(8b)
|
164 |
|
|
rtm_address_g : integer := 0; -- Used for self-release
|
165 |
169 |
lanttu |
use_self_rel_g : integer := 0 -- Does it release itself from RTM?
|
166 |
159 |
lanttu |
|
167 |
|
|
);
|
168 |
|
|
port (
|
169 |
|
|
|
170 |
|
|
-- Interface: clk
|
171 |
|
|
-- Clock interface
|
172 |
|
|
clk : in std_logic;
|
173 |
|
|
|
174 |
|
|
-- Interface: dct_if
|
175 |
|
|
-- Interface for connecting idctquant accelerator
|
176 |
|
|
data_idct_in : in std_logic_vector(8 downto 0);
|
177 |
|
|
data_quant_in : in std_logic_vector(7 downto 0);
|
178 |
|
|
dct_ready4col_in : in std_logic;
|
179 |
|
|
wr_idct_in : in std_logic;
|
180 |
|
|
wr_quant_in : in std_logic;
|
181 |
|
|
chroma_out : out std_logic;
|
182 |
|
|
data_dct_out : out std_logic_vector(8 downto 0);
|
183 |
|
|
idct_ready4col_out : out std_logic;
|
184 |
|
|
intra_out : out std_logic;
|
185 |
|
|
loadQP_out : out std_logic;
|
186 |
|
|
QP_out : out std_logic_vector(4 downto 0);
|
187 |
|
|
quant_ready4col_out : out std_logic;
|
188 |
|
|
wr_dct_out : out std_logic;
|
189 |
|
|
|
190 |
|
|
-- Interface: hibi_master
|
191 |
|
|
-- HIBI wrapper r4 version 2 master interface
|
192 |
|
|
hibi_av_out : out std_logic;
|
193 |
|
|
hibi_comm_out : out std_logic_vector(4 downto 0);
|
194 |
|
|
hibi_data_out : out std_logic_vector(31 downto 0);
|
195 |
|
|
hibi_re_out : out std_logic;
|
196 |
|
|
hibi_we_out : out std_logic;
|
197 |
|
|
|
198 |
|
|
-- Interface: hibi_slave
|
199 |
|
|
hibi_av_in : in std_logic;
|
200 |
|
|
hibi_comm_in : in std_logic_vector(4 downto 0);
|
201 |
|
|
hibi_data_in : in std_logic_vector(31 downto 0);
|
202 |
|
|
hibi_empty_in : in std_logic;
|
203 |
|
|
hibi_full_in : in std_logic;
|
204 |
|
|
|
205 |
|
|
-- These ports are not in any interface
|
206 |
|
|
-- debug_out : out std_logic;
|
207 |
|
|
|
208 |
|
|
-- Interface: rst_n
|
209 |
|
|
-- Active low reset input.
|
210 |
|
|
rst_n : in std_logic
|
211 |
|
|
|
212 |
|
|
);
|
213 |
|
|
end component;
|
214 |
|
|
|
215 |
|
|
component dctQidct_core
|
216 |
|
|
port (
|
217 |
|
|
|
218 |
|
|
-- Interface: clk
|
219 |
|
|
clk : in std_logic;
|
220 |
|
|
|
221 |
|
|
-- Interface: dct_if
|
222 |
|
|
chroma_in : in std_logic;
|
223 |
|
|
data_dct_in : in std_logic_vector(8 downto 0);
|
224 |
|
|
idct_ready4column_in : in std_logic;
|
225 |
|
|
intra_in : in std_logic;
|
226 |
|
|
loadQP_in : in std_logic;
|
227 |
|
|
QP_in : in std_logic_vector(4 downto 0);
|
228 |
|
|
quant_ready4column_in : in std_logic;
|
229 |
|
|
wr_dct_in : in std_logic;
|
230 |
|
|
data_idct_out : out std_logic_vector(8 downto 0);
|
231 |
|
|
data_quant_out : out std_logic_vector(7 downto 0);
|
232 |
|
|
dct_ready4column_out : out std_logic;
|
233 |
|
|
wr_idct_out : out std_logic;
|
234 |
|
|
wr_quant_out : out std_logic;
|
235 |
|
|
|
236 |
|
|
-- Interface: rst_n
|
237 |
|
|
rst_n : in std_logic
|
238 |
|
|
|
239 |
|
|
);
|
240 |
|
|
end component;
|
241 |
|
|
|
242 |
|
|
-- You can write vhdl code after this tag and it is saved through the generator.
|
243 |
|
|
-- ##KACTUS2_BLACK_BOX_DECLARATIONS_BEGIN##
|
244 |
|
|
-- ##KACTUS2_BLACK_BOX_DECLARATIONS_END##
|
245 |
|
|
-- Stop writing your code after this tag.
|
246 |
|
|
|
247 |
|
|
|
248 |
|
|
begin
|
249 |
|
|
|
250 |
|
|
-- You can write vhdl code after this tag and it is saved through the generator.
|
251 |
|
|
-- ##KACTUS2_BLACK_BOX_ASSIGNMENTS_BEGIN##
|
252 |
|
|
-- ##KACTUS2_BLACK_BOX_ASSIGNMENTS_END##
|
253 |
|
|
-- Stop writing your code after this tag.
|
254 |
|
|
|
255 |
|
|
dct_to_hibi_0 : dct_to_hibi
|
256 |
|
|
port map (
|
257 |
|
|
chroma_out => dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifCHROMA_TO_ACC,
|
258 |
|
|
clk => clk,
|
259 |
|
|
data_dct_out(8 downto 0) => dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifDATA_DCT_TO_ACC(8 downto 0),
|
260 |
|
|
data_idct_in(8 downto 0) => dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifDATA_IDCT_FROM_ACC(8 downto 0),
|
261 |
|
|
data_quant_in(7 downto 0) => dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifDATA_QUANT_FROM_ACC(7 downto 0),
|
262 |
|
|
dct_ready4col_in => dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifDCT_READY4COL_FROM_ACC,
|
263 |
|
|
hibi_av_in => hibi_av_in,
|
264 |
|
|
hibi_av_out => hibi_av_out,
|
265 |
|
|
hibi_comm_in(4 downto 0) => hibi_comm_in(4 downto 0),
|
266 |
|
|
hibi_comm_out(4 downto 0) => hibi_comm_out(4 downto 0),
|
267 |
|
|
hibi_data_in(31 downto 0) => hibi_data_in(31 downto 0),
|
268 |
|
|
hibi_data_out(31 downto 0) => hibi_data_out(31 downto 0),
|
269 |
|
|
hibi_empty_in => hibi_empty_in,
|
270 |
|
|
hibi_full_in => hibi_full_in,
|
271 |
|
|
hibi_re_out => hibi_re_out,
|
272 |
|
|
hibi_we_out => hibi_we_out,
|
273 |
|
|
idct_ready4col_out => dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifIDCT_READY4COL_TO_ACC,
|
274 |
|
|
intra_out => dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifINTRA_TO_ACC,
|
275 |
|
|
loadQP_out => dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifLOAD_QP_TO_ACC,
|
276 |
|
|
QP_out(4 downto 0) => dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifQP_TO_ACC(4 downto 0),
|
277 |
|
|
quant_ready4col_out => dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifQUANT_READY4COL_TO_ACC,
|
278 |
|
|
rst_n => rst_n,
|
279 |
|
|
wr_dct_out => dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifWR_DCT_TO_ACC,
|
280 |
|
|
wr_idct_in => dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifWR_IDCT_FROM_ACC,
|
281 |
|
|
wr_quant_in => dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifWR_QUANT_FROM_ACC
|
282 |
|
|
);
|
283 |
|
|
|
284 |
|
|
dctqidct_0 : dctQidct_core
|
285 |
|
|
port map (
|
286 |
|
|
chroma_in => dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifCHROMA_TO_ACC,
|
287 |
|
|
clk => clk,
|
288 |
|
|
data_dct_in(8 downto 0) => dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifDATA_DCT_TO_ACC(8 downto 0),
|
289 |
|
|
data_idct_out(8 downto 0) => dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifDATA_IDCT_FROM_ACC(8 downto 0),
|
290 |
|
|
data_quant_out(7 downto 0) => dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifDATA_QUANT_FROM_ACC(7 downto 0),
|
291 |
|
|
dct_ready4column_out => dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifDCT_READY4COL_FROM_ACC,
|
292 |
|
|
idct_ready4column_in => dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifIDCT_READY4COL_TO_ACC,
|
293 |
|
|
intra_in => dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifINTRA_TO_ACC,
|
294 |
|
|
loadQP_in => dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifLOAD_QP_TO_ACC,
|
295 |
|
|
QP_in(4 downto 0) => dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifQP_TO_ACC(4 downto 0),
|
296 |
|
|
quant_ready4column_in => dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifQUANT_READY4COL_TO_ACC,
|
297 |
|
|
rst_n => rst_n,
|
298 |
|
|
wr_dct_in => dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifWR_DCT_TO_ACC,
|
299 |
|
|
wr_idct_out => dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifWR_IDCT_FROM_ACC,
|
300 |
|
|
wr_quant_out => dct_to_hibi_0_dct_if_to_dctqidct_0_dct_ifWR_QUANT_FROM_ACC
|
301 |
|
|
);
|
302 |
|
|
|
303 |
|
|
end structural;
|
304 |
|
|
|