WO2009033397A1 - Procédé pour accéder à des données dans une mémoire flash et contrôleur d'accès à des données - Google Patents

Procédé pour accéder à des données dans une mémoire flash et contrôleur d'accès à des données Download PDF

Info

Publication number
WO2009033397A1
WO2009033397A1 PCT/CN2008/072213 CN2008072213W WO2009033397A1 WO 2009033397 A1 WO2009033397 A1 WO 2009033397A1 CN 2008072213 W CN2008072213 W CN 2008072213W WO 2009033397 A1 WO2009033397 A1 WO 2009033397A1
Authority
WO
WIPO (PCT)
Prior art keywords
unit
flash
data block
command
address
Prior art date
Application number
PCT/CN2008/072213
Other languages
English (en)
French (fr)
Inventor
Jiangxun Tang
Original Assignee
Artek Microelectronics Co., Ltd.
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 Artek Microelectronics Co., Ltd. filed Critical Artek Microelectronics Co., Ltd.
Priority to EP08800725.7A priority Critical patent/EP2187315B1/en
Publication of WO2009033397A1 publication Critical patent/WO2009033397A1/zh
Priority to US12/646,934 priority patent/US8234541B2/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0238Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory
    • G06F12/0246Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory in block erasable memory, e.g. flash memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/08Error detection or correction by redundancy in data representation, e.g. by using checking codes
    • G06F11/10Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's
    • G06F11/1008Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's in individual solid state devices
    • G06F11/1068Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's in individual solid state devices in sector programmable memories, e.g. flash disk
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/10Providing a specific technical effect
    • G06F2212/1032Reliability improvement, data loss prevention, degraded operation etc

Definitions

  • the present invention relates to flash memory technology, and more particularly to a flash memory controller and a control method thereof. Background of the invention
  • a flash memory storage medium is a non-volatile memory that has internal information that can be reserved after power-down and can be erased and reprogrammed repeatedly.
  • embedded systems using flash memory as a storage medium are widely used.
  • the existing flash controllers mainly use data blocks (usually 512 Bytes) as the basic processing unit, and perform Error Detection and Correction (ECC) error correction.
  • ECC Error Detection and Correction
  • each 512 Bytes main data block (Main Data Block) needs to resend the command and address to start the next 512 Bytes main data block transmission after transmission, that is, it needs to be transmitted in a 512 Bytes main data block and its ECC correction.
  • the transmission of the next 512 Bytes main data block is started, that is, the existing scheme mainly adopts the serial execution mode. Summary of the invention
  • Embodiments of the present invention provide a data access method and a data access controller for a flash memory to solve the problem of inefficient control of a flash controller in the prior art.
  • An embodiment of the present invention provides a data access control method for a flash memory, including: continuously outputting at least one main data block to a buffer area of a flash, and a flash buffer area for buffering data to be input into the flash storage area;
  • An embodiment of the present invention further provides a data access control method for a flash memory, including: buffering verification data of at least one main data block from a buffer area of a flash, and buffering at least one of the flash memory areas from a flash memory area. Main data block and its check data; continuously reading at least one main data block from the flash buffer area;
  • At least one primary data block is continuously read, at least one primary data is sequentially verified using the parity data of the cached at least one primary data block.
  • An embodiment of the present invention further provides a data access controller of a flash memory, including: a first unit, configured to continuously output at least one main data block to a buffer area of the flash; and at least one main memory buffered in the second unit After the verification data of the data block is all output to the buffer area of fl as h, at least one main data block in the flash buffer area and its check data are written into the flash storage area;
  • a second unit configured to generate check data for each main data block and cache when the first unit outputs at least one main data block to a buffer area of the flash; output the check data of the cached at least one main data block To the flash buffer area.
  • An embodiment of the present invention further provides a data access controller of a flash memory, including: a first unit, configured to continuously transfer at least one main data block and its check data from a flash storage area to a flash buffer area, The buffer area of the instruction flash transfers the verification data to the second unit, and continuously reads at least one main data block from the buffer area of the flash;
  • a second unit configured to buffer parity data of at least one primary data block from a buffer of fl as h, and compare the buffered parity data when the first unit reads at least one primary data block from a buffer of the flash Check it out.
  • Embodiments of the present invention also provide a method of controlling data access using a controller, wherein the controller includes a check unit for generating a check code and verifying the main data, and at least one standard control unit, each standard The control unit is used to implement at least one data access function And has an enable parameter.
  • the at least one standard control unit includes a busy idle detection unit, a first command unit, a second command unit, an address sending unit, a transmission unit, and a switching unit; the method includes the following steps:
  • each standard control unit is first to last: a busy detection unit, a first command unit, an address sending unit, a transmission unit, a switching unit, and a second command unit, and the execution sequence is used as a standard process;
  • the data access process includes a first P segment and a second phase
  • the enabling parameter of the busy-bus detecting unit, the first command unit, the address sending unit, the transmitting unit, and the switching unit is configured to be executed, and the enabling parameter of the second command unit is configured as a bypass;
  • the first command unit sends a write operation command to the flash
  • the address sending unit sends the first address to the flash
  • the transmission unit sends the unit according to the address.
  • the first address sent is written into the buffer area of the flash by at least one main data block, and each time a main data block is written, the switching unit instructs the check unit to buffer the check data generated by the currently written main data block, and is The next written main data block generates check data to prepare;
  • the enabling parameters of the first command unit, the address sending unit, the transmitting unit, the switching unit, and the second command unit are configured to be executed, and the enabling parameters of the busy detecting unit and the switching unit are configured as bypass;
  • the first command unit sends a rewrite address command to fl as h
  • the address sending unit sends the second address to the flash
  • the transmission unit transmits at least one main data according to the second address sent by the address sending unit.
  • the check data of the block is continuously outputted to the buffer area of the flash
  • the second command unit outputs at least one main data block in the flash buffer area and the check data thereof to the flash storage area.
  • Embodiments of the present invention also provide a method of controlling data access using a controller
  • the controller includes a check unit for generating a check code and verifying the main data, and at least one standard control unit, each standard control unit is configured to implement at least one data access function and have an enable parameter.
  • the at least one standard control unit includes a first busy idle detection unit, a second busy idle detection unit, a first command unit, a second command unit, an address sending unit, a transmission unit, and a switching unit;
  • each standard control unit is first to last: first busy detection unit, first command unit, address sending unit, second command unit, second busy detecting unit, transmission unit, and switching unit, and Use this order of execution as a standard process;
  • the data access process includes a first interface and a second phase
  • the enabling parameters of the first busy detecting unit, the first command unit, the address sending unit, the second command unit, the second busy detecting unit, and the transmitting unit are configured to be executed, and the switching unit is configured to be
  • the energy parameter is bypass;
  • the first busy detection unit detects that the flash is idle
  • the first command unit sends a read operation command to the flash
  • the address sending unit sends a third address to the flash
  • the second command unit indicates the flash.
  • at least one main data block and its check data are read from the flash storage area to the flash buffer area according to the third address sent by the address sending unit, and the second busy detecting unit detects that the flash is idle, the transmission unit reads the flash.
  • the enabling parameters of the first command unit, the address sending unit, the transmitting unit, and the switching unit are configured to be executed, and the enabling parameters of the first busy detecting unit, the second command unit, and the second busy detecting unit are Bypass
  • the first command unit sends a rewrite address command to fl as h
  • the address sending unit sends a fourth address to the flash
  • the transmission unit continuously reads at least one main according to the fourth address sent by the address sending unit.
  • Embodiments of the present invention also provide a method for controlling data access using a controller, wherein the controller includes a check unit for generating a check code and verifying the main data, and at least one standard control unit.
  • Each standard control unit is configured to implement at least one data access function and has an enable parameter, and the at least one standard control unit includes a first busy idle detection unit, a second busy idle detection unit, a first command unit, and a second command unit.
  • each standard control unit is first to last: first busy detection unit, first command unit, address transmission unit, second command unit, second busy detection unit, transmission unit, switching unit, and Three command units, and in this order of execution as a standard process;
  • the data access process includes a write operation and/or a read operation, the write operation includes a first P segment and a second P segment; the read operation includes a third phase and a fourth phase;
  • the enabling parameters of the first busy detecting unit, the first command unit, the address sending unit, the transmitting unit, and the switching unit are configured to be executed, and the second command unit, the second busy detecting unit, and the second The enable parameter of the three command unit is bypass;
  • the first command unit sends a write operation command to the flash
  • the address sending unit sends the first address to the flash
  • the transmission unit sends the unit according to the address.
  • the first address sent is written into the buffer area of the flash by at least one main data block, and each time a main data block is written, the switching unit instructs the check unit to buffer the check data generated by the currently written main data block, and is The next written main data block generates check data to prepare;
  • the enabling parameters of the first command unit, the address sending unit, the transmitting unit, the switching unit, and the second command unit are configured to be executed, and the first busy detecting unit, the second busy detecting unit, and the switching unit are configured.
  • the enabling parameter of the third command unit is bypass;
  • the first command unit sends a rewrite address command to fl as h
  • the address sending unit sends the second address to the flash
  • the transmission unit transmits at least one main data according to the second address sent by the address sending unit.
  • the check data of the block is continuously outputted to the buffer area of the flash, and the second command unit outputs at least one main data block in the flash buffer area and the check data thereof to the flash storage area;
  • the enabling parameters of the first busy detecting unit, the first command unit, the address sending unit, the second command unit, the second busy detecting unit, and the transmitting unit are configured to be executed, and the switching unit and the third command are configured.
  • the enabling parameter of the unit is bypass;
  • the first busy detection unit detects that the flash is idle
  • the first command unit sends a read operation command to the flash
  • the address sending unit sends a third address to the flash
  • the second command unit indicates the flash.
  • at least one main data block and its check data are read from the flash storage area to the flash buffer area according to the third address sent by the address sending unit, and the second busy detecting unit detects that the flash is idle, the transmission unit reads the flash.
  • the enabling parameters of the first command unit, the address sending unit, the transmitting unit, and the switching unit are configured to be executed, the first busy detecting unit, the second command unit, the second busy detecting unit, and the third command unit.
  • the enable parameter is bypass;
  • the first command unit sends a rewrite address command to the flash
  • the address sending unit sends a fourth address to the flash
  • the transmission unit continuously reads the at least one main according to the fourth address sent by the address sending unit.
  • the data block each time reading one main data block, the switching unit instructs the verification unit to save the result of checking the currently read main data block and prepare for verifying the next read main data block.
  • the technical solution provided by the embodiment of the present invention sets a check code buffer in the flash controller, and after receiving the command to start the write operation sent by the CPU, generates the check data of the main data block while transmitting the main data block. And verify the data cache with the flash controller's checksum cache After waiting for the transmission of the main data block, the verification data is transferred to the flash at one time. Since the processing of the main data and the processing of the check code are performed in parallel, a plurality of main data blocks can be transmitted at a time, and the check data is transmitted after all the main data blocks are transmitted, so that only a plurality of main data blocks are transmitted. The CPU needs to send a write operation start command.
  • the technical solution provided by the embodiment of the present invention can avoid frequent interference of the CPU and improve the efficiency of data access.
  • check data can be transferred to the cache of the flash controller first, it is not necessary to read the main data in the flash every time a main data block is transferred. Check data for the block. Therefore, it is also avoided that the CPU of the main data block will interfere every time, and the efficiency of data access is improved.
  • the reconfigurable control unit is used to form the standard process, so that when the existing control unit cannot meet the requirements, only some of the standard control units can be replaced without replacing the entire control unit, thus increasing the flash control.
  • the flexibility and expandability of the device BRIEF DESCRIPTION OF THE DRAWINGS
  • FIG. 2 is a timing diagram of a prior art flash read operation
  • FIG. 3 is a schematic structural diagram of a flash controller according to an embodiment of the present invention
  • FIG. 4 is a schematic structural diagram of a flash controller according to an embodiment of the present invention
  • FIG. 5 is a flash control of a read operation according to an embodiment of the present invention
  • FIG. 6 is a timing diagram of a write operation according to an embodiment of the present invention
  • FIG. 7 is a timing diagram of a read operation in accordance with an embodiment of the present invention.
  • FIG. 8 is a schematic diagram showing a standard flow of a reconfigurable control unit according to an embodiment of the present invention
  • 9 is a schematic diagram of a standard flow of a reconfigurable control unit in accordance with another embodiment of the present invention. Mode for carrying out the invention
  • the main data block of 512 Bytes is written as a unit, and the specific process is as follows: First, the flash controller receives the flash write operation instruction sent by the CPU, and points the address pointer of the write operation to the main data of the flash. A zone, and a master data block is written into the buffered main data area of the flash, and the encoder of the error correction code is encoded together. When the transmission of the main data block is completed, the encoder also completes the encoding and outputs the verification data, such as an error correction code.
  • the flash controller points the address pointer of the write operation to the spare area of the flash, writes the encoded result to the spare area of the buffer of fl as h, and then flashes a main data in the flash buffer and its check data (such as error correction). Code) is sent to the flash memory area. Finally, the flash controller returns the encoding result to the CPU. After checking the encoding result, the CPU sends a command to the flash controller to write the next main data block.
  • step 111 the flash controller receives a command sent by the CPU to perform a 512 Bytes write operation, and starts a step 112 to write a 512 Bytes main data block, and At the same time, step 113 generates verification data of the primary data block. It can be seen from the timing diagram that both step 112 and step 113 occupy 512 clock cycles.
  • Step 114 returns a coded result (GET RESULT0) to the CPU each time a main block of 512 Bytes is written to the flash, and step 115 gives the next 512 Bytes write command (GIVE CMD1) by the CPU.
  • the writing of the next primary data block from step 121 to step 125 is started.
  • the inventors of the present invention found that this method occupies additional clock resources due to frequent interference of the CPU, and the efficiency of the entire flash write operation is low.
  • the main data block of 512 Bytes is also read as a unit, and the specific process is as follows: First, the flash controller receives the flash read operation sent by the CPU. As an instruction, the main data block to be read and its error correction code are read into the flash buffer, and the address pointer of the read operation is pointed to the spare area of fl as h, and a main data block currently needed to be read is The error correction code is read into the flash controller. Then, the flash address pointer is pointed to the main data area of the flash, and the main data block is read from the main data area of the cache of the flash, and the B algorithm of the error correction code is also processed together.
  • the processing result of the B algorithm shows that the main data is in error
  • the processing result of the B algorithm is output to the C algorithm for calculation
  • the result of the C algorithm is input into the D algorithm for calculation.
  • the flash controller returns the result to the CPU.
  • the CPU sends a command to the flash controller to perform the next master block read operation. After all the main data blocks have been read in this read operation, an error data report is sent to the CPU, including the address of the main data block in which the error occurred in this read operation.
  • step 211 the flash controller receives a read operation command sent by the CPU, and the startup step 212 reads a 512 Bytes main data block.
  • step 213 checks the read main data block. As can be seen from the timing diagram, both step 212 and step 213 occupy 512 clock cycles. At this time, if the verification result of step 213 shows that the data has an error, step 214 and step 215 process the error data in a serial manner.
  • step 216 the flash controller sends the result of the serial processing to the CPU.
  • step 217 the CPU gives the next read operation command. The reading of the next primary data block is completed from step 221 to step 227.
  • the inventors of the present invention have found that the prior art method of reading flash master data occupies an extra clock cycle due to frequent interference of the CPU, and the efficiency of the entire flash read operation is low. Meanwhile, as shown in FIG. 2, the inventors of the present invention also found that if the result of the processing of the algorithm B shows that the main data has an error, it is also necessary to execute the algorithm C and the algorithm D for data error correction, and at this time, the complete reading of the flash main data is performed. The process takes up more clock cycles and the read operation is less efficient. And when the circuit of the C algorithm or the D algorithm is executed, the circuit for reading the main data and the circuit for executing the B algorithm are in an idle state, and the utilization of the hardware is not high.
  • the inventors of the present invention have found that all operations in the prior art are based on a 512 Bytes data block as a basic operation unit, and the read/write operation is performed in a serial operation manner as a controller. When some parts of the circuit are working, other parts of the circuit are in an idle state. If the main data is found to be in error when the read operation performs ECC check on the main data, the circuit structure of the three-level error correction is used for error correction. The input of the error correction circuit is based on the output of the error correction circuit of the previous stage.
  • the existing scheme needs to switch the flash address and the CPU to control the flash controller when performing reading and writing of each 512 Bytes main data block, resulting in inefficient reading and writing; in addition, in the main data read operation
  • the time required for each level of error correction is close to 512 clock cycles, and the time required for three-level error correction exceeds 1000 clock cycles, far more than that required to read one master data block. 512 clock cycles.
  • each complete 512 Bytes main data block reading process requires corresponding ECC error correction completion, so when an error occurs in the read main data block, the actual time required to read a 512 Bytes main data block is Far more than pure master block read time, causing ECC to restrict transmission performance.
  • the size of the flash page (page) has reached 4KBytes. Objectively, it is necessary to be able to provide arbitrary reading and writing within the page, and at the same time, ECC error correction can be performed. It is not necessary to read the flash main data in 512 Bytes as a unit. Write, the existing technology of reading and writing only 512Bytes as a unit can not meet the needs of practical applications. Therefore, the inventor of the present invention provides a method for access control of a flash and a corresponding flash controller. The embodiments of the present invention are described in detail below with reference to the accompanying drawings.
  • FIG. 3 is a schematic structural view of the flash controller.
  • the flash controller includes at least a reconfigurable control unit 320 and a check unit 330.
  • the reconfigurable control unit 320 that is, the first unit is configured to continuously output at least one main data block to the buffer area of the flash when performing the write operation, and at least one of the buffer unit at the check unit 330, ie, the second unit After the check data of the main data block is all output to the buffer area of the flash, the reconfigurable control control unit 320 writes at least one main data block in the flash buffer area and its check data into the flash storage area.
  • the checking unit 330 is configured to generate check data for each main data block and cache when the reconfigurable control unit 320 outputs the at least one main data block to the buffer area of the flash; and buffer the at least one main data block The verification data is output to the flash buffer area.
  • the reconfigurable control unit 320 is configured to continuously output at least one main data block and its check data from the flash storage area to the flash buffer area, and output the check data from the flash buffer area.
  • at least one main data block is continuously output from the buffer area of the flash.
  • the verification unit 330 is configured to buffer the verification data output by the reconfigurable control unit 320 from the buffer area of the flash, and perform verification on the at least one main data block when the reconfigurable control unit 320 outputs the buffer from the flash buffer area. The data is verified.
  • the flash controller may further include an internal interface unit 310, that is, a third unit.
  • the reconfigurable control unit 320 is configured to continuously output at least one main data block to the flash buffer area after receiving the write operation start command sent by the CPU through the internal interface unit 310, and at least one of the flash buffer areas After the main data block and its check data are written in the flash memory area, an interrupt is sent to the CPU through the internal interface unit 310, and a status report command from the CPU is received, and status information indicating whether the write operation is successful is sent to the CPU.
  • the reconfigurable control unit 320 further outputs at least one main data block and its check data from the flash storage area to the flash buffer area after receiving the read operation start command sent by the CPU through the internal interface unit 310. And after outputting at least one main data block in the buffer of the flash, the internal interface unit 310 sends an interrupt to the CPU, receives a status report command from the CPU, and sends status information indicating whether the read operation is successful to the CPU.
  • the flash controller may further include a flash interface unit 340, that is, a fourth unit.
  • the reconfigurable control unit 320 continuously outputs at least one main data block to the flash buffer area through the flash interface unit 340; and outputs the buffered check data to the flash buffer area through the flash interface unit 340.
  • the reconfigurable control unit 320 also continuously outputs at least one main data block from the flash buffer area through the flash interface unit 340.
  • the check unit 330 outputs the check data in the buffer area of the flash through the flash interface unit 340.
  • the check unit 330 includes the following modules: a check code buffer 331, that is, the second module 331 is used to buffer the check data outputted by the flash interface unit 340 and the ECC_A module 332, that is, the check data generated by the first module 332.
  • the ECC_A module 332 is configured to generate check data for each primary data block when the reconfigurable control unit 320 outputs the at least one primary data block to the buffer area of the flash, and cache at least one of the check code buffers 331 The check data of the main data block is output to the buffer area of the flash.
  • the ECC_B module 333 that is, the third module 333 is configured to process, for the reconfigurable control unit 320, each main data block continuously outputted from the buffer area of the flash, and use the first algorithm to process the main data block and store it on the check code buffer. Checking the data, and determining whether the main data block has an error.
  • the result of the first algorithm processing is sent to the ECC_C module 334, that is, the fourth module 334; the ECC_C module 334 is used for
  • the ECC_B module 333 determines that a primary data block has an error
  • the second algorithm is used to process the result of the first algorithm processing sent by the ECC_B module 333
  • the ECC_D module 335 that is, the fifth module 335 is configured to process the ECC_C module 334 by using the third algorithm.
  • the result of the second algorithm processing is sent, the result of the third algorithm processing is recorded, and an error report is output after the at least one main data block is continuously read.
  • FIG. 4 is a schematic diagram showing the structure of a flash controller when a write operation is performed in an embodiment of the present invention.
  • the flash controller in the embodiment of the present invention includes at least a reconfigurable control unit 320 and a school insurance unit 330.
  • the reconfigurable control unit 320 is configured to continuously output at least one main data block to the buffer area of the flash; and the verification unit 330 outputs all the verification data of the at least one main data block buffered to the flash buffer area. Thereafter, the reconfigurable control unit 320 writes at least one main data block in the flash buffer area and its check data into the flash storage area.
  • the verifying unit 330 is configured to generate check data for each main data block and cache when the reconfigurable control unit outputs the at least one main data block to the buffer area of the flash; and buffer the at least one main data block that is buffered The test data is output to the flash buffer area.
  • the flash controller in the embodiment of the present invention may further include an internal interface unit 310.
  • the reconfigurable control unit 320 is configured to continuously output at least one main data block to the buffer area of the flash and receive at least one of the flash buffer areas when receiving the write operation start command sent by the CPU through the internal interface unit 310. After the main data block and its check data are written in the flash memory area, an interrupt is sent to the CPU through the internal interface unit 310, and a status report command from the CPU is received, and status information indicating whether the write operation is successful is sent to the CPU.
  • the flash controller in the embodiment of the present invention may further include a flash interface unit 340.
  • the reconfigurable control unit 320 continuously outputs at least one main data block to the flash buffer area through the flash interface unit 340; and outputs the buffered check data to the flash buffer area through the flash interface unit 340.
  • the check unit in the embodiment of the present invention includes an ECC_A module 332, that is, a first module 332, which is used for each main when the reconfigurable control unit 320 outputs at least one main data block to the buffer area of the flash.
  • the data block generates verification data, and outputs verification data of at least one main data block buffered by the check code buffer to a buffer area of the flash.
  • the check code buffer 331 is used to buffer the check data generated by the first module 332.
  • the flash interface unit 340 is responsible for forwarding to the flash.
  • the flash address to be written into the main data block and the command that requires internal operation of the flash, such as a command instructing the flash to write the data in the cache to the flash the flash interface unit 340 is also responsible for forwarding the data transmitted between the flash controller and the flash.
  • the main data block of the flash and its check data are written;
  • the check code buffer 331 mainly stores the check data, such as the error correction code of the ECC, for encoding and decoding the error correction code in the pipeline mode.
  • the ECC_A encoding algorithm module 332 is responsible for generating parity data for each primary data block of the input flash.
  • the reconfigurable control unit 320 controls the entire write operation process and is designed to use a software configurable Finite State Machine (FSM).
  • FSM Finite State Machine
  • the internal interface unit 310 is mainly an internal interface bus, and is responsible for forwarding data transmission between the reconfigurable control unit 320 and the CPU, such as forwarding a control command sent by the CPU (such as a write operation start command) and after the main data is written. Interrupts forwarded by the CPU, etc.
  • the main data block is first continuously input from the internal interface unit 310, transferred to the reconfigurable control unit 320, and then the main data block is continuously transmitted to the flash through the flash interface unit 340.
  • the ECC encoder 332 (ECC-A) as the error correction coding module acquires the main data from the reconfigurable control unit for error correction code encoding, and inputs the error correction code input error correction.
  • Code buffer 331 The operation of performing error correction code encoding is performed in synchronization with the action of the main data transmission.
  • Fig. 5 is a view showing the structure of a flash controller when a flash read operation is performed in the embodiment of the present invention.
  • the flash controller includes at least a reconfigurable control unit 320 and a check unit 330, wherein the reconfigurable control unit 320 is configured to: at least one main data block and its calibration from a flash storage area
  • the verification data is continuously outputted to the buffer area of the flash, and the verification data is output from the buffer area of the flash to the verification unit 330, and at least one main data block is continuously outputted from the buffer area of the flash.
  • the verifying unit 330 is configured to buffer the check data read out by the reconfigurable control unit 320 from the buffer area of the flash, and perform the calibration while the reconfigurable control unit 320 outputs at least one main data block from the buffer area of the flash. Verify the data for verification.
  • the reconfigurable control unit 320 is configured to receive through the internal interface unit 310. After the read operation start command sent by the CPU, at least one main data block and its check data are output from the flash storage area to the flash buffer area, and pass through the internal interface after outputting at least one main data block in the flash buffer area.
  • the unit 310 sends an interrupt to the CPU, receives a status report command from the CPU, and transmits status information indicating whether the read operation was successful to the CPU.
  • the reconfigurable control unit 320 continuously outputs at least one main data block from the flash buffer area through the flash interface unit 340.
  • the verification unit 330 outputs the verification data in the buffer area of the flash through the flash interface unit 340.
  • the check unit includes a check code buffer 331 , that is, a second module 331 for buffering the check data output by the flash interface unit 340.
  • the ECC_B module 333 that is, the third module 333, is configured to process, for the reconfigurable control unit 320, each main data block continuously outputted from the buffer area of the flash, and use the first algorithm to process the main data block and store the check code buffer. Check the data on it and judge whether the main data block has an error. When it is determined that a primary data block has an error, the result of the first algorithm processing is sent to the ECC_C module 334, that is, the fourth module 334.
  • the ECC_C module 334 is configured to process the result of the first algorithm processing sent by the ECC_B module 333 by using the second algorithm when the ECC_B module 333 determines that a primary data block has an error.
  • the ECC_D module 335 that is, the fifth module 335 is configured to process the result of the second algorithm processing sent by the ECC_C module 334 by using the third algorithm, record the result of the third algorithm processing, and after the at least one main data block is continuously read. Output error report.
  • the flash interface unit 340 is configured to forward data transmitted between the flash controller and the flash, such as the main data block read from the flash and its verification data, and the internal operation of the flash is required.
  • the check code buffer 331 is used to store check data read from the flash, such as an error correction code.
  • the decoding algorithm modules ECC_B, ECC_C, and ECC_D are used to sequentially check each of the read main data blocks by using the check data stored in the check code buffer.
  • the internal interface unit 310 is configured to forward data transmission between the reconfigurable control unit and the CPU, such as forwarding a control command sent by the CPU (such as a write operation start command) and An interrupt that is forwarded to the CPU after the main data is written.
  • the reconfigurable control unit 320 is used to control the entire read operation process.
  • the error correction code in the flash is first read into the check code buffer 331 before the main data is read.
  • the reconfigurable control unit 320 controls the flash interface unit 340 to send a read command and an address of the main data to be read to the flash, continuously read the main data block to the flash interface unit 340, and the main control unit 320 through the reconfigurable control unit 320 The data continues to be transmitted to the internal interface unit 310. While the main data is being read to the internal interface unit 310, the error correction code is sequentially sent to the ECC_B error correction code module 333 for error correction calculation.
  • the result of the ECC_B error correction calculation shows that the main data is erroneous
  • the result of the ECC_B error correction code module 333 is sequentially sent to the ECC_C module 334 and the ECC_D module 335 for calculation, and at the same time, the ECC_B module 333 continues the subsequent main data block. Error correction calculation.
  • the entire master block transfer process is thus performed in a pipelined manner.
  • the write operation timing diagram is shown in Figure 6.
  • step 601 after receiving the write operation start command sent by the CPU, the first reconfigurable control unit sends a first command (CMD0) to the flash to point the flash address, that is, the write operation address pointer, to the address configured by the CPU. Is the address of the main data area in the flash.
  • step 602 the main data is sent to the flash buffer by the reconfigurable control unit.
  • the data amount of the write once flash in the embodiment of the present invention is no longer limited to one data block, such as 512 bytes, but may be an integer multiple of 512 bytes, as long as the data amount of one write flash is less than flash.
  • the size of the middle page such as 4kBytes.
  • the amount of data written to the flash at a time can be set as needed, and can be 512Bytes, lkBytes, 2kBytes, and 4kBytes.
  • the reconfigurable control unit not only controls the transmission operation of the main data, but also controls the operation of the ECC encoder.
  • the ECC encoder simultaneously performs ECC encoding during the main data transmission; since the ECC algorithm is a
  • the data of the data block (such as 512 Bytes) is the basic calculation unit, so in step 602, the data of more than one data block is continuously transmitted.
  • the reconfigurable control unit automatically splits the main data into more than one transmission unit.
  • a transmission unit can be a 512 Bytes data block
  • the main data of this write operation is all written into the buffer of fl as h.
  • step 604 when the main data is divided into a 512 Bytes transmission unit and written into the flash buffer, the simultaneously generated ECC code check data, that is, the error correction code, is stored in the flash controller's check code buffer (spare data ram) ).
  • the reconfigurable control unit automatically sends the rewrite address command CMD1, and the flash address pointer is directed from the flash main data area to the flash spare area, and step 606 is temporarily stored in the check code buffer.
  • the error correction code is sent to the spare area of the flash.
  • step 607 when all the main data is sent to the flash buffer, the reconfigurable control unit automatically sends the programming command CMD2 to write the data in the flash buffer (the main data and its error correction code). Go to the flash memory area.
  • the reconfigurable control unit will issue an interrupt to the CPU, and the CPU reads the state information in the reconfigurable control unit, that is, the CPU sends a status report command to the reconfigurable control unit, and the reconfigurable control unit sends the CPU to the CPU.
  • Send status information to determine whether the write operation is successful.
  • the process of this write operation is completed.
  • the CPU sends the next command to initiate a write operation to proceed to the next write process.
  • step 701 after receiving the read operation start command sent by the CPU, the flash controller first sends a first command (CMD0) to the flash to point the flash address pointer to the read space, that is, the spare area of the flash; And the check data, such as the error correcting code is read from the flash storage area into the flash buffer area, and the second command (CMD1) is sent to point the flash pointer to the spare data area of the current page by step 702, and the step is performed.
  • step 703 further reads the error correction code in the flash buffer area into the check code buffer of the flash controller.
  • Step 704 indicates that the purpose of transmitting the data is the check code buffer of the flash controller.
  • step 705 when the error correction code in the flash buffer is read into the check code buffer, a third command (CMD2) is sent to point the flash address pointer to the main data area of the current page (page).
  • CMD2 third command
  • step 706 the reconfigurable control unit initiates the main data transfer, sequentially splits the main data to be read into data blocks of size 512 bytes, and continuously reads the main data block from the flash into the flash controller.
  • step 707 the synchronized ECC check operation is also continuously performed.
  • Each of the 512 bytes of the main data block requires almost 1536 clock cycles for error correction when a data error occurs, and the three algorithms in FIG. 6 need to be sequentially performed.
  • the ECC_B shown in step 707, the ECC_C shown in step 708, and the ECC_D shown in step 709 are performed, and the execution of the latter algorithm needs to be based on the result of the previous algorithm, and must wait until the execution of the previous algorithm is completed.
  • the execution described here may mean that part of the data of one main data block is processed by the algorithm and output, and the data of the entire main data block is not required to be processed by the algorithm, and the next step processes the main data output by the previous step.
  • Step 710 records each error occurrence data and outputs an error report after the main data block is continuously read.
  • step 707 the execution of the ECC_B algorithm shown in step 707 is completed simultaneously with the process of transmitting one main data block shown in step 706. If the execution result of step 707 shows that the transmitted main data block has an error, step 708 will After step 707 is completed, it is started, and step 709 is started after step 708 is completed. After the data processing of one main data block is completed in step 707, step 708 still calculates the output result of step 707, and the subsequent transmission of the main data block and the execution of the ECC_B algorithm continue uninterrupted.
  • the reconfigurable control unit issues an interrupt to the CPU, and the CPU reads the status information in the reconfigurable control unit, ie the CPU to the reconfigurable control
  • the unit sends a status report command, and the reconfigurable control unit sends status information to the CPU to determine whether the write operation is successful.
  • the process of the current read operation is completed.
  • the CPU sends a command to start reading the main data and proceeds to the next read process. It can be seen from the above technical solution that during the read/write operation, the CPU first configures the main data size, address, command and other information to be transmitted into the flash controller, and then sends a start command to the flash controller, in the flash controller.
  • the CPU no longer interferes with the operation of the controller during the entire operation.
  • the flash controller completes all operations, it will issue an interrupt to the CPU, and the CPU reads the status information in the flash controller to determine whether the read/write operation is successful.
  • the present invention is implemented. The technical solution provided by the example can significantly reduce the interaction between the flash controller and the CPU, so that the read/write efficiency is significantly improved.
  • Figure 8 depicts a control flow diagram of a reconfigurable control unit, each block representing an execution action or standard control unit, each standard control unit being used to implement at least one data access function, specifically executed during operation or not , depending on the configuration of the software.
  • the description of each standard control unit is as follows:
  • S_idle Controller idle state.
  • S_rbi_0 The controller detects the free/busy (busy) status of the flash for the first time.
  • S_addr The controller sends a variable length address.
  • S_wait The controller waits for the flash decoding to be completed. If the flash decoding rate is fast, the standard control unit may not be set.
  • S_rbi_l The controller detects the flash free/busy state for the second time.
  • S_dma The controller performs data direct memory access (DMA) transfer.
  • DMA data direct memory access
  • S_count The controller switches the ECC codec and sector transmission.
  • each standard control unit has an enable parameter
  • the method of controlling data access using the reconfigurable control unit includes: configuring a standard flow consisting of at least one standard control unit.
  • the enabling parameter of each standard control unit in the standard process is configured according to the data access function corresponding to this stage, and the enabling parameter indicates the function of the control unit of this standard or bypassing the standard control.
  • Unit performs a standard procedure to complete the data access function of this phase corresponding to each of the currently configured individual enable parameters.
  • the initial reconfigurable control unit is in an idle initial state 811.
  • S_rbi_0 standard control unit 812
  • S_cmd_0 standard control unit 812
  • S_addr standard control unit 813
  • S_wait standard control unit 814
  • S_cmd_l standard control unit 815
  • S_rbi_l standard control unit 816
  • S_dma standard control unit 817
  • S_count standard control unit 818
  • the read operation can be divided into two phases.
  • the reconfigurable control unit is in an idle initial state 811, the enable parameters of the configuration standard control units 812 to 817 are executed, and the enable parameter of the configuration standard control unit 818 is bypassed.
  • the flash controller After receiving a command to initiate a read operation of the CPU, the flash controller executes a standard control unit 812 to detect the free/busy state of the flash. If the flash current state is idle, perform subsequent operations.
  • the flash controller executes the standard control unit 813 to send a read operation command to the flash.
  • the flash controller executes a standard control unit 814 to send a variable length address to the flash.
  • the address includes the flash page address and the spare area address of the flash.
  • the flash controller executes the standard control unit 815, waiting for the flash to decode the address.
  • the standard control unit 816 is executed to instruct the flash to read the main data and its error correction code from the flash storage area according to the flash page address sent by the flash controller. Flash in the cache.
  • the flash controller executes the standard control unit 817, and checks the free/busy state of the flash again to determine whether the read data (main data and its error correction code) is completed. If done, continue with the next steps.
  • the flash controller executes the standard control unit 818, performs DMA transfer, and reads the error correction code in the flash buffer into the check code buffer of the flash controller according to the spare area address of the flash sent by the flash controller.
  • the flash controller returns to the idle state 811 begins the second phase of the read operation.
  • the enable parameters of the standard control units 813, 814, 815, 818, and 819 are configured to be executed, and the enable parameters of the configuration standard control units 812, 816, and 817 are bypassed.
  • Standard control unit 812 is not executed.
  • the flash controller executes the standard control unit 813, rewrites the address, and points the address pointer to the main data area of the flash.
  • the flash controller executes the standard control unit 814 to send the address of the flash's main data area to the flash.
  • the flash controller executes the standard control unit 815, waiting for the flash to decode the address.
  • the standard control unit 816 command is not executed.
  • the standard control unit 817 command is not executed.
  • the flash controller executes the standard control unit 818 for DMA transfer, starting with
  • the flash controller executes a standard control unit 819, instructing the verification unit to save the result of verifying the currently read main data block and verifying the next read main data block. Be prepared until the main data blocks in the flash's cache are all read. The flash controller returns to the idle state 811 again, and the read operation is completed.
  • the writing unit will be described below as an example.
  • S_rbi_0 standard control unit 822
  • S_cmd_0 standard control unit 823
  • S_addr standard control unit 824
  • S_wait standard control unit 825
  • S_dma standard control unit 826
  • S_count standard control unit
  • the write operation is also divided into two phases.
  • the reconfigurable control unit is in an idle initial state 811, the enable parameters of the configuration standard control units 822 to 827 are executed, and the enable parameter of the configuration standard control unit 828 is bypassed.
  • the flash controller is in an idle initial state 821.
  • the flash controller After receiving a command to initiate a write operation of the CPU, the flash controller executes a standard control unit 822 to detect the free/busy state of the flash.
  • the flash controller executes the standard control unit 823 to send a write operation command to the flash.
  • the flash controller executes the standard control unit 824 to send a variable length address to the flash.
  • the address includes the flash page address and the flash's main data area address.
  • the flash controller executes the standard control unit 825, waiting for the flash to decode the address.
  • the flash controller executes the standard control unit 826, and performs DMA transfer.
  • the main data is written to the flash buffer in 512 bytes as a data block according to the main data area address of the flash.
  • the flash controller executes a standard control unit 827 to instruct the check unit to buffer the check data generated for the currently written main data block, and generate a check for the next written main data block.
  • the data is prepared until the main data is written to the flash cache.
  • the standard control unit 828 is not executed.
  • the flash controller returns to the idle state to begin the second phase of the write operation.
  • the standard control units 823 to 826 are first configured, and the enable parameters of the standard control unit 828 are executed, and the enable parameters of the standard control units 822 and 827 are bypassed.
  • Standard control unit 822 is not executed.
  • the flash controller executes the standard control unit 823, rewrites the address, and points the address pointer to the spare area of the flash.
  • the flash controller executes a standard control unit 824, which sends the spare area address of the flash to the flash.
  • the flash controller executes the standard control unit 825, waiting for the flash to decode the address.
  • the flash controller executes the standard control unit 826, performs DMA transfer, and writes the error correction code into the flash buffer according to the spare area address of the flash.
  • the flash controller executes the standard control unit 828, instructing the flash to write the main data and its error correction code from the flash buffer to the flash storage area according to the flash page address sent by the flash controller.
  • the standard control unit 827 command is not executed.
  • the controller returns to the idle state 821 and the write operation is completed.
  • the action states of all the reconfigurable control units are designed according to the read and write characteristics of the flash.
  • the configuration can be arbitrarily reduced.
  • Each standard control unit can be executed or bypassed according to various requirements, and various controls are reconstructed. Read and write timing.
  • the reading unit and the writing unit shown in FIG. 8 may be two independent standard processes, implemented by different hardware or software, or may be a standard process of data access, by executing Or bypass the standard control unit in the standard process to achieve specific read or write functions.
  • Figure 9 is a standard flow chart for combining a read unit and a write unit to form a read/write access control unit.
  • S_rbi_0 standard control unit 902
  • S_cmd_0 standard control unit 903
  • S_addr standard control unit 904
  • S_wait standard control unit 905
  • S_cmd_l standard control unit 906
  • S_rbi_l standard control unit 907
  • S_dma standard control unit 908
  • S_count standard The sequential execution of control unit 909
  • S_cmd_2 standard control unit 910
  • the read operation can be divided into two stages.
  • the enable parameters of the standard control units 902 to 908 are configured for execution, and the enable parameters of the standard control units 909 and 910 are bypassed.
  • the enable parameters of the standard control units 903, 904, 905, 908, and 909 are configured for execution, and the enable parameters of the configuration standard control units 902, 906, 907, and 910 are bypassed.
  • the specific control flow is shown in Figure 8, and will not be described here.
  • Write operations can also be divided into two phases.
  • the enable parameters of the standard control units 902 to 905, 908, and 909 are configured to be executed in the first phase, and the enable parameters of the configuration standard control units 906, 907, and 910 are bypassed.
  • the specific execution flow is as shown in FIG. 8 and will not be described here.
  • the enable parameters of the standard control units 903, 904, 905, 908, and 910 are configured to be executed, and the enable parameters of the configuration standard control units 902, 906, 907, and 909 are bypassed.
  • the function of the second stage of FIG. 8 can be implemented by replacing the standard control unit 910 in FIG. 9 with the standard control unit 828 in the specific execution process, and details are not described herein again.
  • a read/write operation can transmit data of one page of flash, and data of one page is divided into a plurality of segments.
  • the data is segmented by the S_count state and transmitted by the S_dma state. .
  • the CPU can send multiple sets of commands into the flash controller at a time. After executing a set of commands, the flash controller can automatically execute the next set of commands. In this way, the CPU intervention of the hardware during the read/write process is reduced. The efficiency of hardware execution.
  • the existing flash controllers are all based on the 512 Bytes data block. If the operation of processing a 4 kBytes flash page requires the CPU to perform eight control operations, the CPU provides only the technical solution provided by the embodiment of the present invention. It needs to be controlled once to complete. Therefore, the hardware implementation of the technical solution provided by the embodiment of the present invention is more efficient than the prior art.
  • the existing error correction code algorithm requires 1K multiple clock cycles to complete each error correction code check in the case of main data error, but each main data block has only 512 Bytes, and each main data block is only required to be read. 512 clock cycles, so after the main data read of each block is completed, at least 512 clock cycles are required to process the error correction code check of the current block, and the main data read has to be suspended.
  • the technical solution provided by the embodiment of the present invention adopts a three-stage pipeline error correction code check, and each level of operation is completed in 512 clock cycles, and the flash controller reads the main data in the flash is no longer received.
  • the operation limitation of the error correction code, the main data reading and the error correction code verification are performed in parallel, and do not affect each other. This mode can at least double the peak speed of the flash read operation.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)

Description

一种闪存的数据访问方法及数据访问控制器
技术领域
本发明涉及闪存技术 , 特别是涉及一种闪存控制器及其控制方法。 发明背景
闪存(Flash Memory )存储介质是一种非易失性的存储器, 具有掉 电后内部信息仍可备用, 以及可被反复擦除再编程等特点。 目前, 以闪 存作为存储介质的嵌入式系统被广泛应用。
现有 flash控制器主要都是以数据块(通常大小为 512Bytes )为基本 的处理单元, 同时进行差错检测及纠正 ( Error Checking and Correcting , ECC )纠错。 现有的技术方案中, 每一个 512Bytes主数据块( Main Data Block )传输结束后需要重新发送命令和地址开始下一个 512Bytes主数 据块传输, 即需要在一个 512Bytes主数据块传输和及其 ECC纠错完成 之后才开始下一 512Bytes主数据块的传输,也就是现有的方案主要采用 串行执行的方式。 发明内容
本发明的实施例提供了一种闪存的数据访问方法及数据访问控制 器, 以解决现有技术中闪存控制器控制效率低下的问题。
本发明的实施例提供了一种闪存的数据访问控制方法, 包括: 将至少一个主数据块连续输出至 flash的緩存区, flash的緩存区用 于緩存准备输入到 flash存储区的数据;
在输出至少一个主数据块的同时, 依次为每一主数据块生成校验数 据并緩存; 将所緩存的至少一个主数据块的校验数据输出至 flash的緩存区。 本发明的实施例还提供了一种闪存的数据访问控制方法, 包括: 緩存来自 flash的緩存区的至少一个主数据块的校验数据, flash的 緩存区中緩存有来自 flash存储区的至少一个主数据块及其校验数据; 从 flash的緩存区中连续读取至少一个主数据块;
在连续读取至少一个主数据块时, 使用所緩存的至少一个主数据块 的校验数据依次对至少一个主数据进行校验。
本发明的实施例还提供了一种闪存的数据访问控制器, 包括: 第一单元,用于将至少一个主数据块连续输出至 flash的緩存区;在 第二单元将其緩存的至少一个主数据块的校验数据全部输出到 flash 的 緩存区后, 将 flash 的緩存区中的至少一个主数据块及其校验数据写入 flash的存储区;
第二单元,用于在第一单元将至少一个主数据块输出至 flash的緩存 区时为每一主数据块生成校验数据并緩存; 将所緩存的至少一个主数据 块的校验数据输出至 flash的緩存区。
本发明的实施例还提供了一种闪存的数据访问控制器, 包括: 第一单元,用于从 flash的存储区中将至少一个主数据块及其校验数 据连续传输到 flash的緩存区, 指令 flash的緩存区将校验数据传输到第 二单元, 从 flash的緩存区中连续读取至少一个主数据块;
第二单元,用于緩存来自 flash的緩存区的至少一个主数据块的校验 数据,并在第一单元从 flash的緩存区读取至少一个主数据块时对所緩存 的校验数据进行校验。
本发明的实施例还提供了一种使用控制器控制数据访问的方法, 其 中控制器包括用于生成校验码和对主数据进行校验的校验单元和至少 一个标准控制单元, 每一标准控制单元用于实现至少一种数据访问功能 并具有一个使能参数。 至少一个标准控制单元包括忙闲检测单元、 第一 命令单元、 第二命令单元、 地址发送单元、 传输单元以及切换单元; 该 方法包括以下步骤:
配置各个标准控制单元的执行顺序由先到后依次为: 忙闲检测单 元、 第一命令单元、 地址发送单元、 传输单元、 切换单元以及第二命令 单元, 并以此执行顺序作为标准流程;
数据访问过程包括第一 P介段和第二阶段;
在第一 p介段, 配置忙闲检测单元、 第一命令单元、 地址发送单元、 传输单元以及切换单元的使能参数为执行, 配置第二命令单元的使能参 数为旁路;
在第一 p介段中执行标准流程时, 当忙闲检测单元检测到 flash 空闲 时, 第一命令单元向 flash发送写操作命令, 地址发送单元向 flash发送 第一地址, 传输单元根据地址发送单元发送的第一地址将至少一个主数 据块写入 flash的緩存区中,每写入一个主数据块,切换单元指示校验单 元緩存为当前写入的主数据块生成的校验数据, 并为下一个写入的主数 据块生成校验数据做准备;
在第二阶段, 配置第一命令单元、 地址发送单元、 传输单元、 切换 单元以及第二命令单元的使能参数为执行, 配置忙闲检测单元以及切换 单元的使能参数为旁路;
在第二阶段中执行标准流程时,第一命令单元向 flash发送改写地址 命令, 地址发送单元将第二地址发送到 flash , 传输单元根据地址发送单 元发送的第二地址将至少一个主数据块的校验数据连续输出到 flash 的 緩存区,第二命令单元将 flash的緩存区中的至少一个主数据块及其校验 数据输出到 flash的存储区。
本发明的实施例还提供了一种使用控制器控制数据访问的方法, 其 中, 控制器包括用于生成校验码和对主数据进行校验的校验单元和至少 一个标准控制单元, 每一标准控制单元用于实现至少一种数据访问功能 并具有一个使能参数, 至少一个标准控制单元包括第一忙闲检测单元、 第二忙闲检测单元、 第一命令单元、 第二命令单元、 地址发送单元、 传 输单元以及切换单元;
配置各个标准控制单元的执行顺序由先到后依次为: 第一忙闲检测 单元、 第一命令单元, 地址发送单元、 第二命令单元、 第二忙闲检测单 元、 传输单元以及切换单元, 并以此执行顺序作为标准流程;
数据访问过程包括第一 Ρ介段和第二阶段;
在第一 ρ介段, 配置第一忙闲检测单元、 第一命令单元, 地址发送单 元、第二命令单元、第二忙闲检测单元以及传输单元的使能参数为执行, 配置切换单元的使能参数为旁路;
在第一阶段中执行标准流程时, 当第一忙闲检测单元检测到 flash 空闲时, 第一命令单元向 flash发送读操作命令, 地址发送单元向 flash 发送第三地址,第二命令单元指示 flash根据地址发送单元发送的第三地 址将至少一个主数据块及其校验数据从 flash的存储区读取到 flash的緩 存区, 第二忙闲检测单元检测到 flash空闲时, 传输单元读取 flash緩存 区中的校验码数据;
在第二阶段, 配置第一命令单元, 地址发送单元、 传输单元以及切 换单元的使能参数为执行, 第一忙闲检测单元、 第二命令单元、 第二忙 闲检测单元的使能参数为旁路;
在第二阶段中执行标准流程时,第一命令单元向 flash发送改写地址 命令,地址发送单元向 flash发送第四地址,传输单元根据地址发送单元 发送的第四地址连续读取至少一个主数据块, 每读取一个主数据块, 切 换单元指示校验单元保存对当前读取的主数据块进行校验的结果并为 对下一个读出的主数据块进行校验做准备。
本发明的实施例还提供了一种使用控制器控制数据访问的方法, 其 特征在于, 控制器包括用于生成校验码和对主数据进行校验的校验单元 和至少一个标准控制单元, 每一标准控制单元用于实现至少一种数据访 问功能并具有一个使能参数, 至少一个标准控制单元包括第一忙闲检测 单元、 第二忙闲检测单元、 第一命令单元、 第二命令单元、 第三命令单 元、 地址发送单元、 传输单元以及切换单元:
配置各个标准控制单元的执行顺序由先到后依次为: 第一忙闲检测 单元、 第一命令单元, 地址发送单元、 第二命令单元、 第二忙闲检测单 元、 传输单元、 切换单元以及第三命令单元, 并以此执行顺序作为标准 流程;
数据访问过程包括写操作和 /或读操作,写操作包括第一 P介段和第二 P介段; 读操作包括第三阶段和第四阶段;
在第一 p介段, 配置第一忙闲检测单元、 第一命令单元、 地址发送单 元、 传输单元以及切换单元的使能参数为执行, 配置第二命令单元、 第 二忙闲检测单元以及第三命令单元的使能参数为旁路;
在第一阶段中执行标准流程时, 当第一忙闲检测单元检测到 flash 空闲时, 第一命令单元向 flash发送写操作命令, 地址发送单元向 flash 发送第一地址, 传输单元根据地址发送单元发送的第一地址将至少一个 主数据块写入 flash的緩存区中,每写入一个主数据块,切换单元指示校 验单元緩存为当前写入的主数据块生成的校验数据, 并为下一个写入的 主数据块生成校验数据做准备;
在第二阶段, 配置第一命令单元、 地址发送单元、 传输单元、 切换 单元以及第二命令单元的使能参数为执行, 配置第一忙闲检测单元、 第 二忙闲检测单元、 切换单元以及第三命令单元的使能参数为旁路; 在第二阶段中执行标准流程时,第一命令单元向 flash发送改写地址 命令, 地址发送单元将第二地址发送到 flash , 传输单元根据地址发送单 元发送的第二地址将至少一个主数据块的校验数据连续输出到 flash 的 緩存区,第二命令单元将 flash的緩存区中的至少一个主数据块及其校验 数据输出到 flash的存储区;
在第三阶段, 配置第一忙闲检测单元、 第一命令单元, 地址发送单 元、第二命令单元、第二忙闲检测单元以及传输单元的使能参数为执行, 配置切换单元以及第三命令单元的使能参数为旁路;
在第三阶段中执行标准流程时, 当第一忙闲检测单元检测到 flash 空闲时, 第一命令单元向 flash发送读操作命令, 地址发送单元向 flash 发送第三地址,第二命令单元指示 flash根据地址发送单元发送的第三地 址将至少一个主数据块及其校验数据从 flash的存储区读取到 flash的緩 存区, 第二忙闲检测单元检测到 flash空闲时, 传输单元读取 flash緩存 区中的校验码数据;
在第四阶段, 配置第一命令单元, 地址发送单元、 传输单元以及切 换单元的使能参数为执行, 第一忙闲检测单元、 第二命令单元、 第二忙 闲检测单元以及第三命令单元的使能参数为旁路;
在第四 p介段中执行标准流程时,第一命令单元向 flash发送改写地址 命令,地址发送单元向 flash发送第四地址,传输单元根据地址发送单元 发送的第四地址连续读取至少一个主数据块, 每读取一个主数据块, 切 换单元指示校验单元保存对当前读取的主数据块进行校验的结果并为 对下一个读出的主数据块进行校验做准备。
本发明实施例提供的技术方案在 flash控制器中设置了校验码緩存, 接收到 CPU发送的启动写操作的命令后,在传输主数据块的同时,生成 该主数据块的校验数据,并将校验数据緩存与 flash控制器的校验码緩存 中, 等到主数据块传输完毕后, 将校验数据一次传输到 flash中。 因为主 数据的处理和校验码的处理是并行进行的, 可以一次传输多个主数据 块, 在所有的主数据块传输完后再传输校验数据, 因此在传输多个主数 据块时只需要 CPU发一次写操作启动命令。 而现有技术在 CPU发送写 数据启动命令后, 因为不能緩存校验数据, 只能传输完一个主数据块后 紧接着传输该主数据块的校验数据。下一次传输主数据块又需要 CPU再 一次发写操作启动命令。 因此本发明实施例提供的技术方案与现有技术 相比能避免 CPU频繁地干涉, 提高了数据访问的效率。
同样在进行读操作时, 因为可以首先将校验数据全部传输到 flash 控制器的緩存中, 在进行校验的时候就不需要每传输一个主数据块时都 必须到 flash中读取该主数据块的校验数据。因此也避免了每传一次主数 据块 CPU都会进行干涉的情况, 提高了数据访问的效率。
同时由于采用了可重构的控制单元来构成标准流程, 使得在现有的 控制单元不能满足要求时, 可以只更换其中的某些标准控制单元, 而无 需更换整个控制单元, 因此增加了 flash控制器的灵活性和可扩充性。 附图简要说明
图 1为现有技术 flash写操作的时序示意图;
图 2为现有技术 flash读操作的时序示意图;
图 3为依据本发明实施例的 flash控制器的总体结构示意图; 图 4为依据本发明实施例的写操作的 flash控制器的结构示意图; 图 5为依据本发明实施例的读操作的 flash控制器的结构示意图; 图 6为依据本发明实施例的写操作的时序示意图;
图 7为依据本发明实施例的读操作的时序示意图;
图 8为依据本发明实施例的可重构的控制单元的标准流程示意图; 图 9为依据本发明另一实施例的可重构的控制单元的标准流程示意 图。 实施本发明的方式
在现有的技术方案中,以 512Bytes的主数据块为一个单元进行写操 作, 具体的流程如下: 首先 flash控制器接收 CPU发送的 flash写操作指 令,将写操作的地址指针指向 flash的主数据区,并将一个主数据块写入 flash的緩存的主数据区中, 同时纠错码的编码器一起进行编码。 当这个 主数据块传输完成后, 编码器也完成编码并输出校验数据, 如纠错码。 Flash控制器将写操作的地址指针指向 flash的备用 (Spare ) 区, 将编码 结果写入 flash的緩存的备用区, 然后将 flash緩存中的一个主数据及其 校验数据(如纠错码)发送到 flash的存储区。 最后 flash控制器把编码 结果返回给 CPU, CPU检查了编码结果之后向 flash控制器发送命令进 行下一个主数据块的写操作。
图 1是现有技术中写操作的时序图, 如图 1所示, 步骤 111中 flash 控制器接收到 CPU发送的进行 512Bytes写操作的命令, 启动步骤 112 写入 512Bytes的主数据块,与此同时步骤 113生成该主数据块的校验数 据。 从时序图中可以看出步骤 112和步骤 113都占用 512个时钟周期。 步骤 114在每一次将 512Bytes的主数据块写入 flash之后向 CPU返回编 码结果( GET RESULT0 ), 步骤 115由 CPU给出下一个 512Bytes写操 作的命令 ( GIVE CMD1 )。 开始从步骤 121到步骤 125的完成下一个主 数据块的写入。本发明的发明人发现这种方式由于 CPU的频繁干涉, 占 用了额外的时钟资源, 整个 flash写操作的效率低下。
在现有的技术方案中,同样以 512Bytes的主数据块为一个单元进行 读操作, 具体的流程如下: 首先 flash控制器接收 CPU发送的 flash读操 作指令,将需要读取的主数据块及其纠错码读取到 flash的緩存中,并将 读操作的地址指针指向 flash的备用区,将当前需要读取的一个主数据块 的纠错码读取到 flash控制器中。接着将 flash地址指针指向 flash的主数 据区, 从 flash的緩存的主数据区中读取该主数据块, 同时纠错码的 B 算法也一起进行处理。 当该主数据块读取完成后, 如果 B算法的处理结 果显示主数据出错,将 B算法的处理结果输出到 C算法中进行计算,将 C算法的结果输入 D算法中进行计算。 最后 flash控制器把结果返回到 CPU, CPU检查了结果之后向 flash控制器发送命令, 进行下一个主数 据块的读操作。在本次读操作中所有的主数据块读取完毕后, 向 CPU发 送错误数据报告, 其中包括本次读操作中发生错误的主数据块的地址。
图 2是现有技术中读操作的时序图, 如图 2所示, 步骤 211中 flash 控制器接收到 CPU发送的读操作命令, 启动步骤 212读取 512Bytes的 主数据块。 于此同时步骤 213对所读取的主数据块进行校验, 从时序图 可以看出, 步骤 212和步骤 213都占用 512个时钟周期。 此时如果步骤 213的校验结果显示数据发生错误, 步骤 214和步骤 215以串行的方式 对错误数据进行处理。 在步骤 216中, flash控制器将串行处理的结果发 送给 CPU。 步骤 217中, CPU给出下一个读操作命令。从步骤 221到步 骤 227完成下一个主数据块的读取。 本发明的发明人发现现有技术的这 种读取 flash主数据的方式由于 CPU的频繁干涉, 占用了额外的时钟周 期, 整个 flash读操作的效率低下。 同时, 如图 2所示, 本发明的发明人 还发现如果算法 B处理的结果显示主数据发生错误, 还需要执行算法 C 和算法 D以进行数据纠错, 此时读取 flash主数据的完整过程会占用更 多的时钟周期,读操作的效率更加低下。并且在执行 C算法或 D算法的 电路工作时, 读取主数据的电路和执行 B算法的电路处于空闲状态, 硬 件的利用率也不高。 从上面的叙述可以看出, 本发明的发明人发现现有技术中所有的操 作都是以 512Bytes 的数据块为基本的操作单元, 读 /写操作以串行操作 的方式进行的, 当控制器某部分电路在工作的时候, 其他部分电路都是 处于空闲状态, 如读操作对主数据进行 ECC校验时如果发现主数据出 错, 会采用 3级纠错的电路结构进行纠错, 每一级纠错电路的输入基于 上一级纠错电路的输出, 在现有的技术方案中, 在第二级纠错的电路进 行时, 其他两级纠错电路因为没有输入而处于空闲状态, 同时, 由于读 取 512Bytes的主数据块需要 512个时钟周期,而每进行一级纠错所需的 时间接近 512个时钟周期, 因此造成在进行后两级纠错时, 对应的主数 据传输已经结束, 主数据传输的电路处于空闲状态。 由于现有技术中每 一个 512Bytes主数据块都需要 flash控制器接收 CPU的控制命令和对控 制器的工作状态的配置、将地址在 flash的主数据区和备用区进行切换以 及将操作结果回传给 CPU, 因此, 现有方案在进行每一个 512Bytes主 数据块的读写时都需要切换 flash地址以及需要 CPU对 flash控制器的控 制, 造成了读写的效率低下; 此外, 在主数据读操作中, 由于采用了三 级纠错的结构, 每一级纠错所需时间接近 512个时钟周期, 三级纠错所 需的时间超过 1000 个时钟周期, 远超过读取一个主数据块所需的 512 个时钟周期。 现有技术中, 每一个完整的 512Bytes的主数据块读取流程 都需要对应的 ECC纠错完成, 因此在读取的主数据块出现错误时,读取 一个 512Bytes 主数据块实际所需的时间远远超过纯粹的主数据块读取 时间, 造成了 ECC制约传输性能的情况。
此外, 现在 flash页 (page ) 大小已经达到了 4KBytes, 客观上需要 能够提供页内任意大小的读写,并同时能进行 ECC纠错, 而没有必要必 须以 512Bytes为一个单元进行 flash主数据的读写,现有的只以 512Bytes 为一个单元进行读写的技术已经不能满足实际应用的需要。 因此,本发明的发明人提供了一种对 flash进行访问控制的方法以及 相应的 flash控制器, 下面结合附图对本发明实施例做详细说明。
图 3为该 flash控制器的结构示意图。 如图 3所示, 该 flash控制器 至少包括可重构的控制单元 320和校验单元 330。 其中可重构的控制单 元 320, 即第一单元用于在进行写操作时将至少一个主数据块连续输出 到 flash的緩存区, 在校验单元 330, 即第二单元将其緩存的至少一个主 数据块的校验数据全部输出到 flash的緩存区后,可重构的控制控制单元 320将 flash的緩存区中的至少一个主数据块及其校验数据写入 flash的 存储区。 校验单元 330用于在可重构的控制单元 320将至少一个主数据 块输出至 flash的緩存区时为每一主数据块生成校验数据并緩存;将所緩 存的至少一个主数据块的校验数据输出至 flash的緩存区。在进行读操作 时,可重构的控制单元 320用于从 flash的存储区中将至少一个主数据块 及其校验数据连续输出到 flash的緩存区, 从 flash的緩存区将校验数据 输出到校验单元 330, 从 flash的緩存区中连续输出至少一个主数据块。 校验单元 330用于緩存可重构的控制单元 320从 flash的緩存区输出的校 验数据,并在可重构的控制单元 320从 flash的緩存区输出至少一个主数 据块的同时对校验数据进行校验。
flash控制器还可以进一步包括内部接口单元 310, 即第三单元。 可 重构的控制单元 320用于在通过内部接口单元 310接收 CPU发送的写操 作启动命令后,将至少一个主数据块连续输出至 flash的緩存区,并在将 flash的緩存区中的至少一个主数据块及其校验数据写入 flash的存储区 后通过内部接口单元 310向 CPU发送中断, 接收来自 CPU的状态上报 命令,向 CPU发送指示写操作是否成功的状态信息。可重构的控制单元 320还在通过内部接口单元 310接收 CPU发送的读操作启动命令后,将 至少一个主数据块及其校验数据从 flash的存储区输出到 flash的緩存区, 并在输出 flash的緩存区中的至少一个主数据块后通过内部接口单元 310 向 CPU发送中断,接收来自 CPU的状态上报命令, 向 CPU发送指示读 操作是否成功的状态信息。
flash控制器还可以进一步包括 flash接口单元 340, 即第四单元。可 重构的控制单元 320通过 flash接口单元 340将至少一个主数据块连续输 出至 flash的緩存区; 并通过 flash接口单元 340将所緩存的校验数据输 出至 flash的緩存区。 可重构的控制单元 320还通过 flash接口单元 340 从 flash的緩存区中将至少一个主数据块连续输出。 校验单元 330通过 flash接口单元 340输出 flash的緩存区中的校验数据。
校验单元 330包括以下模块: 校验码緩存 331 , 即第二模块 331用 于緩存通过 flash接口单元 340输出的校验数据和 ECC_A模块 332 , 即 第一模块 332生成的校验数据。 ECC_A模块 332用于在可重构的控制单 元 320将至少一个主数据块输出至 flash的緩存区时,为每一个主数据块 生成校验数据, 并将校验码緩存 331所緩存的至少一个主数据块的校验 数据输出至 flash的緩存区。 ECC_B模块 333 , 即第三模块 333用于针 对可重构的控制单元 320从 flash的緩存区中连续输出的每一个主数据 块, 利用第一算法处理本主数据块存储在校验码緩存上的校验数据, 并 判断本主数据块是否发生错误, 当判断出一个主数据块发生了错误, 将 第一算法处理的结果发送到 ECC_C模块 334, 即第四模块 334; ECC_C 模块 334用于在 ECC_B模块 333判断一个主数据块发生错误的时候, 利用第二算法处理 ECC_B模块 333发送的第一算法处理的结果; ECC_D 模块 335 ,即第五模块 335用于利用第三算法处理 ECC_C模块 334发送 的第二算法处理的结果, 记录第三算法处理的结果, 并在至少一个主数 据块连续读取完毕后输出错误报告。
上述 flash控制器的功能也可以用两个单独的控制器来分别完成。 图 4介绍了本发明实施例进行写操作时 flash控制器的结构示意图。 如图 4所示,本发明实施例中的 flash控制器至少包括可重构的控制单元 320和校险单元 330。 其中, 可重构的控制单元 320用于将至少一个主 数据块连续输出至 flash的緩存区;在校验单元 330将其緩存的至少一个 主数据块的校验数据全部输出到 flash 的緩存区后, 可重构的控制单元 320将 flash的緩存区中的至少一个主数据块及其校验数据写入 flash的 存储区。 校验单元 330用于在可重构的控制单元将至少一个主数据块输 出至 flash的緩存区时为每一主数据块生成校验数据并緩存;将所緩存的 至少一个主数据块的校验数据输出至 flash的緩存区。
本发明实施例中的 flash控制器还可以包括内部接口单元 310。可重 构的控制单元 320用于在通过内部接口单元 310接收 CPU发送的写操作 启动命令时, 将至少一个主数据块连续输出至 flash 的緩存区, 并在将 flash的緩存区中的至少一个主数据块及其校验数据写入 flash的存储区 后通过内部接口单元 310向 CPU发送中断, 接收来自 CPU的状态上报 命令, 向 CPU发送指示写操作是否成功的状态信息。
本发明实施例中的 flash控制器还可以包括 flash接口单元 340。 可 重构的控制单元 320通过 flash接口单元 340将至少一个主数据块连续输 出至 flash的緩存区; 并通过 flash接口单元 340将所緩存的校验数据输 出至 flash的緩存区。
本发明实施例中的校验单元包括 ECC_A模块 332,即第一模块 332, 该模块用于在可重构的控制单元 320将至少一个主数据块输出至 flash 的緩存区时, 为每一个主数据块生成校验数据, 并将校验码緩存所緩存 的至少一个主数据块的校验数据输出至 flash的緩存区。校验码緩存 331 , 即第二模块 331用于緩存第一模块 332生成的校验数据。
具体阐述如下, 如图 4所示, flash接口单元 340负责向 flash转发 即将写入主数据块的 flash地址以及需要 flash内部操作的命令, 如指示 flash将其緩存中的数据写入 flash中的命令, flash接口单元 340还负责 转发 flash控制器和 flash之间传输的数据,如写入 flash的主数据块及其 校验数据; 校验码緩存 331主要存储校验数据, 如 ECC的纠错码, 以便 进行流水线模式的纠错码的编解码。 ECC_A编码算法模块 332负责为每 一个输入 flash的主数据块产生校验数据。可重构的控制单元 320控制整 个写操作进程, 在设计上采用了软件可配置的有限状态机(Finite State Machine, FSM )。 内部接口单元 310主要是内部接口总线, 负责转发可 重构的控制单元 320和 CPU之间的数据传输, 如转发 CPU发送的控制 命令(如写操作启动命令)和在主数据写入完成后向 CPU转发的中断等。
当写操作启动后, 主数据块首先从内部接口单元 310连续输入, 传 输到可重构的控制单元 320, 接着通过 flash接口单元 340, 把主数据块 连续地发送到 flash中。 在主数据传输的这个过程中, ECC编码器 332 ( ECC-A )作为纠错编码模块从可重构的控制单元获取主数据进行纠错 码编码, 并将编好的纠错码输入纠错码緩存 331。 进行纠错码编码的动 作与主数据传输的动作同步进行。
图 5介绍了本发明实施例进行 flash读操作时 flash控制器的结构示 意图。如图 5所示,该 flash控制器至少包括可重构的控制单元 320和校 验单元 330,其中可重构的控制单元 320用于从 flash的存储区中将至少 一个主数据块及其校验数据连续输出到 flash的緩存区, 从 flash的緩存 区将校验数据输出到校验单元 330,从 flash的緩存区中连续输出至少一 个主数据块。校验单元 330用于緩存可重构的控制单元 320从 flash的緩 存区读出的校验数据,并在可重构的控制单元 320从 flash的緩存区输出 至少一个主数据块的同时对校验数据进行校验。
其中, 可重构的控制单元 320用于在通过内部接口单元 310接收 CPU发送的读操作启动命令后, 将至少一个主数据块及其校验数据从 flash的存储区输出到 flash的緩存区, 并在输出 flash的緩存区中的至少 一个主数据块后通过内部接口单元 310向 CPU发送中断,接收来自 CPU 的状态上报命令,向 CPU发送指示读操作是否成功的状态信息。可重构 的控制单元 320通过 flash接口单元 340从 flash的緩存区中连续输出至 少一个主数据块。 校验单元 330通过 flash接口单元 340输出 flash的緩 存区中的校验数据。
其中, 校验单元包括校验码緩存 331 , 即第二模块 331 , 用于緩存 通过 flash接口单元 340输出的校验数据。 ECC_B模块 333 , 即第三模 块 333 ,用于针对可重构的控制单元 320从 flash的緩存区中连续输出的 每一个主数据块, 利用第一算法处理本主数据块存储在校验码緩存上的 校验数据, 并判断本主数据块是否发生错误。 当判断出一个主数据块发 生了错误,将第一算法处理的结果发送到 ECC_C模块 334, 即第四模块 334。 ECC_C模块 334用于在 ECC_B模块 333判断一个主数据块发生 错误的时候, 利用第二算法处理 ECC_B模块 333发送的第一算法处理 的结果。 ECC_D模块 335 ,即第五模块 335用于利用第三算法处理 ECC_C 模块 334发送的第二算法处理的结果, 记录第三算法处理的结果, 并在 所述至少一个主数据块连续读取完毕后输出错误报告。
具体阐述如下,如图 5所示,其中 flash接口单元 340用于转发 flash 控制器和 flash之间传输的数据, 如从 flash中读取的主数据块及其校验 数据,以及需要 flash内部操作的命令。校验码緩存 331用于存储从 flash 中读取的校验数据, 如纠错码。 解码算法模块 ECC_B、 ECC_C 以及 ECC_D 用于利用校验码緩存中存储的校验数据对读取的每一个主数据 块依次进行校验。 内部接口单元 310用于转发可重构的控制单元和 CPU 之间的数据传输, 如转发 CPU发送的控制命令 (如写操作启动命令 )和 在主数据写入完成后向 CPU转发的中断。可重构的控制单元 320用于控 制整个读操作进程。
当读操作启动后, 由于进行校验需要纠错码信息, 所以在主数据读 取前首先把 flash中的纠错码读取到校验码緩存 331。可重构的控制单元 320控制 flash接口单元 340向 flash发送读取命令和所要读取主数据的 地址, 连续读取主数据块到 flash接口单元 340, 并通过可重构的控制单 元 320将主数据继续传输到内部接口单元 310。 在将主数据读取到内部 接口单元 310的同时, 纠错码依次被送到 ECC_B纠错码模块 333进行 纠错计算。 如果 ECC_B纠错计算的结果显示主数据错误, ECC_B纠错 码模块 333 出来的结果会被依次送到 ECC_C模块 334和 ECC_D模块 335中进行计算, 与此同时, ECC_B模块 333继续后续主数据块的纠错 计算。 整个主数据块的传输过程就这样以流水线的方式执行下去。
在 flash控制器的控制下, 写操作时序图如图 6所示。 在步骤 601 中, 当接收到 CPU发送的写操作启动命令后,首先可重构的控制单元向 flash发送第一个命令 ( CMD0 )把 flash地址, 即写操作地址指针指向 CPU配置的地址, 也就是 flash中主数据区的地址。 并在步骤 602中, 通过可重构的控制单元发送主数据到 flash的緩存区中。从图 6可以看出 本发明实施例中一次写入 flash的数据量的大小不再只限于一个数据块, 如 512bytes, 而可以是 512bytes的整数倍大小,只要一次写入 flash的数 据量小于 flash中页的大小, 如 4kBytes即可。 一次写入 flash的数据量 可以根据需要来设置, 可以为 512Bytes、 lkBytes, 2kBytes和 4kBytes 等值。 可重构的控制单元不仅要控制主数据的传输操作, 还要控制 ECC 编码器的工作, 在步骤 603中, ECC编码器在主数据传输的时候也同步 进行 ECC编码; 由于 ECC算法是以一个数据块(如 512Bytes ) 的数据 为基本的计算单元, 所以步骤 602中在连续传输超过一个数据块的数据 量的时候, 可重构的控制单元会自动的切分主数据为一个以上传输单元
(一个传输单元可以为一个 512Bytes的数据块), 将本次写操作的主数 据全部写入 flash的緩存中。
在步骤 604 中, 当主数据被分成一个个 512Bytes的传输单元写入 flash的緩存中,同时生成的 ECC编码校验数据,即纠错码都被存在 flash 控制器的校验码緩存 ( spare data ram ) 中。 步骤 605中当主数据传输完 成后, 可重构的控制单元会自动的发送改写地址命令 CMD1 , 将 flash 地址指针从 flash的主数据区指向 flash的备用区, 步骤 606把暂存在校 验码緩存中的纠错码发送到 flash的备用 ( spare ) 区中。
在步骤 607中, 当所有的主数据都被发送到 flash的緩存中后,可重 构的控制单元会自动的发送编程命令 CMD2,把 flash緩存中的数据 (主 数据及其纠错码 )写到 flash的存储区中。
此时可重构的控制单元会向 CPU发出中断, CPU读取可重构的控 制单元中的状态信息, 即 CPU向可重构的控制单元发送状态上报命令, 可重构的控制单元向 CPU发送状态信息,确定本次写操作是否成功, 自 此本次写操作的流程完成。 CPU发送下一条启动写操作的命令, 进行下 一个写入的流程。
读操作时序图如图 7所示。在步骤 701中, 当接收到 CPU发送的读 操作启动命令后, 首先 Flash控制器向 flash发送第一个命令 ( CMD0 ) 把 flash地址指针指向被读空间, 即 flash的备用区; 接着把主数据及其 校验数据, 如纠错码从 flash的存储区中读取到 flash的緩存区中, 并且 通过步骤 702发送第二个命令 ( CMD1 )将 flash指针指向当前页的备用 数据区, 通过步骤 703进一步把 flash的緩存区中的纠错码读取到 flash 控制器的校验码緩存中。步骤 704指示发送数据的目的为 flash控制器的 校验码緩存。 在步骤 705中,当 flash的緩存区中的纠错码被读取到校验码緩存后, 发送第三个命令 ( CMD2 )把 flash的地址指针指向当前页 ( page )的主 数据区。 在步骤 706中, 可重构的控制单元启动主数据传输, 依次把需 要读取的主数据分割成大小为 512bytes的数据块, 将主数据块连续地从 flash中读取到 flash控制器中。 在步骤 707中, 同步的 ECC校验操作也 连续进行, 每一个 512bytes的主数据块在出现数据错误的时候进行纠错 需要差不多 1536个时钟周期, 并需要依次进行图 6中的三个算法, 即 步骤 707所示的 ECC_B、 步骤 708所示的 ECC_C和步骤 709所示的 ECC_D的执行, 而且后一个算法的执行需要基于前一个算法的结果,必 须要等到前一个算法执行完毕之后才可以进行。 这里所说的执行完毕可 以指一个主数据块的部分数据经过算法处理后输出, 而不需要整个主数 据块的数据经过算法处理后一起输出, 此时下一个步骤处理上一个步骤 输出的一个主数据块的部分数据的处理结果。 步骤 710记录每一个发生 错误的数据, 并在主数据块连续读取完毕后输出错误报告。
如图 7所示, 步骤 707所示的 ECC_B算法的执行与步骤 706所示 的传输一个主数据块的进程同时完成, 如果步骤 707的执行结果显示所 传输的主数据块出现错误,步骤 708会在步骤 707完成后启动,步骤 709 会在步骤 708完成后启动。 在步骤 707中一个主数据块的数据处理完毕 后, 步骤 708仍在对步骤 707的输出结果进行计算的同时, 后续主数据 块的传输和 ECC_B算法的执行仍然不间断的进行下去, 整个流程以流 水线方式进行, 直到所有的主数据块都被传输, 此时可重构的控制单元 会向 CPU发出中断, CPU读取可重构的控制单元中的状态信息,即 CPU 向可重构的控制单元发送状态上报命令,可重构的控制单元向 CPU发送 状态信息,确定本次写操作是否成功, 自此本次读操作的流程完成。 CPU 发送一条启动读主数据的命令, 进行下一个读的流程。 从上述技术方案可以看出, 在读 /写操作的时候, CPU 先把需要传 输的主数据大小、地址、命令等信息配置到 flash控制器中,接着对 flash 控制器发送启动命令, 在 flash控制器的整个操作过程中 CPU不再干预 控制器的操作。 当 flash控制器完成了所有的操作之后, 会向 CPU发出 中断, CPU读取 flash控制器中的状态信息, 确定本次读 /写操作是否成 功。 然而, 现有技术中, 每进行一次 512bytes主数据块的读或写, 都会 伴随着相应的校验数据的编解码, flash控制器就会向 CPU发出一次中 断,相比之下,本发明实施例所提供的技术方案能显著减少 flash控制器 与 CPU之间的交互 , 使得读 /写的效率得到明显提高。
图 8描述了可重构的控制单元的控制流程图, 每一个方框代表一个 执行动作或标准控制单元, 每一个标准控制单元用于实现至少一种数据 访问功能, 具体在运行中执行与否, 取决于软件的配置。 其中各个标准 控制单元的说明如下:
S_idle: 控制器空闲状态。
S_rbi_0:控制器第一次检测 flash的闲 /忙 ( ready/busy )状态。
S_cmd_0:控制器发送第一条命令。
S_addr: 控制器发送长度可变的地址。
S_wait:控制器等待 flash译码完成, 如果 flash的译码速率很快, 可 以不设置该标准控制单元。
S_cmd_l: 控制器发送第二条命令。
S_rbi_l: 控制器第二次检测 flash闲 /忙 ( ready/busy )状态。
S_dma: 控制器进行数据直接存储器存取 ( Direct Memory Access, DMA )传输。
S_count:控制器切换 ECC编解码器和段(sector )传输。
下面结合具体实施例来说明可重构的控制单元的标准控制流程。 在本发明的一个实施例中, 每一标准控制单元具有一个使能参数, 使用可重构的控制单元来控制数据访问的方法包括: 配置由至少一个标 准控制单元构成的标准流程。 在数据访问的每一 P介段, 按本阶段对应的 数据访问功能配置标准流程中每一标准控制单元的使能参数, 该使能参 数指示执行本标准控制单元的功能或旁路本标准控制单元; 执行标准流 程, 以完成对应于当前配置的各个使能参数的本阶段的数据访问功能。
首先以读取单元为例进行说明, 开始可重构的控制单元处于空闲的 初始状态 811在读操作中按照 S_rbi_0 (标准控制单元 812 )、 S_cmd_0 (标准控制单元 812 )、 S_addr (标准控制单元 813 )、 S_wait (标准控制 单元 814 )、 S_cmd_l (标准控制单元 815 )、 S_rbi_l (标准控制单元 816 )、 S_dma (标准控制单元 817 ) 以及 S_count (标准控制单元 818 ) 的先后 顺序执行可以构成一个标准流程。
读操作可以分为两个阶段。
第一个阶段开始时可重构的控制单元处于空闲的初始状态 811 , 配 置标准控制单元 812至 817的使能参数为执行, 配置标准控制单元 818 的使能参数为旁路。
在接到 CPU的启动读操作的命令后, flash控制器执行标准控制单 元 812, 检测 flash的忙 /闲状态。 如果 flash当前状态为闲, 执行后续操 作。
flash控制器执行标准控制单元 813 , 向 flash发送读操作命令。
flash控制器执行标准控制单元 814, 向 flash发送长度可变的地址。 地址中包括了 flash页地址和 flash的备用区地址。
flash控制器执行标准控制单元 815 , 等待 flash对地址的译码完成。 在步骤 flash控制器执行标准控制单元 816, 指示 flash根据 flash控 制器发送的 flash 页地址将主数据及其纠错码从 flash 的存储区读取到 flash的緩存中。
flash控制器执行标准控制单元 817 , 再次检查 flash的闲 /忙状态, 以确定读取数据(主数据及其纠错码)是否完成。 如果完成, 继续后续 步骤。
flash控制器执行标准控制单元 818, 进行 DMA传输, 根据 flash控 制器发送的 flash的备用区地址将 flash的緩存中的纠错码读取到 flash控 制器的校验码緩存中。
不执行标准控制单元 819。
flash控制器回到空闲状态 811开始读操作的第二个阶段。 首先配置 标准控制单元 813、 814、 815、 818和 819的使能参数为执行, 配置标 准控制单元 812、 816以及 817的使能参数为旁路。
不执行标准控制单元 812。
flash控制器执行标准控制单元 813 , 重新改写地址, 将地址指针指 向 flash的主数据区。
flash控制器执行标准控制单元 814,将 flash的主数据区的地址发送 到 flash。
flash控制器执行标准控制单元 815 , 等待 flash对地址的译码完成。 不执行标准控制单元 816命令。
不执行标准控制单元 817命令。
flash 控制器执行标准控制单元 818 , 进行 DMA 传输, 开始以
512bytes为一个数据块读取 flash的緩存中的主数据。
每读取一个主数据块, flash控制器执行一次标准控制单元 819, 指 示校验单元保存对当前读取的主数据块进行校验的结果并为对下一个 读出的主数据块进行校验做准备,直到 flash的緩存中的主数据块全部读 取完。 flash控制器再次回到空闲状态 811 , 读操作完成。
下面以写入单元为例进行说明。在写操作中按照 S_rbi_0 (标准控制 单元 822 )、 S_cmd_0 (标准控制单元 823 )、 S_addr (标准控制单元 824 )、 S_wait (标准控制单元 825 )、 S_dma (标准控制单元 826 )、 S_count (标 准控制单元 827 ) 以及 S_cmd_l (标准控制单元 828 ) 的先后顺序执行 可以构成一个标准流程。
写操作也分为两个阶段。
第一个阶段开始时可重构的控制单元处于空闲的初始状态 811 , 配 置标准控制单元 822至 827的使能参数为执行, 配置标准控制单元 828 的使能参数为旁路。
开始时 flash控制器处于空闲的初始状态 821。
在接到 CPU的启动写操作的命令后, flash控制器执行标准控制单 元 822 , 检测 flash的忙 /闲状态。
flash控制器执行标准控制单元 823 , 向 flash发送写操作命令。
如果 flash 当前状态为闲, flash控制器执行标准控制单元 824, 向 flash发送长度可变的地址。 地址中包括了 flash页地址和 flash的主数据 区地址。
flash控制器执行标准控制单元 825 , 等待 flash对地址的译码完成。 flash控制器执行标准控制单元 826, 进行 DMA传输, 将根据 flash 的主数据区地址, 以 512bytes为一个数据块将主数据写入到 flash的緩 存中。
每写入一个主数据块, flash控制器执行一次标准控制单元 827以指 示校验单元緩存为当前写入的主数据块生成的校验数据, 并为下一个写 入的主数据块生成校验数据做准备, 直到主数据全部写入 flash 的緩存 中。 不执行标准控制单元 828。
flash控制器回到空闲状态开始写操作的第二个阶段。首先配置标准 控制单元 823至 826, 以及标准控制单元 828的使能参数为执行, 配置 标准控制单元 822以及 827的使能参数为旁路。
不执行标准控制单元 822。
flash控制器执行标准控制单元 823 , 重新改写地址, 将地址指针指 向 flash的备用区。
flash控制器执行标准控制单元 824, 将 flash的备用区地址发送到 flash。
flash控制器执行标准控制单元 825 , 等待 flash对地址的译码完成。 flash控制器执行标准控制单元 826, 进行 DMA传输, 根据 flash的 备用区地址将纠错码写入 flash的緩存。
flash控制器执行标准控制单元 828 , 指示 flash根据 flash控制器发 送的 flash页地址将主数据及其纠错码从 flash的緩存写入到 flash的存储 区中。
不执行标准控制单元 827命令。
控制器回到空闲状态 821 , 写操作完成。
以上所有可重构的控制单元的动作状态都是根据 flash 的读写特性 设计的, 可以任意裁减配置, 可以根据各种需求执行或旁路控制中的每 一个标准控制单元, 重构成各种控制读写时序。
从以上可重构的控制单元的控制流程可以看出,两次读 /写单元的执 行可以完成一次读 /写操作, 而且每一次读 /写单元执行时都只需要在将 标准流程中的一些标准控制单元执行或旁路即可以实现对不同的数据 的访问, 而不需要设计新的标准控制单元,这种方式使得 flash控制器对 不同数据的兼容性大大提高。 同时, 由于读 /写数据是由多个标准控制单 元组合完成的, 在现有的控制单元不能满足要求时, 可以只更换其中的 某些标准控制单元, 而无需更换整个控制单元, 因此增加了 flash控制器 的灵活性和可扩充性。
在本发明的实施例中, 图 8所示的读取单元和写入单元可以是独立 的两个标准流程, 通过不同的硬件或软件来实现, 也可以是一个数据访 问的标准流程, 通过执行或旁路标准流程中的标准控制单元来实现具体 的读或者写的功能。 图 9为将读取单元和写入单元合在一起构成一个读 写访问控制单元的标准流程图, 如图 9 所示, 在写和 /或读操作中按照 S_rbi_0 (标准控制单元 902 )、 S_cmd_0 (标准控制单元 903 )、 S_addr (标准控制单元 904 )、 S_wait (标准控制单元 905 )、 S_cmd_l (标准控 制单元 906 )、 S_rbi_l (标准控制单元 907 )、 S_dma(标准控制单元 908 )、 S_count (标准控制单元 909 ) 以及 S_cmd_2 (标准控制单元 910 ) 的先 后顺序执行可以构成一个标准流程。
其中, 读操作可以分成两个阶段。 在第一个阶段中配置标准控制单 元 902至 908的使能参数为执行, 配置标准控制单元 909以及 910的使 能参数为旁路。 第二个阶段中配置标准控制单元 903、 904、 905、 908 以及 909的使能参数为执行,配置标准控制单元 902、 906、 907以及 910 的使能参数为旁路。 具体的控制流程如图 8中的读取单元, 在此不再赘 述。
写操作也可以分成两个阶段。 在第一个阶段中配置标准控制单元 902至 905、 908以及 909的使能参数为执行, 配置标准控制单元 906、 907以及 910的使能参数为旁路。 具体执行流程如图 8中的写入单元, 在此不再赘述。 在第二个阶段中配置标准控制单元 903、 904、 905、 908 以及 910的使能参数为执行,配置标准控制单元 902、 906、 907以及 909 的使能参数为旁路。 与图 8中的写入单元的第二阶段比较可以看出, 在 具体执行流程中将图 9中的标准控制单元 910换成标准控制单元 828即 可实现图 8第二阶段的功能, 在此不再赘述。
在本发明实施例所提供的技术方案中,一次读 /写操作可以传输 flash 一个 page的数据, 一个 page的数据被分成很多个段(sector )数据由 S_count状态切分并由 S_dma状态进行数据传输。
CPU一次可以发送多组命令进 flash控制器, flash控制器在执行完 一组命令后, 可以自动执行下一组命令, 通过这样的方式减小了读 /写过 程中 CPU对硬件的干预, 提高了硬件的执行效率。
与现有技术对比:
现有的 flash控制器都是以 512Bytes的数据块为基本的处理单元, 如果处理一个 4kBytes的 flash页的操作需要 CPU进行八次控制操作才 能完成; 采用本发明实施例提供的技术方案, CPU只需要进行一次控制 操作就可以完成。 因此和现有技术相比, 本发明实施例提供的技术方案 的硬件执行效率更高。
现有的纠错码算法在主数据出错的情况下每进行一次纠错码校验 都需要 1K多个时钟周期才能完成,但是每一个主数据块只有 512Bytes, 每一个主数据块读取只需要 512个时钟周期, 因此在每一个 block的主 数据读取完成后,至少需要再等待 512个时钟周期才能处理完当前 block 的纠错码校验, 主数据读取就不得不暂停。 本发明的实施例所提供的技 术方案采用了三级流水线的纠错码校验, 每一级操作都是在 512个时钟 周期完成, flash控制器对 flash中主数据的读取就不再受到纠错码的操 作限制, 主数据读取和纠错码校验并行进行, 互不影响。 这种模式至少 可以使 flash读操作峰值速度提高一倍。
以上所述, 仅为本发明的实施例而已, 并非用于限定本发明的保护 范围。

Claims

权利要求书
1、 一种闪存 flash的数据访问控制方法, 其特征在于, 包括: 将至少一个主数据块连续输出至 flash的緩存区, 所述 flash的緩存 区用于緩存准备输入到 flash存储区的数据;
在输出所述至少一个主数据块的同时, 依次为每一主数据块生成校 验数据并緩存;
将所緩存的所述至少一个主数据块的校验数据输出至所述 flash 的 緩存区。
2、 根据权利要求 1所述的控制方法, 其特征在于,
在所述至少一个主数据的校验数据输出完毕后,所述 flash的緩存区 中的主数据块及其校验数据被输出至所述 flash的存储区。
3、 根据权利要求 1或 2所述的控制方法, 其特征在于, 所述将所 述的至少一个主数据块输出到所述 flash的緩存区包括:
将写地址指针指向 flash的主数据区;
根据所述写地址指针将所述的至少一个主数据块输出到所述 flash 的緩存区。
4、 根据权利要求 1或 2所述的控制方法, 其特征在于, 所述将所 緩存的所述至少一个主数据块的校验数据输出到所述 flash 的緩存区包 括:
将写地址指针指向 flash的备用 Spare区;
根据所述写地址指针将所緩存的所述至少一个主数据块的校验数 据输出到所述 flash的緩存区。
5、 根据权利要求 1或 2所述的控制方法, 其特征在于,
将至少一个主数据块输出至 flash的緩存区前,接收来自中央处理单 元 CPU的写数据启动命令; 将所述 flash的緩存区中的主数据块及其校验数据输出到所述 flash 的存储区后, 向所述 CPU发出中断, 并接收来自所述 CPU的状态上报 命令, 向所述 CPU发送用于指示写操作是否成功的状态信息。
6、 一种 flash的数据访问的控制方法, 其特征在于, 包括: 緩存来自 flash的緩存区的至少一个主数据块的校验数据,所述 flash 的緩存区中緩存有来自 flash存储区的所述至少一个主数据块及其校验 数据;
从 flash的緩存区中连续读取所述至少一个主数据块;
在连续读取所述至少一个主数据块时, 使用所緩存的所述至少一个 主数据块的校验数据依次对所述至少一个主数据进行校验。
7、 根据权利要求 6所述的控制方法, 其特征在于, 所述 flash的緩 存区緩存的至少一个主数据块及其校验数据从所述 flash存储区连续传 输至所述 flash的緩存区。
8、 根据权利要求 6或 7所述的控制方法, 其特征在于, 所述緩存 来自 flash的緩存区的校验数据, 包括:
将读地址指针指向 flash的备用 Spare区;
根据所述读地址指针从 flash的緩存区接收所述校验数据并緩存。
9、根据权利要求 6或 7所述的控制方法,其特征在于,所述从 flash 的緩存区中连续读取至少一个主数据块, 包括:
将读地址指针指向 flash的主数据区;
根据所述读地址指针从 flash 的緩存区中连续读取至少一个主数据 块。
10、 根据权利要求 6或 7所述的控制方法, 其特征在于, 所述依次 对緩存的校验数据进行校验, 包括:
针对每一个主数据块, 利用第一算法处理本主数据块的校验数据, 并判断本主数据块是否发生错误;
其中, 当判断一个主数据块发生错误, 则依次利用第二算法和第三 算法对所述第一算法处理所述一个主数据块的校验数据的结果进行处 理, 记录所述第三算法处理结果, 并在所述至少一个主数据块连续读取 完毕后输出错误报告。
11、 根据权利要求 7所述的控制方法, 其特征在于, 进一步包括: 在从 flash 的存储区中连续传输至少一个主数据块及其校验数据到 flash的緩存区中前, 接收来自中央处理单元 CPU的读数据启动命令; 在所述至少一个主数据块的校验数据校验完毕后,向所述 CPU发出 中断, 接收来自所述 CPU的状态上报命令, 向所述 CPU发送用于指示 读操作是否成功的状态信息。
12、 一种 flash的数据访问控制器, 其特征在于, 包括:
第一单元,用于将至少一个主数据块连续输出至 flash的緩存区;在 第二单元将其緩存的所述至少一个主数据块的校验数据全部输出到 flash的緩存区后, 将所述 flash的緩存区中的至少一个主数据块及其校 验数据写入 flash的存储区;
第二单元, 用于在所述第一单元将所述至少一个主数据块输出至 flash的緩存区时为每一主数据块生成校验数据并緩存;将所緩存的所述 至少一个主数据块的校验数据输出至所述 flash的緩存区。
13、 根据权利要求 12所述的控制器, 其特征在于, 进一步包括: 第三单元;
所述第一单元进一步用于在通过所述第三单元接收 CPU发送的写 操作启动命令后,将至少一个主数据块连续输出至 flash的緩存区,并在 将所述 flash的緩存区中的至少一个主数据块及其校验数据写入 flash的 存储区后通过所述第三单元向所述 CPU发送中断, 接收来自所述 CPU 的状态上报命令, 向所述 CPU发送指示写操作是否成功的状态信息。
14、 根据权利要求 12所述的控制器, 其特征在于, 进一步包括: 第四单元;
所述第一单元通过所述第四单元将所述至少一个主数据块连续输 出至所述 flash的緩存区;
所述第二单元通过所述第四单元将所緩存的校验数据输出至所述 flash的緩存区。
15、 根据权利要求 12所述的控制器, 其特征在于, 所述第二单元 包括:
第一模块: 用于在所述第一单元将所述至少一个主数据块输出至 flash的緩存区时, 为所述每一个主数据块生成校验数据;
第二模块: 用于緩存所述第一模块生成的所述校验数据, 并将所緩 存的所述校验数据输出至所述 flash的緩存区。
16、 根据权利要求 12所述的控制器, 其特征在于,
第一单元进一步用于从所述 flash 的存储区中将至少一个主数据块 及其校验数据连续传输到所述 flash的緩存区, 指令所述 flash的緩存区 将所述校验数据传输到所述第二单元,从所述 flash的緩存区中连续读取 所述至少一个主数据块;
第二单元进一步用于緩存来自所述 flash 的緩存区的所述至少一个 主数据块的校验数据,并在所述第一单元从所述 flash的緩存区读取所述 至少一个主数据块时使用所緩存的所述至少一个主数据块的校验数据 依次对所述至少一个主数据块进行校验。
17、 根据权利要求 16 所述的控制器, 其特征在于, 进一步包括第 三单元;
所述第一单元进一步用于在通过所述第三单元接收 CPU发送的读 操作启动命令后,将至少一个主数据块及其校验数据从 flash的存储区输 出到 flash的緩存区, 并在从所述 flash的緩存区连续读取所述至少一个 主数据块后通过所述第三单元向所述 CPU发送中断,接收来自所述 CPU 的状态上报命令, 向所述 CPU发送指示读操作是否成功的状态信息。
18、 根据权利要求 16 所述的控制器, 其特征在于, 进一步包括第 四单元;
所述第一单元通过所述第四单元从所述 flash 的緩存区中连续读取 所述至少一个主数据块;
所述第二单元通过所述第四单元接收来自所述 flash 的緩存区的所 述至少一个主数据块的校验数据并緩存所述校验数据。
19、 根据权利要求 18 所述的控制器, 其特征在于, 所述第二单元 包括:
第一模块: 用于在所述第一单元将所述至少一个主数据块输出至 flash的緩存区时, 为每一个主数据块生成校验数据;
第二模块: 用于緩存所述第一模块生成的校验数据, 将其緩存的所 述校验数据输出至所述 flash的緩存区,并緩存通过所述第四单元接收到 的来自所述 flash的緩存区的校验数据;
第三模块,用于针对第一单元从 flash的緩存区中连续输出的每一个 主数据块, 利用第一算法处理所述第二模块緩存的本主数据块的校验数 据, 并判断本主数据块是否发生错误, 当判断出一个主数据块发生错误 时, 将所述第一算法处理的结果发送到第四模块;
第四模块, 用于在所述第三模块判断所述一个主数据块发生错误 时, 利用第二算法处理所述第三模块发送的所述第一算法处理的结果; 第五模块, 用于利用第三算法处理所述第四模块发送的所述第二算 法处理的结果, 记录所述第三算法处理的结果, 并在所述至少一个主数 据块连续读取完毕后输出错误报告。
20、 一种 flash的数据访问控制器, 其特征在于, 包括:
第一单元,用于从 flash的存储区中将至少一个主数据块及其校验数 据连续传输到 flash的緩存区, 指令所述 flash的緩存区将所述校验数据 传输到第二单元,从所述 flash的緩存区中连续读取所述至少一个主数据 块;
第二单元,用于緩存来自所述 flash的緩存区的所述至少一个主数据 块的校验数据,并在所述第一单元从所述 flash的緩存区读取所述至少一 个主数据块时对所緩存的校验数据进行校验。
21、 根据权利要求 20所述的控制器, 其特征在于, 进一步包括第 三单元:
所述第一单元进一步用于在通过所述第三单元接收 CPU发送的读 操作启动命令后,将至少一个主数据块及其校验数据从 flash的存储区输 出到 flash的緩存区, 并在从所述 flash的緩存区连续读取所述至少一个 主数据块后通过所述第三单元向所述 CPU发送中断,接收来自所述 CPU 的状态上报命令, 向所述 CPU发送指示读操作是否成功的状态信息。
22、 根据权利要求 20所述的控制器, 其特征在于, 进一步包括第 四单元:
所述第一单元通过所述第四单元从所述 flash 的緩存区中连续读取 所述至少一个主数据块;
所述第二单元通过所述第四单元接收来自所述 flash 的緩存区的所 述至少一个主数据块的校验数据并緩存所述校验数据。
23、 根据权利要求 22所述的控制器, 其特征在于, 所述第二单元 包括:
第二模块,用于緩存通过所述第四单元接收到的来自所述 flash的緩 存区的校验数据;
第三模块,用于针对第一单元从 flash的緩存区中连续输出的每一个 主数据块, 利用第一算法处理本主数据块存储在所述第二模块上的校验 数据, 并判断本主数据块是否发生错误, 当判断出一个主数据块发生错 误时, 将所述第一算法处理的结果发送到第四模块;
第四模块, 用于在所述第三模块判断所述一个主数据块发生错误 时, 利用第二算法处理所述第三模块发送的所述第一算法处理的结果; 第五模块, 用于利用第三算法处理所述第四模块发送的所述第二算 法处理的结果, 记录所述第三算法处理的结果, 并在所述至少一个主数 据块连续读取完毕后输出错误报告。
24、 一种使用控制器控制数据访问的方法, 其特征在于, 所述控制 器包括用于生成校验码和对主数据进行校验的校验单元和至少一个标 准控制单元, 每一标准控制单元用于实现至少一种数据访问功能并具有 一个使能参数, 所述至少一个标准控制单元包括忙闲检测单元、 第一命 令单元、 第二命令单元、 地址发送单元、 传输单元以及切换单元; 配置各个标准控制单元的执行顺序由先到后依次为: 忙闲检测单 元、 第一命令单元、 地址发送单元、 传输单元、 切换单元以及第二命令 单元, 并以所述执行顺序作为标准流程;
所述数据访问过程包括第一 P介段和第二阶段;
在所述第一 P介段, 配置所述忙闲检测单元、 第一命令单元、 地址发 送单元、 传输单元以及切换单元的使能参数为执行, 配置所述第二命令 单元的使能参数为旁路;
在所述第一 P介段中执行所述标准流程时, 所述忙闲检测单元检测到 flash空闲时, 所述第一命令单元向 flash发送写操作命令, 所述地址发 送单元向 flash发送第一地址,所述传输单元根据所述地址发送单元发送 的第一地址将至少一个主数据块写入 flash的緩存区中,每写入一个主数 据块, 所述切换单元指示所述校验单元緩存为当前写入的主数据块生成 的校验数据, 并为下一个写入的主数据块生成校验数据做准备;
在所述第二阶段, 配置所述第一命令单元、 地址发送单元、 传输单 元、 切换单元以及第二命令单元的使能参数为执行, 配置所述忙闲检测 单元以及切换单元的使能参数为旁路;
在所述第二阶段中执行所述标准流程时,所述第一命令单元向 flash 发送改写地址命令, 所述地址发送单元将第二地址发送到 flash, 所述传 输单元根据所述地址发送单元发送的第二地址将所述至少一个主数据 块的校验数据连续输出到所述 flash的緩存区,所述第二命令单元将所述 flash的緩存区中的所述至少一个主数据块及其校验数据输出到 flash的 存储区。
25、 一种使用控制器控制数据访问的方法, 其特征在于, 所述控制 器包括用于生成校验码和对主数据进行校验的校验单元和至少一个标 准控制单元, 每一标准控制单元用于实现至少一种数据访问功能并具有 一个使能参数, 所述至少一个标准控制单元包括第一忙闲检测单元、 第 二忙闲检测单元、 第一命令单元、 第二命令单元、 地址发送单元、 传输 单元以及切换单元;
配置各个标准控制单元的执行顺序由先到后依次为: 第一忙闲检测 单元、 第一命令单元, 地址发送单元、 第二命令单元、 第二忙闲检测单 元、 传输单元以及切换单元, 并以所述执行顺序作为标准流程;
所述数据访问过程包括第一 P介段和第二阶段;
在所述第一 P介段, 配置所述第一忙闲检测单元、 第一命令单元, 地 址发送单元、 第二命令单元、 第二忙闲检测单元以及传输单元的使能参 数为执行, 配置所述切换单元的使能参数为旁路; 在所述第一 P介段中执行所述标准流程时, 所述第一忙闲检测单元检 测到 flash空闲时, 所述第一命令单元向 flash发送读操作命令, 所述地 址发送单元向 flash发送第三地址, 所述第二命令单元指示 flash根据所 述地址发送单元发送的第三地址将至少一个主数据块及其校验数据从 flash的存储区读取到 flash的緩存区,所述第二忙闲检测单元检测到 flash 空闲时, 所述传输单元读取 flash緩存区中的校验码数据;
在所述第二阶段, 配置所述第一命令单元, 地址发送单元、 传输单 元以及切换单元的使能参数为执行,第一忙闲检测单元、第二命令单元、 第二忙闲检测单元的使能参数为旁路;
在所述第二阶段中执行所述标准流程时,所述第一命令单元向 flash 发送改写地址命令,所述地址发送单元向 flash发送第四地址,所述传输 单元根据所述地址发送单元发送的第四地址连续读取所述至少一个主 数据块, 每读取一个主数据块, 所述切换单元指示所述校验单元保存对 当前读取的主数据块进行校验的结果并为对下一个读出的主数据块进 行校验做准备。
26、 一种使用控制器控制数据访问的方法, 其特征在于, 所述控制 器包括用于生成校验码和对主数据进行校验的校验单元和至少一个标 准控制单元, 每一标准控制单元用于实现至少一种数据访问功能并具有 一个使能参数, 所述至少一个标准控制单元包括第一忙闲检测单元、 第 二忙闲检测单元、 第一命令单元、 第二命令单元、 第三命令单元、 地址 发送单元、 传输单元以及切换单元:
配置各个标准控制单元的执行顺序由先到后依次为: 第一忙闲检测 单元、 第一命令单元, 地址发送单元、 第二命令单元、 第二忙闲检测单 元、 传输单元、 切换单元以及第三命令单元, 并以所述执行顺序作为标 准流程; 所述数据访问过程包括写操作和 /或读操作,所述写操作包括第一阶 段和第二阶段; 所述读操作包括第三阶段和第四阶段;
在所述第一 P介段, 配置所述第一忙闲检测单元、 第一命令单元、 地 址发送单元、 传输单元以及切换单元的使能参数为执行, 配置所述第二 命令单元、 第二忙闲检测单元以及第三命令单元的使能参数为旁路; 在所述第一 P介段中执行所述标准流程时, 所述第一忙闲检测单元检 测到 flash空闲时, 所述第一命令单元向 flash发送写操作命令, 所述地 址发送单元向 flash发送第一地址,所述传输单元根据所述地址发送单元 发送的第一地址将至少一个主数据块写入 flash的緩存区中,每写入一个 主数据块, 所述切换单元指示所述校验单元緩存为当前写入的主数据块 生成的校验数据, 并为下一个写入的主数据块生成校验数据做准备; 在所述第二阶段, 配置所述第一命令单元、 地址发送单元、 传输单 元、 切换单元以及第二命令单元的使能参数为执行, 配置所述第一忙闲 检测单元、 第二忙闲检测单元、 切换单元以及第三命令单元的使能参数 为旁路;
在所述第二阶段中执行所述标准流程时,所述第一命令单元向 flash 发送改写地址命令, 所述地址发送单元将第二地址发送到 flash, 所述传 输单元根据所述地址发送单元发送的第二地址将所述至少一个主数据 块的校验数据连续输出到所述 flash的緩存区,所述第二命令单元将所述 flash的緩存区中的所述至少一个主数据块及其校验数据输出到 flash的 存储区;
在所述第三阶段, 配置所述第一忙闲检测单元、 第一命令单元, 地 址发送单元、 第二命令单元、 第二忙闲检测单元以及传输单元的使能参 数为执行, 配置所述切换单元以及第三命令单元的使能参数为旁路; 在所述第三 P介段中执行所述标准流程时, 所述第一忙闲检测单元检 测到 flash空闲时, 所述第一命令单元向 flash发送读操作命令, 所述地 址发送单元向 flash发送第三地址, 所述第二命令单元指示 flash根据所 述地址发送单元发送的第三地址将至少一个主数据块及其校验数据从 flash的存储区读取到 flash的緩存区,所述第二忙闲检测单元检测到 flash 空闲时, 所述传输单元读取 flash緩存区中的校验码数据;
在所述第四阶段, 配置所述第一命令单元, 地址发送单元、 传输单 元以及切换单元的使能参数为执行,第一忙闲检测单元、第二命令单元、 第二忙闲检测单元以及第三命令单元的使能参数为旁路;
在所述第四阶段中执行所述标准流程时,所述第一命令单元向 flash 发送改写地址命令,所述地址发送单元向 flash发送第四地址,所述传输 单元根据所述地址发送单元发送的第四地址连续读取所述至少一个主 数据块, 每读取一个主数据块, 所述切换单元指示所述校验单元保存对 当前读取的主数据块进行校验的结果并为对下一个读出的主数据块进 行校验做准备。
PCT/CN2008/072213 2007-09-07 2008-08-29 Procédé pour accéder à des données dans une mémoire flash et contrôleur d'accès à des données WO2009033397A1 (fr)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP08800725.7A EP2187315B1 (en) 2007-09-07 2008-08-29 Method for accessing data in flash memory and data accessing controller
US12/646,934 US8234541B2 (en) 2007-09-07 2009-12-23 Method and controller for data access in a flash memory

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN200710149833.4 2007-09-07
CNA2007101498334A CN101140809A (zh) 2007-09-07 2007-09-07 支持流水线纠错码和可配置操作的flash控制器及其控制方法

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US12/646,934 Continuation US8234541B2 (en) 2007-09-07 2009-12-23 Method and controller for data access in a flash memory

Publications (1)

Publication Number Publication Date
WO2009033397A1 true WO2009033397A1 (fr) 2009-03-19

Family

ID=39192704

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2008/072213 WO2009033397A1 (fr) 2007-09-07 2008-08-29 Procédé pour accéder à des données dans une mémoire flash et contrôleur d'accès à des données

Country Status (4)

Country Link
US (1) US8234541B2 (zh)
EP (1) EP2187315B1 (zh)
CN (1) CN101140809A (zh)
WO (1) WO2009033397A1 (zh)

Families Citing this family (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101140809A (zh) * 2007-09-07 2008-03-12 炬力集成电路设计有限公司 支持流水线纠错码和可配置操作的flash控制器及其控制方法
CN102103559B (zh) * 2009-12-18 2014-06-18 上海华虹集成电路有限责任公司 一种带有AES和ECC的多通道NANDflash控制器
US8484542B2 (en) * 2011-02-08 2013-07-09 Sandisk Technologies Inc. Data recovery using additional error correction coding data
CN102279819A (zh) * 2011-07-28 2011-12-14 张岭 提高固态数据存储系统对于大块数据的存储效率的方法
CN102446342B (zh) * 2011-08-30 2013-04-17 西安交通大学 可重构二值运算器、可重构二值图像处理系统及其实现基本形态学算法的方法
CN102568605B (zh) * 2011-12-23 2014-12-24 青岛海信信芯科技有限公司 系统总线检错纠错方法和nand flash控制器
CN103164292B (zh) * 2013-02-20 2016-05-25 深圳市硅格半导体有限公司 数据的纠错方法及装置
KR102355436B1 (ko) * 2015-01-09 2022-01-26 에스케이하이닉스 주식회사 데이터 저장 장치
KR102585221B1 (ko) * 2016-04-21 2023-10-05 삼성전자주식회사 메모리 장치, 메모리 시스템 및 메모리 장치의 동작 방법
JP6782303B2 (ja) * 2016-11-07 2020-11-11 株式会社日立製作所 計算機、計算機システムおよびデータ量制限方法
CN106775483B (zh) * 2016-12-26 2019-05-28 湖南国科微电子股份有限公司 一种用于ssd的raid编解码系统及方法
CN107622470B (zh) * 2017-09-01 2020-12-01 杭州趣维科技有限公司 一种基于二维码的实时鲁棒数字水印的嵌入和提取方法
CN109656855A (zh) * 2018-08-16 2019-04-19 浮栅智联科技(苏州)有限公司 在网卡内读写数据的方法、计算存储网络一体化芯片和网卡
WO2020056622A1 (zh) * 2018-09-19 2020-03-26 深圳市汇顶科技股份有限公司 图像校验系数的读取方法、闪存控制器、系统及存储介质
CN109669802A (zh) * 2018-11-13 2019-04-23 北京时代民芯科技有限公司 一种用于edac验证的可配置存储器验证系统
CN109614152B (zh) * 2018-12-06 2022-11-04 镕铭微电子(济南)有限公司 硬件加速模块及存储设备
CN111538622B (zh) * 2020-04-24 2023-08-01 上海航天电子通讯设备研究所 星载固态存储器纠错方法
CN111858141B (zh) * 2020-07-24 2021-12-17 南方电网数字电网研究院有限公司 系统芯片存储控制装置和系统芯片
CN112115017B (zh) * 2020-08-07 2022-07-12 航天科工空间工程发展有限公司 一种星载软件程序的逻辑代码监控方法和装置

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5721739A (en) 1995-12-14 1998-02-24 Fairchild Semiconductor Corporation Method for detecting read errors, correcting single-bit read errors and reporting multiple-bit read errors
US20030101405A1 (en) 2001-11-21 2003-05-29 Noboru Shibata Semiconductor memory device
CN1480953A (zh) * 2002-09-07 2004-03-10 鸿富锦精密工业(深圳)有限公司 在内存中存放校验码的方法及装置
US20060050576A1 (en) 2004-09-09 2006-03-09 Samsung Electronics Co., Ltd. NAND flash memory device and copyback program method for same
CN1831786A (zh) * 2005-12-14 2006-09-13 兆日科技(深圳)有限公司 闪速存储器数据完整性保护方法
CN101004664A (zh) * 2006-01-20 2007-07-25 三星电子株式会社 存储卡、非易失性存储器、及其拷回操作的方法
CN101140809A (zh) * 2007-09-07 2008-03-12 炬力集成电路设计有限公司 支持流水线纠错码和可配置操作的flash控制器及其控制方法

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6275911B1 (en) * 1996-09-20 2001-08-14 Denso Corporation Memory writing device for an electronic device
US7222800B2 (en) * 2003-08-18 2007-05-29 Honeywell International Inc. Controller customization management system
JP3912355B2 (ja) * 2003-10-14 2007-05-09 ソニー株式会社 データ管理装置、データ管理方法、不揮発性メモリ、不揮発性メモリを有する記憶装置及びデータ処理システム
US20050132128A1 (en) * 2003-12-15 2005-06-16 Jin-Yub Lee Flash memory device and flash memory system including buffer memory
DE102004004796B4 (de) * 2004-01-30 2007-11-29 Infineon Technologies Ag Vorrichtung zur Datenübertragung zwischen Speichern
CN100451951C (zh) 2006-01-26 2009-01-14 深圳艾科创新微电子有限公司 Risc cpu中的5+3级流水线设计方法

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5721739A (en) 1995-12-14 1998-02-24 Fairchild Semiconductor Corporation Method for detecting read errors, correcting single-bit read errors and reporting multiple-bit read errors
US20030101405A1 (en) 2001-11-21 2003-05-29 Noboru Shibata Semiconductor memory device
CN1480953A (zh) * 2002-09-07 2004-03-10 鸿富锦精密工业(深圳)有限公司 在内存中存放校验码的方法及装置
US20060050576A1 (en) 2004-09-09 2006-03-09 Samsung Electronics Co., Ltd. NAND flash memory device and copyback program method for same
CN1831786A (zh) * 2005-12-14 2006-09-13 兆日科技(深圳)有限公司 闪速存储器数据完整性保护方法
CN101004664A (zh) * 2006-01-20 2007-07-25 三星电子株式会社 存储卡、非易失性存储器、及其拷回操作的方法
CN101140809A (zh) * 2007-09-07 2008-03-12 炬力集成电路设计有限公司 支持流水线纠错码和可配置操作的flash控制器及其控制方法

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP2187315A4

Also Published As

Publication number Publication date
EP2187315A1 (en) 2010-05-19
EP2187315A4 (en) 2011-10-12
US8234541B2 (en) 2012-07-31
CN101140809A (zh) 2008-03-12
US20100100794A1 (en) 2010-04-22
EP2187315B1 (en) 2016-01-27

Similar Documents

Publication Publication Date Title
WO2009033397A1 (fr) Procédé pour accéder à des données dans une mémoire flash et contrôleur d'accès à des données
TWI773890B (zh) 資料儲存裝置及其校驗碼處理方法
KR101507975B1 (ko) 솔리드 스테이트 메모리 제어기를 위한 플렉시블 시퀀서 디자인 아키텍쳐
KR102217966B1 (ko) 스토리지 드라이브의 비휘발성 반도체 메모리에 그리고 상기 비휘발성 반도체 메모리로부터 데이터를 전달하기 위해 디스크립터들을 생성하는 장치 및 방법
TW201303594A (zh) 快閃記憶體介質控制器及裝置
TWI418991B (zh) 針對智慧型儲存交換器所設計的快閃記憶體系統
WO2012050935A2 (en) Apparatus, system, and method for data transformations within a data storage device
TW201303587A (zh) 用於在快閃記憶體介質控制器中處理儲存在快閃記憶體記憶體的頁中的中繼資料的方法、裝置及快閃記憶體記憶體系統
US8996794B2 (en) Flash memory controller
US11954332B2 (en) Data processing method, controller, storage device, and storage system
WO2012006062A1 (en) Interface management control systems and methods for non-volatile semiconductor memory
WO2015035536A1 (zh) 在基于闪存的存储系统中构建raid的方法及系统
JP2011018222A (ja) インタリーブ制御装置、インタリーブ制御方法及びメモリシステム
WO2010127636A1 (zh) 与非型闪存控制器及其数据传输方法
US9575669B2 (en) Programmable solid state drive controller and method for scheduling commands utilizing a data structure
US20080222500A1 (en) Data relay apparatus, data relay method and data relay integrated circuit
CN104281413A (zh) 命令队列管理方法、存储器控制器及存储器储存装置
JP2007249469A (ja) 不揮発性半導体記憶装置およびメモリシステム
TWI494756B (zh) 下達讀取指令的方法、快閃記憶體控制器與快閃記憶體儲存系統
TWI533309B (zh) 資料寫入方法、記憶體儲存裝置及記憶體控制電路單元
CN102568605B (zh) 系统总线检错纠错方法和nand flash控制器
TWI787110B (zh) 寫入資料到閃存記憶體的方法及裝置
US8166228B2 (en) Non-volatile memory system and method for reading and storing sub-data during partially overlapping periods
JP2010086321A (ja) メモリ制御システム
WO2017191706A1 (ja) メモリ制御回路、メモリ、記憶装置、および、情報処理システム

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 08800725

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 2008800725

Country of ref document: EP

NENP Non-entry into the national phase

Ref country code: DE