TWI823436B - Apparatus and method for generating low-density parity-check (ldpc) code - Google Patents

Apparatus and method for generating low-density parity-check (ldpc) code Download PDF

Info

Publication number
TWI823436B
TWI823436B TW111123322A TW111123322A TWI823436B TW I823436 B TWI823436 B TW I823436B TW 111123322 A TW111123322 A TW 111123322A TW 111123322 A TW111123322 A TW 111123322A TW I823436 B TWI823436 B TW I823436B
Authority
TW
Taiwan
Prior art keywords
parity check
low
density parity
check code
user data
Prior art date
Application number
TW111123322A
Other languages
Chinese (zh)
Other versions
TW202401992A (en
Inventor
郭軒豪
Original Assignee
慧榮科技股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 慧榮科技股份有限公司 filed Critical 慧榮科技股份有限公司
Priority to TW111123322A priority Critical patent/TWI823436B/en
Application granted granted Critical
Publication of TWI823436B publication Critical patent/TWI823436B/en
Publication of TW202401992A publication Critical patent/TW202401992A/en

Links

Images

Landscapes

  • Error Detection And Correction (AREA)
  • Detection And Correction Of Errors (AREA)

Abstract

The invention is related to an apparatus and a method for generating low-density parity-check (LDPC) code. The apparatus includes an LDPC encoder, a look-ahead circuit and an exclusive-OR calculator. The LDPC encoder is arranged operably to encode the former part of user data with a parity check matrix using a two-stage encoding algorithm to generate a first calculation result. The look-ahead circuit is arranged operably to perform a dot product on the latter part of user data with one of plurality of feature rows corresponding to the parity check matrix to generate a second calculation result. The exclusive-OR calculator is arranged operably to perform an exclusive-OR calculation on the first calculation result and the second calculation result to generate the former part of LDPC code. With the apparatus described above, the time consumed by the two two-stage encoding algorithm would be reduced, resulting in the elimination of timing bubble between the transmissions of user data and LDPC code.

Description

低密度奇偶檢查碼的產生裝置及方法 Device and method for generating low-density parity check code

本發明涉及儲存裝置,尤指一種低密度奇偶檢查碼的產生裝置及方法。 The present invention relates to a storage device, and in particular, to a device and method for generating a low-density parity check code.

閃存通常分為NOR閃存與NAND閃存。NOR閃存為隨機存取裝置,中央處理器(Host)可於位址腳位上提供任何存取NOR閃存的位址,並及時地從NOR閃存的資料腳位上獲得儲存於該位址上的資料。相反地,NAND閃存並非隨機存取,而是序列存取。NAND閃存無法像NOR閃存一樣,可以存取任何隨機位址,中央處理器反而需要寫入序列的位元組(Bytes)的值到NAND閃存中,用於定義請求命令(Command)的類型(如,讀取、寫入、抹除等),以及用在此命令上的位址。位址可指向一個頁面(閃存中寫入作業的最小資料塊)或一個區塊(閃存中抹除作業的最小資料塊)。提昇資料傳輸到閃存模組的正確率,一直是影響閃存控制器的整體效能的重要課題。因此,本發明提出一種低密度奇偶檢查碼的產生裝置及方法,用於提升資料傳輸到閃存模組的正確率。 Flash memory is usually divided into NOR flash memory and NAND flash memory. NOR flash memory is a random access device. The central processor (Host) can provide any address to access the NOR flash memory on the address pin, and obtain the data stored at the address from the data pin of the NOR flash memory in a timely manner. material. On the contrary, NAND flash memory does not have random access, but sequential access. NAND flash memory cannot access any random address like NOR flash memory. Instead, the central processor needs to write a sequence of Bytes values into the NAND flash memory to define the type of request command (Command) (such as , read, write, erase, etc.), and the address used on this command. The address can point to a page (the smallest block of data for a write operation in flash memory) or a block (the smallest block of data for an erase operation in flash memory). Improving the accuracy of data transmission to flash memory modules has always been an important issue that affects the overall performance of flash memory controllers. Therefore, the present invention proposes a low-density parity check code generation device and method for improving the accuracy of data transmission to a flash memory module.

有鑑於此,如何減輕或消除上述相關領域的缺失,實為有待解決的問題。 In view of this, how to alleviate or eliminate the deficiencies in the above-mentioned related fields is a problem that needs to be solved.

本說明書涉及一種低密度奇偶檢查碼的產生裝置,包含:低密度奇偶檢查碼編碼器、前視電路和互斥或計算單元。低密度奇偶檢查碼編碼器用於使用二階段編碼演算法,以奇偶校檢矩陣對使用者資料 的前部進行編碼,產生第一計算結果。前視電路用於在每次迭代以相應於奇偶校檢矩陣的多個特徵列中的一個對使用者資料的後部執行內積計算,產生第二計算結果。互斥或計算單元用於對第一計算結果和第二計算結果進行互斥或計算,產生低密度奇偶檢查碼的前部。 This specification relates to a low-density parity check code generation device, including: a low-density parity check code encoder, a look-ahead circuit and a mutual exclusion or calculation unit. The low-density parity check code encoder is used to use a two-stage encoding algorithm to encode user data using a parity check matrix. The front part is encoded to produce the first calculation result. The lookahead circuit is configured to perform an inner product calculation on the rear part of the user data using one of the plurality of feature columns corresponding to the parity check matrix in each iteration to generate a second calculation result. The mutual exclusion or calculation unit is used to perform mutual exclusion or calculation on the first calculation result and the second calculation result to generate the front part of the low-density parity check code.

本說明書另涉及一種由控制器執行的低密度奇偶檢查碼的產生方法。控制器耦接切換器、低密度奇偶檢查碼編碼器和前視電路。該方法包含:在使用者資料的前部傳送至低密度奇偶檢查碼編碼器完畢時,控制切換器以讓使用者資料的後部饋入所述前視電路,並且發出第一訊號給低密度奇偶檢查碼編碼器以啟動第二階段編碼;以及在使用者資料的後部傳送至前視電路完畢時,發出第二訊號給低密度奇偶檢查碼編碼器以開始輸出第一計算結果給互斥或計算單元,發出第三訊號給前視電路以開始輸出第二計算結果給所述互斥或計算單元。 This specification also relates to a method of generating a low-density parity check code executed by a controller. The controller is coupled to the switch, the low-density parity check code encoder and the look-ahead circuit. The method includes: when the front part of the user data is transmitted to the low-density parity check code encoder, controlling the switch to allow the rear part of the user data to feed into the look-ahead circuit, and sending a first signal to the low-density parity check code the check code encoder to start the second stage encoding; and when the rear part of the user data is transmitted to the look-ahead circuit, a second signal is sent to the low-density parity check code encoder to start outputting the first calculation result to the mutex or calculation The unit sends a third signal to the look-ahead circuit to start outputting the second calculation result to the mutual exclusive OR calculation unit.

上述實施例的優點之一,通過如上所述的裝置,可縮短二階段編碼演算法的計算時間,從而消除使用者資料和低密度奇偶檢查碼的傳輸之間的時間空檔。 One of the advantages of the above-described embodiment is that the calculation time of the two-stage encoding algorithm can be shortened by the above-described device, thereby eliminating the time gap between the transmission of user data and low-density parity check codes.

本發明的其他優點將搭配以下的說明和圖式進行更詳細的解說。 Other advantages of the present invention will be explained in more detail in conjunction with the following description and drawings.

10:電子裝置 10: Electronic devices

110:主機端 110: Host side

130:閃存控制器 130:Flash controller

131:主機介面 131:Host interface

134:處理單元 134: Processing unit

136:隨機存取記憶體 136: Random access memory

138:NAND閃存控制器 138:NAND flash controller

139:閃存介面 139:Flash memory interface

150:閃存模組 150:Flash memory module

151:介面 151:Interface

153#0~153#15:NAND閃存單元 153#0~153#15: NAND flash memory unit

CH#0~CH#3:通道 CH#0~CH#3: Channel

CE#0~CE#3:致能訊號 CE#0~CE#3: enable signal

302:使用者資料 302:User information

304:LDPC碼 304:LDPC code

310:LDPC編碼器 310:LDPC encoder

320:多工器 320:Multiplexer

tb:時間空檔 tb: time slot

402#1:使用者資料的前部 402#1: The front part of the user data

402#2:使用者資料的後部 402#2: End of user data

404#1,404#2:計算結果 404#1,404#2: Calculation result

406#1:LDPC碼的前部 406#1: The front part of LDPC code

406#2:LDPC碼的後部 406#2: The rear part of the LDPC code

510,610:控制器 510,610:Controller

520:切換器 520:Switcher

530,560:LDPC編碼器 530,560: LDPC encoder

540:前視電路 540: Forward looking circuit

550:互斥或計算單元 550: Mutual exclusion or calculation unit

570:多工器 570:Multiplexer

620:內積計算單元 620: Inner product calculation unit

630:特徵列產生電路 630: Feature column generation circuit

640:資料寄存器 640: Data register

680,680#0~680#3:特徵列 680,680#0~680#3: Feature column

710:多工器 710:Multiplexer

720#0~720#3:輸入端口 720#0~720#3: Input port

730:來源寄存器 730: Source register

730#0~730#3:寄存器 730#0~730#3: Register

810#0~810#3:D正反器 810#0~810#3:D flip-flop

S1010~S1040:方法步驟 S1010~S1040: Method steps

圖1為依據本發明實施例的電子裝置的系統架構圖。 FIG. 1 is a system architecture diagram of an electronic device according to an embodiment of the present invention.

圖2為依據本發明實施例的閃存模組的示意圖。 FIG. 2 is a schematic diagram of a flash memory module according to an embodiment of the present invention.

圖3為依據一些實施方式的使用者資料和LDPC碼的編碼和傳輸示意圖。 Figure 3 is a schematic diagram of encoding and transmission of user data and LDPC codes according to some embodiments.

圖4為依據本發明實施例的消除使用者資料和LDPC碼的傳輸之間的時間空檔的示意圖。 FIG. 4 is a schematic diagram of eliminating the time gap between the transmission of user data and LDPC codes according to an embodiment of the present invention.

圖5為依據本發明實施例的LDPC碼的產生裝置的方塊圖。 FIG. 5 is a block diagram of an LDPC code generating device according to an embodiment of the present invention.

圖6為依據本發明實施例的前視電路的方塊圖。 FIG. 6 is a block diagram of a front-view circuit according to an embodiment of the present invention.

圖7和圖8為依據本發明實施例的特徵列產生電路的方塊圖。 7 and 8 are block diagrams of a feature sequence generating circuit according to an embodiment of the present invention.

圖9為依據本發明實施例的特徵列的示意圖。 FIG. 9 is a schematic diagram of a feature column according to an embodiment of the present invention.

圖10為依據本發明實施例的控制方法的流程圖。 Figure 10 is a flow chart of a control method according to an embodiment of the present invention.

以下說明為完成發明的較佳實現方式,其目的在於描述本發明的基本精神,但並不用以限定本發明。實際的發明內容必須參考之後的權利要求範圍。 The following description is a preferred implementation manner for completing the invention, and its purpose is to describe the basic spirit of the invention, but is not intended to limit the invention. For the actual invention, reference must be made to the following claims.

必須了解的是,使用於本說明書中的“包含”、“包括”等詞,用以表示存在特定的技術特徵、數值、方法步驟、作業處理、元件以及/或組件,但並不排除可加上更多的技術特徵、數值、方法步驟、作業處理、元件、組件,或以上的任意組合。 It must be understood that the words "including" and "include" used in this specification are used to indicate the existence of specific technical features, numerical values, method steps, work processes, components and/or components, but do not exclude the possibility of adding further technical features, values, method steps, processes, components, components, or any combination of the above.

於權利要求中使用如“第一”、“第二”、“第三”等詞是用來修飾權利要求中的元件,並非用來表示之間具有優先順序,前置關係,或者是一個元件先於另一個元件,或者是執行方法步驟時的時間先後順序,僅用來區別具有相同名字的元件。 The use of words such as "first", "second" and "third" in the claims is used to modify the elements in the claims, and is not used to indicate that there is a priority, precedence relationship between them, or that they are one element. Prior to another element, or the chronological order in which method steps are performed, it is only used to distinguish elements with the same name.

必須了解的是,當元件描述為“連接”或“耦接”至另一元件時,可以是直接連結、或耦接至其他元件,可能出現中間元件。相反地,當元件描述為“直接連接”或“直接耦接”至另一元件時,其中不存在任何中間元件。使用來描述元件之間關係的其他語詞也可類似方式解讀,例如“介於”相對於“直接介於”,或者是“鄰接”相對於“直接鄰接”等等。 It must be understood that when an element is described as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element, and intervening elements may be present. In contrast, when an element is described as being "directly connected" or "directly coupled" to another element, there are no intervening elements present. Other words used to describe the relationship between elements could be interpreted in a similar fashion, such as "between" versus "directly between," "adjacent" versus "directly adjacent," etc.

參考圖1。電子裝置10包含主機端(Host Side)110、閃存控制器130及閃存模組150,並且閃存控制器130及閃存模組150可合稱為裝置端(Device Side)。電子裝置10可實施於個人電腦、筆記型電腦(Laptop PC)、平板電腦、手機、數位相機、數位攝影機等電子產品之中。主機端110與閃存控制器130的主機介面(Host Interface)131之間可以通用序列匯流排(Universal Serial Bus,USB)、先進 技術附著(advanced technology attachment,ATA)、序列先進技術附著(serial advanced technology attachment,SATA)、快捷週邊組件互連介面(peripheral component interconnect express,PCI-E)、通用快閃記憶儲存(Universal Flash Storage,UFS)、嵌入式多媒體卡(Embedded Multi-Media Card,eMMC)等通訊協定彼此溝通。NAND閃存控制器(NAND Flash Controller,NFC)138的閃存介面(Flash Interface)139與閃存模組150之間可以雙倍資料率(Double Data Rate,DDR)通訊協定彼此溝通,例如,開放NAND快閃(Open NAND Flash Interface,ONFI)、雙倍資料率開關(DDR Toggle)或其他通訊協定。閃存控制器130包含處理單元134,可使用多種方式實施,如使用通用硬體(例如,單一處理器、具平行處理能力的多處理器、圖形處理器或其他具運算能力的處理器),並且在執行軟體以及/或韌體指令時,提供之後描述的功能。處理單元134通過主機介面131接收主機命令,例如讀取命令(Read Command)、寫入命令(Write Command)、丟棄命令(Discard Command)、抹除命令(Erase Command)等,排程並執行這些命令。閃存控制器130另包含隨機存取記憶體(Random Access Memory,RAM)136,可實施為動態隨機存取記憶體(Dynamic Random Access Memory,DRAM)、靜態隨機存取記憶體(Static Random Access Memory,SRAM)或上述兩者的結合,用於配置空間作為資料緩衝區,儲存從主機端110讀取並即將寫入閃存模組150的使用者資料(也可稱為主機資料),以及從閃存模組150讀取並即將輸出給主機端110的使用者資料。隨機存取記憶體136另可儲存執行過程中需要的資料,例如,變數、資料表、主機與閃存位址對照表(Host-to-Flash Address Mapping Table,簡稱H2F表)、閃存與主機位址對照表(Flash-to-Host Address Mapping Table,簡稱F2H表)等。NAND閃存控制器138提供存取閃存模組150時需要的功能,例 如命令序列器(Command Sequencer)、低密度奇偶校驗(Low-Density Parity-Check,LDPC)等。 Refer to Figure 1. The electronic device 10 includes a host side (Host Side) 110, a flash memory controller 130 and a flash memory module 150, and the flash memory controller 130 and the flash memory module 150 can be collectively referred to as a device side (Device Side). The electronic device 10 can be implemented in electronic products such as personal computers, laptop computers (Laptop PC), tablet computers, mobile phones, digital cameras, and digital video cameras. The host 110 and the host interface (Host Interface) 131 of the flash memory controller 130 can be connected by Universal Serial Bus (USB), advanced Advanced technology attachment (ATA), serial advanced technology attachment (SATA), peripheral component interconnect express (PCI-E), Universal Flash Storage, Communication protocols such as UFS) and Embedded Multi-Media Card (eMMC) communicate with each other. The flash interface (Flash Interface) 139 of the NAND Flash Controller (NFC) 138 and the flash memory module 150 can communicate with each other using a Double Data Rate (DDR) communication protocol, for example, open NAND flash (Open NAND Flash Interface, ONFI), double data rate switch (DDR Toggle) or other communication protocols. The flash memory controller 130 includes a processing unit 134, which can be implemented in a variety of ways, such as using general-purpose hardware (eg, a single processor, multiple processors with parallel processing capabilities, a graphics processor, or other processors with computing capabilities), and When executing software and/or firmware instructions, the functions described later are provided. The processing unit 134 receives host commands through the host interface 131, such as read command (Read Command), write command (Write Command), discard command (Discard Command), erase command (Erase Command), etc., schedules and executes these commands. . The flash memory controller 130 also includes a random access memory (Random Access Memory, RAM) 136, which can be implemented as a dynamic random access memory (Dynamic Random Access Memory, DRAM) or a static random access memory (Static Random Access Memory, SRAM) or a combination of the above two, is used to configure space as a data buffer to store user data (also called host data) read from the host 110 and about to be written to the flash memory module 150, and from the flash memory module. The group 150 reads and outputs the user data to the host 110 . The random access memory 136 can also store data needed during execution, such as variables, data tables, host-to-Flash Address Mapping Table (H2F table for short), flash memory and host addresses. Comparison table (Flash-to-Host Address Mapping Table, referred to as F2H table), etc. The NAND flash memory controller 138 provides functions required to access the flash memory module 150, such as Such as command sequencer (Command Sequencer), low-density parity-check (Low-Density Parity-Check, LDPC), etc.

閃存控制器130中可配置共享匯流排架構(Shared Bus Architecture),用於讓元件之間彼此耦接以傳遞資料、位址、控制訊號等,這些元件包含主機介面131、處理單元134、RAM 136、NAND閃存控制器138等。匯流排包含並行的物理線,連接閃存控制器130中兩個以上的組件。共享匯流排是一種共享的傳輸媒體,在任意的時間上,只能有兩個裝置可以使用這些線來彼此溝通,用於傳遞資料。資料及控制訊號能夠在組件間分別沿資料和控制線進行雙向傳播,但另一方面,位址訊號只能沿位址線進行單向傳播。例如,當處理單元134想要讀取RAM 136的特定位址上的資料時,處理單元134在位址線上傳送此位址給RAM 136。接著,此位址的資料會在資料線上回覆給處理單元134。為了完成資料讀取操作,控制訊號會使用控制線進行傳遞。 The flash memory controller 130 can be configured with a shared bus architecture (Shared Bus Architecture) for coupling components to each other to transmit data, addresses, control signals, etc. These components include the host interface 131, the processing unit 134, and the RAM 136 , NAND flash memory controller 138, etc. The bus includes parallel physical lines that connect two or more components in the flash memory controller 130 . A shared bus is a shared transmission medium. At any time, only two devices can use these lines to communicate with each other and transfer data. Data and control signals can propagate in both directions between components along data and control lines respectively, but on the other hand, address signals can only propagate in one direction along address lines. For example, when the processing unit 134 wants to read data at a specific address of the RAM 136, the processing unit 134 transmits the address to the RAM 136 on the address line. Then, the data at this address will be returned to the processing unit 134 on the data line. In order to complete the data reading operation, control signals are transmitted using control lines.

閃存模組150提供大量的儲存空間,通常是數百個千兆位元組(Gigabytes,GB),甚至是數個兆兆位元組(Terabytes,TB),用於儲存大量的使用者資料,例如高解析度圖片、影片等。閃存模組150中包含控制電路以及記憶體陣列,記憶體陣列中的記憶單元可組態為單層式單元(Single Level Cells,SLCs)、多層式單元(Multiple Level Cells,MLCs)三層式單元(Triple Level Cells,TLCs)、四層式單元(Quad-Level Cells,QLCs)或上述的任意組合。處理單元134可通過閃存介面139寫入使用者資料到閃存模組150中的指定位址(目的位址),以及從閃存模組150中的指定位址(來源位址)讀取使用者資料。閃存介面139使用數個電子訊號來協調閃存控制器130與閃存模組150間的資料與命令傳遞,包含資料線(Data Line)、時脈訊號(Clock Signal)與控制訊號(Control Signal)。資料線可用於傳遞命令、位址、讀出及寫入的資料;控 制訊號線可用於傳遞晶片致能(Chip Enable,CE)、位址提取致能(Address Latch Enable,ALE)、命令提取致能(Command Latch Enable,CLE)、寫入致能(Write Enable,WE)等控制訊號。 The flash memory module 150 provides a large amount of storage space, usually hundreds of gigabytes (GB) or even several terabytes (TB), for storing a large amount of user data. For example, high-resolution pictures, videos, etc. The flash memory module 150 includes a control circuit and a memory array. The memory cells in the memory array can be configured as single-level cells (Single Level Cells, SLCs) and multi-level cells (Multiple Level Cells, MLCs). (Triple Level Cells, TLCs), Quad-Level Cells (QLCs), or any combination of the above. The processing unit 134 can write user data to a specified address (destination address) in the flash memory module 150 through the flash memory interface 139, and read user data from a specified address (source address) in the flash memory module 150. . The flash memory interface 139 uses several electronic signals to coordinate the transmission of data and commands between the flash memory controller 130 and the flash memory module 150, including data lines (Data Line), clock signals (Clock Signal) and control signals (Control Signal). Data lines can be used to transmit commands, addresses, read and write data; control The control signal line can be used to transmit Chip Enable (CE), Address Latch Enable (ALE), Command Latch Enable (CLE), Write Enable (WE) ) and other control signals.

參考圖2,閃存模組150中的介面151可包含四個輸出入通道(I/O channels,以下簡稱通道)CH#0至CH#3,每一個通道連接四個NAND閃存單元,例如,通道CH#0連接NAND閃存單元153#0、153#4、153#8及153#12。每個NAND閃存單元可封裝為獨立的芯片(die)。閃存介面139可通過介面151發出致能訊號CE#0至CE#3中的一個來致能NAND閃存單元153#0至153#3、153#4至153#7、153#8至153#11、或153#12至153#15,接著以並行的方式從致能的NAND閃存單元讀取使用者資料,或者寫入使用者資料至致能的NAND閃存單元。所屬技術領域人員可依據系統的需求改變閃存模組150的設計,在閃存模組150中配置更多或更少的通道,和/或將每個通道連接上更多或更少的NAND閃存單元,本發明並不因此受限。 Referring to Figure 2, the interface 151 in the flash memory module 150 may include four input/output channels (I/O channels, hereinafter referred to as channels) CH#0 to CH#3, each channel is connected to four NAND flash memory units, for example, channel CH#0 is connected to NAND flash memory cells 153#0, 153#4, 153#8 and 153#12. Each NAND flash memory cell can be packaged as an independent chip (die). The flash memory interface 139 can send one of the enable signals CE#0 to CE#3 through the interface 151 to enable the NAND flash memory units 153#0 to 153#3, 153#4 to 153#7, and 153#8 to 153#11. , or 153#12 to 153#15, and then read user data from the enabled NAND flash memory unit in a parallel manner, or write user data to the enabled NAND flash memory unit. Those skilled in the art can change the design of the flash memory module 150 according to system requirements, configure more or fewer channels in the flash memory module 150, and/or connect each channel to more or fewer NAND flash memory cells. , the present invention is not limited thereby.

NAND閃存控制器138可包含低密度奇偶校檢編碼器(LDPC Encoder),用於依據使用者資料來產生低密度奇偶檢查碼(LDPC Code),其是一種線性的錯誤修正碼(Linear Error Correcting Code)。舉例來說,LDPC碼的產生可使用以下公式表示:MSG1xn ☉ PCMnx(n+m)=CW1x(n+m)其中,MSG1xm代表使用者資料的1列、n行矩陣,PCMnx(n+m)代表n列、(n+m)行奇偶校檢矩陣(Parity Check Matrix),CW1x(n+m)代表最後產生的碼字(Codeword)的1列、(n+m)行矩陣,☉代表模2乘法(Modulo 2 Multiplication)。奇偶校檢矩陣可包含類循環(Quasi-Cyclic,QC)結構,並且CW1x(n+m)中的前n個位元的值等於MSG1xn的值,而CW1x(n+m)中的後m個位元的值稱為LDPC碼。舉例如下:

Figure 111123322-A0305-02-0008-1
所屬技術領域人員知道可使用習知的奇偶校檢矩陣和高效演算法來產生低密度奇偶檢查碼,例如二階段編碼(2-stage Encoding)等。 The NAND flash memory controller 138 may include a low-density parity check encoder (LDPC Encoder) for generating a low-density parity check code (LDPC Code) based on user data, which is a linear error correction code (Linear Error Correcting Code). ). For example, the generation of LDPC code can be expressed by the following formula: MSG 1xn ☉ PCM nx(n+m) =CW 1x(n+m) where MSG 1xm represents a 1-column, n-row matrix of user data, PCM nx (n+m) represents n columns and (n+m) rows parity check matrix (Parity Check Matrix), CW 1x(n+m) represents 1 column and (n+m) of the last generated codeword (Codeword) Row matrix, ☉ represents Modulo 2 Multiplication. The parity check matrix may contain a Quasi-Cyclic (QC) structure, and the value of the first n bits in CW 1x(n+m) is equal to the value of MSG 1xn , while the value of the first n bits in CW 1x(n+m) The value of the last m bits is called the LDPC code. Examples are as follows:
Figure 111123322-A0305-02-0008-1
Those skilled in the art know that conventional parity check matrices and efficient algorithms can be used to generate low-density parity check codes, such as two-stage encoding (2-stage Encoding).

參考圖3中的(A)部分,在一些實施方式中,NAND閃存控制器138可包含LDPC編碼器310和多工器(Multiplexer)320。LDPC編碼器310使用事先決定的奇偶校檢矩陣,將一段固定長度的使用者資料302編碼成固定長度的LDPC碼304,例如,將2KB(位元組)的使用者資料302編碼成512B的LDPC碼304。初始時,多工器320用於輸出使用者資料302到閃存模組150。在使用者資料302傳輸完成後,多工器320被控制來輸出LDPC碼304到閃存模組150。然而,參考圖3中的(B)部分,在使用一些演算法實作的LDPC編碼器310中,LDPC編碼器310在收到完整的使用者資料302後需要運算一段時間tb才能產生LDPC碼304,讓LDPC碼304能夠開始傳輸到閃存模組150,這段運算時間tb又稱為時間空檔(Timing Bubble)。例如,在二階段編碼中,奇偶校檢矩陣可拆成兩個矩陣,H=[H1,H2]。第一階段將使用者資料(也可稱為訊息位元,Message Bits)和第一矩陣H1進行內積計算(Dot Product)以產生部分奇偶檢查碼(Partial Parity)。第二階段將部分奇偶檢查碼和第二矩陣的反矩陣H2T進行內積計算以產生LDPC碼。由於第二階段需要使用反矩陣的內積計算,計算複雜度較高,因此,LDPC編碼器310需要計算一段時間才能夠得到LDPC碼,造成時間空檔。然而,在高速的傳輸介面運行時是無法中斷的,如果在傳輸資料到閃存模組150的過程中出現時間空檔,則傳送到閃存模組150的資料容易發生錯誤。 Referring to part (A) of FIG. 3 , in some embodiments, the NAND flash memory controller 138 may include an LDPC encoder 310 and a multiplexer (Multiplexer) 320 . The LDPC encoder 310 uses a predetermined parity check matrix to encode a fixed-length user data 302 into a fixed-length LDPC code 304, for example, encoding a 2KB (byte) user data 302 into a 512B LDPC Code 304. Initially, the multiplexer 320 is used to output user data 302 to the flash memory module 150 . After the user data 302 transmission is completed, the multiplexer 320 is controlled to output the LDPC code 304 to the flash memory module 150 . However, referring to part (B) of Figure 3 , in the LDPC encoder 310 implemented using some algorithms, the LDPC encoder 310 needs to operate for a period of time tb after receiving the complete user information 302 to generate the LDPC code 304 , so that the LDPC code 304 can start to be transmitted to the flash memory module 150. This operation time tb is also called a time gap (Timing Bubble). For example, in two-stage encoding, the parity check matrix can be split into two matrices, H=[H1,H2]. In the first stage, the user data (also called Message Bits) and the first matrix H1 are subjected to inner product calculation (Dot Product) to generate a partial parity code (Partial Parity). In the second stage, the inner product of the partial parity check code and the inverse matrix H2 T of the second matrix is calculated to generate the LDPC code. Since the second stage needs to use the inner product calculation of the inverse matrix, the calculation complexity is high. Therefore, the LDPC encoder 310 needs to calculate for a period of time to obtain the LDPC code, resulting in a time gap. However, the high-speed transmission interface cannot be interrupted when running. If there is a time gap in the process of transmitting data to the flash memory module 150, the data transmitted to the flash memory module 150 is prone to errors.

為了消除如上所述的時間空檔,參考圖4,本發明實施例提出一種LDPC碼的產生方法和裝置,用於消除如圖3所述的時間空檔tb。由於LDPC編碼器310需要運行一段固定的時間tb才能開始產生完成的LDPC碼,因此,本發明實施例將最終產生的LDPC碼304分為兩個部分:前部(a)406#1和後部(b)406#2。前部(a)406#1的長度視時間 空檔tb的長度而定。舉例來說,如果LDPC編碼器310需要2個時鐘週期(clock cycles)才能開始輸出LDPC碼,並且1個時鐘週期可以輸出4B的資料到閃存模組150,則LDPC碼304的前部(a)406#1的長度固定為8B。整個使用者資料302則可分為兩個部分:前部(a)402#1和後部(b)402#2,並且為前部(a)402#1和後部(b)402#2分別使用兩個電路來編碼出LDPC碼304的前部(a)406#1和後部(b)406#2。 In order to eliminate the time gap as described above, with reference to Figure 4, an embodiment of the present invention proposes an LDPC code generation method and device for eliminating the time gap tb as shown in Figure 3. Since the LDPC encoder 310 needs to run for a fixed period of time tb before it can start to generate the completed LDPC code, the embodiment of the present invention divides the finally generated LDPC code 304 into two parts: the front part (a) 406#1 and the rear part ( b)406#2. The length of front part (a) 406#1 depends on the time Depends on the length of gap tb. For example, if the LDPC encoder 310 needs 2 clock cycles to start outputting the LDPC code, and 1 clock cycle can output 4B of data to the flash memory module 150, then the front part (a) of the LDPC code 304 The length of 406#1 is fixed at 8B. The entire user information 302 can be divided into two parts: the front part (a) 402#1 and the rear part (b) 402#2, and is used for the front part (a) 402#1 and the rear part (b) 402#2 respectively. Two circuits are used to encode the front part (a) 406#1 and the rear part (b) 406#2 of the LDPC code 304.

參考圖5所示的LDPC碼的產生裝置,一個電路可包含LDPC編碼器560(例如,先前實做的LDPC編碼器310),使用二階段編碼演算法,以預先定義的奇偶校檢矩陣對使用者資料302編碼出LDPC碼304的後部(b)406#2。另一個電路可包含切換器520、LDPC編碼器530、前視電路(Look-ahead Circuit)540、互斥或計算單元(Exclusive-OR Calculation Unit)550和多工器570,用於以預先定義的奇偶校檢矩陣對使用者資料302快速編碼出LDPC碼304的前部(a)406#1,使得使用者資料302的後部(b)傳送到閃存模組150後可以立即依序傳送LDPC碼304的前部(a)406#1和後部(b)406#2到閃存模組150,讓使用者資料302和LDPC碼304的傳輸之間並不存在時間空檔(如圖4的下半部所示)。 Referring to the LDPC code generation device shown in Figure 5, a circuit may include an LDPC encoder 560 (for example, the previously implemented LDPC encoder 310), using a two-stage encoding algorithm, using a predefined parity check matrix pair The user data 302 encodes the rear part (b) 406#2 of the LDPC code 304. Another circuit may include a switcher 520, an LDPC encoder 530, a Look-ahead Circuit 540, an Exclusive-OR Calculation Unit 550, and a multiplexer 570 for using a predefined The parity check matrix quickly encodes the front part (a) 406#1 of the LDPC code 304 of the user data 302, so that the LDPC code 304 can be transmitted immediately after the rear part (b) of the user data 302 is sent to the flash memory module 150. The front part (a) 406#1 and the rear part (b) 406#2 to the flash memory module 150, so that there is no time gap between the transmission of the user data 302 and the LDPC code 304 (as shown in the lower half of Figure 4 shown).

切換器520包含一個輸入端和兩個輸出端,輸入端用於接收使用者資料302,一個輸出端耦接LDPC編碼器530的輸入端,另一個輸出端耦接前視電路540的輸入端。切換器520在控制器510的控制下,選擇性地耦接LDPC編碼器530或前視電路540的輸入端。控制器510可在編碼使用者資料302的開始之前控制切換器520,讓使用者資料302饋入LDPC編碼器530。接著,在使用者資料302的前部(a)402#1完整饋入到LDPC編碼器530後,控制器510控制切換器302,用於讓使用者資料302的後部(b)402#2饋入前視電路540。LDPC編碼器530使用二階段編碼演算法,以預先定義的奇偶校檢矩陣對使用者資料302的前部(a)402#1進行編碼,以產生編碼資料404#1。控制器510可 在LDPC編碼器530為使用者資料302的前部(a)402#1計算出大部分的部分奇偶校驗碼時,指示LDPC編碼器530開始執行第二階段的編碼(也就是提早啟動第二階段的編碼)。由於執行第二階段的編碼的期間,使用者資料302的後部(b)402#2沒有饋入LDPC編碼器530,因此,前視電路540對使用者資料302的後部(b)402#2和相應於奇偶校檢矩陣的特徵列(Feature Row)執行內積計算,以產生編碼資料404#2,用於補償LDPC編碼器530的計算結果404#1。在這裡需要注意的是,所屬技術領域人員理解由於本說明書中所述的內積計算執行於二元領域(Binary Field),所以,本說明書中所述的矩陣內積計算等同於模2乘法。互斥或計算單元550耦接於LDPC編碼器530和前視電路540的輸出端,逐批次對LDPC編碼器530的輸出404#1和前視電路540的輸出404#2進行互斥或計算,例如,每個批次可為8B的輸出404#1和404#2進行互斥或計算。多工器570包含兩個輸入端和一個輸出端,一個輸入端耦接互斥或計算單元550的輸出,另一個輸入端耦接LDPC編碼器560的輸出,輸出端耦接閃存模組150。控制器510可在產生LDPC碼的一開始,或者使用者資料302的後部(b)402#2饋入到前視電路540完畢後,控制多工器570,用於將互斥或計算單元550的輸出端耦接至閃存模組150,讓互斥或計算單元550的計算結果(也就是LDPC碼304的前部(a)406#1)能夠輸出到閃存模組150。控制器510在LDPC碼304的前部(a)406#1輸出到閃存模組150完畢後,控制多工器570,用於將LDPC編碼器560的輸出端耦接至閃存模組150,讓LDPC編碼器560的計算結果(也就是LDPC碼304的後部(b)406#2)能夠輸出到閃存模組150。 The switch 520 includes an input terminal and two output terminals. The input terminal is used to receive the user data 302 . One output terminal is coupled to the input terminal of the LDPC encoder 530 , and the other output terminal is coupled to the input terminal of the look-ahead circuit 540 . The switch 520 is selectively coupled to the input end of the LDPC encoder 530 or the look-ahead circuit 540 under the control of the controller 510 . The controller 510 may control the switch 520 before starting to encode the user data 302 so that the user data 302 is fed into the LDPC encoder 530 . Then, after the front part (a) 402#1 of the user data 302 is completely fed into the LDPC encoder 530, the controller 510 controls the switch 302 to allow the back part (b) 402#2 of the user data 302 to be fed into the LDPC encoder 530. Enter the forward looking circuit 540. The LDPC encoder 530 uses a two-stage encoding algorithm to encode the front part (a) 402#1 of the user data 302 with a predefined parity check matrix to generate encoded data 404#1. Controller 510 can When the LDPC encoder 530 calculates most of the partial parity codes for the front part (a) 402#1 of the user data 302, the LDPC encoder 530 is instructed to start performing the second stage of encoding (that is, to start the second stage of encoding early). stage coding). Since the rear part (b) 402#2 of the user data 302 is not fed into the LDPC encoder 530 during the execution of the second stage of encoding, the lookahead circuit 540 Inner product calculation is performed corresponding to the feature row of the parity check matrix to generate encoding data 404#2, which is used to compensate the calculation result 404#1 of the LDPC encoder 530. It should be noted here that those skilled in the art understand that since the inner product calculation described in this specification is performed in a binary field (Binary Field), the matrix inner product calculation described in this specification is equivalent to modulo 2 multiplication. The mutual exclusion OR calculation unit 550 is coupled to the output ends of the LDPC encoder 530 and the look-ahead circuit 540, and performs mutual exclusion OR calculation on the output 404#1 of the LDPC encoder 530 and the output 404#2 of the look-ahead circuit 540 batch by batch. , for example, each batch can be mutually exclusive or calculated for 8B outputs 404#1 and 404#2. The multiplexer 570 includes two input terminals and an output terminal. One input terminal is coupled to the output of the mutex calculation unit 550 , the other input terminal is coupled to the output of the LDPC encoder 560 , and the output terminal is coupled to the flash memory module 150 . The controller 510 may control the multiplexer 570 at the beginning of generating the LDPC code, or after the rear part (b) 402#2 of the user data 302 is fed to the look-ahead circuit 540, for converting the mutual exclusion or calculation unit 550 The output terminal is coupled to the flash memory module 150, so that the calculation result of the mutual exclusive OR calculation unit 550 (that is, the front part (a) 406#1 of the LDPC code 304) can be output to the flash memory module 150. After the controller 510 completes outputting the front part (a) 406#1 of the LDPC code 304 to the flash memory module 150, it controls the multiplexer 570 to couple the output end of the LDPC encoder 560 to the flash memory module 150, so that The calculation result of the LDPC encoder 560 (that is, the rear part (b) 406#2 of the LDPC code 304) can be output to the flash memory module 150.

參考圖6所示的前視電路540的實施例,包含控制器610、內積計算單元620、特徵列產生電路630和資料寄存器640。資料寄存器640用於儲存使用者資料302的後部(b)402#2。特徵列產生電路630可包含來源寄存器,用於儲存前視基礎(Look-ahead Basis),其長度預設 為|m2|+|pa|-1,m2代表使用者資料302的後部(b)402#2的長度,pa代表LDPC碼304的前部(a)406#1的長度。前視基礎從奇偶校檢矩陣推導而出,並且包含奇偶校檢矩陣中用來編碼使用者資料302的後部(b)402#2所需的子集合。此外,特徵列的長度等於使用者資料302的後部(b)402#2的長度。例如,假設使用者資料302的後部(b)402#2為8B(也就是64位元)並且LDPC碼304的前部(a)406#1為8B(也就是64位元),則來源寄存器的長度為127位元,並且特徵列680的長度為8B(也就是64位元)。由於奇偶校檢矩陣包含類循環結構,因此除了第一次迭代以外,每次迭代中用來計算的特徵列,就是上一個特徵列的循環右移一位的結果。參考圖9所示的特徵列示意圖,每一列代表一個前視基礎,而每一列中的反斜線局部代表前視基礎中的特徵列680。特徵列680#1是特徵列680#0的循環右移一位的結果,特徵列680#2是特徵列680#1的循環右移一位的結果,依此類推。特徵列產生電路630另包含用於從前視基礎中獲得每次迭代需要的特徵列680的電路。在每次迭代中,控制器610發出訊號給特徵列產生電路630,用於驅動特徵列產生電路630輸出這次迭代需要的特徵列680。內積計算單元620耦接特徵列產生電路630和資料寄存器640,在每次迭代中對特徵列產生電路630所輸出的特徵列和資料寄存器640中儲存的值進行內積計算,獲得計算結果404#2,並且輸出計算結果404#2到互斥或計算單元550。 Referring to the embodiment of the look-ahead circuit 540 shown in FIG. 6 , it includes a controller 610 , an inner product calculation unit 620 , a feature column generation circuit 630 and a data register 640 . The data register 640 is used to store the last part (b) 402#2 of the user data 302. The feature string generation circuit 630 may include a source register for storing a look-ahead basis, the length of which is preset to |m 2 |+|p a |-1, m 2 represents the rear part of the user data 302 ( b) The length of 402#2, p a represents the length of the front part of LDPC code 304 (a) 406#1. The lookahead basis is derived from the parity check matrix and contains the subset of the parity check matrix required to encode the rear part (b) 402#2 of the user data 302. In addition, the length of the feature row is equal to the length of the rear part (b) 402#2 of the user data 302. For example, assuming that the rear part (b) 402#2 of the user data 302 is 8B (that is, 64 bits) and the front part (a) 406#1 of the LDPC code 304 is 8B (that is, 64 bits), then the source register The length of is 127 bits, and the length of the feature column 680 is 8B (that is, 64 bits). Since the parity check matrix contains a cyclic structure, except for the first iteration, the feature column used for calculation in each iteration is the result of the previous feature column being cyclically shifted to the right by one bit. Referring to the feature column diagram shown in FIG. 9 , each column represents a forward-looking basis, and the backslash in each column partially represents the feature column 680 in the forward-looking basis. Feature column 680#1 is the result of feature column 680#0 being rotated to the right by one bit, feature column 680#2 is the result of feature column 680#1 being rotated to the right by one bit, and so on. The feature column generation circuit 630 further includes a circuit for obtaining the feature column 680 required for each iteration from the lookahead basis. In each iteration, the controller 610 sends a signal to the feature string generation circuit 630 to drive the feature string generation circuit 630 to output the feature string 680 required for this iteration. The inner product calculation unit 620 is coupled to the feature sequence generation circuit 630 and the data register 640. In each iteration, the inner product calculation is performed on the feature sequence output by the feature sequence generation circuit 630 and the value stored in the data register 640 to obtain the calculation result 404. #2, and output the calculation result 404#2 to the exclusive OR calculation unit 550.

參考圖7所示的特徵列產生電路630的實施例,包含多工器710和來源寄存器730。初始時,來源寄存器730儲存預設的前視基礎。多工器710包含多個輸入端口,每個輸入端口以指定順序通過預設數目的實體線分別連接到來源寄存器730中的預設數目的寄存器。例如,多工器710的輸入端口720#0通過實體線依序連接到寄存器730#1、730#2、730#3;多工器710的輸入端口720#1通過實體線依序連接到寄存器730#2、730#3、730#0;多工器710的輸入端口720#2通過實 體線依序連接到寄存器730#3、730#0、730#1;以及多工器710的輸入端口720#3通過實體線依序連接到寄存器730#0、730#1、730#2。在第一次迭代時,多工器710接收到控制訊號以將輸入端口720#0連接到輸出端口,用於輸出寄存器730#1、730#2、730#3的值作為特徵列680。在第二次迭代時,多工器710接收到控制訊號以將輸入端口720#1連接到輸出端口,用於輸出寄存器730#2、730#3、730#0的值作為特徵列680,依此類推。 Referring to the embodiment of the feature column generation circuit 630 shown in FIG. 7 , it includes a multiplexer 710 and a source register 730 . Initially, the source register 730 stores a default look-ahead basis. The multiplexer 710 includes a plurality of input ports, and each input port is respectively connected to a preset number of registers in the source register 730 through a preset number of physical lines in a specified order. For example, the input port 720#0 of the multiplexer 710 is connected to the registers 730#1, 730#2, and 730#3 in sequence through physical lines; the input port 720#1 of the multiplexer 710 is connected to the registers in sequence through physical lines. 730#2, 730#3, 730#0; the input port 720#2 of the multiplexer 710 passes through the real The body lines are connected to the registers 730#3, 730#0, and 730#1 in sequence; and the input port 720#3 of the multiplexer 710 is connected to the registers 730#0, 730#1, and 730#2 in sequence through the physical lines. In the first iteration, the multiplexer 710 receives a control signal to connect the input port 720#0 to the output port for outputting the values of the registers 730#1, 730#2, and 730#3 as the feature sequence 680. In the second iteration, the multiplexer 710 receives a control signal to connect the input port 720#1 to the output port for outputting the values of the registers 730#2, 730#3, and 730#0 as the feature sequence 680, and so on. And so on.

參考圖8所示的特徵列產生電路630的實施例,包含以多個D正反器(D Flip-flop)810#0至810#3串接起來的位移器(Bit-shifter)。每個D正反器的輸出端q連接到下一個D正反器的輸入端d,形成一個環形。初始時,控制器(未顯示於圖8)設定D正反器810#0至810#3中的每一個來儲存預設的前視基礎。一部分的D正反器的輸出,例如D正反器810#1、810#2和810#3的輸出,形成特徵列。控制器設定(Set)一個D正反器以使其儲存邏輯“1”,或者重設(Reset)一個D正反器以使其儲存邏輯“0”。接著,每個D正反器偵測到時鐘訊號clk發生變化時(也就是上緣-Rising Edges和下緣-Falling Edges),輸出其中儲存的值到下一個D正反器進行儲存。在每次迭代中,依序搜集D正反器810#1至810#3的輸出680[0]至680[2]作為特徵列680。舉例來說,控制器在初始時驅動D正反器810#0至810#3以儲存預設的前視基礎“0b0001”。D正反器810#0至810#3的輸出在第一次迭代時為“0b001”;D正反器810#0至810#3的輸出在第二次迭代時為“0b000”;D正反器810#0至810#3的輸出在第三次迭代時為“0b100”;D正反器810#0至810#3的輸出在第四次迭代時為“0b010”。 Referring to the embodiment of the feature sequence generating circuit 630 shown in FIG. 8 , it includes a bit-shifter (Bit-shifter) connected in series with a plurality of D flip-flop (D flip-flop) 810 #0 to 810 #3. The output terminal q of each D flip-flop is connected to the input terminal d of the next D flip-flop, forming a ring. Initially, the controller (not shown in Figure 8) sets each of the D flip-flops 810#0 to 810#3 to store the default forward-looking basis. The outputs of a part of the D flip-flops, such as the outputs of the D flip-flops 810#1, 810#2, and 810#3, form a feature sequence. The controller sets a D flip-flop so that it stores a logic "1", or resets a D flip-flop so that it stores a logic "0". Then, when each D flip-flop detects a change in the clock signal clk (that is, rising edges and falling edges), it outputs the value stored in it to the next D flip-flop for storage. In each iteration, the outputs 680[0] to 680[2] of the D flip-flops 810#1 to 810#3 are sequentially collected as the feature sequence 680. For example, the controller initially drives the D flip-flops 810#0 to 810#3 to store the default forward-looking base "0b0001". The outputs of D flip-flops 810#0 to 810#3 are "0b001" in the first iteration; the outputs of D flip-flops 810#0 to 810#3 are "0b000" in the second iteration; The outputs of the flip-flops 810#0 to 810#3 are "0b100" in the third iteration; the outputs of the D flip-flops 810#0 to 810#3 are "0b010" in the fourth iteration.

參考圖10所示的由控制器510所執行的控制方法的流程圖。詳細說明如下: Refer to the flowchart of the control method executed by the controller 510 shown in FIG. 10 . The details are as follows:

步驟S1010:發出訊號給切換器520,用於讓使用者資料302饋入LDPC編碼器530(也可稱為第一LDPC編碼器)。 Step S1010: Send a signal to the switch 520 to allow the user data 302 to be fed into the LDPC encoder 530 (also called the first LDPC encoder).

步驟S1020:在使用者資料302中的前部(a)402#1傳送完畢時,控制切換器520以將輸入端耦接至前視電路540,讓使用者資料302中的後部(b)402#2饋入前視電路540,並且發出訊號給LDPC編碼器530以啟動第二階段編碼(也就是提早啟動第二階段的編碼)。 Step S1020: After the front part (a) 402 #1 in the user data 302 is transmitted, control the switch 520 to couple the input terminal to the front-view circuit 540 so that the back part (b) 402 in the user data 302 #2 is fed into the lookahead circuit 540 and sends a signal to the LDPC encoder 530 to start the second stage encoding (ie, start the second stage encoding early).

步驟S1030:在使用者資料302中的後部(b)402#2傳送完畢時,控制多工器570以讓互斥或計算單元550的輸出端連接到多工器570的輸出端,用於讓互斥或計算單元550的計算結果(也就是LDPC碼的前部(a)406#1)能夠寫入到閃存模組150;發出訊號給LDPC編碼器530以開始輸出計算結果404#1;發出訊號給前視電路540以開始輸出計算結果404#2;並且發出訊號給LDPC編碼器560(也可稱為第二LDPC編碼器)以開始計算LDPC碼的後部(b)406#2。 Step S1030: After the transmission of the rear part (b) 402#2 in the user data 302 is completed, control the multiplexer 570 so that the output end of the mutex or calculation unit 550 is connected to the output end of the multiplexer 570 for allowing The calculation result of the mutual exclusion or calculation unit 550 (that is, the front part (a) 406#1 of the LDPC code) can be written to the flash memory module 150; a signal is sent to the LDPC encoder 530 to start outputting the calculation result 404#1; and A signal is given to the lookahead circuit 540 to start outputting the calculation result 404#2; and a signal is sent to the LDPC encoder 560 (which may also be called the second LDPC encoder) to start calculating the rear part (b) 406#2 of the LDPC code.

步驟S1040:在LDPC碼的前部(a)406#1傳送完畢時,控制多工器570以讓LDPC編碼器560的輸出端連接到多工器570的輸出端,用於讓LDPC編碼器560的計算結果(也就是LDPC碼的後部(b)406#2)能夠寫入到閃存模組150;並且發出訊號給LDPC編碼器560以開始輸出其計算結果406#2。 Step S1040: When the transmission of the front part (a) 406#1 of the LDPC code is completed, control the multiplexer 570 so that the output end of the LDPC encoder 560 is connected to the output end of the multiplexer 570 for allowing the LDPC encoder 560 The calculation result (that is, the last part of the LDPC code (b) 406#2) can be written to the flash memory module 150; and a signal is sent to the LDPC encoder 560 to start outputting the calculation result 406#2.

雖然圖1、圖2、圖5至圖8中包含了以上描述的元件,但不排除在不違反發明的精神下,使用更多其他的附加元件,以達成更佳的技術效果。此外,雖然圖10的流程圖採用指定的順序來執行,但是在不違反發明精神的情況下,熟習此技藝人士可以在達到相同效果的前提下,修改這些步驟間的順序,所以,本發明並不侷限於僅使用如上所述的順序。此外,熟習此技藝人士亦可以將若干步驟整合為一個步驟,或者是除了這些步驟外,循序或平行地執行更多步驟,本發明亦不因此而侷限。 Although Figures 1, 2, 5 to 8 contain the above-described elements, it does not rule out the use of more other additional elements to achieve better technical effects without violating the spirit of the invention. In addition, although the flow chart in Figure 10 is executed in a specified order, those skilled in the art can modify the order of these steps without violating the spirit of the invention and achieve the same effect. Therefore, the present invention does not You are not limited to using only the order described above. In addition, those skilled in the art can also integrate several steps into one step, or in addition to these steps, perform more steps sequentially or in parallel, and the invention is not limited thereby.

雖然本發明使用以上實施例進行說明,但需要注意的是,這些描述並非用以限縮本發明。相反地,此發明涵蓋了熟習此技藝人士顯而易見的修改與相似設置。所以,申請權利要求範圍須以最寬廣的方 式解釋來包含所有顯而易見的修改與相似設置。 Although the present invention is described using the above embodiments, it should be noted that these descriptions are not intended to limit the present invention. On the contrary, this invention covers modifications and similar arrangements which will be obvious to one skilled in the art. Therefore, the scope of claims in the application must be in the broadest possible way. The formula is interpreted to include all obvious modifications and similar settings.

302:使用者資料 302:User information

304:LDPC碼 304:LDPC code

402#1:使用者資料的前部 402#1: The front part of the user data

402#2:使用者資料的後部 402#2: End of user data

404#1,404#2:計算結果 404#1,404#2: Calculation results

406#1:LDPC碼的前部 406#1: The front part of LDPC code

406#2:LDPC碼的後部 406#2: The rear part of the LDPC code

510:控制器 510:Controller

520:切換器 520:Switcher

530,560:LDPC編碼器 530,560: LDPC encoder

540:前視電路 540: Forward looking circuit

550:互斥或計算單元 550: Mutual exclusion or calculation unit

570:多工器 570:Multiplexer

Claims (13)

一種低密度奇偶檢查碼的產生裝置,包含:第一低密度奇偶檢查碼編碼器,用於使用二階段編碼演算法,以奇偶校檢矩陣對使用者資料的前部進行編碼,產生第一計算結果;前視電路,用於在每次迭代以相應於所述奇偶校檢矩陣的多個特徵列中的一個對所述使用者資料的後部執行內積計算,產生第二計算結果;以及互斥或計算單元,耦接所述第一低密度奇偶檢查碼編碼器的輸出端和所述前視電路的輸出端,用於對所述第一計算結果和所述第二計算結果進行互斥或計算,產生低密度奇偶檢查碼的前部。 A device for generating low-density parity check codes, including: a first low-density parity check code encoder for using a two-stage encoding algorithm to encode the front part of user data with a parity check matrix to generate a first calculation Result; a look-ahead circuit for performing an inner product calculation on the rear part of the user data with one of the plurality of feature columns corresponding to the parity check matrix at each iteration to generate a second calculation result; and an exclusive OR calculation unit, coupled to the output end of the first low-density parity check code encoder and the output end of the lookahead circuit, for performing mutual exclusion on the first calculation result and the second calculation result or compute, the front part that produces a low-density parity check code. 如請求項1所述的低密度奇偶檢查碼的產生裝置,包含:第二低密度奇偶檢查碼編碼器,用於使用所述二階段編碼演算法,以所述奇偶校檢矩陣對所述使用者資料進行編碼,產生所述低密度奇偶檢查碼的後部。 The device for generating a low-density parity check code as described in claim 1, including: a second low-density parity check code encoder for using the two-stage encoding algorithm and using the parity check matrix to The data is encoded to produce the rear part of the low-density parity check code. 如請求項2所述的低密度奇偶檢查碼的產生裝置,包含:多工器,包含第一輸入端、第二輸入端和第一輸出端,所述第一輸入端耦接於所述互斥或計算單元的輸出端,所述第二輸入端耦接於所述第二低密度奇偶檢查碼編碼器的輸出端,所述第一輸出端耦接於閃存模組;以及第一控制器,耦接所述多工器,用於在所述低密度奇偶檢查碼的所述前部輸出到所述閃存模組完畢後,控制所述多工器以將所述第二低密度奇偶檢查碼編碼器的輸出端耦接至所述閃存模組,讓所述低密度奇偶檢查碼的所述後部輸出到所述閃存模組。 The device for generating low-density parity check codes according to claim 2, comprising: a multiplexer including a first input terminal, a second input terminal and a first output terminal, the first input terminal being coupled to the mutual The output terminal of the OR calculation unit, the second input terminal is coupled to the output terminal of the second low-density parity check code encoder, the first output terminal is coupled to the flash memory module; and the first controller , coupled to the multiplexer, for controlling the multiplexer to convert the second low-density parity check code to the second low-density parity check code after the front part of the low-density parity check code is output to the flash memory module. The output end of the code encoder is coupled to the flash memory module, allowing the rear part of the low-density parity check code to be output to the flash memory module. 如請求項3所述的低密度奇偶檢查碼的產生裝置,包含:切換器,包含第三輸入端、第二輸出端和第三輸出端,所述第三輸入端用於接收所述使用者資料,所述第二輸出端耦接所述第一低密度奇偶檢查碼編碼器的輸入端,以及所述第三輸出端耦接所述前視電路的輸入端,其中,所述第一控制器耦接所述切換器、所述第一低密度奇偶檢查碼編碼器和所述前視電路,用於在所述使用者資料的所述前部傳送至所述第一低密度奇偶檢查碼編碼器完畢時,控制所述切換器以讓所述第三輸入端耦接所述第三輸出端,讓所述使用者資料的所述後部饋入所述前視電路,並且發出第一訊號給所述第一低密度奇偶檢查碼編碼器以啟動第二階段編碼;在所述使用者資料的所述後部傳送至所述前視電路完畢時,發出第二訊號給所述第一低密度奇偶檢查碼編碼器以開始輸出所述第一計算結果給所述互斥或計算單元,發出第三訊號給所述前視電路以開始輸出所述第二計算結果給所述互斥或計算單元。 The device for generating low-density parity check codes as described in claim 3, including: a switch including a third input terminal, a second output terminal, and a third output terminal, and the third input terminal is used to receive the user data, the second output terminal is coupled to the input terminal of the first low-density parity check code encoder, and the third output terminal is coupled to the input terminal of the look-ahead circuit, wherein the first control A device coupled to the switch, the first low density parity check code encoder and the lookahead circuit for transmitting to the first low density parity check code in the front part of the user data When the encoder is completed, the switch is controlled so that the third input terminal is coupled to the third output terminal, the rear part of the user data is fed into the forward-looking circuit, and a first signal is emitted. Enable the first low-density parity check code encoder to start a second stage of encoding; when the rear part of the user data is transmitted to the look-ahead circuit, a second signal is sent to the first low-density parity check code encoder. The parity check code encoder starts outputting the first calculation result to the mutual exclusive OR calculation unit, and sends a third signal to the lookahead circuit to start outputting the second calculation result to the mutual exclusive OR calculation unit. . 如請求項1所述的低密度奇偶檢查碼的產生裝置,其中,所述前視電路包含:資料寄存器,用於儲存所述使用者資料的所述後部;特徵列產生電路,用於依據前視基礎產生每次所述迭代需要的所述特徵列,其中,所述前視基礎包含所述奇偶校檢矩陣中用來編碼所述使用者資料的所述後部的子集合,其中,除了第一次迭代需要的所述特徵列外,每次所述迭代需要的所述特徵列是上次迭代使用的特徵列的循環右移一位的結果;內積計算單元,耦接所述特徵列產生電路和所述資料寄存器,用於在每次所述迭代中對所述使用者資料的所述後部和相應特徵列進行內積計算,獲得計算結果,並且輸出所述計算結果到所述 互斥或計算單元;以及第二控制器,用於在每次所述迭代輸出控制訊號給所述特徵列產生電路,驅動所述特徵列產生電路輸出所述相應特徵列。 The device for generating a low-density parity check code as claimed in claim 1, wherein the look-ahead circuit includes: a data register for storing the rear part of the user data; and a feature string generation circuit for based on the foregoing A look-ahead basis generates the feature columns required for each iteration, wherein the look-ahead basis includes a subset of the rear portion of the parity check matrix used to encode the user data, wherein, except for In addition to the feature column required for one iteration, the feature column required for each iteration is the result of a cyclic right shift of the feature column used in the previous iteration; an inner product calculation unit is coupled to the feature column Generating a circuit and the data register for performing an inner product calculation on the rear part of the user data and the corresponding feature column in each iteration, obtaining a calculation result, and outputting the calculation result to the a mutual exclusion or calculation unit; and a second controller for outputting a control signal to the feature sequence generating circuit in each iteration, and driving the feature sequence generating circuit to output the corresponding feature sequence. 如請求項5所述的低密度奇偶檢查碼的產生裝置,其中,所述奇偶校檢矩陣包含類循環結構。 The device for generating a low-density parity check code according to claim 5, wherein the parity check matrix includes a cyclic-like structure. 如請求項5所述的低密度奇偶檢查碼的產生裝置,其中,所述前視基礎的長度為|m2|+|pa|-1,m2代表所述使用者資料的所述後部的長度,pa代表所述低密度奇偶檢查碼的所述前部的長度。 The device for generating low-density parity check codes as claimed in claim 5, wherein the length of the look-ahead basis is |m 2 |+| pa |-1, and m 2 represents the rear part of the user information The length of p a represents the length of the front part of the low-density parity check code. 如請求項5所述的低密度奇偶檢查碼的產生裝置,其中,所述特徵列產生電路包含:來源寄存器,用於儲存所述前視基礎;以及多工器,包含多個輸入端口和一個輸出端口,每個所述輸入端口以指定順序通過預設數目的實體線分別連接到所述來源寄存器中的所述預設數目的寄存器,用於當接收到控制訊號時,將指定輸入端口連接到所述輸出端口,用以輸出所述相應特徵列。 The device for generating low-density parity check codes as claimed in claim 5, wherein the feature sequence generating circuit includes: a source register for storing the lookahead basis; and a multiplexer including a plurality of input ports and a Output ports, each of the input ports is connected to the preset number of registers in the source register through a preset number of physical lines in a specified order, for connecting the specified input port when a control signal is received. to the output port to output the corresponding feature column. 如請求項5所述的低密度奇偶檢查碼的產生裝置,其中,所述特徵列產生電路包含:多個D正反器,用以於初始時儲存所述前視基礎,其中,每個所述D正反器的輸出端連接到下一個所述D正反器的輸入端,形成一個環形,其中,一部分的所述D正反器的輸出形成所述相應特徵列,其中,每個所述D正反器偵測到時鐘訊號發生變化時,輸出其中儲存的值到下一個所述D正反器進行儲存。 The device for generating low-density parity check codes according to claim 5, wherein the feature sequence generating circuit includes: a plurality of D flip-flops for initially storing the look-ahead basis, wherein each of the The output end of the D flip-flop is connected to the input end of the next D flip-flop, forming a ring, wherein the output of a part of the D flip-flop forms the corresponding feature column, wherein each of the D flip-flop When the D flip-flop detects a change in the clock signal, it outputs the value stored therein to the next D flip-flop for storage. 一種低密度奇偶檢查碼的產生方法,由控制器執行,其中,所述控制器耦接切換器、第一低密度奇偶檢查碼編碼器和前視電路,所述方法包含:在使用者資料的前部傳送至所述第一低密度奇偶檢查碼編碼器完畢時,控制所述切換器以讓所述使用者資料的後部饋入所述前視電路,並且發出第一訊號給所述第一低密度奇偶檢查碼編碼器以啟動第二階段編碼,其中,所述第一低密度奇偶檢查碼編碼器耦接所述切換器,用於使用二階段編碼演算法,以奇偶校檢矩陣對所述使用者資料的所述前部進行編碼,產生第一計算結果,其中,所述前視電路耦接所述切換器,用於在每次迭代以相應於所述奇偶校檢矩陣的多個特徵列中的一個對所述使用者資料的所述後部執行內積計算,產生第二計算結果;以及在所述使用者資料的所述後部傳送至所述前視電路完畢時,發出第二訊號給所述第一低密度奇偶檢查碼編碼器以開始輸出所述第一計算結果給互斥或計算單元,發出第三訊號給所述前視電路以開始輸出所述第二計算結果給所述互斥或計算單元,其中,所述互斥或計算單元耦接所述第一低密度奇偶檢查碼編碼器和所述前視電路,用於對所述第一計算結果和所述第二計算結果進行互斥或計算,產生低密度奇偶檢查碼的前部。 A method for generating a low-density parity check code, executed by a controller, wherein the controller is coupled to a switch, a first low-density parity check code encoder and a look-ahead circuit, the method includes: in user data When the front part is transmitted to the first low-density parity check code encoder, the switch is controlled to allow the rear part of the user data to be fed into the look-ahead circuit, and a first signal is sent to the first The low-density parity check code encoder is used to start the second-stage encoding, wherein the first low-density parity check code encoder is coupled to the switch and is used to use the two-stage encoding algorithm to encode the parity check matrix. The front part of the user data is encoded to generate a first calculation result, wherein the look-ahead circuit is coupled to the switch and is used to encode multiple values corresponding to the parity check matrix at each iteration. One of the feature columns performs an inner product calculation on the rear part of the user data to generate a second calculation result; and when the transmission of the rear part of the user data to the look-ahead circuit is completed, a second A signal is sent to the first low-density parity check code encoder to start outputting the first calculation result to the mutex or calculation unit, and a third signal is sent to the lookahead circuit to start outputting the second calculation result to the The mutual exclusive or calculation unit, wherein the mutual exclusive or calculation unit is coupled to the first low density parity check code encoder and the look-ahead circuit, and is used to compare the first calculation result and the second The results of the computation are mutually exclusive or computed, producing the front part of the low-density parity check code. 如請求項10所述的低密度奇偶檢查碼的產生方法,包含:在所述低密度奇偶檢查碼的所述前部輸出到閃存模組完畢後,控制多工器以將第二低密度奇偶檢查碼編碼器耦接至所述閃存模組,讓所述低密度奇偶檢查碼的後部輸出到所述閃存模組,其中,所述多工器的輸入端耦接所述互斥或計算單元和所述第二低密度奇偶檢查碼編碼器, 其中,所述多工器的輸出端耦接所述閃存模組,其中,所述第二低密度奇偶檢查碼編碼器用於使用所述二階段編碼演算法,以所述奇偶校檢矩陣對所述使用者資料進行編碼,產生所述低密度奇偶檢查碼的所述後部。 The method for generating a low-density parity check code as described in claim 10, including: after the front part of the low-density parity check code is output to the flash memory module, controlling the multiplexer to convert the second low-density parity check code to the flash memory module. A check code encoder is coupled to the flash memory module to allow the rear part of the low-density parity check code to be output to the flash memory module, wherein the input end of the multiplexer is coupled to the mutex or calculation unit and the second low density parity check code encoder, Wherein, the output end of the multiplexer is coupled to the flash memory module, wherein the second low-density parity check code encoder is used to use the two-stage encoding algorithm to encode the parity check matrix. The user data is encoded to generate the rear portion of the low-density parity check code. 如請求項10所述的低密度奇偶檢查碼的產生方法,其中,所述奇偶校檢矩陣包含類循環結構。 The method for generating a low-density parity check code as described in claim 10, wherein the parity check matrix includes a cyclic-like structure. 如請求項12所述的低密度奇偶檢查碼的產生方法,其中,除了第一次迭代需要的所述特徵列外,每次所述迭代需要的所述特徵列是上次迭代使用的特徵列的循環右移一位的結果。 The method for generating low-density parity check codes as described in claim 12, wherein, in addition to the feature columns required for the first iteration, the feature columns required for each iteration are the feature columns used in the previous iteration. The result of loop shifting one bit to the right.
TW111123322A 2022-06-23 2022-06-23 Apparatus and method for generating low-density parity-check (ldpc) code TWI823436B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW111123322A TWI823436B (en) 2022-06-23 2022-06-23 Apparatus and method for generating low-density parity-check (ldpc) code

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW111123322A TWI823436B (en) 2022-06-23 2022-06-23 Apparatus and method for generating low-density parity-check (ldpc) code

Publications (2)

Publication Number Publication Date
TWI823436B true TWI823436B (en) 2023-11-21
TW202401992A TW202401992A (en) 2024-01-01

Family

ID=89722690

Family Applications (1)

Application Number Title Priority Date Filing Date
TW111123322A TWI823436B (en) 2022-06-23 2022-06-23 Apparatus and method for generating low-density parity-check (ldpc) code

Country Status (1)

Country Link
TW (1) TWI823436B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102340318A (en) * 2011-10-08 2012-02-01 中国科学院上海微系统与信息技术研究所 Method for encoding quasi-cycle LDPC (Low Density Parity Check) codes
CN103023516A (en) * 2013-01-01 2013-04-03 苏州威士达信息科技有限公司 LDPC (low density parity check) coder capable of generating matrix and check matrix jointly and coding method
CN111162797A (en) * 2020-01-21 2020-05-15 华侨大学 Encoding device and encoding method of 5G LDPC code with compatible rate
CN113765623B (en) * 2021-09-02 2022-06-07 中山大学 Bidirectional communication method based on superposition coding and extra information transmission

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102340318A (en) * 2011-10-08 2012-02-01 中国科学院上海微系统与信息技术研究所 Method for encoding quasi-cycle LDPC (Low Density Parity Check) codes
CN103023516A (en) * 2013-01-01 2013-04-03 苏州威士达信息科技有限公司 LDPC (low density parity check) coder capable of generating matrix and check matrix jointly and coding method
CN111162797A (en) * 2020-01-21 2020-05-15 华侨大学 Encoding device and encoding method of 5G LDPC code with compatible rate
CN113765623B (en) * 2021-09-02 2022-06-07 中山大学 Bidirectional communication method based on superposition coding and extra information transmission

Also Published As

Publication number Publication date
TW202401992A (en) 2024-01-01

Similar Documents

Publication Publication Date Title
TWI692762B (en) Flash memory controller, flash memory module and associated electronic device
TWI517173B (en) Apparatuses and methods of updating reliability data
CN106205728B (en) Parity check circuit and memory device including the same
US20200272539A1 (en) Methods and apparatuses for error correction
TWI516035B (en) Management of data storage in analog memory cells using a non-integer number of bits per cell
US9858994B2 (en) Memory system with MLC memory cells and partial page compression or reduction
US8484547B2 (en) System and method for reducing memory in a multi-channel parallel encoder system
TWI536749B (en) Decoding method, memory storage device and memory controlling circuit unit
US20180034483A1 (en) Variable t bch encoding
TWI823436B (en) Apparatus and method for generating low-density parity-check (ldpc) code
TWI732642B (en) Data writing method, memory control circuit unit and memory storage apparatus
KR102017807B1 (en) Apparatus for processing data and method for processing data
US20230421178A1 (en) Apparatus and method for generating low-density parity-check (ldpc) code
TWI719880B (en) Apparatus and method for programming data of page groups into flash units
TWI804359B (en) Method and apparatus for decoding low-density parity-check (ldpc) code
TWI808902B (en) Apparatus for detecting errors during data encryption
TWI835381B (en) Apparatus for detecting errors during data encryption
TWI835601B (en) Apparatus and method for expanding round keys during data encryption
US20230421175A1 (en) Method and apparatus for decoding low-density parity-check (ldpc) code
TWI829252B (en) Method and computer program product and apparatus for decoding low-density parity-check (ldpc) code
WO2021146967A1 (en) Low density parity check code encoding method and encoder
US11169878B2 (en) Non-volatile memory accessing method using data protection with aid of look-ahead processing, and associated apparatus
TW202420088A (en) Apparatus for detecting errors during data encryption
TW202236832A (en) Adaptive serial general purpose input output interface and siganl receiver thereof
CN117997797A (en) Error detecting device for data encryption