日本黄色一级经典视频|伊人久久精品视频|亚洲黄色色周成人视频九九九|av免费网址黄色小短片|黄色Av无码亚洲成年人|亚洲1区2区3区无码|真人黄片免费观看|无码一级小说欧美日免费三级|日韩中文字幕91在线看|精品久久久无码中文字幕边打电话

當(dāng)前位置:首頁 > > AdriftCoreFPGA芯研社

1簡介

TMDS編碼是由Silicon Image(后來的HDMI Licensing)開發(fā)的一種專門用于DVI和HDMI的編碼技術(shù)。它的主要特點(diǎn)是通過將每個(gè)8位數(shù)據(jù)編碼成10位數(shù)據(jù),以減少信號(hào)中的電平轉(zhuǎn)換次數(shù)(即過渡數(shù)量),從而減小電磁干擾。這種方法是一種8b/10b編碼形式,但使用的編碼集不同于最初的IBM版本。

2TMDS控制信號(hào)

C0和C1 ,在TMDS編碼中,通道0通常用于傳輸重要的同步信號(hào)。C0和C1位分別編碼了水平同步信號(hào)(HSync)和垂直同步信號(hào)(VSync),這是視頻顯示中重要的控制信號(hào),用于同步顯示器的掃描。在其他通道(如通道1和通道2)中,C0和C1位則編碼了CTL0到CTL3信號(hào)。在DVI協(xié)議中,這些信號(hào)未被使用;但在HDMI協(xié)議中,這些信號(hào)用于傳輸額外的控制信息。例如,它們可以指示即將傳輸?shù)臄?shù)據(jù)類型(如視頻數(shù)據(jù)或數(shù)據(jù)島,即非視頻數(shù)據(jù)塊),HDCP(高帶寬數(shù)字內(nèi)容保護(hù))狀態(tài)等。這些信號(hào)幫助接收器理解即將到來的數(shù)據(jù)性質(zhì)和處理要求。

de ,DE信號(hào)通常在水平消隱和垂直消隱(即屏幕未顯示有效圖像的區(qū)域)期間為低電平。當(dāng)掃描線處于有效顯示區(qū)域時(shí),DE信號(hào)為高電平。在HDMI/DVI傳輸中,DE信號(hào)被用來幫助接收器識(shí)別和分離傳輸?shù)南袼財(cái)?shù)據(jù)與同步信號(hào),從而正確顯示圖像。主要用于指示傳輸?shù)臄?shù)據(jù)是否有效的視頻數(shù)據(jù)。

3Encode

TMDS通過兩個(gè)階段的過程,將輸入的8位數(shù)據(jù)轉(zhuǎn)換為具有特定理想特性的10位編碼。

第一階段,第一位,在這個(gè)階段,第一位保持不變。后續(xù)位,每個(gè)后續(xù)位與前一位進(jìn)行異或(XOR)或同或(XNOR)操作。編碼器會(huì)選擇異或或同或操作,以確定哪種操作將導(dǎo)致最少的電平轉(zhuǎn)換。第九位用于編碼采用的是哪種操作。

第二階段 ,可選反轉(zhuǎn):在這個(gè)階段,前八位數(shù)據(jù)可以選擇性地進(jìn)行反轉(zhuǎn),以均衡數(shù)據(jù)中“1”和“0”的數(shù)量,從而維持平均的直流電平。第十位用于編碼是否進(jìn)行了這種反轉(zhuǎn)操作。

下圖是TMDS編碼的流程圖

1. 第一步判斷:N1{D} > 4 OR (N1{D} == 4 AND D[0] == 0)

決定如何處理當(dāng)前8位數(shù)據(jù)D[0:7],即通過異或(XOR)還是同或(XNOR)操作進(jìn)行編碼。如果數(shù)據(jù)中的“1”的數(shù)量(N1{D})大于4(即多數(shù)為“1”),或者N1{D}等于4并且最低位D[0]為0,則使用同或(XNOR)操作,編碼結(jié)果將趨向于更多的“0”。否則,使用異或(XOR)操作,編碼結(jié)果可能趨向于更多的“1”。

2. DE信號(hào)的判斷

DE(Data Enable)信號(hào)用于區(qū)分視頻數(shù)據(jù)和控制信號(hào)。如果DE為高,則表示這是視頻數(shù)據(jù),否則是控制信號(hào)。如果DE為高,繼續(xù)處理視頻數(shù)據(jù)。如果DE為低,選擇預(yù)定義的控制信號(hào)編碼模式(CTRLTOKEN)。

3. 第二步判斷:(Cnt(t-1) == 0) OR (N1{q_m} == N0{q_m})

根據(jù)上一時(shí)鐘周期的計(jì)數(shù)器值Cnt(t-1)和當(dāng)前數(shù)據(jù)的平衡性(即N1{q_m}和N0{q_m}的比較)決定是否反轉(zhuǎn)輸出數(shù)據(jù)q_out。如果Cnt(t-1)等于0,或者當(dāng)前編碼結(jié)果中“1”和“0”的數(shù)量相等(N1{q_m} == N0{q_m}),直接輸出。否則,繼續(xù)判斷是否需要反轉(zhuǎn)數(shù)據(jù)。

4. 第三步判斷:(Cnt(t-1) > 0 AND N1{q_m} > N0{q_m}) OR (Cnt(t-1) < 0 AND N0{q_m} > N1{q_m}決定是否反轉(zhuǎn)數(shù)據(jù)輸出,反轉(zhuǎn)操作的目的是為了維持DC平衡。如果計(jì)數(shù)器Cnt(t-1)大于0,表示之前的編碼傾向于“1”較多,如果當(dāng)前數(shù)據(jù)中“1”的數(shù)量也較多,則需要反轉(zhuǎn)數(shù)據(jù)以增加“0”的數(shù)量。類似地,如果Cnt(t-1)小于0,表示之前的編碼傾向于“0”較多,如果當(dāng)前數(shù)據(jù)中“0”的數(shù)量也較多,則需要反轉(zhuǎn)數(shù)據(jù)以增加“1”的數(shù)量。

5. 反轉(zhuǎn)數(shù)據(jù)的邏輯

在需要反轉(zhuǎn)的情況下,執(zhí)行數(shù)據(jù)反轉(zhuǎn)操作,并調(diào)整計(jì)數(shù)器Cnt(t)。反轉(zhuǎn)數(shù)據(jù)位(q_out[7:0] = ~q_m[7:0]),同時(shí)調(diào)整計(jì)數(shù)器,確保編碼后的數(shù)據(jù)更接近DC平衡。

6. 控制信號(hào)處理

當(dāng)DE為低時(shí),輸出預(yù)定義的控制信號(hào)(如同步信號(hào)或空白信號(hào))。根據(jù)輸入的控制位C0和C1,選擇一個(gè)固定的10位編碼(CTRLTOKEN)。

4總結(jié)

TMDS的目的是確保在高速信號(hào)傳輸時(shí)保持?jǐn)?shù)據(jù)的完整性,主要應(yīng)用于視頻數(shù)據(jù)傳輸。而8b/10b編碼主要用于一般的高速數(shù)據(jù)鏈路,目的是提高信號(hào)傳輸?shù)目煽啃院屯叫?。雖然兩者都采用了將8位數(shù)據(jù)轉(zhuǎn)換為10位數(shù)據(jù)的方式,但具體的編碼規(guī)則和目的不同。TMDS更注重減少信號(hào)過渡和電磁干擾,而8b/10b則更側(cè)重于維持DC平衡和信號(hào)同步。

附錄A:TMDS ENCODE Verilog代碼

//////////////////////////////////////////////////////////////////////////////////  Xilinx, Inc. 2008                 www.xilinx.com////////////////////////////////////////////////////////////////////////////////////  File name :       encode.v////  Description :     TMDS encoder ////  Date - revision : Jan. 2008 - v 1.0////  Author :          Bob Feng////  Disclaimer: LIMITED WARRANTY AND DISCLAMER. These designs are//              provided to you "as is". Xilinx and its licensors make and you//              receive no warranties or conditions, express, implied,//              statutory or otherwise, and Xilinx specifically disclaims any//              implied warranties of merchantability, non-infringement,or//              fitness for a particular purpose. Xilinx does not warrant that//              the functions contained in these designs will meet your//              requirements, or that the operation of these designs will be//              uninterrupted or error free, or that defects in the Designs//              will be corrected. Furthermore, Xilinx does not warrantor//              make any representations regarding use or the results of the//              use of the designs in terms of correctness, accuracy,//              reliability, or otherwise.////              LIMITATION OF LIABILITY. In no event will Xilinx or its//              licensors be liable for any loss of data, lost profits,cost//              or procurement of substitute goods or services, or for any//              special, incidental, consequential, or indirect damages//              arising from the use or operation of the designs or//              accompanying documentation, however caused and on any theory//              of liability. This limitation will apply even if Xilinx//              has been advised of the possibility of such damage. This//              limitation shall apply not-withstanding the failure of the//              essential purpose of any limited remedies herein.////  Copyright by 2006 Xilinx, Inc.//  All rights reserved//////////////////////////////////////////////////////////////////////////////// `timescale 1 ps / 1ps module encode ( input            clkin, // pixel clock input input            rstin, // async. reset input (active high) input      [7:0] din, // data inputs: expect registered input            c0, // c0 input input            c1, // c1 input input            de, // de input output reg [9:0] dout // data outputs);  //////////////////////////////////////////////////////////// // Counting number of 1s and 0s for each incoming pixel // component. Pipe line the result. // Register Data Input so it matches the pipe lined adder // output //////////////////////////////////////////////////////////// reg [3:0] n1d; //number of 1s in din reg [7:0] din_q;  always @ (posedge clkin) begin n1d <= din[0] + din[1] + din[2] + din[3] + din[4] + din[5] + din[6] + din[7];  din_q <= din; end  /////////////////////////////////////////////////////// // Stage 1: 8 bit -> 9 bit // Refer to DVI 1.0 Specification, page 29, Figure 3-5 /////////////////////////////////////////////////////// wire decision1;  assign decision1 = (n1d > 4'h4) | ((n1d == 4'h4) & (din_q[0] == 1'b0));/* reg [8:0] q_m; always @ (posedge clkin) begin q_m[0] <=#1 din_q[0]; q_m[1] <=#1 (decision1) ? (q_m[0] ^~ din_q[1]) : (q_m[0] ^ din_q[1]); q_m[2] <=#1 (decision1) ? (q_m[1] ^~ din_q[2]) : (q_m[1] ^ din_q[2]); q_m[3] <=#1 (decision1) ? (q_m[2] ^~ din_q[3]) : (q_m[2] ^ din_q[3]); q_m[4] <=#1 (decision1) ? (q_m[3] ^~ din_q[4]) : (q_m[3] ^ din_q[4]); q_m[5] <=#1 (decision1) ? (q_m[4] ^~ din_q[5]) : (q_m[4] ^ din_q[5]); q_m[6] <=#1 (decision1) ? (q_m[5] ^~ din_q[6]) : (q_m[5] ^ din_q[6]); q_m[7] <=#1 (decision1) ? (q_m[6] ^~ din_q[7]) : (q_m[6] ^ din_q[7]); q_m[8] <=#1 (decision1) ? 1'b0 : 1'b1; end*/ wire [8:0] q_m; assign q_m[0] = din_q[0]; assign q_m[1] = (decision1) ? (q_m[0] ^~ din_q[1]) : (q_m[0] ^ din_q[1]); assign q_m[2] = (decision1) ? (q_m[1] ^~ din_q[2]) : (q_m[1] ^ din_q[2]); assign q_m[3] = (decision1) ? (q_m[2] ^~ din_q[3]) : (q_m[2] ^ din_q[3]); assign q_m[4] = (decision1) ? (q_m[3] ^~ din_q[4]) : (q_m[3] ^ din_q[4]); assign q_m[5] = (decision1) ? (q_m[4] ^~ din_q[5]) : (q_m[4] ^ din_q[5]); assign q_m[6] = (decision1) ? (q_m[5] ^~ din_q[6]) : (q_m[5] ^ din_q[6]); assign q_m[7] = (decision1) ? (q_m[6] ^~ din_q[7]) : (q_m[6] ^ din_q[7]); assign q_m[8] = (decision1) ? 1'b0 : 1'b1;  ///////////////////////////////////////////////////////// // Stage 2: 9 bit -> 10 bit // Refer to DVI 1.0 Specification, page 29, Figure 3-5 ///////////////////////////////////////////////////////// reg [3:0] n1q_m, n0q_m; // number of 1s and 0s for q_m always @ (posedge clkin) begin n1q_m  <= q_m[0] + q_m[1] + q_m[2] + q_m[3] + q_m[4] + q_m[5] + q_m[6] + q_m[7]; n0q_m  <= 4'h8 - (q_m[0] + q_m[1] + q_m[2] + q_m[3] + q_m[4] + q_m[5] + q_m[6] + q_m[7]); end  parameter CTRLTOKEN0 = 10'b1101010100; parameter CTRLTOKEN1 = 10'b0010101011; parameter CTRLTOKEN2 = 10'b0101010100; parameter CTRLTOKEN3 = 10'b1010101011;  reg [4:0] cnt; //disparity counter, MSB is the sign bit wire decision2, decision3;  assign decision2 = (cnt == 5'h0) | (n1q_m == n0q_m); ///////////////////////////////////////////////////////////////////////// // [(cnt > 0) and (N1q_m > N0q_m)] or [(cnt < 0) and (N0q_m > N1q_m)] ///////////////////////////////////////////////////////////////////////// assign decision3 = (~cnt[4] & (n1q_m > n0q_m)) | (cnt[4] & (n0q_m > n1q_m));  //////////////////////////////////// // pipe line alignment //////////////////////////////////// reg       de_q, de_reg; reg       c0_q, c1_q; reg       c0_reg, c1_reg; reg [8:0] q_m_reg;  always @ (posedge clkin) begin de_q    <= de; de_reg  <= de_q;  c0_q    <= c0; c0_reg  <= c0_q; c1_q    <= c1; c1_reg  <= c1_q;  q_m_reg <= q_m; end  /////////////////////////////// // 10-bit out // disparity counter /////////////////////////////// always @ (posedge clkin or posedge rstin) begin if(rstin) begin dout <= 10'h0; cnt <= 5'h0; end else begin if (de_reg) begin if(decision2) begin dout[9]   <= ~q_m_reg[8];  dout[8]   <= q_m_reg[8];  dout[7:0] <= (q_m_reg[8]) ? q_m_reg[7:0] : ~q_m_reg[7:0];  cnt <=#1 (~q_m_reg[8]) ? (cnt + n0q_m - n1q_m) : (cnt + n1q_m - n0q_m); end else begin if(decision3) begin dout[9]   <= 1'b1; dout[8]   <= q_m_reg[8]; dout[7:0] <= ~q_m_reg[7:0];  cnt <=#1 cnt + {q_m_reg[8], 1'b0} + (n0q_m - n1q_m); end else begin dout[9]   <= 1'b0; dout[8]   <= q_m_reg[8]; dout[7:0] <= q_m_reg[7:0];  cnt <= cnt - {~q_m_reg[8], 1'b0} + (n1q_m - n0q_m); end end end else begin case ({c1_reg, c0_reg}) 2'b00:   dout <= CTRLTOKEN0; 2'b01:   dout <= CTRLTOKEN1; 2'b10:   dout <= CTRLTOKEN2; default: dout <= CTRLTOKEN3; endcase  cnt <= 5'h0; end end end endmodule


本站聲明: 本文章由作者或相關(guān)機(jī)構(gòu)授權(quán)發(fā)布,目的在于傳遞更多信息,并不代表本站贊同其觀點(diǎn),本站亦不保證或承諾內(nèi)容真實(shí)性等。需要轉(zhuǎn)載請(qǐng)聯(lián)系該專欄作者,如若文章內(nèi)容侵犯您的權(quán)益,請(qǐng)及時(shí)聯(lián)系本站刪除。
關(guān)閉