HDMI RGB_TO_DVI模块

HDMI RGB_TO_DVI模块

一、模块简介

在HDMI视频数据传输过程中,将24位的RGB888格式的图像,在编码和并串转换后,以TMDS数据输出至HDMI。HDMI_Encoder模块负责对数据进行编码,HDMI_Serializer模块对编码后的数据进行并串转换,最后通过OBUFDS转化成TMDS差分信号传输。
在这里插入图片描述

二、逻辑代码

module HDMI_RGBtoDVI(
    input			wire				[00:00]				i_pixel_clk     ,     //像素数据输入时钟
	input			wire				[00:00]				i_pixel_5_clk   ,     //像素数据输出shizhong
	input			wire				[00:00]				i_rst_n         ,     //复位时钟,低有效	
	input			wire				[23:00]				i_pixel_data    ,     //像素输入数据
	input			wire				[00:00]				i_hsync         ,     //行同步数据
	input			wire				[00:00]				i_vsync         ,     //场同步数据
	input			wire				[00:00]				i_de            ,     //像素数据有效信号
	
	output			wire				[02:00]				o_tmds_data_p   ,     //TMDS数据信号
	output			wire				[02:00]				o_tmds_data_n   ,
	output			wire				[00:00]				o_tmds_clk_p    ,     //TMDS时钟信号
	output			wire				[00:00]				o_tmds_clk_n    ,     
	output			wire				[00:00]				o_tmds_en             //TMDS使能信号
    );
	
    reg 			[00:00]				rst_temp1			;
	reg 			[00:00]				rst_temp2			;	
	wire			[00:00]				sys_rst  			;	//异步复位信号,高有效
    wire			[00:00]				tmds_data_r			;
    wire			[00:00]				tmds_data_g			;
	wire			[00:00]				tmds_data_b			;
	wire			[00:00]				tmds_clk   			;
    wire			[09:00]				tmds_red    		;
	wire			[09:00]				tmds_green  		;
	wire			[09:00]				tmds_blue   		;
    wire			[09:00]				tmds_clk_bit		;
	
	assign	o_tmds_en = 1'b1;
	assign	tmds_clk_bit = 10'b11_1110_0000;	
	
	//同步信号,异步复位,高有效
    assign    sys_rst = rst_temp2;
	always@(posedge i_pixel_clk or negedge i_rst_n)
	begin
	    if(!i_rst_n)
		   begin
		     rst_temp1 <= 1'b1;
		     rst_temp2 <= 1'b1;
		   end
	    else begin
	           rst_temp1 <= 1'b0;
			   rst_temp2 <= rst_temp1;
	         end
	end
	
	OBUFDS #(
		.IOSTANDARD("TMDS33"), 			// Specify the output I/O standard
		.SLEW("SLOW")           		// Specify the output slew rate
	)OBUFDS_inst_r (
		.O(o_tmds_data_p[2]),    		// Diff_p output (connect directly to top-level port)
		.OB(o_tmds_data_n[2]),   		// Diff_n output (connect directly to top-level port)
		.I(tmds_data_r)      			// Buffer input
	);	
	
	OBUFDS #(
		.IOSTANDARD("TMDS33"), 			// Specify the output I/O standard
		.SLEW("SLOW")           		// Specify the output slew rate
	)OBUFDS_inst_g (
		.O(o_tmds_data_p[1]),     		// Diff_p output (connect directly to top-level port)
		.OB(o_tmds_data_n[1]),   		// Diff_n output (connect directly to top-level port)
		.I(tmds_data_g)     			// Buffer input
   );		
	
	OBUFDS #(
		.IOSTANDARD("TMDS33"), 			// Specify the output I/O standard
		.SLEW("SLOW")           		// Specify the output slew rate
	)OBUFDS_inst_b (
		.O(o_tmds_data_p[0]),    	 	// Diff_p output (connect directly to top-level port)
		.OB(o_tmds_data_n[0]),   		// Diff_n output (connect directly to top-level port)
		.I(tmds_data_b)      			// Buffer input
	);		

	OBUFDS #(
		.IOSTANDARD("TMDS33"), 			// Specify the output I/O standard
		.SLEW("SLOW")           		// Specify the output slew rate
	)OBUFDS_inst_clk (
		.O(o_tmds_clk_p),     			// Diff_p output (connect directly to top-level port)
		.OB(o_tmds_clk_n),   			// Diff_n output (connect directly to top-level port)
		.I(tmds_clk)      				// Buffer input
	);   
   
	HDMI_Encoder HDMI_Encoder_b(
		.i_pixel_clk   (i_pixel_clk        )  ,             
		.i_rst         (sys_rst            )  ,             
		.i_data        (i_pixel_data[07:00])  ,             
		.i_de          (i_de               )  ,             
		.i_ctrl_1      (i_hsync            )  ,             
		.i_ctrl_2      (i_vsync            )  ,             
		.o_data        (tmds_blue          )                
    );   

	HDMI_Encoder HDMI_Encoder_g(
		.i_pixel_clk   (i_pixel_clk        )  ,             
		.i_rst         (sys_rst            )  ,             
		.i_data        (i_pixel_data[15:08])  ,             
		.i_de          (i_de               )  ,             
		.i_ctrl_1      (1'b0               )  ,             
		.i_ctrl_2      (1'b0               )  ,             
		.o_data        (tmds_green         )                
    );   	

	HDMI_Encoder HDMI_Encoder_r(
		.i_pixel_clk   (i_pixel_clk        )  ,             
		.i_rst         (sys_rst            )  ,             
		.i_data        (i_pixel_data[23:16])  ,             
		.i_de          (i_de               )  ,             
		.i_ctrl_1      (1'b0               )  ,             
		.i_ctrl_2      (1'b0               )  ,             
		.o_data        (tmds_red           )                
    );   	
	
	HDMI_Serializer HDMI_Serializer_r(
		.i_pixel_clk     (i_pixel_clk  ) ,       
		.i_pixel_5_clk   (i_pixel_5_clk) ,       
		.i_rst           (sys_rst      ) ,       
		.i_pixel_data    (tmds_red     ) ,       
		.o_pixel_data    (tmds_data_r  )         
    );   

	HDMI_Serializer HDMI_Serializer_g(
		.i_pixel_clk     (i_pixel_clk  ) ,       
		.i_pixel_5_clk   (i_pixel_5_clk) ,       
		.i_rst           (sys_rst      ) ,       
		.i_pixel_data    (tmds_green   ) ,       
		.o_pixel_data    (tmds_data_g  )         
    );   

	HDMI_Serializer HDMI_Serializer_b(
		.i_pixel_clk     (i_pixel_clk  ) ,       
		.i_pixel_5_clk   (i_pixel_5_clk) ,       
		.i_rst           (sys_rst      ) ,       
		.i_pixel_data    (tmds_blue    ) ,       
		.o_pixel_data    (tmds_data_b  )         
    );   	
	
	HDMI_Serializer HDMI_Serializer_clk(
		.i_pixel_clk     (i_pixel_clk  ) ,       
		.i_pixel_5_clk   (i_pixel_5_clk) ,       
		.i_rst           (sys_rst      ) ,       
		.i_pixel_data    (tmds_clk_bit ) ,       
		.o_pixel_data    (tmds_clk     )         
    ); 	
endmodule
  • 2
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小灰灰的FPGA

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值