1 |
7 |
qiubin |
//////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// cavlc_len_gen ////
|
4 |
|
|
//// ////
|
5 |
|
|
//// Description ////
|
6 |
|
|
//// generate the number of bits to forward ////
|
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 |
6 |
qiubin |
|
38 |
7 |
qiubin |
//2011-8-7 20:19 initial revision
|
39 |
|
|
|
40 |
6 |
qiubin |
`include "defines.v"
|
41 |
|
|
|
42 |
7 |
qiubin |
module cavlc_len_gen
|
43 |
|
|
(
|
44 |
|
|
cavlc_state,
|
45 |
|
|
len_read_total_coeffs_comb,
|
46 |
|
|
len_read_levels_comb,
|
47 |
|
|
len_read_total_zeros_comb,
|
48 |
|
|
len_read_run_befores_comb,
|
49 |
|
|
len_comb
|
50 |
6 |
qiubin |
);
|
51 |
|
|
//------------------------
|
52 |
|
|
// ports
|
53 |
|
|
//------------------------
|
54 |
7 |
qiubin |
input [7:0] cavlc_state;
|
55 |
|
|
input [4:0] len_read_total_coeffs_comb;
|
56 |
|
|
input [4:0] len_read_levels_comb;
|
57 |
|
|
input [3:0] len_read_total_zeros_comb;
|
58 |
|
|
input [3:0] len_read_run_befores_comb;
|
59 |
6 |
qiubin |
|
60 |
7 |
qiubin |
output [4:0] len_comb;
|
61 |
6 |
qiubin |
|
62 |
|
|
//------------------------
|
63 |
|
|
// regs
|
64 |
|
|
//------------------------
|
65 |
7 |
qiubin |
reg [4:0] len_comb; //number of bits comsumed by cavlc in a cycle
|
66 |
6 |
qiubin |
|
67 |
|
|
//------------------------
|
68 |
|
|
// len_comb
|
69 |
|
|
//------------------------
|
70 |
|
|
always @ (*)
|
71 |
7 |
qiubin |
case (1'b1) //synthesis parallel_case
|
72 |
|
|
cavlc_state[`cavlc_read_total_coeffs_bit] : len_comb <= len_read_total_coeffs_comb;
|
73 |
|
|
cavlc_state[`cavlc_read_t1s_flags_bit],
|
74 |
|
|
cavlc_state[`cavlc_read_level_prefix_bit],
|
75 |
|
|
cavlc_state[`cavlc_read_level_suffix_bit] : len_comb <= len_read_levels_comb;
|
76 |
|
|
cavlc_state[`cavlc_read_total_zeros_bit] : len_comb <= len_read_total_zeros_comb;
|
77 |
|
|
cavlc_state[`cavlc_read_run_befores_bit] : len_comb <= len_read_run_befores_comb;
|
78 |
|
|
cavlc_state[`cavlc_calc_level_bit],
|
79 |
|
|
cavlc_state[`cavlc_idle_bit] : len_comb <= 0;
|
80 |
|
|
default : len_comb <= 'bx;
|
81 |
6 |
qiubin |
endcase
|
82 |
|
|
|
83 |
|
|
endmodule
|
84 |
|
|
|