欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

HDMI测试数据

程序员文章站 2022-06-10 20:28:21
...
module				hdmi(
    input    clk_i,    //156.25MHZ   6.4ns
    input    rst_n,

    input    [4:0]move_i,
    input    [7:0]time_gap_i,
    input    [7:0]pix_deep_i,   //8'h00   8'h01   8'h02
    input    [7:0]pix_w_i,
    input    [11:0]pix_start_i,
    
	input    [7 :0]pix_mode_i,

    output    video_vs_o,
    output    video_hs_o,
    output    video_de_o,
    output    [47:0]video_da_o            					   
);


parameter                                   DISTANCE  = 32;


parameter                                   H_ALL = 2080;
parameter									V_ALL = 2250;


parameter									H_VALID = 1920;
parameter									V_VALID = 2160;

parameter									HSYNC = 40;
parameter									VSYNC = 40;


parameter                                   H_BEGIN = 100;
parameter									H_END = 2020;


//前消隐30行   后消赢20
parameter									V_BEGIN = 70;
parameter									V_END = 2230;

//对8bit最小移动单位的修改


//工作就是产生出这几个信号
reg    flag_right_ji_high;
reg    flag_right_ji_low;
reg    flag_right_ou;
reg    flag_left_ji_low;
reg    flag_left_ji_high;
reg    flag_left_ou;

reg    [7:0]double_vs_step;//这个信号就是做为移动两边当一步的




reg    [7:0]    copy_cnt;
reg    [7:0]    copy_cnt_static;
reg    [7:0]    pix_w_i_tmp_cnt;// 像素宽度计数器
reg             de_before_tmp1;
wire            de_before_tmp4_pos; 


		
//对8bit最小移动单位的



wire	[7:0]		red_data;
wire	[7:0]		green_data;
wire	[7:0]		blue_data;

reg     [15:0]      red_data_tmp;
reg     [15:0]      green_data_tmp;
reg     [15:0]      blue_data_tmp; 


reg		[12:0]		odck_cnt;
reg		[12:0]		h_cnt;

reg     [47:0]      video_da_o_tmp;

reg					de;

reg					vs_sync;
reg					hs_sync;


reg                 de_before_tmp4;

reg					value_valid;
reg		[7:0]		data_value;
reg					position_valid;


reg                 position_valid_one;
reg                 position_valid_two;


reg					red_color_valid;	
reg					green_color_valid;
reg					blue_color_valid;

reg					vs_sync_tmp1;
reg					de_tmp1;	


reg    [4:0]        move_i_tmp;
reg    [7:0]		video_mode;


assign    video_hs_o = hs_sync;
assign    video_vs_o = vs_sync;
assign    video_de_o = de_tmp1;


assign	red_data   = red_color_valid?  (value_valid?data_value:(position_valid?8'hff:8'h0)):8'h0;
assign	green_data = green_color_valid?(value_valid?data_value:(position_valid?8'hff:8'h0)):8'h0;
assign	blue_data  = blue_color_valid? (value_valid?data_value:(position_valid?8'hff:8'h0)):8'h0;



[email protected](posedge clk_i or negedge rst_n)
	if(!rst_n)
		odck_cnt <= 13'h0;
	else
	begin
		if(odck_cnt == H_ALL)
			odck_cnt	<= 13'h0;
		else
			odck_cnt	<= odck_cnt + 1'b1;
	end

[email protected](posedge clk_i or negedge rst_n)
	if(!rst_n)
		h_cnt	<= 13'h0;
	else if(odck_cnt == H_ALL)begin
		if(h_cnt == V_ALL)
			h_cnt	<= 13'h0;
		else
			h_cnt	<= h_cnt + 1'b1;
	end
	else
	    h_cnt <= h_cnt;
	
[email protected](posedge clk_i or negedge rst_n)
	if(!rst_n)
		de	<= 1'b0;
	else
	begin
		if((odck_cnt >= H_BEGIN)&&(odck_cnt < H_END)&&(h_cnt >= V_BEGIN)&&(h_cnt < V_END))  //4K
			de	<= 1'b1;
		else
			de	<= 1'b0;
	end
[email protected](posedge clk_i or negedge rst_n)
	if(!rst_n)
	    de_before_tmp1 <= 1'b0;
	else
	begin
		if((odck_cnt >= H_BEGIN - 1'b1)&&(odck_cnt < H_END - 1'b1)&&(h_cnt >= V_BEGIN)&&(h_cnt < V_END))
			de_before_tmp1	<= 1'b1;
		else
			de_before_tmp1	<= 1'b0;
	end
	
assign    de_before_tmp1_pos = (de_before_tmp1)&&(~de);
	
[email protected](posedge clk_i or negedge rst_n)
	if(!rst_n)
	    de_before_tmp4 <= 1'b0;
	else
	begin
		if((odck_cnt >= H_BEGIN - 3'b111)&&(odck_cnt < H_END - 3'b111)&&(h_cnt >= V_BEGIN)&&(h_cnt < V_END))
			de_before_tmp4	<= 1'b1;
		else
			de_before_tmp4	<= 1'b0;
	end



reg    de_before_tmp4_tmp1;
reg    de_before_tmp4_pos_modelsim;



[email protected](posedge clk_i or negedge rst_n)
	if(!rst_n)
	    de_before_tmp4_tmp1 <= 1'b0;
	else
	    de_before_tmp4_tmp1 <= de_before_tmp4;

assign  de_before_tmp4_pos = ((~de_before_tmp4_tmp1)&&de_before_tmp4);



reg    move_i_flag;
reg    [7:0]pix_w_i_tmp;

reg    [7:0]    vs_cnt;//当暂停的时候这个计数器不工作
[email protected](posedge clk_i or negedge rst_n)
	if(!rst_n)
	    pix_w_i_tmp_cnt <= 8'b0;
	else if(move_i_tmp == 5'h04 || move_i_tmp == 5'h00 || move_i_flag)//move_i_flag是表示当在5'h01和5'h02之间变换的时候
	    pix_w_i_tmp_cnt <= 8'h0;
	else  begin
	    if(pix_w_i_tmp_cnt == pix_w_i_tmp-1'b1 && (vs_sync&&(~vs_sync_tmp1)) && vs_cnt == time_gap_i-1'b1)
		    pix_w_i_tmp_cnt <= 8'h0;
		else if((vs_sync&&(~vs_sync_tmp1)) && vs_cnt == time_gap_i-1'b1)
		    pix_w_i_tmp_cnt <= pix_w_i_tmp_cnt + 1'b1;
		else
		    pix_w_i_tmp_cnt <= pix_w_i_tmp_cnt;
	end
	
reg    [7:0]x;//右边偶数移动的   偏移和加法两个偏移量
[email protected](posedge clk_i or negedge rst_n)
	if(!rst_n)
	    x <= 8'b0;
	else if(move_i_tmp == 5'h04 || move_i_tmp == 5'h00 || move_i_flag)//move_i_flag是表示当在5'h01和5'h02之间变换的时候
	    x <= 8'h0;
	else  begin
	    if((x == pix_w_i_tmp[7:1]-1'b1) && (vs_sync&&(~vs_sync_tmp1)) && vs_cnt == time_gap_i-1'b1 && pix_w_i_tmp_cnt[0])
		    x <= 8'h0;
		else if((vs_sync&&(~vs_sync_tmp1)) && vs_cnt == time_gap_i-1'b1 && pix_w_i_tmp_cnt[0])
		    x <= x + 1'b1;
		else
		    x <= x;
	end
[email protected](posedge clk_i or negedge rst_n)
	if(!rst_n)
	    double_vs_step <= 8'b0;
	else if(move_i_tmp == 5'h04 || move_i_tmp == 5'h00 || move_i_flag)//move_i_flag是表示当在5'h01和5'h02之间变换的时候
	    double_vs_step <= 8'h0;
	else  begin
	    if(((double_vs_step == (pix_w_i_tmp-1'b1)/2'd2) && (vs_sync&&(~vs_sync_tmp1)) && vs_cnt == time_gap_i-1'b1 && pix_w_i_tmp_cnt[0])
		   || pix_w_i_tmp_cnt == 8'h0
		  )
		    double_vs_step <= 8'h0;
		else if((vs_sync&&(~vs_sync_tmp1)) && vs_cnt == time_gap_i-1'b1 && pix_w_i_tmp_cnt[0])
		    double_vs_step <= double_vs_step + 1'b1;
		else
		    double_vs_step <= double_vs_step;
	end
	
	

//copy_cnt_static 是专门为了使能产生的
//右移动的是奇数需要加   左边也做成这样子
[email protected](posedge clk_i or negedge rst_n)
	if(!rst_n)
	    flag_right_ou  <=  1'b0;
	else if(        ( (  (copy_cnt_static + double_vs_step)==pix_w_i[7:1]-1'b1)
                     ||	(  (copy_cnt_static + double_vs_step)==pix_w_i-1'b1))
	                 &&de
	                 &&(~pix_w_i[0])   &&pix_w_i_tmp_cnt[0] && move_i==5'h02)
	    flag_right_ou <= 1'b1;
	else
	    flag_right_ou <= 1'b0;	
		
[email protected](posedge clk_i or negedge rst_n)
	if(!rst_n)
	    flag_right_ji_high <= 1'b0;
	else if(  ((copy_cnt_static + double_vs_step)%(pix_w_i[7:1])==1'b0) 
	                &&de//把de之前的全部去掉
	                &&(copy_cnt_static + double_vs_step != 0)    //把0去掉
                    &&(copy_cnt_static + double_vs_step != pix_w_i - 1'b1) //把最高位去掉  只要中间的
                	&&pix_w_i[0]  && pix_w_i_tmp_cnt[0]  && move_i == 5'h02)
	    flag_right_ji_high <= 1'b1;
	else
	    flag_right_ji_high <= 1'b0;
		
[email protected](posedge clk_i or negedge rst_n)
	if(!rst_n)
	    flag_right_ji_low <= 1'b0;
	else if(  ((copy_cnt_static + double_vs_step)%(pix_w_i - 1'b1)==1'b0)   
                &&de
				&&(copy_cnt_static + double_vs_step != 0)
              	&&pix_w_i[0]  && pix_w_i_tmp_cnt[0] && move_i == 5'h02)
	    flag_right_ji_low <= 1'b1;
	else
	    flag_right_ji_low <= 1'b0;
		
[email protected](posedge clk_i or negedge rst_n)
	if(!rst_n)
	    flag_left_ji_low <= 1'b0;
	else if(  ( copy_cnt_static - double_vs_step == pix_w_i[7:1])  
	            &&de

             	&&pix_w_i[0]  &&  (~pix_w_i_tmp_cnt[0]) && move_i==5'h01 &&(flag_left_ji_high!=8'h0) )
	    flag_left_ji_low <= 1'b1;
	else
	    flag_left_ji_low <= 1'b0;

[email protected](posedge clk_i or negedge rst_n)
	if(!rst_n)
	    flag_left_ji_high <= 1'b0;
	else if(  ((copy_cnt_static - double_vs_step)==0)  
               &&de	
           
     		   &&pix_w_i[0]  &&  (~pix_w_i_tmp_cnt[0])  && move_i==5'h01  &&(flag_left_ji_low!=8'h0))
	    flag_left_ji_high <= 1'b1;
	else
	    flag_left_ji_high <= 1'b0;

[email protected](posedge clk_i or negedge rst_n)
	if(!rst_n)
	    flag_left_ou <= 1'b0;
	else if(  ((copy_cnt_static - double_vs_step)%(pix_w_i[7:1])==1'b0)  
                &&de 	

            	&&(~pix_w_i[0])  && pix_w_i_tmp_cnt[0] && move_i==5'h01  )
	    flag_left_ou <= 1'b1;
	else
	    flag_left_ou <= 1'b0;



	

//de_before_tmp4_pos_modelsim  要根据新的计数器来改变	
[email protected](posedge clk_i or negedge rst_n)
	if(!rst_n)
	    de_before_tmp4_pos_modelsim <= 1'b0;
	else if(de_before_tmp4_pos && h_cnt == 13'd70&& pix_w_i_tmp_cnt==8'h00 && vs_cnt==8'h00)//(一帧只取一个de)(加vs_cnt是为了舍弃一帧中多余的,好几帧才给一个数值)
        de_before_tmp4_pos_modelsim <= 1'b1;
	else
	    de_before_tmp4_pos_modelsim <= 1'b0;






reg    de_before_tmp4_pos_modelsim_left;// 为了左移
[email protected](posedge clk_i or negedge rst_n)
	if(!rst_n)
	    de_before_tmp4_pos_modelsim_left <= 1'b0;
	else if(pix_w_i == 8'h01)
	    de_before_tmp4_pos_modelsim_left <= de_before_tmp4_pos_modelsim;
	else if(de_before_tmp4_pos && h_cnt == 13'd70&& pix_w_i_tmp_cnt==8'h01 && vs_cnt==8'h00)//(一帧只取一个de)(加vs_cnt是为了舍弃一帧中多余的,好几帧才给一个数值)
        de_before_tmp4_pos_modelsim_left <= 1'b1;
	else
	    de_before_tmp4_pos_modelsim_left <= 1'b0;

reg de_before_tmp4_pos_modelsim_ture;
[email protected](posedge clk_i or negedge rst_n)
	if(!rst_n)
	    de_before_tmp4_pos_modelsim_ture <= 1'b0;
	else if(move_i_tmp == 5'h01)
        de_before_tmp4_pos_modelsim_ture <= de_before_tmp4_pos_modelsim_left;
    else 
	    de_before_tmp4_pos_modelsim_ture <= de_before_tmp4_pos_modelsim;





[email protected](posedge clk_i or negedge rst_n)
	if(!rst_n)
		hs_sync	<= 1'b0;
	else
	begin
		if(odck_cnt < HSYNC)			
			hs_sync	<= 1'b1;
		else
			hs_sync	<= 1'b0;
	end
	
[email protected](posedge clk_i or negedge rst_n)
	if(!rst_n)
		vs_sync <= 1'b0;
	else
	begin
		if(h_cnt < VSYNC)				 
			vs_sync <= 1'b1;
		else
			vs_sync <= 1'b0;
	end

[email protected](posedge clk_i or negedge rst_n)
	if(!rst_n)
		vs_sync_tmp1	<= 1'b0;
	else
		vs_sync_tmp1	<= vs_sync;
		

[email protected](posedge clk_i or negedge rst_n)
	if(!rst_n)
		de_tmp1	<= 1'b0;
	else
		de_tmp1	<= de;


[email protected](posedge clk_i or negedge rst_n)
	if(!rst_n)
		video_mode	<= 8'h0;
	else
		video_mode	<= pix_mode_i;

	
[email protected](posedge clk_i or negedge rst_n)
	if(!rst_n)
	    move_i_tmp <= 5'b0;
	else
	    move_i_tmp <= move_i;

//像素的宽度   竖条情况下



reg    [7:0]middle_number;

reg    pix_w_i_flag;  //奇数偶数标志
[email protected](posedge clk_i or negedge rst_n)
    if(!rst_n)
	    pix_w_i_flag <= 1'b0;
	else
	    pix_w_i_flag <= pix_w_i% 2'd2;

[email protected](posedge clk_i or negedge rst_n)
	if(!rst_n)
	    middle_number <= 8'b0;
	else if(pix_w_i_flag)
	    middle_number <= (pix_w_i + 1'b1)/2;
	else
	    middle_number <=  pix_w_i[7:1];
	
[email protected](posedge clk_i or negedge rst_n)
	if(!rst_n)
	    pix_w_i_tmp <= 8'b0;
	else
	    pix_w_i_tmp <= pix_w_i;
		
//要让copy_cnt动起来
[email protected](posedge clk_i or negedge rst_n)
	if(!rst_n)
	    copy_cnt <= 8'b0;
	else if(de_before_tmp1_pos && (move_i == 5'h01 || move_i == 5'h02) && pix_w_i_tmp_cnt!=8'h0)begin//给初始值  只有动的时候这个赋值才会起作用
 	    if(move_i == 5'h2)//右边移动
		    copy_cnt <= double_vs_step + 1'b1;
		else if(move_i == 5'h1)//左边移动
		    copy_cnt <= pix_w_i - 1'b1 - double_vs_step;
	end
	else if(de_before_tmp1)begin
	    if(copy_cnt == pix_w_i_tmp - 1'b1)
	        copy_cnt <= 8'b0;
	    else
		    copy_cnt <= copy_cnt + 1'b1;
	end
	else
	    copy_cnt <= 8'b0;
		
[email protected](posedge clk_i or negedge rst_n)
	if(!rst_n)
	    copy_cnt_static <= 8'b0;
	else if(de_before_tmp1)begin
	    if(copy_cnt_static == pix_w_i_tmp - 1'b1)
	        copy_cnt_static <= 8'b0;
	    else
		    copy_cnt_static <= copy_cnt_static + 1'b1;
	end
	else
	    copy_cnt_static <= 8'b0;		
		
		
		
//像素的初始数值  竖条情况下
reg  [11:0]pix_start_i_tmp;

reg    [11:0]   move_step_cnt;

[email protected](posedge clk_i or negedge rst_n)
	if(!rst_n)
	    pix_start_i_tmp  <=  12'b0;
	else
	    pix_start_i_tmp  <=  pix_start_i;

reg  [7:0]data_value_start_remeber;

[email protected](posedge clk_i or negedge rst_n)
	if(!rst_n)
	    data_value_start_remeber <= 8'b0;
	else if(de_before_tmp4_pos_modelsim_ture)begin
	    if(move_i_tmp == 5'h01)//右移动
	    	data_value_start_remeber  <=  data_value_start_remeber - 1'b1;
	    else if(move_i_tmp == 5'h02)//左移动 
	        data_value_start_remeber  <=  data_value_start_remeber + 1'b1;	
	    else if(move_i_tmp == 5'h04)
	        data_value_start_remeber  <=  data_value_start_remeber;
	    else
	        data_value_start_remeber  <=  pix_start_i_tmp[7:0];
	    end
	
	else
	    data_value_start_remeber  <=  data_value_start_remeber;

reg  hs_vaild;//只取中间有效的那一部分
[email protected](posedge clk_i or negedge rst_n)
	if(!rst_n)
	    hs_vaild <= 1'b0;
	else if(h_cnt > 13'd70 && h_cnt <= 13'd2230)
	    hs_vaild <= hs_sync;
	else
	    hs_vaild <= 1'b0;


[email protected](posedge clk_i or negedge rst_n)
begin
	if(!rst_n)
	begin
		value_valid			<= 1'b0;
		data_value			<= 8'h0;
		//data_value_start    <= 8'h0;
	end
	else
	begin
		case(pix_mode_i)// 第一个修改 video_mode
		8'h00,8'h01,8'h02,
		8'h03,8'h04:						//黑、红、绿、蓝、白灰度
		begin
			value_valid	<= 1'b1;
			data_value	<= 8'hff;
		end
		
		8'h05,8'h06,
		8'h07,8'h08:						//红、绿、蓝、白竖向色带
		begin
			value_valid		<= 1'b1;
			
			if(de_before_tmp4_pos_modelsim_ture)//之前用的是hs_sync,现在用de_before_tmp4上升沿,去掉多余的de_before_tmp4_pos,改用一个de 
				begin
				if(move_i_tmp == 5'h02)//左移动
					data_value  <=  data_value + 1'b1;
	            else if(move_i_tmp == 5'h01)//右移动
					data_value  <=  data_value - 1'b1;//本来是减move_step_cnt
				else if(move_i_tmp == 5'h04)
				    data_value <= data_value;//data_value
				else
				    data_value <= pix_start_i_tmp[7:0];//pix_start_i_tmp[7:0]
			end 	
			
			else if(hs_vaild)
                data_value <= data_value_start_remeber;	
				
			else if(move_i_tmp == 5'h01)begin
                if(double_vs_step == 8'h0)begin 
				    if(de_before_tmp1 && copy_cnt == pix_w_i_tmp - 1'b1 - double_vs_step )//第一个特殊情况
					    data_value <= data_value + 2'd2;
				end
				else if(de_before_tmp1 && copy_cnt ==  double_vs_step - 1'b1 )//正常情况
				    data_value <= data_value + 2'd2;
            end			
					
			//数据的产生方式
			else if(de_before_tmp1 && copy_cnt == pix_w_i_tmp  -1'b1- double_vs_step)
				data_value <= data_value + 2'd2;
		    
		end
		
		
		default:  value_valid		<= 1'b0;
		endcase
	end
end

//左移和右移
reg    [7:0]    time_gap_i_tmp; 
reg    [11:0]   move_cnt;

[email protected](posedge clk_i or negedge rst_n)
	if(!rst_n)
	    time_gap_i_tmp <= 8'b0;
	else
	    time_gap_i_tmp <= time_gap_i;
		
		

[email protected](posedge clk_i or negedge rst_n)
    if(!rst_n)
	    vs_cnt  <= 8'h0;
	else if(move_i_tmp == 5'h04 || move_i_tmp == 5'h00 || move_i_flag)//move_i_flag是表示当在5'h01和5'h02之间变换的时候
	    vs_cnt <= 8'h0;
	else begin
	    if(vs_cnt == time_gap_i-1'b1 && (vs_sync&&(~vs_sync_tmp1)))//time_gap_i_tmp
		    vs_cnt <= 8'h0;
		else if(vs_sync&&(~vs_sync_tmp1))
			vs_cnt <= vs_cnt + 1'b1;
		else
		    vs_cnt <= vs_cnt;
	end

reg    move_i_flag_en;

[email protected](posedge clk_i or negedge rst_n)
	if(!rst_n)
	    move_i_flag <= 1'b0;
	else if((move_i_tmp==5'h02&&move_i==5'h01) || (move_i_tmp==5'h01&&move_i==5'h02))      //5'h01跳到5'h02  或者   5'h02跳到5'h01
	    move_i_flag <= 1'b1;
	else 
	    move_i_flag <= 1'b0;
		
			
[email protected](posedge clk_i or negedge rst_n)
	if(!rst_n)
		move_i_flag_en <= 1'b0;
	else if(move_i_tmp==5'h01&&move_i==5'h04)
	    move_i_flag_en <= 1'b1;
	else if(move_i_tmp==5'h04&&move_i==5'h01)
	    move_i_flag_en <= 1'b0;
	else 
	    move_i_flag_en <= move_i_flag_en;
		

//转换期间的en
reg    change_en;
[email protected](posedge clk_i or negedge rst_n)
	if(!rst_n)
	    change_en <= 1'b0;
	else if(move_i_flag)//开始标志
	    change_en <= 1'b1;
	else if(move_step_cnt == 1'b0)//结束标志 
	    change_en <= 1'b0;
	else
	    change_en <= change_en;


[email protected](posedge clk_i or negedge rst_n)
	if(!rst_n)
	    move_step_cnt <= 12'b0;
	else if(move_i_tmp == 5'h00)
	    move_step_cnt <= 12'h0;
	else if(move_i_tmp == 5'h04)
	    move_step_cnt <= move_step_cnt;
	else if(change_en)
	    if(vs_cnt == time_gap_i-1'b1 && (vs_sync&&(~vs_sync_tmp1)))
            move_step_cnt <= move_step_cnt - 1'b1;
		else
		    move_step_cnt <= move_step_cnt; 
	else begin
	    if(move_step_cnt == H_VALID  )
		    move_step_cnt <= 12'b0;
	    else if(vs_cnt == time_gap_i-1'b1 && (vs_sync&&(~vs_sync_tmp1)))
		    move_step_cnt <= move_step_cnt + 1'b1;
		else
		    move_step_cnt <= move_step_cnt;
	end	


[email protected](posedge clk_i or negedge rst_n)
	if(!rst_n)
	    move_cnt  <=  12'b0;
	else if(move_i_tmp == 5'h02)begin       //左移动
	    if(change_en)
	        move_cnt  <=  odck_cnt - move_step_cnt;//特殊情况
	    else
 	        move_cnt  <=  odck_cnt + move_step_cnt;
	end
	else if(move_i_tmp == 5'h01)begin       //右移动
        if(change_en)	   
		    move_cnt  <=  odck_cnt + move_step_cnt;
        else
	        move_cnt  <=  odck_cnt - move_step_cnt;
	end
	else if(move_i_tmp == 5'h04)begin
		if(move_i_flag_en)
		    move_cnt  <=  odck_cnt - move_step_cnt;
		else
		    move_cnt  <=  odck_cnt + move_step_cnt;
	end  
    else
        move_cnt  <=  odck_cnt;


[email protected](posedge clk_i or negedge rst_n)
begin
	if(!rst_n)
		position_valid		<= 1'b0;
	else
	begin
		case(pix_mode_i)
		
		8'h09:begin        //白横线
		    if(h_cnt % DISTANCE ==0)
			    position_valid    <=    1'b1;
			else
			    position_valid    <=    1'b0;
		end
		
		
		8'h0a:begin        //白竖线
			if(move_cnt % 5'd16 ==0)
			    position_valid    <=    1'b1;
			else
			    position_valid    <=    1'b0;
		end
		
		8'h0b:begin        //白网格
			if(h_cnt % DISTANCE ==0 || move_cnt % 5'd16 ==0)
			    position_valid    <=    1'b1;
			else
			    position_valid    <=    1'b0;
		end
		
		
		8'h0c:						//    白斜线/
		begin
		    case(h_cnt%32)
			
			6'd0,6'd1:  if(move_cnt%16==6'd15)
					        position_valid  <= 1'b1;
				        else
					        position_valid  <= 1'b0;  
			6'd2,6'd3:  if(move_cnt%16==6'd14)
					        position_valid  <= 1'b1;
				        else
					        position_valid  <= 1'b0;  
			6'd4,6'd5:  if(move_cnt%16==6'd13)
					        position_valid  <= 1'b1;
				        else
					        position_valid  <= 1'b0;
			6'd6,6'd7:  if(move_cnt%16==6'd12)
					        position_valid  <= 1'b1; 
				        else
					        position_valid  <= 1'b0; 
			6'd8,6'd9:  if(move_cnt%16==6'd11)
					        position_valid  <= 1'b1; 
				        else
					        position_valid  <= 1'b0; 
			6'd10,6'd11:if(move_cnt%16==6'd10)
					        position_valid  <= 1'b1;
				        else
					        position_valid  <= 1'b0;
			6'd12,6'd13:if(move_cnt%16==6'd9)
					        position_valid  <= 1'b1;
				        else
					        position_valid  <= 1'b0; 
			6'd14,6'd15:if(move_cnt%16==6'd8)
					        position_valid  <= 1'b1;
				        else
					        position_valid  <= 1'b0;
			6'd16,6'd17:if(move_cnt%16==6'd7)
					        position_valid  <= 1'b1;
				        else
					        position_valid  <= 1'b0;
			6'd18,6'd19:if(move_cnt%16==6'd6)
					        position_valid  <= 1'b1;
				        else
					        position_valid  <= 1'b0;
			6'd20,6'd21:if(move_cnt%16==6'd5)
					        position_valid  <= 1'b1; 
				        else
					        position_valid  <= 1'b0;
			6'd22,6'd23:if(move_cnt%16==6'd4)
					        position_valid  <= 1'b1; 
				        else
					        position_valid  <= 1'b0; 
			6'd24,6'd25:if(move_cnt%16==6'd3)
					        position_valid  <= 1'b1;
				        else
					        position_valid  <= 1'b0;
			6'd26,6'd27:if(move_cnt%16==6'd2)
					        position_valid  <= 1'b1;
				        else
					        position_valid  <= 1'b0; 
			6'd28,6'd29:if(move_cnt%16==6'd1)
					        position_valid  <= 1'b1;
				        else
					        position_valid  <= 1'b0;
			6'd30,6'd31:if(move_cnt%16==6'd0)
					        position_valid  <= 1'b1;
				        else
					        position_valid  <= 1'b0;
			endcase
		end
		
		8'h0d:                        //    白斜线\
		begin
		    case(h_cnt%32)
		    //斜线2
			6'd0,6'd1:  if(move_cnt%16==6'd0)
					        position_valid		<= 1'b1;
				        else
					        position_valid		<= 1'b0;
			6'd2,6'd3:  if(move_cnt%16==6'd1)
					        position_valid		<= 1'b1;
				        else
					        position_valid		<= 1'b0;
			6'd4,6'd5:  if(move_cnt%16==6'd2)
					        position_valid		<= 1'b1;
				        else
					        position_valid		<= 1'b0;
			6'd6,6'd7:  if(move_cnt%16==6'd3)
					        position_valid		<= 1'b1;
				        else
					        position_valid		<= 1'b0;
			6'd8,6'd9:  if(move_cnt%16==6'd4)
					        position_valid		<= 1'b1;
				        else
					        position_valid		<= 1'b0;
			6'd10,6'd11:if(move_cnt%16==6'd5)
					        position_valid		<= 1'b1;
				        else
					        position_valid		<= 1'b0;
			6'd12,6'd13:if(move_cnt%16==6'd6)
					        position_valid		<= 1'b1;
				        else
					        position_valid		<= 1'b0;
			6'd14,6'd15:if(move_cnt%16==6'd7)
					        position_valid		<= 1'b1;
				        else
					        position_valid		<= 1'b0;
			6'd16,6'd17:if(move_cnt%16==6'd8)
					        position_valid		<= 1'b1;
				        else
					        position_valid		<= 1'b0;
			6'd18,6'd19:if(move_cnt%16==6'd9)
					        position_valid		<= 1'b1;
				        else
					        position_valid		<= 1'b0;
			6'd20,6'd21:if(move_cnt%16==6'd10)
					        position_valid		<= 1'b1;
				        else
					        position_valid		<= 1'b0;
			6'd22,6'd23:if(move_cnt%16==6'd11)
					        position_valid		<= 1'b1;
				        else
					        position_valid		<= 1'b0;
			6'd24,6'd25:if(move_cnt%16==6'd12)
					        position_valid		<= 1'b1;
				        else
					        position_valid		<= 1'b0;
			6'd26,6'd27:if(move_cnt%16==6'd13)
					        position_valid		<= 1'b1;
				        else
					        position_valid		<= 1'b0;
			6'd28,6'd29:if(move_cnt%16==6'd14)
					        position_valid		<= 1'b1;
				        else
					        position_valid		<= 1'b0;
			6'd30,6'd31:if(move_cnt%16==6'd15)
					        position_valid		<= 1'b1;
				        else
					        position_valid		<= 1'b0;
			endcase
		end
		
		8'h0e:                       //    白交叉斜线
		begin
		    case(h_cnt%32)
			
			6'd0,6'd1:  if(move_cnt%16==6'd0 || move_cnt%16==6'd15)
					        position_valid		<= 1'b1;
				        else
					        position_valid		<= 1'b0;
			6'd2,6'd3:  if(move_cnt%16==6'd1 || move_cnt%16==6'd14)
					        position_valid		<= 1'b1;
				        else
					        position_valid		<= 1'b0;
			6'd4,6'd5:  if(move_cnt%16==6'd2 || move_cnt%16==6'd13)
					        position_valid		<= 1'b1;
				        else
					        position_valid		<= 1'b0;
			6'd6,6'd7:  if(move_cnt%16==6'd3 || move_cnt%16==6'd12)
					        position_valid		<= 1'b1;
				        else
					        position_valid		<= 1'b0;
			6'd8,6'd9:  if(move_cnt%16==6'd4 || move_cnt%16==6'd11)
					        position_valid		<= 1'b1;
				        else
					        position_valid		<= 1'b0;
			6'd10,6'd11:if(move_cnt%16==6'd5 || move_cnt%16==6'd10)
					        position_valid		<= 1'b1;
				        else
					        position_valid		<= 1'b0;
			6'd12,6'd13:if(move_cnt%16==6'd6 || move_cnt%16==6'd9)
					        position_valid		<= 1'b1;
				        else
					        position_valid		<= 1'b0;
			6'd14,6'd15:if(move_cnt%16==6'd7 || move_cnt%16==6'd8)
					        position_valid		<= 1'b1;
				        else
					        position_valid		<= 1'b0;
			6'd16,6'd17:if(move_cnt%16==6'd8 || move_cnt%16==6'd7)
					        position_valid		<= 1'b1;
				        else
					        position_valid		<= 1'b0;
			6'd18,6'd19:if(move_cnt%16==6'd9 || move_cnt%16==6'd6)
					        position_valid		<= 1'b1;
				        else
					        position_valid		<= 1'b0;
			6'd20,6'd21:if(move_cnt%16==6'd10 || move_cnt%16==6'd5)
					        position_valid		<= 1'b1;
				        else
					        position_valid		<= 1'b0;
			6'd22,6'd23:if(move_cnt%16==6'd11 || move_cnt%16==6'd4)
					        position_valid		<= 1'b1;
				        else
					        position_valid		<= 1'b0;
			6'd24,6'd25:if(move_cnt%16==6'd12 || move_cnt%16==6'd3)
					        position_valid		<= 1'b1;
				        else
					        position_valid		<= 1'b0;
			6'd26,6'd27:if(move_cnt%16==6'd13 || move_cnt%16==6'd2)
					        position_valid		<= 1'b1;
				        else
					        position_valid		<= 1'b0;
			6'd28,6'd29:if(move_cnt%16==6'd14 || move_cnt%16==6'd1)
					        position_valid		<= 1'b1;
				        else
					        position_valid		<= 1'b0;
			6'd30,6'd31:if(move_cnt%16==6'd15 || move_cnt%16==6'd0)
					        position_valid		<= 1'b1;
				        else
					        position_valid		<= 1'b0;
			endcase
		end
	    endcase
	end
end

[email protected](posedge clk_i or negedge rst_n)
    if(!rst_n)
	    position_valid_one <= 1'b0;
	else if(pix_mode_i == 8'h0e)begin //video_mode
	    if(   ((h_cnt%32==6'd0 ||h_cnt%32==6'd1 )&& move_cnt%16==6'd0  ) || 
              ((h_cnt%32==6'd2 ||h_cnt%32==6'd3 )&& move_cnt%16==6'd1  ) ||
              ((h_cnt%32==6'd4 ||h_cnt%32==6'd5 )&& move_cnt%16==6'd2  ) || 			  
		      ((h_cnt%32==6'd6 ||h_cnt%32==6'd7 )&& move_cnt%16==6'd3  ) ||
		      ((h_cnt%32==6'd8 ||h_cnt%32==6'd9 )&& move_cnt%16==6'd4  ) ||
		      ((h_cnt%32==6'd10||h_cnt%32==6'd11)&& move_cnt%16==6'd5  ) ||
		      ((h_cnt%32==6'd12||h_cnt%32==6'd13)&& move_cnt%16==6'd6  ) ||
		      ((h_cnt%32==6'd14||h_cnt%32==6'd15)&& move_cnt%16==6'd7  ) ||
			  ((h_cnt%32==6'd16||h_cnt%32==6'd17)&& move_cnt%16==6'd8  ) || 
			  ((h_cnt%32==6'd18||h_cnt%32==6'd19)&& move_cnt%16==6'd9  ) || 
			  ((h_cnt%32==6'd20||h_cnt%32==6'd21)&& move_cnt%16==6'd10 ) || 
			  ((h_cnt%32==6'd22||h_cnt%32==6'd23)&& move_cnt%16==6'd11 ) || 
			  ((h_cnt%32==6'd24||h_cnt%32==6'd25)&& move_cnt%16==6'd12 ) || 
			  ((h_cnt%32==6'd26||h_cnt%32==6'd27)&& move_cnt%16==6'd13 ) || 
			  ((h_cnt%32==6'd28||h_cnt%32==6'd29)&& move_cnt%16==6'd14 ) || 
			  ((h_cnt%32==6'd30||h_cnt%32==6'd31)&& move_cnt%16==6'd15 ) 
		)
            position_valid_one <= 1'b1;		
		else
		    position_valid_one <= 1'b0;
	
	end
	else 
	    position_valid_one <= 1'b0;    

[email protected](posedge clk_i or negedge rst_n)
begin
	if(!rst_n)
	begin
		red_color_valid		<= 1'b0;
		green_color_valid	<= 1'b0;
		blue_color_valid	<= 1'b0;
	end
	else
	
	begin	
		case(pix_mode_i)  //video_mode        
        //黑屏
		8'h00:
		begin
		    red_color_valid		<= 1'b0;
			green_color_valid	<= 1'b0;
			blue_color_valid	<= 1'b0;    
		end

		//全白、白竖条、白横线、白竖线、白网格、白左斜线、白右斜线、白交叉斜线
		8'h04,8'h08,8'h09,8'h0a,8'h0b,8'h0c,8'h0d,8'h0e:
		begin
			red_color_valid		<= 1'b1;
			green_color_valid	<= 1'b1;
			blue_color_valid	<= 1'b1;    
	    end
		
		//红屏、红条
		8'h01,8'h05:
		begin
		    red_color_valid		<= 1'b1;
			green_color_valid	<= 1'b0;
			blue_color_valid	<= 1'b0; 
		end
		
		//绿屏、绿竖条
		8'h02,8'h06:
		begin
		    red_color_valid		<= 1'b0;
			green_color_valid	<= 1'b1;
			blue_color_valid	<= 1'b0; 
		end
		
		//蓝屏、蓝竖条
		8'h03,8'h07:
		begin
		    red_color_valid		<= 1'b0;
			green_color_valid	<= 1'b0;
			blue_color_valid	<= 1'b1; 
		end
		
		default: begin
		    red_color_valid	    <= 1'b0;
			green_color_valid	<= 1'b0;
			blue_color_valid	<= 1'b0; 
		
		end
		
		endcase
	end
end


	
[email protected](posedge clk_i or negedge rst_n)
	if(!rst_n)
	    video_da_o_tmp  <= 48'h0;
	else 
	    case(pix_mode_i)//video_mode
		8'h0a:   video_da_o_tmp <={green_data,blue_data,red_data,8'b0,8'b0,8'b0};
        8'h0b:  if(h_cnt % DISTANCE ==0)
		            video_da_o_tmp <={green_data,blue_data,red_data,green_data,blue_data,red_data};
		        else
	                video_da_o_tmp <={green_data,blue_data,red_data,8'b0,8'b0,8'b0};
		8'h0c:  if(h_cnt % 2 ==0)
		            video_da_o_tmp <={8'b0,8'b0,8'b0,green_data,blue_data,red_data};
		        else
	                video_da_o_tmp <={green_data,blue_data,red_data,8'b0,8'b0,8'b0};
		8'h0d:  if(h_cnt % 2 ==0)
		            video_da_o_tmp <={green_data,blue_data,red_data,8'b0,8'b0,8'b0};
		        else
	                video_da_o_tmp <={8'b0,8'b0,8'b0,green_data,blue_data,red_data}; 
	    8'h0e:  begin
					if(h_cnt %2 ==0)begin
	                    if(position_valid_one)
	                        video_da_o_tmp <={green_data,blue_data,red_data,8'b0,8'b0,8'b0};
	                    //else if(position_valid_two)
						else
	                        video_da_o_tmp <={8'b0,8'b0,8'b0,green_data,blue_data,red_data};
	                end
					else begin
	                    if(position_valid_one)
		                    video_da_o_tmp <={8'b0,8'b0,8'b0,green_data,blue_data,red_data};
						else
		                    video_da_o_tmp <={green_data,blue_data,red_data,8'b0,8'b0,8'b0};
	                end
			    end  
		
		5'h5:
	        if(!pix_w_i_flag)begin
	            if(copy_cnt==middle_number)
	        	video_da_o_tmp <= {green_data,blue_data,red_data+1'b1,green_data,blue_data,red_data+1'b1};
	            else if(copy_cnt== 1'b0)
	        	video_da_o_tmp <= {green_data,blue_data,red_data,green_data,blue_data,red_data};
				else
				video_da_o_tmp <= video_da_o_tmp;
	        end
	        
	        else begin
			
            if(copy_cnt == middle_number - 1'b1) 
                video_da_o_tmp <={green_data,blue_data,red_data,green_data,blue_data,red_data+1'b1 };
	        else if(copy_cnt == middle_number )
                video_da_o_tmp <={green_data,blue_data,red_data+1'b1,green_data,blue_data,red_data+1'b1};
	        else if(copy_cnt == 1'b0)
	            video_da_o_tmp <={green_data,blue_data,red_data,green_data,blue_data,red_data };
	        else
	            video_da_o_tmp <= video_da_o_tmp;
	        end 	
	
	        5'h6:
	        if(!pix_w_i_flag)begin
	            if(copy_cnt==middle_number)
	        	video_da_o_tmp <= {green_data+1'b1,blue_data,red_data,green_data+1'b1,blue_data,red_data};
	            else if(copy_cnt== 1'b0)
	        	video_da_o_tmp <= {green_data,blue_data,red_data,green_data,blue_data,red_data};
				else
				video_da_o_tmp <= video_da_o_tmp;
	        end
	        
	        else begin
            if(copy_cnt == middle_number - 1'b1) 
                video_da_o_tmp <={green_data,blue_data,red_data,green_data+1'b1,blue_data,red_data};
	        else if(copy_cnt == middle_number )
                video_da_o_tmp <={green_data+1'b1,blue_data,red_data,green_data+1'b1,blue_data,red_data};
	        else if(copy_cnt == 1'b0)
	            video_da_o_tmp <={green_data,blue_data,red_data,green_data,blue_data,red_data };
	        else
	            video_da_o_tmp <= video_da_o_tmp;
	        end 
	
	        5'h7:
	        if(!pix_w_i_flag)begin
	            if(copy_cnt==middle_number)
	        	video_da_o_tmp <= {green_data,blue_data+1'b1,red_data,green_data,blue_data+1'b1,red_data};
	            else if(copy_cnt== 1'b0)
	        	video_da_o_tmp <= {green_data,blue_data,red_data,green_data,blue_data,red_data};
				else
				video_da_o_tmp <= video_da_o_tmp;
	        end
	        
	        
	        else begin
            if(copy_cnt == middle_number - 1'b1) 
                video_da_o_tmp <={green_data,blue_data,red_data,green_data,blue_data+1'b1,red_data};
	        else if(copy_cnt == middle_number )
                video_da_o_tmp <={green_data,blue_data+1'b1,red_data,green_data,blue_data+1'b1,red_data};
	        else if(copy_cnt == 1'b0)
	            video_da_o_tmp <={green_data,blue_data,red_data,green_data,blue_data,red_data };
	        else
	            video_da_o_tmp <= video_da_o_tmp;
	        end 
	
	        5'h8:
	        if(!pix_w_i_flag)begin
	            if(copy_cnt==middle_number)
	        	video_da_o_tmp <= {green_data+1'b1,blue_data+1'b1,red_data+1'b1,green_data+1'b1,blue_data+1'b1,red_data+1'b1};
	            else if(copy_cnt== 1'b0)
	        	video_da_o_tmp <= {green_data,blue_data,red_data,green_data,blue_data,red_data};
				else
				video_da_o_tmp <= video_da_o_tmp;
	        end
			
			
	        else begin
			if(copy_cnt == middle_number - 1'b1) 
                video_da_o_tmp <={green_data,blue_data,red_data,green_data+1'b1,blue_data+1'b1,red_data+1'b1 };
	        else if(copy_cnt == middle_number )
                video_da_o_tmp <={green_data+1'b1,blue_data+1'b1,red_data+1'b1,green_data+1'b1,blue_data+1'b1,red_data+1'b1};
	        else if(copy_cnt == 1'b0)
	            video_da_o_tmp <={green_data,blue_data,red_data,green_data,blue_data,red_data };
	        else
	            video_da_o_tmp <= video_da_o_tmp;
	        end 
		
		default:video_da_o_tmp <={green_data,blue_data,red_data,green_data,blue_data,red_data};
		endcase
		
		//添加的新的赋值方式
		
reg  [47:0]video_da_o_tmp_tmp;
//GBR  GBR 
[email protected](posedge clk_i or negedge rst_n)
    if(!rst_n)
	    video_da_o_tmp_tmp <= 48'b0;
	else  begin 

	    case(pix_mode_i)
		5'h5:   //注释以这个为准
	            if(pix_w_i == 8'h1)
	                video_da_o_tmp_tmp <= video_da_o_tmp;
	            else if(flag_right_ji_high)//右移动  奇数   以5为例    2是高位加1  4是低位加1
	                video_da_o_tmp_tmp <= {
					                        video_da_o_tmp[47:40],
											video_da_o_tmp[39:32],
					                        video_da_o_tmp[31:24]+1'b1,
					                        video_da_o_tmp[23:16],
											video_da_o_tmp[15:8 ],
					                        video_da_o_tmp[7 :0 ]};
				else if(flag_right_ji_low)//右移动  奇数   以5为例    2是高位加1  4是低位加1
	                video_da_o_tmp_tmp <= {
					                        video_da_o_tmp[47:40],
											video_da_o_tmp[39:32],
					                        video_da_o_tmp[31:24],
					                        video_da_o_tmp[23:16],
											video_da_o_tmp[15:8 ],
					                        video_da_o_tmp[7 :0 ]+1'b1};
			     
	            else if(flag_right_ou)//右移动  偶数  以为6为例   2是低位加1   5也是低位加1
	                video_da_o_tmp_tmp <= {
					                        video_da_o_tmp[47:40],
											video_da_o_tmp[39:32],
					                        video_da_o_tmp[31:24],
					                        video_da_o_tmp[23:16],
											video_da_o_tmp[15:8 ],
					                        video_da_o_tmp[7 :0 ]+1'b1};
                else if(flag_left_ji_low)//左移动   奇数	以5为例  0是高位减1  2是低位减1	
	                video_da_o_tmp_tmp <= {
					                        video_da_o_tmp[47:40],
											video_da_o_tmp[39:32],
					                        video_da_o_tmp[31:24],
					                        video_da_o_tmp[23:16],
											video_da_o_tmp[15:8 ],
					                        video_da_o_tmp[7 :0 ]-1'b1};
				else if(flag_left_ji_high)//左移动   奇数	以5为例  0是高位减1  2是低位减1	
	                video_da_o_tmp_tmp <= {
					                        video_da_o_tmp[47:40],
											video_da_o_tmp[39:32],
					                        video_da_o_tmp[31:24]-1'b1,
					                        video_da_o_tmp[23:16],
											video_da_o_tmp[15:8 ],
					                        video_da_o_tmp[7 :0 ]};
									
	            else if(flag_left_ou)//左移动   偶数 以6为例    0是高位减1     3是高位减1
	                video_da_o_tmp_tmp <= {
					                        video_da_o_tmp[47:40],
											video_da_o_tmp[39:32],
					                        video_da_o_tmp[31:24]-1'b1,
					                        video_da_o_tmp[23:16],
											video_da_o_tmp[15:8 ],
					                        video_da_o_tmp[7 :0 ]};	
		        else
				    video_da_o_tmp_tmp <= video_da_o_tmp;
		5'h6:
		        if(pix_w_i == 8'h1)
	                video_da_o_tmp_tmp <= video_da_o_tmp;
	            else if(flag_right_ji_high)//右移动  奇数   以5为例    3是高位加1  5是地位加1
	                video_da_o_tmp_tmp <= {
					                        video_da_o_tmp[47:40]+1'b1,
											video_da_o_tmp[39:32],
					                        video_da_o_tmp[31:24],
					                        video_da_o_tmp[23:16],
											video_da_o_tmp[15:8 ],
					                        video_da_o_tmp[7 :0 ]};
				else if(flag_right_ji_low)//右移动  奇数   以5为例    3是高位加1  5是地位加1
	                video_da_o_tmp_tmp <= {
					                        video_da_o_tmp[47:40],
											video_da_o_tmp[39:32],
					                        video_da_o_tmp[31:24],
					                        video_da_o_tmp[23:16]+1'b1,
											video_da_o_tmp[15:8 ],
					                        video_da_o_tmp[7 :0 ]};
			     
	            else if(flag_right_ou)//右移动  偶数  以为6为例   3是低位加1   6也是地位加1
	                video_da_o_tmp_tmp <= {
					                        video_da_o_tmp[47:40],
											video_da_o_tmp[39:32],
					                        video_da_o_tmp[31:24],
					                        video_da_o_tmp[23:16]+1'b1,
											video_da_o_tmp[15:8 ],
					                        video_da_o_tmp[7 :0 ]};
                else if(flag_left_ji_low)//左移动   奇数	以5为例  1是低位减1  4是高位减1	
	                video_da_o_tmp_tmp <= {
					                        video_da_o_tmp[47:40],
											video_da_o_tmp[39:32],
					                        video_da_o_tmp[31:24],
					                        video_da_o_tmp[23:16]-1'b1,
											video_da_o_tmp[15:8 ],
					                        video_da_o_tmp[7 :0 ]};
				else if(flag_left_ji_high)//左移动   奇数	以5为例  1是低位减1  4是高位减1	
	                video_da_o_tmp_tmp <= {
					                        video_da_o_tmp[47:40]-1'b1,
											video_da_o_tmp[39:32],
					                        video_da_o_tmp[31:24],
					                        video_da_o_tmp[23:16],
											video_da_o_tmp[15:8 ],
					                        video_da_o_tmp[7 :0 ]};
									
	            else if(flag_left_ou)//左移动   偶数 以6为例    1是低位加1,4是低位加1
	                video_da_o_tmp_tmp <= {
					                        video_da_o_tmp[47:40]-1'b1,
											video_da_o_tmp[39:32],
					                        video_da_o_tmp[31:24],
					                        video_da_o_tmp[23:16],
											video_da_o_tmp[15:8 ],
					                        video_da_o_tmp[7 :0 ]};	
		        else
				    video_da_o_tmp_tmp <= video_da_o_tmp;
		5'h7:
		        if(pix_w_i == 8'h1)
	                video_da_o_tmp_tmp <= video_da_o_tmp;
	            else if(flag_right_ji_high)//右移动  奇数   以5为例    3是高位加1  5是地位加1
	                video_da_o_tmp_tmp <= {
					                        video_da_o_tmp[47:40],
											video_da_o_tmp[39:32]+1'b1,
					                        video_da_o_tmp[31:24],
					                        video_da_o_tmp[23:16],
											video_da_o_tmp[15:8 ],
					                        video_da_o_tmp[7 :0 ]};
				else if(flag_right_ji_low)//右移动  奇数   以5为例    3是高位加1  5是地位加1
	                video_da_o_tmp_tmp <= {
					                        video_da_o_tmp[47:40],
											video_da_o_tmp[39:32],
					                        video_da_o_tmp[31:24],
					                        video_da_o_tmp[23:16],
											video_da_o_tmp[15:8 ]+1'b1,
					                        video_da_o_tmp[7 :0 ]};
			     
	            else if(flag_right_ou)//右移动  偶数  以为6为例   3是低位加1   6也是地位加1
	                video_da_o_tmp_tmp <= {
					                        video_da_o_tmp[47:40],
											video_da_o_tmp[39:32],
					                        video_da_o_tmp[31:24],
					                        video_da_o_tmp[23:16],
											video_da_o_tmp[15:8 ]+1'b1,
					                        video_da_o_tmp[7 :0 ]};
                else if(flag_left_ji_low)//左移动   奇数	以5为例  1是低位减1  4是高位减1	
	                video_da_o_tmp_tmp <= {
					                        video_da_o_tmp[47:40],
											video_da_o_tmp[39:32],
					                        video_da_o_tmp[31:24],
					                        video_da_o_tmp[23:16],
											video_da_o_tmp[15:8 ]-1'b1,
					                        video_da_o_tmp[7 :0 ]};
				else if(flag_left_ji_high)//左移动   奇数	以5为例  1是低位减1  4是高位减1	
	                video_da_o_tmp_tmp <= {
					                        video_da_o_tmp[47:40],
											video_da_o_tmp[39:32]-1'b1,
					                        video_da_o_tmp[31:24],
					                        video_da_o_tmp[23:16],
											video_da_o_tmp[15:8 ],
					                        video_da_o_tmp[7 :0 ]};
									
	            else if(flag_left_ou)//左移动   偶数 以6为例    1是低位加1,4是低位加1
	                video_da_o_tmp_tmp <= {
					                        video_da_o_tmp[47:40],
											video_da_o_tmp[39:32]-1'b1,
					                        video_da_o_tmp[31:24],
					                        video_da_o_tmp[23:16],
											video_da_o_tmp[15:8 ],
					                        video_da_o_tmp[7 :0 ]};	
		        else
				    video_da_o_tmp_tmp <= video_da_o_tmp;
		5'h8:
		        if(pix_w_i == 8'h1)
	                video_da_o_tmp_tmp <= video_da_o_tmp;
	            else if(flag_right_ji_high)//右移动  奇数   以5为例    3是高位加1  5是地位加1
	                video_da_o_tmp_tmp <= {
					                        video_da_o_tmp[47:40]+1'b1,
											video_da_o_tmp[39:32]+1'b1,
					                        video_da_o_tmp[31:24]+1'b1,
					                        video_da_o_tmp[23:16],
											video_da_o_tmp[15:8 ],
					                        video_da_o_tmp[7 :0 ]};
				else if(flag_right_ji_low)//右移动  奇数   以5为例    3是高位加1  5是地位加1
	                video_da_o_tmp_tmp <= {
					                        video_da_o_tmp[47:40],
											video_da_o_tmp[39:32],
					                        video_da_o_tmp[31:24],
					                        video_da_o_tmp[23:16]+1'b1,
											video_da_o_tmp[15:8 ]+1'b1,
					                        video_da_o_tmp[7 :0 ]+1'b1};
			     
	            else if(flag_right_ou)//右移动  偶数  以为6为例   3是低位加1   6也是地位加1
	                video_da_o_tmp_tmp <= {
					                        video_da_o_tmp[47:40],
											video_da_o_tmp[39:32],
					                        video_da_o_tmp[31:24],
					                        video_da_o_tmp[23:16]+1'b1,
											video_da_o_tmp[15:8 ]+1'b1,
					                        video_da_o_tmp[7 :0 ]+1'b1};
                else if(flag_left_ji_low)//左移动   奇数	以5为例  1是低位减1  4是高位减1	
	                video_da_o_tmp_tmp <= {
					                        video_da_o_tmp[47:40],
											video_da_o_tmp[39:32],
					                        video_da_o_tmp[31:24],
					                        video_da_o_tmp[23:16]-1'b1,
											video_da_o_tmp[15:8 ]-1'b1,
					                        video_da_o_tmp[7 :0 ]-1'b1};
				else if(flag_left_ji_high)//左移动   奇数	以5为例  1是低位减1  4是高位减1	
	                video_da_o_tmp_tmp <= {
					                        video_da_o_tmp[47:40]-1'b1,
											video_da_o_tmp[39:32]-1'b1,
					                        video_da_o_tmp[31:24]-1'b1,
					                        video_da_o_tmp[23:16],
											video_da_o_tmp[15:8 ],
					                        video_da_o_tmp[7 :0 ]};
									
	            else if(flag_left_ou)//左移动   偶数 以6为例    1是低位加1,4是低位加1
	                video_da_o_tmp_tmp <= {
					                        video_da_o_tmp[47:40]-1'b1,
											video_da_o_tmp[39:32]-1'b1,
					                        video_da_o_tmp[31:24]-1'b1,
					                        video_da_o_tmp[23:16],
											video_da_o_tmp[15:8 ],
					                        video_da_o_tmp[7 :0 ]};	
		        else
				    video_da_o_tmp_tmp <= video_da_o_tmp;
					
		default: video_da_o_tmp_tmp <= video_da_o_tmp;
		endcase
	end
	assign video_da_o= video_da_o_tmp_tmp;

endmodule
相关标签: FPGA