201029339 六、發明說明: 【發明所屬之技術領域】 本發明是有關於一種二元平方剩餘(quadratic residue ,QR)碼之解碼技術,特別是指一種格雷碼(Golaycode) 之解碼方法及解碼器。 【先前技術】 近年來,從消費性電子產品到通訊電子產品,對於訊 號傳送之可靠度的需求日漸殷切;因此,錯誤偵測及更正 機制也日益重要。在數位通訊過程中,傳送端為了確保欲 傳送之原始資料的正確性,一般而言,會對原始資料附加 冗餘資料(redundant data),而接收端即可根據此冗餘資料進 行錯誤校正。由於二元平方剩餘碼對於傳輸通道中所產生 的錯誤有很好的更正能力,故成為非常受歡迎的通道編碼 (channel coding)方式之一,且目前已為衛星通訊系統、數位 電視系統、各式數位影音記錄媒體等所廣泛使用之錯誤更 正碼(Error Correction Code)。 其中,(23,12, 7)格雷碼即是一種有名的二元平方 剩餘碼。現有的解碼方式主要有代數演算法(algebraic algorithm)、歐機里德演算法(Euclid algorithm)、步階解碼 演算法(step-by-step decoding algorithm),此等演算法因為 運算延遲時間長(long time delay )、複雜度高、規則性低、 所需閘數(gate count)高,故其硬體實現上不易且成本較 高。 【發明内容】 201029339 因此,本發明之目的,即在提供一種格雷碼之解碼方 法。 於是,本發明格雷碼之解碼方法,包含下列步驟:(a) 接收一筆二位兀序列(binary sequence);(b)根據已接收 的該二位元序列,及預先定義的一第一輔助校驗矩陣求 出一第一症狀(syndrome)向量;(〇根據已接收的該二位 凡序列,及預先定義的一第二輔助校驗矩陣,求出一第二 症狀向量;(d)根據該第一症狀向量、該第二症狀向量, 及該第一輔助校驗矩陣、該第二輔助校驗矩陣,求出一第 一延伸症狀向量、複數個第二延伸症狀向量、複數個第三 延伸症狀向量,及複數個第四延伸症狀向量;(e)分別求出 對應該第一症狀向量、該第二症狀向量、該第一延伸症狀 向量、該等第二延伸症狀向量、該等第三延伸症狀向量, 及該等第四延伸症狀向量之複數個權重值(weight ) ; ^ f )根據該等權重值進行條件判斷,決定出一錯誤位置向量 :以及(g)根據該錯誤位置向量及已接收的該二位元序列 解碼出對應的一原始資料。本發明之另一目的,即在提供 一種格雷碼之解碼器。 於疋’本發明格雷碼之解瑪器’包含一資料緩衝儲存 (buffer)單元、一症狀向量計算單元、一延伸症狀向量計 算單元、一權重值計算單元、一錯誤位置向量決定單元, 及一運算單元。 該資科緩衝儲存單元用以儲存已接收的一筆二位元序 列。該症狀向量計算單元用以根據該二位元序列與預先定 201029339 義的一第一輔助校驗矩陣,求出一第-症狀向量,及用以 根據該二位元序列與預先定義的一第二輔助校驗矩陣求 出一第二症狀向量。該延伸症狀向量計算單元用以根據該 第=症狀向量、該第二症狀向量及該第一輔助校驗矩陣 、該第二輔助校驗矩陣,求出一第一延伸症狀向量、複數 個第二延伸症狀向量、複數個第三延伸症狀向量,及複數 個第四延伸症狀向#。該㈣值計算單元用以分別求出對 應'•亥第症狀向量、該第二症狀向量、該第一延伸症狀向 β 4、該等第二延伸症狀向量、該等第三延伸症狀向量,及 該等第四延伸症狀向量之複數個權重值。該錯誤位置向量 决疋單70用以根據該等權重值進行條件判斷,決定出一錯 誤位置向量。該運算單元用以根據該錯誤位置向量及已接 收的該二位元序列解碼出對應的一原始資料。 本發明之功效在於:藉由該等權重值之條件判斷,決 疋出該錯誤位置向量,並據以求出該原始資料;不但可以 有效率地進行格雷碼之解碼,且其運算複雜度、所需閘數 Φ 及成本皆大幅低於現有之演算法’適合以硬體實現。 【實施方式】 有關本發明之前述及其他技術内容、特點與功效,在 以下配合參考圖式之一個較佳實施例的詳細說明中,將可 清楚的呈現。 參閲圖1,本發明格雷碼之解碼器i之較佳實施例包含 一資料緩衝儲存單元11、—症狀向量計算單元12、一延伸 向量計算單元13、一權重值計算單元14、一錯誤位置向量 5 201029339 決定單元15 ’及一運算單元i6。 該資料緩衝儲存單元u用以儲存已接收的—筆二位元 序列。該症狀向量計算單元12心根據該二位元序列與預 先定義的-第-辅助校驗矩陣,求出一第一症狀向量及 用以根據該二位元序列與預先定義的-第二辅助校驗矩陣 ’求出H狀向量。該延伸向量計算單元13用以根據 該第-症狀向量、該第二症狀向量,及該第一輔助校驗矩 陣、該第二辅助校驗矩陣’纟出一第一延伸症狀向量、複 數個第二延伸症狀向量、複數個第三延伸症狀向量,及複 數個第四延伸症狀向量。該權重值計算單元14用以分別求 出對應該第-症狀向量、該第二症狀向量、該第—延伸症 狀向量、該等第二延伸症狀向量、該等第三延伸症狀向量 ,及該等第四延伸症狀向量之複數個權重值。該錯誤位置 向量決定單元15用以根據該等權重值進行條件判斷,決定 出-錯誤位置向量。該運算單元16用以根據該錯誤位置向 量及已接收的該二位元序列解碼出對應的一原始資料。 在本較佳實施例中,該格雷碼之解碼器1係以硬體( hardWare )方式實施,但其亦可以軟體(software )或韌體 (firmware)方式實施,並不限於本較佳實施例之例示。 在進行格雷碼之解碼方法的描述之前,預先定義其步 驟中會使用到的矩陣。 (23, i2’7)格雷碼生成多項式如式(1)所示。 容(^ = 1X^0-#)..................................... ( 其中’ h為在模(modulo ) 23下的非〇二元平方剩餘 201029339 的集合;A為格雷碼生成多項式的根(root)。 而對於每一 _/· = 〇,ι,···,22,β如式(2)所示。 β +..·〜,................................…⑺ 其中’《為迦羅瓦場(Gal〇is Field) GF(2„)的原根( primitive root),\。,£1),1,..”0^。為格雷碼生成多項式的根之原 根係數,且GF(2),定義格雷碼生成多項式的根 之一原根係數矩陣(以A代表),如式(3)所示。201029339 VI. Description of the Invention: [Technical Field] The present invention relates to a decoding technique of a quadratic residue (QR) code, and more particularly to a decoding method and decoder for a Golay code. [Prior Art] In recent years, there has been an increasing demand for reliability of signal transmission from consumer electronics to communication electronics; therefore, error detection and correction mechanisms are becoming increasingly important. In the digital communication process, in order to ensure the correctness of the original data to be transmitted, the transmitting end generally adds redundant data to the original data, and the receiving end can perform error correction based on the redundant data. Since the binary square residual code has a good correcting ability for errors generated in the transmission channel, it has become one of the most popular channel coding methods, and is currently a satellite communication system, a digital television system, and each An error correction code (Error Correction Code) widely used in digital video recording media. Among them, (23,12, 7) Gray code is a well-known binary square residual code. The existing decoding methods mainly include algebraic algorithms, Euclid algorithms, and step-by-step decoding algorithms. These algorithms have long delays in operation ( Long time delay ), high complexity, low regularity, and high gate count are difficult to implement and costly. SUMMARY OF THE INVENTION 201029339 Accordingly, it is an object of the present invention to provide a decoding method for Gray code. Therefore, the decoding method of the Gray code of the present invention comprises the following steps: (a) receiving a binary sequence; (b) receiving the binary sequence according to the received one, and a predefined first auxiliary school Determining a first symptom vector according to the matrix; (determining a second symptom vector according to the received two-bit sequence and a predefined second auxiliary check matrix; (d) according to the a first symptom vector, the second symptom vector, and the first auxiliary check matrix, the second auxiliary check matrix, and determining a first extended symptom vector, a plurality of second extended symptom vectors, and a plurality of third extensions a symptom vector, and a plurality of fourth extended symptom vectors; (e) respectively determining a corresponding first symptom vector, the second symptom vector, the first extended symptom vector, the second extended symptom vector, the third Extending the symptom vector, and a plurality of weight values of the fourth extended symptom vector; ^ f) performing conditional judgment based on the weight values to determine an error position vector: and (g) according to the error position And the two received sequence of bits of a decoded data corresponding to the original. Another object of the present invention is to provide a Gray code decoder.疋 'The Gray code grammar of the present invention' comprises a data buffer storage unit, a symptom vector calculation unit, an extended symptom vector calculation unit, a weight value calculation unit, an error position vector decision unit, and a Arithmetic unit. The resource buffer storage unit is configured to store a received binary sequence. The symptom vector calculation unit is configured to obtain a first symptom vector according to the binary sequence and a first auxiliary check matrix defined in advance 201029339, and to use the predefined sequence according to the binary sequence The second auxiliary check matrix finds a second symptom vector. The extended symptom vector calculation unit is configured to obtain a first extended symptom vector and a plurality of second according to the first symptom vector, the second symptom vector, the first auxiliary check matrix, and the second auxiliary check matrix. The extended symptom vector, the plurality of third extended symptom vectors, and the plurality of fourth extended symptoms to #. The (four) value calculation unit is configured to respectively obtain a corresponding '•Hui symptom vector, the second symptom vector, the first extended symptom to β 4, the second extended symptom vector, the third extended symptom vector, and The plurality of weight values of the fourth extended symptom vector. The error position vector decision block 70 is used for conditional judgment based on the weight values to determine an error position vector. The operation unit is configured to decode a corresponding original data according to the error location vector and the received binary sequence. The effect of the invention is that the error location vector is determined by the condition of the weight value, and the original data is obtained according to the condition; not only can the Gray code be efficiently decoded, but also the operation complexity, The required number of gates Φ and cost are significantly lower than the existing algorithms 'suitable for hardware implementation. The above and other technical contents, features, and advantages of the present invention will be apparent from the following detailed description of the preferred embodiments. Referring to FIG. 1, a preferred embodiment of the Gray code decoder i of the present invention comprises a data buffer storage unit 11, a symptom vector calculation unit 12, an extension vector calculation unit 13, a weight value calculation unit 14, and an error location. Vector 5 201029339 determines unit 15 'and an arithmetic unit i6. The data buffer storage unit u is used to store the received pen-bit sequence. The symptom vector calculation unit 12 calculates a first symptom vector according to the binary sequence and the predefined-auxiliary check matrix, and uses the predefined two-second auxiliary school according to the two-bit sequence. Check the matrix 'to find the H-shaped vector. The extension vector calculation unit 13 is configured to extract a first extended symptom vector according to the first symptom vector, the second symptom vector, and the first auxiliary check matrix, and the second auxiliary check matrix Two extended symptom vectors, a plurality of third extended symptom vectors, and a plurality of fourth extended symptom vectors. The weight value calculation unit 14 is configured to respectively determine a corresponding first symptom vector, the second symptom vector, the first extended symptom vector, the second extended symptom vector, the third extended symptom vector, and the like The plurality of weight values of the fourth extended symptom vector. The error position vector determining unit 15 is configured to perform conditional judgment based on the equal weight values to determine an error-error position vector. The operation unit 16 is configured to decode a corresponding original data according to the error location vector and the received binary sequence. In the preferred embodiment, the decoder 1 of the Gray code is implemented in a hardware manner, but it can also be implemented in a software or firmware manner, and is not limited to the preferred embodiment. An illustration. The matrix used in the steps is pre-defined before the description of the Gray code decoding method is performed. (23, i2'7) Gray code generation polynomial is as shown in equation (1). Rong (^ = 1X^0-#).................................... (where ' h is the set of non-〇 binary squared remainder 201029339 under modulo 23; A is the root of the Gray code generator polynomial. For each _/· = 〇, ι,···, 22, β is as shown in the formula (2). β +..·~,................................(7) Among them, 'the root of the GF(2„) of Gal〇is Field, \., £1),1,..”0^. The root coefficient of the root of the polynomial is generated for Gray code, and GF(2) defines the root coefficient matrix (represented by A) of the root of the Gray code generator polynomial, as shown in equation (3).
α〇,〇 αο,ι … αο,ιο A = «1,0 α\,\ … αΜ〇 _ Λ _α22,0 α22Λ α22,1〇 αη,ο αη,ι ** . Λ απ,ιοΑ〇,〇 αο,ι ... αο,ιο A = «1,0 α\,\ ... αΜ〇 _ Λ _α22,0 α22Λ α22,1〇 αη,ο αη,ι ** . Λ απ, ιο
其中,疋義4為原根係數矩陣^的一上半子矩陣;*為 原根係數矩陣A的一下半子矩陣。 進一步定義一第一辅助校驗矩陣(以$代表),以及一 第二辅助校驗矩陣(以Α代表),分別如式(4)以及(5) 所示。Among them, 疋 4 is an upper half submatrix of the original root coefficient matrix ^; * is the lower half submatrix of the original root coefficient matrix A. Further, a first auxiliary check matrix (represented by $) and a second auxiliary check matrix (represented by )) are defined, as shown in equations (4) and (5), respectively.
...............(4 ) ·**···········( 5 ) 7χ 參閱圖i與圖2,配合上述格雷碼之解碼器卜本發明 格雷碼之解碼方法的較佳實施例包含下列步驟。 、在步驟21中,該格雷碼之解碼器i接收該二位元序列 (以"-(/^,..,,^2”,,22)代表);並儲存於該資料緩衝儲存單元 工2根據該二位元 在步驟22中,該症狀向量計算單元 201029339 Γ:二第;輔:—、第二輔一 狀向量(以Α代表),及該第二症狀向量( 2代表)’分別如式⑷以及⑺所示。 ^?Γ>...................... ,、 .......................................... = %..................... ,、 —在步驟23中’該延伸症狀向量計算單元ι3根據該第 、:狀向量Α、第二症狀向量及該第一輔助校驗矩陣[ _辅助校驗矩陣I求出該第-延伸症狀向量、該等第 延伸症狀向量、該等第三延伸症狀向量,及該等第四延 伸症狀向量’分別如式(8)、(”、( 1〇)及(U)所示。 第一延伸症狀向量=ϊ2θ^12).. .................................... 〇 ) 第二延伸症狀向量4㊉俨,匕{11,12,...,22}......................(9) 第三延伸症狀向量=ϊ㈣"㊉私1),iM12,13”",22}.............. ( 1〇) 第四延伸症狀向量= ί-2@ρ,匕似,叫......................(1〇 其中,乂(/)為該第一、該第二輔助校驗矩陣乃的第/列向 量,J = l,2;㊉為有限場加法運算,在此即是互斥或(x〇r) 運算。 在步驟24中,該權重值計算單元14先求出該第一症 狀向量5、第二症狀向量4、該第一延伸症狀向量、該等第 二延伸症狀向量、該等第三延伸症狀向量,及該等第四延 伸症狀向量的權重值,分別以咐⑻、咐⑹、财$㊉私2))、 Η^,θλ/1))、㊉纪”㊉把)),及财氏㊉杞2))代表。然後該錯誤位 置向量決定單元15根據财⑻、⑽⑹、州咕㊉咕))、Μ^㊉纪η) 201029339 、η^ΛΘ/^Θ啞:)’及州咐#俨}進行以下條件判斷,並依條件 判斷的結果決定出錯誤向量(以?代表)。值得一提的是, 對於可解的(decodable )的二位元序列f,依上述運算求出 的權重值’必定僅符合以下六種情況的其中一者。 情況一:若OSw咕)<3,則& =〇 ’其令,; 清況一.若 1^〇2)<3,且 i2=(s。,“),則吒=〇且 〜12=\,其中,Of <10; 情況三:若,且?2㊉纪)= (m,W,則 _ 〜=1 且心 12 ,其中,0S/S1O ; 情況四:若存在唯一的一 f值,ie {11,丨2,,22卜使得...............(4) ·**············ (5) 7χ Refer to Figure i and Figure 2, together with the above-mentioned Gray code decoder The preferred embodiment of the decoding method of the Gray code of the present invention comprises the following steps. In step 21, the decoder i of the Gray code receives the binary sequence (represented by "-(/^,..,,^2",, 22)); and stores in the data buffer storage unit According to the two bits in step 22, the symptom vector calculation unit 201029339 Γ: two; auxiliary: -, second auxiliary one-shaped vector (represented by Α), and the second symptom vector (2 represents)' They are shown in equations (4) and (7) respectively. ^?Γ>......................,,.................. ............................. = %................... . . , , - In step 23, the extended symptom vector calculation unit ι3 finds the first based on the first:: vector vector Α, the second symptom vector, and the first auxiliary check matrix [ _ auxiliary check matrix I - The extended symptom vector, the first extended symptom vector, the third extended symptom vector, and the fourth extended symptom vector ' are represented by equations (8), (", (1), and (U), respectively. An extended symptom vector = ϊ 2θ ^ 12)................................ 〇) Two extended symptom vectors 4 俨, 匕 {11,12,...,22}......................(9) Third Extended symptom vector = ϊ (four) " 十私1), iM12, 13"", 22}.............. (1〇) Fourth extension symptom vector = ί-2@ρ, Similar, called ......................(1〇 where 乂(/) is the first, the second auxiliary check matrix is the first /column vector, J = l, 2; ten is a finite field addition operation, here is a mutually exclusive or (x〇r) operation. In step 24, the weight value calculation unit 14 first finds the first symptom vector 5. The second symptom vector 4, the first extended symptom vector, the second extended symptom vector, the third extended symptom vector, and the weight values of the fourth extended symptom vector are respectively 咐(8), 咐(6) , Finance $10 private 2)), Η^, θλ/1)), Shiji "ten"), and Cai's ten 杞 2)). Then, the error position vector decision unit 15 judges the following conditions according to the financial (8), (10) (6), state 咕 咕 咕)), Μ 十 η 2010) 201029339, η ^ ΛΘ / ^ Θ ::) 'and the state 咐 # 俨}, And based on the results of the conditional judgment, the error vector (represented by ?) is determined. It is worth mentioning that for the decodable binary sequence f, the weight value determined by the above operation must only meet one of the following six cases. Case 1: If OSw咕)<3, then &=〇' its order,; condition 1. if 1^〇2)<3, and i2=(s.,"), then 吒=〇 ~12=\, where,Of <10; Case 3: If, and ?2 十纪) = (m, W, then _ =1 and heart 12, where 0S/S1O; Case 4: If there is a unique An f value, ie {11, 丨2,, 22
Bw明㊉Α7”β2,則^;=1,且〜=〇,其中,nsx22,且片 情況五:若存在唯一的一 ζ·值,匕似以,22),使得 你叫㊉纪”㊉斯)):】,則〜=1,e, =1 ,且勹=〇,其中,12^以, 且_/_#·;以及 情況六:若存在唯一的一 £•值,ie{〇1,,1〇},使得 ♦㊉〇 = 2,且ί2θΑ-,⑵=(M,…,〜),則〜=〇且〜3,其中 參 5 0^;<10 0 上述情況中的e,·代表該錯誤位置向量5的第z•位元,錯 誤位置向量e位70中未被給定(assign )值的位元表示不在 乎位元(don’t care bit)。 在步驟25中,該運算單元16將該錯誤位置向量g與該 二位元序列F進行互斥或運算,以解碼出該原始資料(以了 代表)’如式(12)所示。 (12) 201029339 综上所述,本發明藉由該等權重值之條件判斷,可以 較少的運算元決定出該錯誤位置向量,並據以求出該原始 資料,而且上述條件判斷中的六種情況,在硬體上可以平 行(parallel )方式實現;不但大幅提昇了格雷碼之解碼效 率,且其運算規則性高,而複雜度、所需閘數及成本皆遠 低於現有之演算法,極適合以硬體實現,故確實能達成本 發明之目的。Bw 明十Α7”β2, then ^;=1, and ~=〇, where nsx22, and slice case five: if there is a unique value, like, to 22), making you called the ten )):], then ~=1, e, =1, and 勹=〇, where 12^以, and _/_#·; and case six: if there is a unique £• value, ie{〇1 ,, 1〇}, such that ♦ ten 〇 = 2, and ί2θ Α -, (2) = (M, ..., ~), then ~ = 〜 and ~ 3, where 5 5 0 ^; < 10 0 e in the above case , represents the z-th bit of the error position vector 5, and the bit of the error position vector e-bit 70 that is not given (assign) value represents the don't care bit. In step 25, the arithmetic unit 16 mutually exclusive ORs the error position vector g with the two-bit sequence F to decode the original data (represented by the equation) as shown in equation (12). (12) 201029339 In summary, the present invention determines that the error location vector can be determined by fewer operands by the condition of the weight values, and the original data is obtained according to the condition, and six of the above condition determinations In this case, it can be implemented in parallel on the hardware; not only greatly improves the decoding efficiency of Gray code, but also has high computational regularity, and the complexity, required gate number and cost are far lower than the existing algorithms. It is very suitable for hardware implementation, so it can achieve the object of the present invention.
惟以上所述者,僅為本發明之較佳實施例而已,當不 能以此限定本發明實施之範圍,即大凡依本發明申請專利 範圍及發明說明内容所作之簡單的等效變化與修飾,皆仍 屬本發明專利涵蓋之範圍内。 【圖式簡單說明】 圖1是一方塊圖, 實施例;以及 圖2是一流程圖, 佳實施例。 說明本發明格雷碼之解碼器的較佳 說明本發明格雷碼之解喝方法的較The above is only the preferred embodiment of the present invention, and the scope of the invention is not limited thereto, that is, the simple equivalent changes and modifications made by the scope of the invention and the description of the invention are All remain within the scope of the invention patent. BRIEF DESCRIPTION OF THE DRAWINGS FIG. 1 is a block diagram, an embodiment; and FIG. 2 is a flow chart, a preferred embodiment. DESCRIPTION OF THE PREFERRED EMBODIMENT OF THE GRAPHIC CODE OF THE INVENTION
10 201029339 【主要元件符號說明】 1 «>««««>» …格雷碼之解碼器 算單元 11 …資料緩衝儲存單 *| 4 > *·«·»»» t 權重值計算單元 元 1 •錯誤位置向量決 1 4 Φ Φ V ft …症狀向量計算單 定單元 元 16 運算單元 1 α 1 ^ '…延伸症狀向量計 21〜2 5…* -步驟10 201029339 [Description of main component symbols] 1 «>««««>» ...Decoding unit of Gray code 11 ... data buffer storage list*| 4 > *·«·»»» t Weight value calculation unit Element 1 • Error position vector decision 1 4 Φ Φ V ft ... symptom vector calculation unit cell 16 arithmetic unit 1 α 1 ^ '... extended symptom vector meter 21~2 5...* - steps
1111