Home » Source Code » H264 Verilog » BitStream_parser_FSM_gating.v

BitStream_parser_FSM_gating.v ( File view )

From:H264 Verilog
  • By culourwq 2016-05-23
  • View(s):0
  • Download(s):2
  • Point(s): 1
			//--------------------------------------------------------------------------------------------------
// Design    : nova
// Author(s) : Ke Xu
// Email	   : eexuke@yahoo.com
// File      : BitStream_parser_FSM_gating.v
// Generated : June 26,2005
// Copyright (C) 2008 Ke Xu                
//-------------------------------------------------------------------------------------------------
// Description 
// BitStream_parser_FSM,clock gating version
//-------------------------------------------------------------------------------------------------

// synopsys translate_off
`include "timescale.v"
// synopsys translate_on
`include "nova_defines.v"

module BitStream_parser_FSM (clk,reset_n,end_of_one_blk4x4_sum,end_of_MB_DEC,
	gclk_parser,gclk_nal,gclk_slice,gclk_sps,gclk_pps,gclk_slice_header,
	gclk_slice_data,gclk_residual,gclk_cavlc,
	trigger_CAVLC,BitStream_buffer_valid_n,nal_unit_type,
	slice_type,num_ref_idx_active_override_flag,
	deblocking_filter_control_present_flag,disable_deblocking_filter_idc,
	mb_skip_run,mb_type_general,prev_intra4x4_pred_mode_flag,CodedBlockPatternLuma,
	CodedBlockPatternChroma,pc_2to0,NumSubMbPart,NumMbPart,
	TotalCoeff,TrailingOnes,maxNumCoeff,zerosLeft,run,
	
	parser_state,nal_unit_state,slice_layer_wo_partitioning_state,slice_header_state,slice_header_s6,
	ref_pic_list_reordering_state,dec_ref_pic_marking_state,slice_data_state,sub_mb_pred_state,
	mb_pred_state,seq_parameter_set_state,pic_parameter_set_state,residual_state,cavlc_decoder_state,
	heading_one_en,pic_num,mb_num,mb_num_h,mb_num_v,
	NextMB_IsSkip,LowerMB_IsSkip,Is_skip_run_entry,Is_skip_run_end,
	luma4x4BlkIdx,mbPartIdx,subMbPartIdx,compIdx,i8x8,i4x4,i4x4_CbCr,
	coeffNum,i_level,i_run,i_TotalCoeff,
	suffix_length_initialized,IsRunLoop);
	input clk;
	input reset_n;
	input end_of_one_blk4x4_sum;
	input end_of_MB_DEC;
	input gclk_parser;
	input gclk_nal;
	input gclk_slice;
	input gclk_sps;
	input gclk_pps;
	input gclk_slice_header;
	input gclk_slice_data;
	input gclk_residual;
	input gclk_cavlc;
	input trigger_CAVLC;
	input BitStream_buffer_valid_n;
	input [4:0] nal_unit_type;
	input [2:0] slice_type;
	input num_ref_idx_active_override_flag;
	input deblocking_filter_control_present_flag;
	input [1:0] disable_deblocking_filter_idc;
	input [6:0] mb_skip_run;
	input [3:0] mb_type_general;
	input prev_intra4x4_pred_mode_flag;
	input [3:0] CodedBlockPatternLuma;
	input [1:0] CodedBlockPatternChroma;
	input [2:0] pc_2to0;
	input [2:0] NumMbPart;
	input [2:0] NumSubMbPart;
	input [4:0] TotalCoeff;
	input [1:0] TrailingOnes;
	input [4:0] maxNumCoeff;
	input [3:0] zerosLeft;
	input [3:0] run;
	
	output [1:0] parser_state;
	output [2:0] nal_unit_state;
	output [1:0] slice_layer_wo_partitioning_state;
	output [3:0] slice_header_state; 
	output slice_header_s6;
	output [2:0] ref_pic_list_reordering_state;
	output [1:0] dec_ref_pic_marking_state;
	output [3:0] slice_data_state;
	output [1:0] sub_mb_pred_state;
	output [2:0] mb_pred_state;
	output [3:0] seq_parameter_set_state;
	output [3:0] pic_parameter_set_state;
	output [3:0] residual_state;
	output [3:0] cavlc_decoder_state;
	output heading_one_en;
	output [5:0] pic_num;
	output [6:0] mb_num;
	output [3:0] mb_num_h;
	output [3:0] mb_num_v;
	output NextMB_IsSkip;
	output LowerMB_IsSkip;
	output Is_skip_run_entry;
	output Is_skip_run_end;
	output [3:0] luma4x4BlkIdx;
	output [1:0] mbPartIdx;
	output [1:0] subMbPartIdx;
	output compIdx;
	output [1:0] i8x8,i4x4;
	output [1:0] i4x4_CbCr;
	output [3:0] coeffNum;
	output [3:0] i_level;
	output [3:0] i_run;
	output [3:0] i_TotalCoeff;
	output suffix_length_initialized;
	output IsRunLoop;
	
	reg [1:0] parser_state;
	reg [2:0] nal_unit_state;
	reg [1:0] slice_layer_wo_partitioning_state;
	reg [3:0] seq_parameter_set_state;
	reg [3:0] pic_parameter_set_state;
	reg [3:0] slice_header_state;
	reg [2:0] ref_pic_list_reordering_state;
 	reg [1:0] dec_ref_pic_marking_state;
	reg [3:0] slice_data_state;
	reg [2:0] mb_pred_state;
	reg [1:0] sub_mb_pred_state;
	reg [3:0] residual_state;
	reg [3:0] cavlc_decoder_state;
	
	wire heading_one_en;
	reg [6:0] mb_num;
	reg [3:0] mb_num_h;
	reg [3:0] mb_num_v;
	reg [1:0] mbPartIdx;
	reg [1:0] subMbPartIdx;
	reg compIdx;
	reg	[1:0] i8x8,i4x4;
	reg [1:0] i4x4_CbCr;
	reg [3:0] coeffNum;
	reg [3:0] coeffNum_reg;
	reg [3:0] i_level,i_run,i_TotalCoeff;
	reg [6:0] count_mb_skip_run;//number of MBs to be skipped
	reg [7:0] count_pcm_byte;
	reg [3:0] luma4x4BlkIdx;
	reg [5:0] pic_num;
	reg suffix_length_initialized;
	reg IsRunLoop;
	
	/*
	// synopsys translate_off
	integer	tracefile;
	initial
		begin
			tracefile = $fopen("trace.txt");
		end
	// synopsys translate_on
	*/

	//--------------
	//parser_state
	//--------------
	always @ (posedge gclk_parser or negedge reset_n)
		if (reset_n == 0)
			parser_state <= `rst_parser;
		else
			case (parser_state)
				`rst_parser			  :parser_state <= (BitStream_buffer_valid_n == 1'b0)? `start_code_prefix:`rst_parser;
				`start_code_prefix:parser_state <= `nal_unit;
				`nal_unit			    :parser_state <= `rst_parser;
			endcase
	//---------------
	//nal_unit_state
	//---------------
	always @ (posedge gclk_nal or negedge reset_n)
		if (reset_n == 0)
			nal_unit_state <= `rst_nal_unit;
		else
			case (nal_unit_state)
				`rst_nal_unit:nal_unit_state <= `forbidden_zero_bit_2_nal_unit_type;
				`forbidden_zero_bit_2_nal_unit_type:
				case (nal_unit_type)
					5'b00001:nal_unit_state <= `slice_layer_non_IDR_rbsp;
					5'b00101:nal_unit_state <= `slice_layer_IDR_rbsp;
					5'b00111:nal_unit_state <= `seq_parameter_set_rbsp;
					5'b01000:nal_unit_state <= `pic_parameter_set_rbsp;
				endcase
				`slice_layer_non_IDR_rbsp,`slice_layer_IDR_rbsp:nal_unit_state <= `rbsp_trailing_one_bit;
				`seq_parameter_set_rbsp :nal_unit_state <= `rbsp_trailing_one_bit;
				`pic_parameter_set_rbsp :nal_unit_state <= `rbsp_trailing_one_bit; 
				`rbsp_trailing_one_bit  :nal_unit_state <= (pc_2to0 == 3'b000)? `rst_nal_unit:`rbsp_trailing_zero_bits;
				`rbsp_trailing_zero_bits:nal_unit_state <= `rst_nal_unit;
			endcase
	//----------------------------------
	//slice_layer_wo_partitioning_state
	//----------------------------------
	always @ (posedge gclk_slice or negedge reset_n)
		if (reset_n == 1'b0)
			slice_layer_wo_partitioning_state <= `rst_slice_layer_wo_partitioning;
		else
			case (slice_layer_wo_partitioning_state)
				`rst_slice_layer_wo_partitioning	:slice_layer_wo_partitioning_state <= `slice_header;
				`slice_header					            :slice_layer_wo_partitioning_state <= `slice_data;
				`slice_data						            :slice_layer_wo_partitioning_state <= `rst_slice_layer_wo_partitioning;
			endcase
	//------------------------
	//seq_parameter_set_state
	//------------------------
	always @ (posedge gclk_sps or negedge reset_n)
		if (reset_n == 0)
			seq_parameter_set_state <= `rst_seq_parameter_set;
		else
			case (seq_parameter_set_state)
				`rst_seq_parameter_set					          :seq_parameter_set_state <= `fixed_header;
				`fixed_header							                :seq_parameter_set_state <= `level_idc_s;
				`level_idc_s								              :seq_parameter_set_state <= `seq_parameter_set_id_sps_s;
				`seq_parameter_set_id_sps_s				        :seq_parameter_set_state <= `log2_max_frame_num_minus4_s;
				`log2_max_frame_num_minus4_s				      :seq_parameter_set_state <= `pic_order_cnt_type_s;
				`pic_order_cnt_type_s					            :seq_parameter_set_state <= `log2_max_pic_order_cnt_lsb_minus4_s;
				`log2_max_pic_order_cnt_lsb_minus4_s		  :seq_parameter_set_state <= `num_ref_frames_s;
				`num_ref_frames_s						              :seq_parameter_set_state <= `gaps_in_frame_num_value_allowed_flag_s;
				`gaps_in_frame_num_value_allowed_flag_s	  :seq_parameter_set_state <= `pic_width_in_mbs_minus1_s;
				`pic_width_in_mbs_minus1_s				        :seq_parameter_set_state <= `pic_height_in_map_units_minus1_s;
				`pic_height_in_map_units_minus1_s		      :seq_parameter_set_state <= `frame_mbs_only_flag_2_frame_cropping_flag;
				`frame_mbs_only_flag_2_frame_cropping_flag:seq_parameter_set_state <= `vui_parameter_present_flag_s;
				`vui_parameter_present_flag_s			        :seq_parameter_set_state <= `rst_seq_parameter_set;
			endcase
	//------------------------
	//pic_parameter_set_state
	//------------------------
	always @ (posedge gclk_pps or negedge reset_n)
		if (reset_n == 0)
			pic_parameter_set_state <= `rst_pic_parameter_set;
		else
			case (pic_parameter_set_state)
				`rst_pic_parameter_set				                             :pic_parameter_set_state <= `pic_parameter_set_id_pps_s;
				`pic_parameter_set_id_pps_s			                           :pic_parameter_set_state <= `seq_parameter_set_id_pps_s;
				`seq_parameter_set_id_pps_s			                           :pic_parameter_set_state <= `entropy_coding_mode_flag_2_pic_order_present_flag;
				`entropy_coding_mode_flag_2_pic_order_present_flag         :pic_parameter_set_state <= `num_slice_groups_minus1_s;
				`num_slice_groups_minus1_s			                           :pic_parameter_set_state <= `num_ref_idx_l0_active_minus1_pps_s;
				`num_ref_idx_l0_active_minus1_pps_s	                       :pic_parameter_set_state <= `num_ref_idx_l1_active_minus1_pps_s;
				`num_ref_idx_l1_active_minus1_pps_s	                       :pic_parameter_set_state <= `weighted_pred_flag_2_weighted_bipred_idc;
				`weighted_pred_flag_2_weighted_bipred_idc                  :pic_parameter_set_state <= `pic_init_qp_minus26_s;
				`pic_init_qp_minus26_s				                             :pic_parameter_set_state <= `pic_init_qs_minus26_s;
				`pic_init_qs_minus26_s				                             :pic_parameter_set_state <= `chroma_qp_index_offset_s;
				`chroma_qp_index_offset_s			                             :pic_parameter_set_state <= `deblocking_filter_control_2_redundant_pic_cnt_present_flag;
				`deblocking_filter_control_2_redundant_pic_cnt_present_flag:pic_parameter_set_state <= `rst_pic_parameter_set;
			endcase
	//-------------------
	//slice_header_state
	//-------------------
	always @ (posedge gclk_slice_header or negedge reset_n)
		if (reset_n == 0)
			begin
				slice_header_state            <= `rst_slice_header;
				ref_pic_list_reordering_state <= `rst_ref_pic_list_reordering;
				dec_ref_pic_marking_state 
...
...
(Not finished, please download and read the complete file)
			
...
Expand> <Close

Want complete source code? Download it here

Point(s): 1

Download
0 lines left, continue to read
Sponsored links

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
Beha_BitStream_ram.v1.16 kB30-04-08|11:58
BitStream_buffer.v11.65 kB30-04-08|11:58
BitStream_controller.v25.60 kB30-04-08|11:58
bitstream_gclk_gen.v12.67 kB30-04-08|11:58
BitStream_parser_FSM_gating.v27.58 kB30-04-08|11:58
bs_decoding.v45.34 kB30-04-08|11:58
cavlc_consumed_bits_decoding.v1.85 kB30-04-08|11:58
cavlc_decoder.v10.33 kB30-04-08|11:58
CodedBlockPattern_decoding.v5.83 kB30-04-08|11:58
dependent_variable_decoding.v2.42 kB30-04-08|11:58
DF_mem_ctrl.v29.69 kB30-04-08|11:58
DF_pipeline.v33.65 kB30-04-08|11:58
DF_reg_ctrl.v15.94 kB30-04-08|11:58
DF_top.v7.41 kB30-04-08|11:58
end_of_blk_decoding.v2.82 kB30-04-08|11:58
exp_golomb_decoding.v6.17 kB30-04-08|11:58
ext_frame_RAM0_wrapper.v5.09 kB30-04-08|11:58
ext_frame_RAM1_wrapper.v5.10 kB30-04-08|11:58
ext_RAM_ctrl.v3.46 kB30-04-08|11:58
H.264.cr.mti2.20 kB28-02-09|13:54
H.264.mpf55.79 kB28-02-09|00:05
heading_one_detector.v2.51 kB30-04-08|11:58
hybrid_pipeline_ctrl.v10.79 kB30-04-08|11:58
Inter_mv_decoding.v93.25 kB30-04-08|11:58
Inter_pred_CPE.v3.74 kB30-04-08|11:58
Inter_pred_LPE.v23.87 kB30-04-08|11:58
Inter_pred_pipeline.v33.29 kB30-04-08|11:58
Inter_pred_reg_ctrl.v124.27 kB30-04-08|11:58
Inter_pred_sliding_window.v130.18 kB30-04-08|11:58
Inter_pred_top.v28.66 kB30-04-08|11:58
Intra4x4_PredMode_decoding.v14.99 kB30-04-08|11:58
Intra_pred_PE.v69.16 kB30-04-08|11:58
Intra_pred_pipeline.v32.46 kB24-02-09|22:46
Intra_pred_reg_ctrl.v36.37 kB30-04-08|11:58
Intra_pred_top.v14.40 kB30-04-08|11:58
IQIT.v32.48 kB30-04-08|11:58
level_decoding.v7.45 kB30-04-08|11:58
nC_decoding.v30.47 kB30-04-08|11:58
nova.v8.19 kB30-04-08|11:58
nova_defines.v12.10 kB30-04-08|11:58
nova_tb.v2.92 kB30-04-08|11:58
NumCoeffTrailingOnes_decoding.v25.79 kB30-04-08|11:58
pc_decoding.v10.34 kB30-04-08|11:58
QP_decoding.v2.31 kB30-04-08|11:58
ram_async_1r_sync_1w.v2.71 kB30-04-08|11:58
ram_sync_1r_sync_1w.v3.01 kB30-04-08|11:58
reconstruction.v22.49 kB30-04-08|11:58
rec_DF_RAM0_96x32.v18.23 kB30-04-08|11:58
rec_DF_RAM0_wrapper.v1.73 kB30-04-08|11:58
rec_DF_RAM1_96x32.v18.23 kB30-04-08|11:58
rec_DF_RAM1_wrapper.v1.73 kB30-04-08|11:58
rec_DF_RAM_ctrl.v6.42 kB30-04-08|11:58
rec_gclk_gen.v16.68 kB30-04-08|11:58
Intra_pred_PE.areasrr10.14 kB22-02-09|14:06
Intra_pred_PE.edn2.76 MB22-02-09|14:06
Intra_pred_PE.fse0.00 B22-02-09|14:06
Intra_pred_PE.sdf2.05 MB22-02-09|14:06
Intra_pred_PE.srd1.03 MB22-02-09|14:06
Intra_pred_PE.srm1.61 MB22-02-09|14:06
Intra_pred_PE.srr34.82 kB22-02-09|14:06
Intra_pred_PE.srs102.69 kB22-02-09|14:06
Intra_pred_PE.tlg418.00 B22-02-09|14:06
Intra_pred_PE_sdc.sdc310.00 B22-02-09|14:06
Intra_pred_PE.msg0.00 B22-02-09|14:46
Intra_pred_PE.plg441.00 B22-02-09|14:06
run_decoding.v11.61 kB30-04-08|11:58
sum.v23.78 kB30-04-08|11:58
syntax_decoding.v24.94 kB30-04-08|11:58
timescale.v546.00 B30-04-08|11:58
total_zeros_decoding.v14.96 kB30-04-08|11:58
vsim.wlf32.00 kB24-02-09|16:06
_primary.dat73.20 kB24-02-09|15:26
_primary.vhd11.00 kB24-02-09|15:26
verilog.asm49.59 kB21-02-09|17:50
_primary.dat7.28 kB21-02-09|17:50
_primary.vhd1.23 kB21-02-09|17:50
verilog.asm275.78 kB24-02-09|15:27
_primary.dat39.36 kB24-02-09|15:27
_primary.vhd4.99 kB24-02-09|15:27
_primary.dat15.08 kB26-02-09|11:49
_primary.vhd3.73 kB26-02-09|11:49
_primary.dat17.38 kB26-02-09|11:49
_primary.vhd4.65 kB26-02-09|11:49
verilog.asm61.01 kB22-02-09|21:56
_primary.dat8.81 kB19-02-09|20:59
_primary.vhd3.04 kB22-02-09|21:56
verilog.asm15.53 kB24-02-09|15:27
_primary.dat1.24 kB24-02-09|15:27
_primary.vhd902.00 B24-02-09|15:27
_primary.dat986.00 B26-02-09|11:49
_primary.vhd419.00 B26-02-09|11:49
_primary.dat1.40 kB26-02-09|11:49
_primary.vhd749.00 B26-02-09|11:49
_primary.dat328.00 B26-02-09|11:49
_primary.vhd307.00 B26-02-09|11:49
_primary.dat687.00 B26-02-09|11:49
_primary.vhd291.00 B26-02-09|11:49
_primary.dat1.73 kB26-02-09|11:24
_primary.vhd585.00 B26-02-09|11:24
_info2.66 kB26-02-09|11:49
syntmp0.00 B22-02-09|14:46
@inter_pred_reg_ctrl0.00 B24-02-09|15:26
@intra4x4_@pred@mode_decoding0.00 B21-02-09|17:50
@intra_pred_@p@e0.00 B24-02-09|15:27
@intra_pred_pipeline0.00 B26-02-09|11:49
@intra_pred_reg_ctrl0.00 B26-02-09|11:49
@intra_pred_top0.00 B22-02-09|21:56
@p@e0.00 B24-02-09|15:27
main_seed_precomputation0.00 B26-02-09|11:49
plane_@h@v_precomputation0.00 B26-02-09|11:49
plane_a_precomputation0.00 B26-02-09|11:49
plane_bc_precomputation0.00 B26-02-09|11:49
ram_sync_1r_sync_1w0.00 B26-02-09|11:24
_temp0.00 B26-02-09|11:49
rev_10.00 B22-02-09|14:06
work0.00 B26-02-09|11:49
H.2640.00 B08-03-09|19:18
...
Sponsored links

BitStream_parser_FSM_gating.v (808.37 kB)

Need 1 point
Your Point(s)

Your Point isn't enough.

Get point immediately by PayPal

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more point

LOGIN

Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com

切换到中文版?

CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!
OK

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D