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

Subversion Repositories cavlc

[/] [cavlc/] [trunk/] [rtl/] [cavlc_top.v] - Blame information for rev 7

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 7 qiubin
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  cavlc_top                                                   ////
4
////                                                              ////
5
////  Description                                                 ////
6
////       top module of cavlc decoder                            ////
7
////                                                              ////
8
////  Author(s):                                                  ////
9
////      - bin qiu, qiubin@opencores.org                         ////
10
////                                                              ////
11
//////////////////////////////////////////////////////////////////////
12
////                                                              ////
13
//// Copyright (C) 2011 Authors and OPENCORES.ORG                 ////
14
////                                                              ////
15
//// This source file may be used and distributed without         ////
16
//// restriction provided that this copyright statement is not    ////
17
//// removed from the file and that any derivative work contains  ////
18
//// the original copyright notice and the associated disclaimer. ////
19
////                                                              ////
20
//// This source file is free software; you can redistribute it   ////
21
//// and/or modify it under the terms of the GNU Lesser General   ////
22
//// Public License as published by the Free Software Foundation; ////
23
//// either version 2.1 of the License, or (at your option) any   ////
24
//// later version.                                               ////
25
////                                                              ////
26
//// This source is distributed in the hope that it will be       ////
27
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
28
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
29
//// PURPOSE.  See the GNU Lesser General Public License for more ////
30
//// details.                                                     ////
31
////                                                              ////
32
//// You should have received a copy of the GNU Lesser General    ////
33
//// Public License along with this source; if not, download it   ////
34
//// from http://www.opencores.org/lgpl.shtml                     ////
35
////                                                              ////
36
//////////////////////////////////////////////////////////////////////
37
 
38 6 qiubin
//2011-8-7 initial version
39
 
40
`include "defines.v"
41
 
42 7 qiubin
module cavlc_top
43
(
44
    clk,
45
    rst_n,
46
    ena,
47
    start,
48
    rbsp,
49
    nC,
50
    max_coeff_num,
51 6 qiubin
 
52 7 qiubin
    coeff_0,
53
    coeff_1,
54
    coeff_2,
55
    coeff_3,
56
    coeff_4,
57
    coeff_5,
58
    coeff_6,
59
    coeff_7,
60
    coeff_8,
61
    coeff_9,
62
    coeff_10,
63
    coeff_11,
64
    coeff_12,
65
    coeff_13,
66
    coeff_14,
67
    coeff_15,
68
    TotalCoeff,
69
    len_comb,
70
    idle,
71
    valid
72 6 qiubin
);
73
//------------------------
74
// ports
75
//------------------------
76 7 qiubin
input   clk, rst_n;
77
input   ena;
78
input   start;
79
input   [0:15]  rbsp;
80
input   signed [5:0]    nC;
81
input   [4:0]   max_coeff_num;
82 6 qiubin
 
83 7 qiubin
output  signed [8:0]    coeff_0;
84
output  signed [8:0]    coeff_1;
85
output  signed [8:0]    coeff_2;
86
output  signed [8:0]    coeff_3;
87
output  signed [8:0]    coeff_4;
88
output  signed [8:0]    coeff_5;
89
output  signed [8:0]    coeff_6;
90
output  signed [8:0]    coeff_7;
91
output  signed [8:0]    coeff_8;
92
output  signed [8:0]    coeff_9;
93
output  signed [8:0]    coeff_10;
94
output  signed [8:0]    coeff_11;
95
output  signed [8:0]    coeff_12;
96
output  signed [8:0]    coeff_13;
97
output  signed [8:0]    coeff_14;
98
output  signed [8:0]    coeff_15;
99
output  [4:0]   TotalCoeff;
100
output  [4:0]   len_comb;
101
output  idle;
102
output  valid;
103 6 qiubin
 
104
//------------------------
105
// cavlc_read_total_coeffs
106
//------------------------
107
wire [1:0] TrailingOnes;
108
wire [4:0] TotalCoeff;
109
wire [1:0] TrailingOnes_comb;
110
wire [4:0] TotalCoeff_comb;
111
wire [4:0] len_read_total_coeffs_comb;
112
wire [7:0] cavlc_state;
113
 
114
cavlc_read_total_coeffs cavlc_read_total_coeffs(
115 7 qiubin
    .clk(clk),
116
    .rst_n(rst_n),
117
    .ena(ena),
118
    .start(start),
119
    .sel(cavlc_state[`cavlc_read_total_coeffs_bit]),
120
 
121
    .rbsp(rbsp),
122
    .nC(nC),
123
 
124
    .TrailingOnes(TrailingOnes),
125
    .TotalCoeff(TotalCoeff),
126 6 qiubin
 
127 7 qiubin
    .TrailingOnes_comb(TrailingOnes_comb),
128
    .TotalCoeff_comb(TotalCoeff_comb),
129 6 qiubin
 
130 7 qiubin
    .len_comb(len_read_total_coeffs_comb)
131 6 qiubin
);
132
 
133
//------------------------
134
// cavlc_read_levels
135
//------------------------
136 7 qiubin
wire    [4:0]   len_read_levels_comb;
137
wire    [3:0]   i;
138 6 qiubin
 
139 7 qiubin
wire    [8:0]   level_0;
140
wire    [8:0]   level_1;
141
wire    [8:0]   level_2;
142
wire    [8:0]   level_3;
143
wire    [8:0]   level_4;
144
wire    [8:0]   level_5;
145
wire    [8:0]   level_6;
146
wire    [8:0]   level_7;
147
wire    [8:0]   level_8;
148
wire    [8:0]   level_9;
149
wire    [8:0]   level_10;
150
wire    [8:0]   level_11;
151
wire    [8:0]   level_12;
152
wire    [8:0]   level_13;
153
wire    [8:0]   level_14;
154
wire    [8:0]   level_15;
155 6 qiubin
 
156
cavlc_read_levels cavlc_read_levels(
157 7 qiubin
    .clk(clk),
158
    .rst_n(rst_n),
159
    .ena(ena),
160
    .t1s_sel(cavlc_state[`cavlc_read_t1s_flags_bit]),
161
    .prefix_sel(cavlc_state[`cavlc_read_level_prefix_bit]),
162
    .suffix_sel(cavlc_state[`cavlc_read_level_suffix_bit]),
163
    .calc_sel(cavlc_state[`cavlc_calc_level_bit]),
164
    .TrailingOnes(TrailingOnes),
165
    .TotalCoeff(TotalCoeff),
166
    .i(i),
167
    .rbsp(rbsp),
168
 
169
    .level_0(level_0),
170
    .level_1(level_1),
171
    .level_2(level_2),
172
    .level_3(level_3),
173
    .level_4(level_4),
174
    .level_5(level_5),
175
    .level_6(level_6),
176
    .level_7(level_7),
177
    .level_8(level_8),
178
    .level_9(level_9),
179
    .level_10(level_10),
180
    .level_11(level_11),
181
    .level_12(level_12),
182
    .level_13(level_13),
183
    .level_14(level_14),
184
    .level_15(level_15),
185
    .len_comb(len_read_levels_comb)
186 6 qiubin
);
187
 
188
//------------------------
189
// cavlc_read_total_zeros
190
//------------------------
191 7 qiubin
wire    [3:0]   TotalZeros_comb;
192
wire    [3:0]   len_read_total_zeros_comb;
193 6 qiubin
 
194
cavlc_read_total_zeros cavlc_read_total_zeros(
195 7 qiubin
    .ena(ena),
196
    .sel(cavlc_state[`cavlc_read_total_zeros_bit]),
197
    .chroma_DC_sel(nC[5]),
198
    .rbsp(rbsp[0:8]),
199
    .TotalCoeff(TotalCoeff[3:0]),
200
    .TotalZeros_comb(TotalZeros_comb),
201
    .len_comb(len_read_total_zeros_comb)
202 6 qiubin
);
203
 
204
//------------------------
205
// read_run_before
206
//------------------------
207 7 qiubin
wire    [3:0]   ZeroLeft;
208
wire    [3:0]   len_read_run_befores_comb;
209 6 qiubin
 
210
cavlc_read_run_befores cavlc_read_run_befores(
211 7 qiubin
    .clk(clk),
212
    .rst_n(rst_n),
213
    .ena(ena),
214
    .clr(cavlc_state[`cavlc_read_total_coeffs_bit]),
215
    .sel(cavlc_state[`cavlc_read_run_befores_bit]),
216
    .ZeroLeft_init(cavlc_state[`cavlc_read_total_zeros_bit]),
217
 
218
    .rbsp(rbsp[0:10]),
219
    .i(i),
220
    .TotalZeros_comb(TotalZeros_comb),
221
 
222
    .level_0(level_0),
223
    .level_1(level_1),
224
    .level_2(level_2),
225
    .level_3(level_3),
226
    .level_4(level_4),
227
    .level_5(level_5),
228
    .level_6(level_6),
229
    .level_7(level_7),
230
    .level_8(level_8),
231
    .level_9(level_9),
232
    .level_10(level_10),
233
    .level_11(level_11),
234
    .level_12(level_12),
235
    .level_13(level_13),
236
    .level_14(level_14),
237
    .level_15(level_15),
238
 
239
    .coeff_0(coeff_0),
240
    .coeff_1(coeff_1),
241
    .coeff_2(coeff_2),
242
    .coeff_3(coeff_3),
243
    .coeff_4(coeff_4),
244
    .coeff_5(coeff_5),
245
    .coeff_6(coeff_6),
246
    .coeff_7(coeff_7),
247
    .coeff_8(coeff_8),
248
    .coeff_9(coeff_9),
249
    .coeff_10(coeff_10),
250
    .coeff_11(coeff_11),
251
    .coeff_12(coeff_12),
252
    .coeff_13(coeff_13),
253
    .coeff_14(coeff_14),
254
    .coeff_15(coeff_15),
255
    .ZeroLeft(ZeroLeft),
256
    .len_comb(len_read_run_befores_comb)
257 6 qiubin
);
258
 
259
//------------------------
260
// cavlc_len_gen
261
//------------------------
262
wire [4:0] len_comb;
263
 
264
cavlc_len_gen cavlc_len_gen(
265 7 qiubin
    .cavlc_state(cavlc_state),
266
    .len_read_total_coeffs_comb(len_read_total_coeffs_comb),
267
    .len_read_levels_comb(len_read_levels_comb),
268
    .len_read_total_zeros_comb(len_read_total_zeros_comb),
269
    .len_read_run_befores_comb(len_read_run_befores_comb),
270
    .len_comb(len_comb)
271 6 qiubin
);
272
 
273
//------------------------
274
// fsm
275
//------------------------
276
cavlc_fsm cavlc_fsm(
277 7 qiubin
    .clk(clk),
278
    .rst_n(rst_n),
279
    .ena(ena),
280
    .start(start),
281
 
282
    .max_coeff_num(max_coeff_num),
283
    .TotalCoeff(TotalCoeff),
284
    .TotalCoeff_comb(TotalCoeff_comb),
285
    .TrailingOnes(TrailingOnes),
286
    .TrailingOnes_comb(TrailingOnes_comb),
287
    .ZeroLeft(ZeroLeft),
288
    .state(cavlc_state),
289
    .i(i),
290
    .idle(idle),
291
    .valid(valid)
292 6 qiubin
);
293
 
294
endmodule

powered by: WebSVN 2.1.0

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