5 use ieee.std_logic_1164.
all;
6 use ieee.numeric_std.
all;
12 Reset_n
: in std_logic;
13 Enable
: in std_logic;
15 in_request
: out std_logic;
16 in_valid
: in std_logic;
17 in_data
: in signed
(31 downto 0);
19 in_sem_request
: out std_logic;
20 in_sem_valid
: in std_logic;
21 in_sem_addr
: out unsigned
(19 downto 0);
22 in_sem_data
: in signed
(31 downto 0);
24 out_sem_requested
: in std_logic;
25 out_sem_valid
: out std_logic;
26 out_sem_addr
: out unsigned
(19 downto 0);
27 out_sem_data
: out signed
(31 downto 0);
29 out_done
: out std_logic;
30 out_eb_done
: out std_logic);
33 architecture a_ReconFrames
of ReconFrames
is
37 Reset_n
: in std_logic;
38 Enable
: in std_logic;
40 in_request
: out std_logic;
41 in_valid
: in std_logic;
42 in_data
: in signed
(31 downto 0);
44 in_sem_request
: out std_logic;
45 in_sem_valid
: in std_logic;
46 in_sem_addr
: out unsigned
(19 downto 0);
47 in_sem_data
: in signed
(31 downto 0);
49 out_sem_requested
: in std_logic;
50 out_sem_valid
: out std_logic;
51 out_sem_addr
: out unsigned
(19 downto 0);
52 out_sem_data
: out signed
(31 downto 0);
54 in_newframe
: in std_logic;
55 out_done
: out std_logic);
58 constant LG_MAX_SIZE
: natural
:= 10;
59 constant MEM_ADDR_WIDTH
: natural
:= 20;
60 -------------------------------------------------------------------------------
61 -- ExpandBlock's signals
62 -------------------------------------------------------------------------------
63 signal out_eb_request
: std_logic;
64 signal out_eb_valid
: std_logic := '0';
65 signal out_eb_data
: signed
(31 downto 0);
67 signal in_eb_DtBuf_request
: std_logic;
68 signal in_eb_DtBuf_valid
: std_logic;
69 signal in_eb_DtBuf_addr
: unsigned
(MEM_ADDR_WIDTH
-1 downto 0);
70 signal in_eb_DtBuf_data
: signed
(31 downto 0);
72 signal out_eb_DtBuf_request
: std_logic;
73 signal out_eb_DtBuf_valid
: std_logic;
74 signal out_eb_DtBuf_addr
: unsigned
(19 downto 0);
75 signal out_eb_DtBuf_data
: signed
(31 downto 0);
77 signal eb_done
: std_logic;
78 signal eb_enable
: std_logic;
80 -------------------------------------------------------------------------------
82 -------------------------------------------------------------------------------
83 signal QuantDispFrags
: unsigned
(LG_MAX_SIZE
*2-1 downto 0);
85 signal count
: integer;
86 signal countExpand
: unsigned
(LG_MAX_SIZE
*2-1 downto 0);
87 signal s_in_request
: std_logic;
89 signal s_out_done
: std_logic;
90 -------------------------------------------------------------------------------
91 -- States and sub-states
92 -------------------------------------------------------------------------------
93 type state_t
is (stt_Read
, stt_Proc
);
94 signal state
: state_t
;
96 type read_state_t
is (stt_read_HFragments
,
97 stt_read_YPlaneFragments
,
99 stt_read_UVPlaneFragments
,
102 stt_read_ReconYDataOffset
,
103 stt_read_ReconUDataOffset
,
104 stt_read_ReconVDataOffset
,
105 stt_read_QuantDispFrags
,
107 signal read_state
: read_state_t
;
109 begin -- a_ReconFrames
111 expandblock0
: expandblock
117 in_request
=> out_eb_request
,
118 in_valid
=> out_eb_valid
,
119 in_data
=> out_eb_data
,
121 in_sem_request
=> out_eb_DtBuf_request
,
122 in_sem_valid
=> out_eb_DtBuf_valid
,
123 in_sem_addr
=> out_eb_DtBuf_addr
,
124 in_sem_data
=> out_eb_DtBuf_data
,
126 out_sem_requested
=> in_eb_DtBuf_request
,
127 out_sem_valid
=> in_eb_DtBuf_valid
,
128 out_sem_addr
=> in_eb_DtBuf_addr
,
129 out_sem_data
=> in_eb_DtBuf_data
,
131 in_newframe
=> s_out_done
,
135 in_sem_request
<= out_eb_DtBuf_request
;
136 out_eb_DtBuf_valid
<= in_sem_valid
;
137 in_sem_addr
<= out_eb_DtBuf_addr
;
138 out_eb_DtBuf_data
<= in_sem_data
;
140 in_eb_DtBuf_request
<= out_sem_requested
;
141 out_sem_valid
<= in_eb_DtBuf_valid
;
142 out_sem_addr
<= in_eb_DtBuf_addr
;
143 out_sem_data
<= in_eb_DtBuf_data
;
144 out_eb_data
<= in_data
;
145 in_request
<= s_in_request
;
148 -----------------------------------------------------------------------------
149 -- Put the s_out_done signal on the output port
150 -----------------------------------------------------------------------------
151 out_done
<= s_out_done
;
153 -----------------------------------------------------------------------------
154 -- Switch the in_request
155 -----------------------------------------------------------------------------
156 process(read_state
, out_eb_request
, in_valid
, Enable
)
158 s_in_request
<= out_eb_request
;
159 out_eb_valid
<= in_valid
;
160 if (read_state
= stt_read_QuantDispFrags
) then
164 if (Enable
= '0') then
172 variable QuantDispFragsIsZero
: std_logic;
175 if (clk
'event and clk
= '1') then
176 if (Reset_n
= '0') then
179 countExpand
<= to_unsigned
(0, LG_MAX_SIZE
*2);
181 QuantDispFrags
<= to_unsigned
(0, LG_MAX_SIZE
*2);
182 read_state
<= stt_read_HFragments
;
186 if (Enable
= '1') then
191 -- assert false report "read_state = "&read_state_t'image(read_state) severity note;
193 if (s_in_request
= '1' and in_valid
= '1') then
194 -- assert false report "rf.in_data = "&integer'image(to_integer(in_data)) severity note;
197 when stt_read_HFragments
=>
199 read_state
<= stt_read_YPlaneFragments
;
201 when stt_read_YPlaneFragments
=>
203 read_state
<= stt_read_YStride
;
205 when stt_read_YStride
=>
207 read_state
<= stt_read_UVPlaneFragments
;
209 when stt_read_UVPlaneFragments
=>
211 read_state
<= stt_read_UVStride
;
213 when stt_read_UVStride
=>
215 read_state
<= stt_read_VFragments
;
217 when stt_read_VFragments
=>
219 read_state
<= stt_read_ReconYDataOffset
;
221 when stt_read_ReconYDataOffset
=>
223 read_state
<= stt_read_ReconUDataOffset
;
225 when stt_read_ReconUDataOffset
=>
227 read_state
<= stt_read_ReconVDataOffset
;
229 when stt_read_ReconVDataOffset
=>
231 read_state
<= stt_read_QuantDispFrags
;
233 when stt_read_QuantDispFrags
=>
236 -- QuantDispFrags is equal to pbi->CodedBlockIndex of the software
237 read_state
<= stt_read_Others
;
238 QuantDispFrags
<= unsigned
(in_data
(LG_MAX_SIZE
*2-1 downto 0));
239 if (in_data
(LG_MAX_SIZE
*2-1 downto 0) = 0) then
243 -----------------------------------------------------------
244 -- Forward to ExpandBlock the parameters below that are
245 -- received only one time pre frame
246 -----------------------------------------------------------
247 -- For Count = 10 to Count = 73 receive the
248 -- pbi->dequant_Y_coeffs matrix
249 -----------------------------------------------------------
250 -- For Count = 74 to Count = 137 receive the
251 -- pbi->dequant_U_coeffs matrix
252 -----------------------------------------------------------
253 -- For Count = 138 to Count = 201 receive the
254 -- pbi->dequant_V_coeffs matrix
255 -----------------------------------------------------------
256 -- For Count = 202 to Count = 265 receive the
257 -- dequant_InterY_coeffs matrix
258 -----------------------------------------------------------
259 -- For Count = 266 to Count = 329 receive the
260 -- dequant_InterU_coeffs matrix
261 -----------------------------------------------------------
262 -- For Count = 330 to Count = 393 receive the
263 -- dequant_InterV_coeffs matrix
264 -----------------------------------------------------------
265 -- If Count = 394 receive the pbi->FrameType value
266 -----------------------------------------------------------
267 -- If Count = 395 receive the
268 -- Offset of the GoldenFrame Buffer
269 -----------------------------------------------------------
270 -- If Count = 396 receive the
271 -- Offset of the LastFrame Buffer
272 -----------------------------------------------------------
273 -- If Count = 397 receive the
274 -- Offset of the ThisFrame Buffer
275 -----------------------------------------------------------
277 -----------------------------------------------------------
278 -- Forward to ExpandBlock the parameters below that are
279 -- received for all fragments
280 -----------------------------------------------------------
281 -- For Count = 398 to Count = 461 receive the
282 -- pbi->QFragData(number of the fragment to be expanded)
284 ------------------------------------------------------------
285 -- If Count = 462 receive the
286 -- pbi->FragCodingMethod(number of the fragment to be expanded)
288 -----------------------------------------------------------
289 -- If Count = 463 receive the
290 -- pbi->FragCoefEOB(number of the fragment to be expanded)
292 -----------------------------------------------------------
293 -- If Count = 464 receive the
294 -- (pbi->FragMVect(number of the fragment to be expanded)).x
296 -----------------------------------------------------------
297 -- If Count = 465 receive the
298 -- (pbi->FragMVect(number of the fragment to be expanded)).y
300 -----------------------------------------------------------
301 -- If Count = 466 receive the
302 -- (number of fragment to be expanded)
303 -----------------------------------------------------------
304 if (count
= 466) then
312 if (QuantDispFrags
= 0) then
313 QuantDispFragsIsZero
:= '1';
315 QuantDispFragsIsZero
:= '0';
318 if (eb_done
= '1' or QuantDispFragsIsZero
= '1') then
320 countExpand
<= countExpand
+ 1;
322 if (countExpand
= TO_INTEGER
(QuantDispFrags
-1) or QuantDispFragsIsZero
= '1') then
324 read_state
<= stt_read_QuantDispFrags
;
325 countExpand
<= to_unsigned
(0, LG_MAX_SIZE
*2);