Home » Source Code » H264 Verilog » rec_gclk_gen.v

rec_gclk_gen.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      : rec_gclk_gen.v
// Generated : Jan 3, 2006
// Copyright (C) 2008 Ke Xu                
//-------------------------------------------------------------------------------------------------
// Description 
// Gated clock generation module for reconstruction
//-------------------------------------------------------------------------------------------------

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

module rec_gclk_gen(clk,
	//IQIT
	end_of_NonZeroCoeff_CAVLC,OneD_counter,TwoD_counter,rescale_counter,
	rounding_counter,residual_state,cavlc_decoder_state,
	gclk_1D,gclk_2D,gclk_rescale,gclk_rounding,
	//Intra pred
	mb_num_h,mb_num_v,NextMB_IsSkip,
	mb_type_general,blk4x4_rec_counter,blk4x4_sum_counter,blk4x4_intra_preload_counter,
	blk4x4_intra_precompute_counter,blk4x4_intra_calculate_counter,
	Intra4x4_predmode,Intra16x16_predmode,Intra_chroma_predmode,
	gclk_intra_mbAddrA_luma,gclk_intra_mbAddrA_Cb,gclk_intra_mbAddrA_Cr,
	gclk_intra_mbAddrB,gclk_intra_mbAddrC_luma,gclk_intra_mbAddrD,gclk_seed,
	//Inter pred
	blk4x4_inter_preload_counter,gclk_Inter_ref_rf,
	//sum
	Inter_blk4x4_pred_output_valid,gclk_pred_output,gclk_blk4x4_sum,
	//Deblocking filter
	end_of_MB_DEC,end_of_BS_DEC,DF_duration,
	gclk_end_of_MB_DEC,gclk_DF,
	//memory
	Intra_mbAddrB_RAM_rd,Intra_mbAddrB_RAM_wr,gclk_Intra_mbAddrB_RAM,
	rec_DF_RAM0_cs_n,gclk_rec_DF_RAM0,
	rec_DF_RAM1_cs_n,gclk_rec_DF_RAM1,
	DF_mbAddrA_RF_rd,DF_mbAddrA_RF_wr,gclk_DF_mbAddrA_RF,
	DF_mbAddrB_RAM_rd,DF_mbAddrB_RAM_wr,gclk_DF_mbAddrB_RAM
	);
	input clk;
	//IQIT
	input end_of_NonZeroCoeff_CAVLC;
	input [2:0] OneD_counter;
	input [2:0] TwoD_counter;
	input [2:0] rescale_counter;
	input [2:0] rounding_counter;
	input [3:0] residual_state;
	input [3:0] cavlc_decoder_state;
	output gclk_1D;
	output gclk_2D;
	output gclk_rescale;
	output gclk_rounding;
	//Intra pred
	input [3:0] mb_num_h;
	input [3:0] mb_num_v;
	input NextMB_IsSkip;
	input [3:0] mb_type_general;
	input [4:0] blk4x4_rec_counter;
	input [2:0] blk4x4_sum_counter;
	input [2:0] blk4x4_intra_preload_counter;
	input [3:0] blk4x4_intra_precompute_counter;
	input [2:0] blk4x4_intra_calculate_counter;
	input [3:0] Intra4x4_predmode;
	input [1:0] Intra16x16_predmode;
	input [1:0] Intra_chroma_predmode;
	output gclk_intra_mbAddrA_luma;
	output gclk_intra_mbAddrA_Cb;
	output gclk_intra_mbAddrA_Cr;
	output gclk_intra_mbAddrB; 
	output gclk_intra_mbAddrC_luma;	
	output gclk_intra_mbAddrD;
	output gclk_seed;
	//Inter pred
	input [5:0] blk4x4_inter_preload_counter;
	output gclk_Inter_ref_rf;
	//sum
	input [1:0] Inter_blk4x4_pred_output_valid;
	output gclk_pred_output;
	output gclk_blk4x4_sum;
	//DF
	input end_of_MB_DEC;
	input end_of_BS_DEC;
	input DF_duration;
	output gclk_end_of_MB_DEC;
	output gclk_DF;
	//memory
	input Intra_mbAddrB_RAM_rd;
	input Intra_mbAddrB_RAM_wr;
	output gclk_Intra_mbAddrB_RAM;
	input rec_DF_RAM0_cs_n;
	output gclk_rec_DF_RAM0;
	input rec_DF_RAM1_cs_n;
	output gclk_rec_DF_RAM1;
	input DF_mbAddrA_RF_rd,DF_mbAddrA_RF_wr;
	output gclk_DF_mbAddrA_RF;
	input DF_mbAddrB_RAM_rd,DF_mbAddrB_RAM_wr;
	output gclk_DF_mbAddrB_RAM;
	
	parameter rst_residual		    = 4'b0000;
	parameter Intra16x16DCLevel_s	= 4'b0001;
	parameter Intra16x16ACLevel_s	= 4'b0011;
	parameter Intra16x16ACLevel_0_s = 4'b0010;
	parameter LumaLevel_s			= 4'b0110;
	parameter LumaLevel_0_s		    = 4'b0111;
	parameter ChromaDCLevel_Cb_s    = 4'b0101;
	parameter ChromaDCLevel_Cr_s	= 4'b0100;
	parameter ChromaACLevel_Cb_s	= 4'b1100;
	parameter ChromaACLevel_Cr_s	= 4'b1101;
	
	parameter Intra4x4_Vertical 			= 4'b0000;
	parameter Intra4x4_Horizontal 			= 4'b0001;
	parameter Intra4x4_DC 					= 4'b0010;
	parameter Intra4x4_Diagonal_Down_Left 	= 4'b0011;
	parameter Intra4x4_Diagonal_Down_Right 	= 4'b0100;
	parameter Intra4x4_Vertical_Right 		= 4'b0101;
	parameter Intra4x4_Horizontal_Down 		= 4'b0110;
	parameter Intra4x4_Vertical_Left 		= 4'b0111;
	parameter Intra4x4_Horizontal_Up 		= 4'b1000;
	
	parameter Intra16x16_Plane 			= 2'b11;
	parameter Intra_chroma_Plane		= 2'b11;
	
	parameter NumCoeffTrailingOnes_LUT = 4'b0010;
	//-------------------------------------------------
	//IQIT
	//-------------------------------------------------
	//gclk_end_of_one_residual_block
	//reg l_end_of_one_residual_block;
	//wire gclk_end_of_one_residual_block;
	//always @ (clk or end_of_one_residual_block)
	//	if (!clk) l_end_of_one_residual_block <= end_of_one_residual_block;
	//assign gclk_end_of_one_residual_block = clk & l_end_of_one_residual_block;
	
	//gclk_endof1NonZeroCoeffResBlk
	//reg l_end_of_NonZeroCoeff_CAVLC;
	//wire gclk_endof1NonZeroCoeffResBlk;
	//always @ (clk or end_of_NonZeroCoeff_CAVLC)
	//	if (!clk) l_end_of_NonZeroCoeff_CAVLC <= end_of_NonZeroCoeff_CAVLC;
	//assign gclk_endof1NonZeroCoeffResBlk = clk & l_end_of_NonZeroCoeff_CAVLC;
	
	//gclk_1D
	wire OneD_en;
	reg l_OneD_en;
	wire gclk_1D;
	assign OneD_en = (
	//	trap DC case after CAVLC:residual_state is still available now 
	(end_of_NonZeroCoeff_CAVLC == 1'b1 && cavlc_decoder_state != `NumCoeffTrailingOnes_LUT &&
	(residual_state == `Intra16x16DCLevel_s || residual_state == `ChromaDCLevel_Cb_s || 
	residual_state == `ChromaDCLevel_Cr_s)) ||  
    //	trap AC case after rescale:residual_state is still available now
	((residual_state == `Intra16x16ACLevel_s || residual_state == `LumaLevel_s || residual_state == `ChromaACLevel_Cb_s ||
	residual_state == `ChromaACLevel_Cr_s) && rescale_counter == 3'b100)	||
	//	trap internal loop
	OneD_counter != 0);
	always @ (clk or OneD_en)
		if (!clk) l_OneD_en <= OneD_en;
	assign gclk_1D = clk & l_OneD_en; 
	
	//gclk_2D
	wire TwoD_en;
	reg l_TwoD_en;
	wire gclk_2D;
	assign TwoD_en = ((OneD_counter == 3'b001 && residual_state != `ChromaDCLevel_Cb_s && residual_state != `ChromaDCLevel_Cr_s) 
					|| TwoD_counter != 0);
	always @ (clk or TwoD_en)
		if (!clk) l_TwoD_en <= TwoD_en;
	assign gclk_2D = clk & l_TwoD_en;
	
	//gclk_rescale
	wire rescale_en;
	reg l_rescale_en;
	wire gclk_rescale;
	assign rescale_en = (
	//trap AC after CAVLC except all zero coeffs case
   	(end_of_NonZeroCoeff_CAVLC == 1'b1 && cavlc_decoder_state != `NumCoeffTrailingOnes_LUT && (
   	residual_state == `Intra16x16ACLevel_s || residual_state == `LumaLevel_s || 
   	residual_state == `ChromaACLevel_Cb_s  || residual_state == `ChromaACLevel_Cr_s)) || 
   	//trap DC case after IDCT,chromaDC:after 1D-IDCT,lumaDC:after 2D-IDCT
	((residual_state == `Intra16x16DCLevel_s && TwoD_counter == 3'b100) ||
	((residual_state == `ChromaDCLevel_Cb_s || residual_state == `ChromaDCLevel_Cr_s) && OneD_counter == 3'b001)) ||
	//trap internal loop
	rescale_counter != 0);
	always @ (clk or rescale_en)
		if (!clk) l_rescale_en <= rescale_en;
	and gc_rescale (gclk_rescale,clk,l_rescale_en);
	
	//gclk_rounding
	wire rounding_en;
	reg l_rounding_en;
	wire gclk_rounding;
	assign rounding_en = (((residual_state == `Intra16x16ACLevel_s || residual_state == `LumaLevel_s ||
	residual_state == `ChromaACLevel_Cb_s || residual_state == `ChromaACLevel_Cr_s) && TwoD_counter == 3'b100)
	|| rounding_counter !=0)?1'b1:1'b0;
	always @ (clk or rounding_en)
		if (!clk) l_rounding_en <= rounding_en;
	assign gclk_rounding = clk & l_rounding_en;
	//-------------------------------------------------
	//Intra pred
	//-------------------------------------------------
	//1.gclk_intra_mbAddrA_luma @ Intra_pred_reg_ctrl.v
	//  For intra pred,update after every blk4x4 is summed
	//  For inter pred,update after blk4x4 5,7,13,15 is summed
	wire intra_mbAddrA_luma_ena;
	reg l_intra_mbAddrA_luma_ena;
	wire gclk_intra_mbAddrA_luma;
	wire Is_LumaRightMostBlk4x4;
	
	assign Is_LumaRightMostBlk4x4 = (blk4x4_rec_counter == 5 || blk4x4_rec_counter == 7 || 
									blk4x4_rec_counter == 13 || blk4x4_rec_counter == 15);
	
	assign intra_mbAddrA_luma_ena = (blk4x4_rec_counter < 16 &&	blk4x4_sum_counter == 3'd3 && (
	//Intra4x4:update when every blk4x4 summed
	(mb_type_general[3:2] == 2'b11 && !(mb_num_h == 10 && Is_LumaRightMostBlk4x4)) ||
	//Intra16x16 && Inter (including skip MB):update when blk4x4 5/7/13/15 is summed 
	//and NextMB_IsSkip is false
	(mb_type_general[3:2] != 2'b11 && mb_num_h != 10 && Is_LumaRightMostBlk4x4 && !NextMB_IsSkip)));
	always @ (clk or intra_mbAddrA_luma_ena)
		if (!clk) l_intra_mbAddrA_luma_ena <= intra_mbAddrA_luma_ena;
	assign gclk_intra_mbAddrA_luma = l_intra_mbAddrA_luma_ena & clk;
	
	//2.gclk_intra_mbAddrA_Cb	@ Intra_pred_reg_ctrl.v
	wire intra_mbAddrA_Cb_ena;
	reg l_intra_mbAddrA_Cb_ena;
	wire gclk_intra_mbAddrA_Cb;	
	wire Is_CbRightMostBlk4x4; 
	assign Is_CbRightMostBlk4x4 = (blk4x4_rec_counter == 17 || blk4x4_rec_counter == 19);
	
	assign intra_mbAddrA_Cb_ena = (blk4x4_sum_counter == 3'd3 && (
	//Intra4x4
	(mb_type_general[3:2] == 2'b11 && mb_num_h != 10 && Is_CbRightMostBlk4x4) ||
	//Intra16x16 && Inter (including skip MB)
	(mb_type_general[3:2] != 2'b11 && mb_num_h != 10 && Is_CbRightMostBlk4x4 && !NextMB_IsSkip)));
	always @ (clk or intra_mbAddrA_Cb_ena)
		if (!clk) l_intra_mbAddrA_Cb_ena <= intra_mbAddrA_Cb_ena;
	assign gclk_intra_mbAddrA_Cb = l_intra_mbAddrA_Cb_ena & clk;
	
	//3.gclk_intra_mbAddrA_Cr	@ Intra_pred_reg_ctrl.v 
	wire intra_mbAddrA_Cr_ena;
	reg l_intra_mbAddrA_Cr_ena;
	wire gclk_intra_mbAddrA_Cr;
	wire Is_CrRightMostBlk4x4;
	assign Is_CrRightMostBlk4x4 = (blk4x4_rec_counter == 21 || blk4x4_rec_counter == 23);
	assign intra_mbAddrA_Cr_ena = (blk4x4_sum_counter == 3'd3 && (
	//Intra4x4
	(mb_type_general[3:2] == 2'b11 && mb_num_h != 10 && Is_CrRightMostBlk4x4) ||
	//Intra16x16 && Inter (including skip MB)
	(mb_type_general[3:2] != 2'b11 && mb_num_h != 10 && Is_CrRightMostBlk4x4 && !NextMB_IsSkip)));
	always @ (clk or intra_mbAddrA_Cr_ena)
		if (!clk) l_intra_mbAddrA_Cr_ena <= intra_mbAddrA_Cr_ena;
	assign gclk_intra_mbAddrA_Cr = l_intra_mbAddrA_Cr_ena & clk;
	
	//4.gclk_intra_mbAddrB		@ Intra_pred_reg_ctrl.v
	//  Control the write of Intra_mbAddrB_reg0 ~ reg 15
	wire intra_mbAddrB_ena;
	reg l_intra_mbAddrB_ena;
	wire gclk_intra_mbAddrB;
	assign intra_mbAddrB_ena = (
	//	Intra4x4
	(mb_type_general[3:2] == 2'b11 && b
...
...
(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

rec_gclk_gen.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