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

Subversion Repositories nova

[/] [nova/] [trunk/] [src/] [pc_decoding.v] - Blame information for rev 11

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 eexuke
//--------------------------------------------------------------------------------------------------
2
// Design    : nova
3
// Author(s) : Ke Xu
4
// Email           : eexuke@yahoo.com
5
// File      : pc_decoding.v
6
// Generated : June 6, 2005
7
// Copyright (C) 2008 Ke Xu                
8
//-------------------------------------------------------------------------------------------------
9
// Description 
10
// Decoding program counter for bitstream_buffer
11
//-------------------------------------------------------------------------------------------------
12
 
13
// synopsys translate_off
14
`include "timescale.v"
15
// synopsys translate_on
16
`include "nova_defines.v"
17
 
18
module pc_decoding (clk,reset_n,parser_state,nal_unit_state,slice_header_state,ref_pic_list_reordering_state,
19
        dec_ref_pic_marking_state,slice_data_state,sub_mb_pred_state,mb_pred_state,seq_parameter_set_state,
20
        pic_parameter_set_state,exp_golomb_len,dependent_variable_len,cavlc_consumed_bits_len,
21
        pc);
22
        input clk,reset_n;
23
        input [1:0] parser_state;
24
        input [2:0] nal_unit_state;
25
        input [3:0] slice_header_state;
26
        input [2:0] ref_pic_list_reordering_state;
27
        input [1:0] dec_ref_pic_marking_state;
28
        input [3:0] slice_data_state;
29
        input [1:0] sub_mb_pred_state;
30
        input [2:0] mb_pred_state;
31
        input [3:0] seq_parameter_set_state;
32
        input [3:0] pic_parameter_set_state;
33
        input [3:0] exp_golomb_len;
34
        input [3:0] dependent_variable_len;
35
        input [4:0] cavlc_consumed_bits_len;
36
        output [6:0] pc;
37
        reg     [6:0] pc;
38
 
39
        reg [2:0] consumed_bits_sel;
40
        reg [4:0] FixedLen;
41
 
42
        always @ (reset_n or parser_state or nal_unit_state or slice_header_state or ref_pic_list_reordering_state or
43
                dec_ref_pic_marking_state or slice_data_state or sub_mb_pred_state or mb_pred_state or
44
                seq_parameter_set_state or pic_parameter_set_state)
45
                if (reset_n == 0)
46
                        consumed_bits_sel <= `rst_consumed_bits_sel;
47
                else if (parser_state == `start_code_prefix)
48
                        consumed_bits_sel <= `fixed_length;
49
                else if (nal_unit_state == `forbidden_zero_bit_2_nal_unit_type)
50
                        consumed_bits_sel <= `fixed_length;
51
                else if (slice_header_state != `rst_slice_header)
52
                        case (slice_header_state)
53
                                `first_mb_in_slice_s                        :consumed_bits_sel <= `exp_golomb;
54
                                `slice_type_s                               :consumed_bits_sel <= `exp_golomb;
55
                                `pic_parameter_set_id_slice_header_s        :consumed_bits_sel <= `exp_golomb;
56
                                `frame_num_s                                :consumed_bits_sel <= `dependent_variable;
57
                                `idr_pic_id_s                               :consumed_bits_sel <= `exp_golomb;
58
                                `pic_order_cnt_lsb_s                        :consumed_bits_sel <= `dependent_variable;
59
                                `num_ref_idx_active_override_flag_s         :consumed_bits_sel <= `fixed_length;
60
                                `num_ref_idx_l0_active_minus1_slice_header_s:consumed_bits_sel <= `exp_golomb;
61
                                `ref_pic_list_reordering:
62
                                case (ref_pic_list_reordering_state)
63
                                        `ref_pic_list_reordering_flag_l0_s:consumed_bits_sel <= `fixed_length;
64
                                        default                           :consumed_bits_sel <= `rst_consumed_bits_sel;
65
                                endcase
66
                                `dec_ref_pic_marking:
67
                                case (dec_ref_pic_marking_state)
68
                                        `no_output_of_prior_pics_flag_2_long_term_reference_flag:consumed_bits_sel <= `fixed_length;
69
                                        `adaptive_ref_pic_marking_mode_flag_s                   :consumed_bits_sel <= `fixed_length;
70
                                        default                                                 :consumed_bits_sel <= `rst_consumed_bits_sel;
71
                                endcase
72
                                `slice_qp_delta_s               :consumed_bits_sel <= `exp_golomb;
73
                                `disable_deblocking_filter_idc_s:consumed_bits_sel <= `exp_golomb;
74
                                `slice_alpha_c0_offset_div2_s   :consumed_bits_sel <= `exp_golomb;
75
                                `slice_beta_offset_div2_s       :consumed_bits_sel <= `exp_golomb;
76
                                default                         :consumed_bits_sel <= `rst_consumed_bits_sel;
77
                        endcase
78
                else if (slice_data_state != `rst_slice_data)
79
                        case (slice_data_state)
80
                                `mb_skip_run_s           :consumed_bits_sel <= `exp_golomb;
81
                                `mb_type_s               :consumed_bits_sel <= `exp_golomb;
82
                                `pcm_alignment_zero_bit_s:consumed_bits_sel <= `exp_golomb;
83
                                `pcm_byte_s              :consumed_bits_sel <= `pcm_alignment;
84
                                `sub_mb_pred:
85
                                case (sub_mb_pred_state)
86
                                        `rst_sub_mb_pred:consumed_bits_sel <= `rst_consumed_bits_sel;
87
                                        default         :consumed_bits_sel <= `exp_golomb;
88
                                endcase
89
                                `mb_pred:
90
                                case (mb_pred_state)
91
                                        `prev_intra4x4_pred_mode_flag_s:consumed_bits_sel <= `fixed_length;
92
                                        `rem_intra4x4_pred_mode_s      :consumed_bits_sel <= `fixed_length;
93
                                        `intra_chroma_pred_mode_s      :consumed_bits_sel <= `exp_golomb;
94
                                        `ref_idx_l0_s                  :consumed_bits_sel <= `exp_golomb;
95
                                        `mvd_l0_s                      :consumed_bits_sel <= `exp_golomb;
96
                                        default                        :consumed_bits_sel <= `rst_consumed_bits_sel;
97
                                endcase
98
                                `coded_block_pattern_s:consumed_bits_sel <= `exp_golomb;
99
                                `mb_qp_delta_s        :consumed_bits_sel <= `exp_golomb;
100
                                `residual             :consumed_bits_sel <= `cavlc_consumed;
101
                                default               :consumed_bits_sel <= `rst_consumed_bits_sel;
102
                        endcase
103
                else if (seq_parameter_set_state != `rst_seq_parameter_set)
104
                        case (seq_parameter_set_state)
105
                                `fixed_header                             :consumed_bits_sel <= `fixed_length;
106
                                `level_idc_s                              :consumed_bits_sel <= `fixed_length;
107
                                `seq_parameter_set_id_sps_s               :consumed_bits_sel <= `exp_golomb;
108
                                `log2_max_frame_num_minus4_s              :consumed_bits_sel <= `exp_golomb;
109
                                `pic_order_cnt_type_s                     :consumed_bits_sel <= `exp_golomb;
110
                                `log2_max_pic_order_cnt_lsb_minus4_s                    :consumed_bits_sel <= `exp_golomb;
111
                                `num_ref_frames_s                         :consumed_bits_sel <= `exp_golomb;
112
                                `gaps_in_frame_num_value_allowed_flag_s         :consumed_bits_sel <= `fixed_length;
113
                                `pic_width_in_mbs_minus1_s                :consumed_bits_sel <= `exp_golomb;
114
                                `pic_height_in_map_units_minus1_s         :consumed_bits_sel <= `exp_golomb;
115
                                `frame_mbs_only_flag_2_frame_cropping_flag:consumed_bits_sel <= `fixed_length;
116
                                `vui_parameter_present_flag_s             :consumed_bits_sel <= `fixed_length;
117
                                default                                   :consumed_bits_sel <= `rst_consumed_bits_sel;
118
                        endcase
119
                else if (pic_parameter_set_state != `rst_pic_parameter_set)
120
                        case (pic_parameter_set_state)
121
                                `pic_parameter_set_id_pps_s                                :consumed_bits_sel <= `exp_golomb;
122
                                `seq_parameter_set_id_pps_s                                :consumed_bits_sel <= `exp_golomb;
123
                                `entropy_coding_mode_flag_2_pic_order_present_flag         :consumed_bits_sel <= `fixed_length;
124
                                `num_slice_groups_minus1_s                                 :consumed_bits_sel <= `exp_golomb;
125
                                `num_ref_idx_l0_active_minus1_pps_s                        :consumed_bits_sel <= `exp_golomb;
126
                                `num_ref_idx_l1_active_minus1_pps_s                        :consumed_bits_sel <= `exp_golomb;
127
                                `weighted_pred_flag_2_weighted_bipred_idc                  :consumed_bits_sel <= `fixed_length;
128
                                `pic_init_qp_minus26_s                                     :consumed_bits_sel <= `exp_golomb;
129
                                `pic_init_qs_minus26_s                                     :consumed_bits_sel <= `exp_golomb;
130
                                `chroma_qp_index_offset_s                                  :consumed_bits_sel <= `exp_golomb;
131
                                `deblocking_filter_control_2_redundant_pic_cnt_present_flag:consumed_bits_sel <= `fixed_length;
132
                                default                                                    :consumed_bits_sel <= `rst_consumed_bits_sel;
133
                        endcase
134
                else if (nal_unit_state == `rbsp_trailing_one_bit)
135
                        consumed_bits_sel <= `fixed_length;
136
                else if (nal_unit_state == `rbsp_trailing_zero_bits)
137
                        consumed_bits_sel <= `trailing_bits;
138
                else
139
                        consumed_bits_sel <= `rst_consumed_bits_sel;
140
 
141
        always @ (reset_n or parser_state or nal_unit_state or slice_header_state or ref_pic_list_reordering_state or
142
                dec_ref_pic_marking_state or slice_data_state or mb_pred_state or seq_parameter_set_state or pic_parameter_set_state)
143
                if (reset_n == 0)
144
                        FixedLen <= 0;
145
                else
146
                        begin
147
                                if (parser_state == `start_code_prefix)
148
                                        FixedLen <= 5'd16;
149
                                else if (nal_unit_state == `forbidden_zero_bit_2_nal_unit_type)
150
                                        FixedLen <= 8;
151
                                else if (slice_header_state == `num_ref_idx_active_override_flag_s)
152
                                        FixedLen <= 1;
153
                                else if (ref_pic_list_reordering_state == `ref_pic_list_reordering_flag_l0_s)
154
                                        FixedLen <= 1;
155
                                else if (dec_ref_pic_marking_state == `no_output_of_prior_pics_flag_2_long_term_reference_flag)
156
                                        FixedLen <= 2;
157
                                else if (dec_ref_pic_marking_state == `adaptive_ref_pic_marking_mode_flag_s)
158
                                        FixedLen <= 1;
159
                                else if (slice_data_state == `pcm_byte_s)
160
                                        FixedLen <= 5'd16;
161
                                else if (mb_pred_state == `prev_intra4x4_pred_mode_flag_s)
162
                                        FixedLen <= 1;
163
                                else if (mb_pred_state == `rem_intra4x4_pred_mode_s)
164
                                        FixedLen <= 3;
165
                                else if (seq_parameter_set_state == `fixed_header)
166
                                        FixedLen <= 5'd16;
167
                                else if (seq_parameter_set_state == `level_idc_s)
168
                                        FixedLen <= 8;
169
                                else if (seq_parameter_set_state == `gaps_in_frame_num_value_allowed_flag_s)
170
                                        FixedLen <= 1;
171
                                else if (seq_parameter_set_state == `frame_mbs_only_flag_2_frame_cropping_flag)
172
                                        FixedLen <= 3;
173
                                else if (seq_parameter_set_state == `vui_parameter_present_flag_s)
174
                                        FixedLen <= 1;
175
                                else if (pic_parameter_set_state == `entropy_coding_mode_flag_2_pic_order_present_flag)
176
                                        FixedLen <= 2;
177
                                else if (pic_parameter_set_state == `weighted_pred_flag_2_weighted_bipred_idc)
178
                                        FixedLen <= 3;
179
                                else if (pic_parameter_set_state == `deblocking_filter_control_2_redundant_pic_cnt_present_flag)
180
                                        FixedLen <= 3;
181
                                else if (nal_unit_state == `rbsp_trailing_one_bit)
182
                                        FixedLen <= 1;
183
                                else
184
                                        FixedLen <= 1;
185
                        end
186
 
187
        reg [6:0] pc_reg;
188
        always @ (consumed_bits_sel or pc_reg or exp_golomb_len or dependent_variable_len or
189
                cavlc_consumed_bits_len or FixedLen)
190
                case (consumed_bits_sel)
191
                        `exp_golomb        :pc <= pc_reg + exp_golomb_len;
192
                        `dependent_variable:pc <= pc_reg + dependent_variable_len;
193
                        `cavlc_consumed    :pc <= pc_reg + cavlc_consumed_bits_len;
194
                        `fixed_length      :pc <= pc_reg + FixedLen;
195
                        `trailing_bits     :pc <= (pc_reg[2:0] == 3'b000)? pc_reg:{{pc_reg[6:3] + 1},3'b0};
196
                        `pcm_alignment     :pc <= (pc_reg[2:0] == 3'b000)? pc_reg:{{pc_reg[6:3] + 1},3'b0};
197
                        default            :pc <= pc_reg;
198
                endcase
199
        always @ (posedge clk)
200
                pc_reg <= (reset_n == 0)? 0:pc;
201
 
202
endmodule
203
 
204
 

powered by: WebSVN 2.1.0

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