Data reading method, device and chip

By using the preset cache in the chip to obtain the target sub-check data and directly performing ECC verification, the problem of multiple read cycles during the ECC verification process is solved and the data transmission efficiency is improved.

CN118394281BActive Publication Date: 2024-09-06BEIJING SEMIDRIVE TECHNOLOGY LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410826179.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-25
Publication Date
2024-09-06
Estimated Expiration
2044-06-25

AI Technical Summary

Technical Problem

When the chip performs ECC verification, it requires two read cycles, resulting in reduced data transmission efficiency.

Method used

By obtaining the corresponding target sub-verification data in the preset cache, it avoids issuing a read verification data command before each data read, and directly obtains the verification data from the cache for ECC verification.

Benefits of technology

It reduces the read cycles required to read data and improves the data transmission efficiency when the chip reads data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118394281B
    Figure CN118394281B
Patent Text Reader

Abstract

The present application discloses a data reading method, device and chip. When a read target data command to an external memory is received from a chip processor and an ECC check is required, it is first determined whether there is check data in a preset cache, and when there is a check data value corresponding to the read target data command in the preset cache, the target sub-check data is read from the preset cache, and after the target data is read from the external memory, an ECC check is performed based on the target sub-check data and the target data. By obtaining the corresponding target sub-check data from the preset cache, it is avoided that a read check data command is issued before each data is read in when an ECC check is required, thereby reducing the read cycle required for reading data, and thereby improving the data transmission efficiency when the chip reads data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of chip technology, and in particular to a data reading method, device and chip. Background Art

[0002] When the chip accesses external memory, in order to ensure the correctness of the data and improve the fault tolerance of the chip, it often performs ECC (Error Correcting Code, or Error Checking and Correction) verification on the read data. ECC verification takes up less storage space and greatly improves the security and correctness of the read data.

[0003] However, currently, when performing ECC verification, the chip needs to issue a command to read ECC verification data before each data is read, and then perform verification after reading the ECC verification data and the data, resulting in two read cycles for each data read. For large data transmission, continuous addresses are often read, and each time a small amount of ECC verification data needs to be obtained, which reduces the data transmission efficiency of the chip. Summary of the invention

[0004] The embodiments of the present application provide a data reading method, device and chip, which obtain corresponding target sub-verification data from a preset cache to improve the data transmission efficiency when the chip reads data.

[0005] A first aspect provides a data reading method, comprising: in response to a read target data command to an external memory sent by a chip processor, determining whether there is verification data in a preset cache, the read target data command being used to read target data to be subjected to ECC verification from the external memory, the verification data comprising a plurality of sub-verification data, each of the sub-verification data corresponding to a read target data command; if verification data corresponding to the read target data command to the external memory exists in the preset cache, obtaining the target sub-verification data from the preset cache without generating a read verification data command to the external memory; reading the target data from the external memory based on the target data address in the read target data command and a first base address pre-configured in a register; performing an ECC check based on the target sub-verification data and the target data, and returning the target data to the chip processor after the check passes.

[0006] In a second aspect, a data reading device is provided, including a read command processing circuit, a pre-fetch control circuit, a read data processing circuit, a verification circuit, a register, a preset cache and a multiplexer, wherein the read command processing circuit is used to obtain a read target data command for an external memory sent by a chip processor, and output the read target data command to the multiplexer and the pre-fetch control circuit; the pre-fetch control circuit is used to determine whether verification data corresponding to the read target data instruction exists in the preset cache according to a cache address signal and a cache valid signal of the preset cache, and when verification data corresponding to the read target data command for the external memory exists in the preset cache, output a verification data valid signal to the preset cache, so as to send the target sub-verification data in the preset cache to the verification circuit, wherein the verification data includes a plurality of sub-verification data, each of which The sub-check data corresponds to a read target data command; the multiplexer is used to output the read target data command signal to the external memory when the ECC verification enable signal is at the first level, so that the external memory returns the target data to the read data processing circuit, wherein the ECC verification enable signal indicates whether it is necessary to perform ECC verification on the data read from the external memory, and the read target data command signal is generated by the prefetch control circuit according to the target data address in the read target data command and the first base address obtained from the register; the read data processing circuit is used to output the target data to the verification circuit when receiving the target data returned by the external memory; the verification circuit is used to perform ECC verification based on the target sub-check data and the target data, and return the target data to the chip processor after the verification passes.

[0007] In a third aspect, a chip is provided, comprising a chip processor and the data reading device as described in the second aspect.

[0008] By applying the above technical solution, when a read target data command to an external memory is received from a chip processor and an ECC check is required, it is first determined whether there is check data in the preset cache, and when there is a check data value corresponding to the read target data command in the preset cache, the target sub-check data is read from the preset cache, and after the target data is read from the external memory, an ECC check is performed based on the target sub-check data and the target data. By obtaining the corresponding target sub-check data from the preset cache, it is avoided that a read check data command is issued before each data is read in when an ECC check is required, thereby reducing the read cycle required for reading data, and thereby improving the data transmission efficiency when the chip reads data. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0010] Figure 1 A flowchart of a data reading method according to an embodiment of the present application;

[0011] Figure 2 A flowchart of a data reading method according to another embodiment of the present application;

[0012] Figure 3 A flowchart of reading verification data according to an embodiment of the present application;

[0013] Figure 4 A schematic diagram of the structure of a data reading device according to an embodiment of the present application;

[0014] Figure 5 This is a schematic diagram of the principle of a data reading method according to another embodiment of the present application;

[0015] Figure 6 This is a timing diagram of different signals when data is read in an embodiment of the present application;

[0016] Figure 7 This is a structural block diagram of the chip according to an embodiment of the present application. DETAILED DESCRIPTION

[0017] Various aspects and features of the present application are described herein with reference to the accompanying drawings.

[0018] It should be understood that various modifications may be made to the embodiments of the present application. Therefore, the above description should not be considered as limiting, but only as an example of an embodiment. Other modifications within the scope and spirit of the present application will occur to those skilled in the art.

[0019] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the present application and, together with the general description of the present application given above and the detailed description of the embodiments given below, serve to explain the principles of the present application.

[0020] These and other characteristics of the present application will become apparent from the following description of a preferred form of embodiment given as a non-limiting example with reference to the accompanying drawings.

[0021] It should also be understood that although the present application has been described with reference to some specific examples, those skilled in the art will be able to readily implement many other equivalent forms of the present application.

[0022] The above and other aspects, features and advantages of the present application will become more apparent in view of the following detailed description when taken in conjunction with the accompanying drawings.

[0023] Specific embodiments of the present application are described hereinafter with reference to the accompanying drawings; however, it should be understood that the embodiments applied for are merely examples of the present application, which may be implemented in a variety of ways. Well-known and / or repeated functions and structures are not described in detail to avoid unnecessary or redundant details that obscure the present application. Therefore, the specific structural and functional details applied for herein are not intended to be limiting, but merely serve as a basis and representative basis for the claims to teach those skilled in the art to use the present application in a variety of ways with substantially any suitable detailed structure.

[0024] This specification may use the phrases "in one embodiment," "in another embodiment," "in yet another embodiment," or "in other embodiments," all of which may refer to one or more of the same or different embodiments according to the present application.

[0025] A data reading method of an embodiment of the present application, when receiving a read target data command to an external memory sent by a chip processor and an ECC check is required, first determine whether there is check data in a preset cache, and when there is a check data value corresponding to the read target data command in the preset cache, read the target sub-check data from the preset cache, and after reading the target data from the external memory, perform an ECC check based on the target sub-check data and the target data. By obtaining the corresponding target sub-check data from the preset cache, it is avoided that a read check data command is issued before each data is read in when an ECC check is required, thereby reducing the read cycle required for reading data, and thereby improving the data transmission efficiency when the chip reads data.

[0026] like Figure 1 As shown, the following steps are included:

[0027] Step S101, in response to a read target data command sent by a chip processor, determines whether there is verification data in a preset cache, wherein the read target data command is used to read target data to be ECC-verified from an external memory, and the verification data includes a plurality of sub-verification data, and each of the sub-verification data corresponds to a read target data command.

[0028] In this embodiment, the chip processor may be the CPU of the chip, and the read target data command is used to read the target data to be ECC-checked from the external memory. The chip processor may send a read target data command in response to a read instruction issued by a user or other electronic device, or may send a read target data command in response to executing a preset task. The chip processor may send a single read target data command, or may send multiple read target data commands in sequence. A preset cache for storing verification data is pre-set. After obtaining the read target data command, it is determined whether verification data exists in the preset cache, and the verification data includes multiple sub-verification data, each sub-verification data corresponds to a read target data command, that is, when performing ECC verification, ECC verification is performed through one sub-verification data and one target data. Since the verification data includes multiple sub-verification data, the ECC verification of the read multiple target data can be completed through the verification data in the preset cache.

[0029] Step S102: if verification data corresponding to the read target data command to the external memory exists in the preset cache, the target sub-verification data is obtained from the preset cache without generating a read verification data command to the external memory.

[0030] In this embodiment, when there is verification data in the preset cache, it is further determined whether the verification data is verification data corresponding to the read target data command of the external memory. If so, there is no need to generate a read verification data command to the external memory, that is, there is no need to read the verification data for ECC verification from the external memory, and the target sub-verification data corresponding to the read target data command is obtained directly from the verification data stored in the preset cache.

[0031] Step S103: Read the target data from the external memory based on the target data address in the read target data command and the first base address preconfigured in the register.

[0032] The target data read command includes a target data address, and a first base address is pre-configured in the register, and the first base address is the base address of the target data. The target data address is obtained from the target data read command, and the first base address is obtained from the register. According to the target data address and the first base address, the storage location of the target data in the external memory can be determined, and the target data is read from the external memory based on the storage location.

[0033] Step S104, performing ECC check based on the target sub-check data and the target data, and returning the target data to the chip processor after the check passes.

[0034] After obtaining the target sub-check data and the target data, an ECC check is performed based on the target sub-check data and the target data. After the check passes, the target data is returned to the chip processor, thus completing the data reading process.

[0035] In addition, there is no particular order for executing step S102 and step S103, and they can be performed one after the other or in parallel.

[0036] The data reading method of the embodiment of the present application responds to the read target data command to the external memory sent by the chip processor, and determines whether there is verification data in the preset cache. The read target data command is used to read the target data to be ECC-checked from the external memory, and the verification data includes multiple sub-verification data, each sub-verification data corresponds to a read target data command; if there is verification data corresponding to the read target data command to the external memory in the preset cache, without generating a read verification data command to the external memory, the target sub-verification data is obtained from the preset cache; based on the target data address in the read target data command and the first base address pre-configured in the register, the target data is read from the external memory; based on the target sub-verification data and the target data, an ECC check is performed, and the target data is returned to the chip processor after the check passes. By obtaining the corresponding target sub-verification data from the preset cache, it is avoided that the read verification data command is issued before each data is read in when an ECC check is required, thereby reducing the read cycle required for reading data, thereby improving the data transmission efficiency when the chip reads data.

[0037] In some embodiments of the present application, Figure 2 As shown, the method further comprises the following steps:

[0038] Step S105, if the verification data corresponding to the read target data command to the external memory does not exist in the preset cache, based on the preset data length and the second base address pre-configured in the register, the verification data corresponding to the read target data command to the external memory is read from the external memory.

[0039] In this embodiment, the situation in which there is no verification data corresponding to the read target data command to the external memory in the preset cache can be divided into two types, one is that there is no verification data in the preset cache, and the other is that there is verification data in the preset cache, but the verification data is irrelevant to the read target data command and cannot be used to verify the corresponding target data.

[0040] Since the corresponding verification data does not exist in the preset cache, the corresponding verification data needs to be read from the external memory. The register is pre-configured with a second base address corresponding to the verification data, the second base address is obtained from the register, and the storage location of the verification data in the external memory is determined according to the preset data length and the second base address, and the verification data corresponding to the read target data command is read from the external memory according to the storage location. The preset length corresponds to multiple sub-verification data, so that the read verification data includes multiple sub-verification data.

[0041] Step S106: Save the verification data corresponding to the command to read the target data from the external memory to the preset cache.

[0042] After reading the corresponding verification data, the verification data is saved in a preset cache, and the corresponding target sub-verification data can be obtained from the preset cache later, and the verification of the target data is completed. In addition, since the saved verification data includes multiple sub-verification data, for one or more subsequent received read target data commands, the corresponding sub-verification data can be directly obtained from the saved verification data without generating a read verification data command to the external memory.

[0043] When the verification data corresponding to the read target data command to the external memory does not exist in the preset cache, the corresponding verification data is read from the external memory and saved to the preset cache, thereby ensuring reliable ECC verification of the target data. Moreover, since the saved verification data includes multiple sub-verification data, when one or more read target data commands are received subsequently, the corresponding sub-verification data can be directly obtained from the saved verification data, thereby improving data reading efficiency.

[0044] In some embodiments of the present application, the read target data command includes a first command signal based on the AXI protocol, the target data includes a first data signal corresponding to the first command signal, and based on a preset data length and a second base address pre-configured in the register, check data corresponding to the read target data command to the external memory is read from the external memory, such as Figure 3 As shown, the following steps are included:

[0045] Step S1051: Generate a read verification data command based on a preset data length and the second base address, and add a second command signal based on the AXI protocol to the read verification data command.

[0046] In this embodiment, a read target data command and a read verification data command are sent based on the AXI (Advanced extensible Interface) protocol, and the target data and verification data are read from the external memory. The read target data command includes a first command signal based on the AXI protocol, and the read target data includes a first data signal corresponding to the first command signal.

[0047] When it is necessary to read verification data from an external memory, a read verification data command is first generated based on a preset data length and a second base address, and a second command signal based on the AXI protocol is added to the read verification data command. The first command signal is different from the second command signal to distinguish between the read verification data command and the read target data command.

[0048] Step S1052, aligning the read verification data command with the timing, so that the read verification data command meets the preset setup time and the preset hold time.

[0049] Timing is the time sequence of control signals that the chip processor should send when executing instructions to ensure that the chip implements correct logical functions. Align the read verification data command with the timing so that the read verification data command meets the preset setup time and preset hold time, thereby ensuring the correct execution of the read verification data command.

[0050] Step S1053, reading verification data corresponding to the read target data command of the external memory from the external memory based on the timing aligned read verification data command, and adding a second data signal corresponding to the second command signal to the read verification data.

[0051] Based on the timing-aligned read verification data command, corresponding verification data is read from the external memory, and a second data signal corresponding to the second command signal is added to the read verification data, where the second data signal is different from the first data signal to distinguish the target data and verification data obtained from the external memory.

[0052] By adding different command signals to the target data read command and the verification data read command, and adding different data signals to the read target data and the verification data, the read command and the read data can be accurately distinguished, thereby achieving more accurate data reading.

[0053] In some embodiments of the present application, the first command signal and the second command signal belong to ARID under the AXI protocol, and the first data signal and the second data signal belong to RID under the AXI protocol, or,

[0054] The first command signal and the second command signal belong to ARUSER under the AXI protocol, and the first data signal and the second data signal belong to RUSER under the AXI protocol.

[0055] In this embodiment, in the AXI protocol, ARID represents the identification tag of the read data sent by the host, RID represents the identification tag of the read data and response sent by the slave, ARUSER represents the user-defined read address channel extension sent by the host, and RUSER represents the user-defined extension of the read data channel sent by the slave.

[0056] Different ARIDs can be used as the first command signal and the second command signal, different RIDs can be used as the first data signal and the second data signal, different ARUSERs can be used as the first command signal and the second command signal, and different RUSERs can be used as the first data signal and the second data signal, so as to accurately distinguish different commands and read data.

[0057] Those skilled in the art may also use other signals under other protocols to distinguish commands and data as needed, such as AHB (Advanced High performance Bus) protocol, ASB (Advanced System Bus) protocol, etc., which does not affect the scope of protection of this application.

[0058] In some embodiments of the present application, the register is also pre-configured with an ECC check enable to control whether the ECC check function is turned on, and the determination of whether there is check data in the preset cache includes:

[0059] Generate a check command based on the ECC check enable, and determine whether there is check data corresponding to a command to read target data from an external memory in the preset cache in response to the check command;

[0060] The first base address, the second base address and the ECC check enable are configured to the register based on the APB bus.

[0061] In this embodiment, the first base address, the second base address and the ECC check enable are configured to the register in advance through the APB (Advanced Peripheral Bus) bus, and the ECC check enable is used to control whether to turn on the ECC check function. After obtaining the read target data command, a check command is generated according to the ECC check enable obtained from the register, and in response to the check command, it is determined whether there is check data corresponding to the read target data command to the external memory in the preset cache.

[0062] By adopting the APB bus, the first base address, the second base address and the ECC check enable are efficiently configured to the register, and the check instruction is generated through the ECC check enable in the register, thereby improving the check efficiency.

[0063] Those skilled in the art may also configure the first base address, the second base address and the ECC check enable to the register in other ways besides the APB bus, which does not affect the protection scope of the present application.

[0064] In some embodiments of the present application, the method further includes: if a reset instruction is received, clearing the preset cache based on the reset instruction, thereby avoiding data expiration or errors in the preset cache, thereby improving the reliability of the preset cache.

[0065] In some embodiments of the present application, performing ECC check on the target data based on the target sub-check data includes:

[0066] Verifying the target data and the target sub-verification data based on an ECC verification algorithm;

[0067] If there is no error in the target data and the target sub-verification data, determining that the verification is passed;

[0068] If any single-bit error exists in the target data or the target sub-check data, correct the single-bit error and generate a first interrupt, and determine that the check fails;

[0069] If there are at least two bits of errors in the target data or the target sub-check data, a second interrupt is generated to determine that the check fails.

[0070] In this embodiment, the target data and the target sub-check data are checked based on the ECC check algorithm. If there is no error in the target data and the target sub-check data, it is determined that the check is passed. If there is any single-bit error in the target data or the target sub-check data, since the ECC check can correct the single-bit error, in this case, any single-bit error is corrected and a first interrupt is generated to determine that the check failed. In addition, the corrected target data is returned to the chip processor, and the chip processor enters the processing flow of reminder, reset or check external memory according to the first interrupt. If there are at least two bits of error in the target data or the target sub-check data, since the ECC check cannot correct multiple bits of error, a second interrupt is directly generated to determine that the check failed, and the chip processor enters the processing flow of reminder, reset or check external memory according to the second interrupt.

[0071] Depending on whether there are errors in the target data and the target sub-check data, the check is determined to be passed when there are no errors, correction is performed and a first interrupt is generated when there are single-bit errors, and a second interrupt is generated when there are at least two-bit errors, thereby achieving more accurate ECC checking.

[0072] In some embodiments of the present application, the read target data command can also be used to read data that does not require ECC checking from an external memory. When the read target data command is used to read data that does not require ECC checking from an external memory, since ECC checking is not required, the read target data command is transmitted to the external memory for data reading, thereby ensuring reliable reading of data from the external memory.

[0073] The present application also provides a data reading device, such as Figure 4 As shown, the device includes a read command processing circuit 10, a pre-fetch control circuit 20, a read data processing circuit 30, a check circuit 40, a register 50, a preset cache 60 and a multiplexer 70.

[0074] The read command processing circuit 10 is used to obtain the read target data command sent by the chip processor 80 to the external memory 90, and output the read target data command to the multiplexer 70 and the pre-fetch control circuit 20;

[0075] The pre-fetch control circuit 20 is used to determine whether there is verification data corresponding to the read target data instruction in the preset cache 60 according to the cache address signal and the cache valid signal of the preset cache 60, and when there is verification data corresponding to the read target data command to the external memory 90 in the preset cache 60, output a verification data valid signal to the preset cache 60, so as to send the target sub-verification data in the preset cache 60 to the verification circuit 40, wherein the verification data includes a plurality of sub-verification data, each of which corresponds to a read target data command;

[0076] The multiplexer 70 is used to output a read target data command signal to the external memory 90 when the ECC verification enable signal is at a first level, so that the external memory 90 returns the target data to the read data processing circuit 30, wherein the ECC verification enable signal indicates whether an ECC check needs to be performed on the data read from the external memory 90, and the read target data command signal is generated by the prefetch control circuit 20 according to the target data address in the read target data command and the first base address obtained from the register 50;

[0077] The read data processing circuit 30 is used to output the target data to the verification circuit 40 when receiving the target data returned by the external memory 90;

[0078] The check circuit 40 is used to perform ECC check based on the target sub-check data and the target data, and return the target data to the chip processor 80 after the check passes.

[0079] In this embodiment, the read command processing circuit 10 receives the read target data command sent by the chip processor 80 to the external memory 90, and outputs the read target data command to the multiplexer 70 and the pre-fetch control circuit 20. After the pre-fetch control circuit 20 receives the read target data command, if the ECC verification enable signal is at the first level, it means that the read target data command is used to read the target data to be ECC-verified from the external memory 90. The pre-fetch control circuit 20 detects the cache address signal and the cache valid signal of the preset cache 60. The cache address signal indicates whether there is verification data in the preset cache 60, and the cache valid signal indicates whether there is verification data corresponding to the read target data command in the preset cache 60. After that, the pre-fetch control circuit 20 determines whether there is verification data corresponding to the read target data instruction in the preset cache 60 according to the cache address signal and the cache valid signal, and when there is corresponding verification data in the preset cache 60, outputs the verification data valid signal to the preset cache 60, so as to send the target sub-verification data in the preset cache 60 to the verification circuit 40. On the other hand, the prefetch control circuit 20 obtains the target data address from the read target data command, obtains the pre-configured first base address from the register 50, and generates a read target data command signal according to the target data address and the first base address, and then sends the read target data command signal to the multiplexer 70.

[0080] The multiplexer 70 (MUX) is a combinational logic circuit with multiple inputs and a single output. In the specific application scenario of the present application, the multiplexer 70 is a two-to-one selector, which can transmit the read target data command or the read target data command signal to the external memory 90. The ECC verification enable signal is a control signal of the multiplexer 70. When the ECC verification enable signal is at the first level, the multiplexer 70 outputs the read target data command signal to the external memory 90, so that the external memory 90 returns the target data to the read data processing circuit 30. When the read data processing circuit 30 receives the target data returned by the external memory 90, it outputs the target data to the verification circuit 40. Finally, the verification circuit 40 performs ECC verification based on the received target sub-verification data and the target data, and returns the target data to the chip processor 80 after the verification passes.

[0081] In some embodiments of the present application, the data reading device uses the AXI protocol to read data, and the read command processing circuit 10 includes a built-in dual-port SRAM, and uses fifo to receive data, which has a first-in first-out feature. The role of fifo is to process the outstanding transmission of AXI. The fifo receives the read target data command issued by the chip processor 80. When the read target data command continuously sent by the chip processor 80 is greater than the fifo depth, and the read data is not completed, the chip processor 80 will be back-pressured to ensure that the pipeline receives the read target data command, thereby improving the reliability of the read command processing circuit 10.

[0082] In some embodiments of the present application, the data reading device adopts the AXI protocol to read data, the read data processing circuit 30 has a built-in dual-port SRAM, adopts fifo to receive data, and has a first-in first-out feature. When the fifo is full (that is, multiple data are read in but not read out, causing the fifo to reach the maximum waterline), the external memory 90 will be back-pressured to ensure that the pipeline receives the data returned by the external memory 90, thereby improving the reliability of the read data processing circuit 30.

[0083] The data reading device of the embodiment of the present application includes a read command processing circuit 10, a pre-fetch control circuit 20, a read data processing circuit 30, a check circuit 40, a register 50, a preset cache 60 and a multiplexer 70. By enabling the pre-fetch control circuit 20 to obtain corresponding target sub-check data from the preset cache 60, it is avoided that a read check data command is issued before each data is read in when an ECC check is required, thereby reducing the read cycle required for reading data, thereby improving the data transmission efficiency when the chip reads data.

[0084] In some embodiments of the present application, the verification data valid signal output by the pre-fetch control circuit 20 is a multi-bit status register signal, and adopts a one-hot code (One-hot, that is, only one bit is valid at any clock edge). Each bit signal in the verification data valid signal indicates a sub-verification data, thereby more efficiently determining whether there is verification data corresponding to the read target data command in the preset cache 60.

[0085] In some embodiments of the present application, the prefetch control circuit 20 is further configured to generate a read verification data command based on a preset data length and a second base address obtained from the register 50 when verification data corresponding to the read target data command to the external memory 90 does not exist in the preset cache 60, and send the read target data command signal and the read verification data command to the external memory 90 via the multiplexer 70;

[0086] The read data processing circuit 30 is further used to save the verification data returned by the external memory 90 to the preset cache 60 when receiving the verification data returned by the external memory 90, and to update the cache address signal and the cache valid signal.

[0087] In this embodiment, since the corresponding verification data does not exist in the preset cache 60, the corresponding verification data needs to be read from the external memory 90. The register 50 is pre-configured with a second base address corresponding to the verification data, and the pre-fetch control circuit 20 obtains the second base address from the register 50, generates a read verification data command according to the preset data length and the second base address, and sends the read target data command signal and the read verification data command to the external memory 90 via the multiplexer 70. The preset length corresponds to a plurality of sub-verification data, so that the read verification data includes a plurality of sub-verification data.

[0088] The external memory 90 responds to the read target data command signal and the read verification data command, and returns the corresponding target data and verification data to the read data processing circuit 30. While the read data processing circuit 30 sends the target data to the verification circuit 40, it saves the verification data in the preset cache 60, and updates the cache address signal and the cache valid signal. Subsequently, the corresponding target sub-verification data can be obtained from the preset cache 60, and the verification of the target data is completed. In addition, since the saved verification data includes multiple sub-verification data, for one or more subsequent received read target data commands, the corresponding sub-verification data can be directly obtained from the saved verification data without generating a read verification data command to the external memory 90.

[0089] When there is no verification data corresponding to the read target data command in the preset cache 60, the pre-fetch control circuit 20 reads the corresponding verification data from the external memory 90 and saves it to the preset cache 60, thereby ensuring reliable ECC verification of the target data. Moreover, since the saved verification data includes multiple sub-verification data, when one or more read target data commands are subsequently received, the corresponding sub-verification data can be directly obtained from the saved verification data, thereby improving data reading efficiency.

[0090] In some embodiments of the present application, the device further includes:

[0091] A register configuration circuit, used for configuring the ECC check enable signal, the first base address and the second base address to the register 50;

[0092] Among them, the prefetch control circuit 20 is also used to compare the target data address and the first base address in the read target data command, and generate a read protection request signal according to the comparison result. The read protection request signal and the ECC check enable signal in the register 50 generate an ECC verification enable signal after passing through an AND gate. The ECC verification enable signal and the read target data command signal are input into the multiplexer 70.

[0093] In this embodiment, the ECC check enable signal, the first base address and the second base address are pre-configured to the register 50 through the register configuration circuit. The ECC check enable signal is used to control whether the ECC check function is turned on. The subsequent pre-fetch control circuit 20 can obtain the ECC check enable signal, the first base address and the second base address from the register 50.

[0094] The pre-fetch control circuit 20 obtains the target data address in the read target data command, compares the target data address with the first base address, and generates a read protection request signal according to the comparison result. The read protection request signal and the ECC check enable signal are combined through an AND gate to generate an ECC verification enable signal. The ECC verification enable signal and the read target data command signal are both input to the multiplexer 70. The ECC verification enable signal is the control signal of the multiplexer 70, and the read target data command signal and the read target data command are two input signals of the multiplexer 70.

[0095] In the specific application scenario of the present application, if the target data address is less than the first base address, the read protection request signal is low, and then the ECC verification enable signal is low. If the target data address is not less than the first base address, the read protection request signal is high, and when the ECC verification enable signal is high, the ECC verification enable signal is high.

[0096] By setting the register configuration circuit to configure the register 50, it is ensured that the pre-fetch control circuit 20 can reliably obtain the ECC check enable signal, the first base address and the second base address, and generate a read protection request signal by comparing the target data address and the first base address in the read target data command, and generate an ECC verification enable signal according to the read protection request signal and the ECC check enable signal, so as to determine whether to perform ECC check according to the target data address of the read target data command, thereby improving reliability.

[0097] In some embodiments of the present application, the multiplexer 70 is also used to transparently transmit the read target data command to the external memory 90 when the ECC verification enable signal is at the second level, so as to read data without ECC verification from the external memory 90.

[0098] In this embodiment, when the ECC verification enable signal is at the second level, it indicates that the read target data command is used to read data without ECC verification from the external memory 90. Since no ECC verification is required, the multiplexer 70 transparently transmits the read target data command to the external memory 90, and the external memory 90 returns the corresponding data to the chip processor 80, thereby ensuring reliable reading of data from the external memory 90.

[0099] In the specific application scenario of the present application, the first level is a high level, and the second level is a low level. When the ECC verification enable signal is a high level, an ECC check is required, and the multiplexer 70 sends the read target data command signal output by the pre-fetch control circuit 20 to the external memory 90, or sends the read target data command signal and the read verification data command output by the pre-fetch control circuit 20 to the external memory 90. When the ECC verification enable signal is a low level, an ECC check is not required, and the multiplexer 70 transparently transmits the read target data command to the external memory 90.

[0100] In order to further explain the technical idea of ​​the present application, the technical solution of the present application is now described in combination with specific application scenarios.

[0101] The embodiment of the present application provides a data reading device that uses the AXI protocol to read data from an external memory 90 .

[0102] like Figure 4 As shown, the register 50 is pre-configured through the APB bus, including the ECC check enable signal (ecc_en), the second base address (code_start_addr), and the first base address (date_start_addr). The configuration data of the register 50 needs to be sent to the pre-fetch control circuit 20 and cross-clock domain processing before AXI transmission to reduce the probability of generating a metastable state.

[0103] The read command processing circuit 10 includes a built-in dual-port SRAM, uses a fifo to receive data, and has a first-in first-out feature. The function of the fifo is to process the outstanding transmission of AXI. The fifo receives the read target data command issued by the CPU (i.e., the chip processor 80). When the read target data command continuously sent by the CPU is greater than the fifo depth and the read data is not completed, the CPU will be back-pressured, that is, the arready_s signal will be pulled low. The read command processing circuit 10 outputs aarvalid_d, araddr_d, and arid_d to the multiplexer 70 (MUX). The ecc_en configured by the register 50 and the read protection request signal (rd_prot_req) form an ECC verification enable signal (ecc_verify_en) through an AND gate. Ecc_verify_en is the control signal of the multiplexer 70. When ecc_en or rd_prot_req is low, no ECC check is performed, and the read command processing circuit 10 outputs arvalid_d, araddr_d, and arid_d signals, which are transparently transmitted to the interface of the external memory 90 through the multiplexer 70, that is, the bypass mode is adopted. When ecc_en and rd_prot_req are both high, ecc_verify_en is high, and ECC check is performed. The pre-fetch control circuit 20 outputs arvalid_new, araddr_new, and arid_new to the multiplexer 70, and then outputs them to the interface of the external memory 90. The rest of the AXI signals are transparently transmitted without additional processing.

[0104] The pre-fetch control circuit 20 obtains the cache address signal (addr_c) and cache valid signal (buf_vld) output by the preset cache 60, and the internal encoder generates the verification data valid signal (code_valid) and rd_prot_req according to the above signals. The logic of the pre-fetch control circuit 20 to generate rd_prot_req is that the internal judgment circuit judges according to the valid aradr_d signal sent by the CPU and the data_start_addr configured by the register 50. Whether aradr_d is valid is generated by arvalid_d and arready_m through the AND gate, that is, the addr_valid signal is valid when it is high. When aradr_d is less than data_start_addr, the output rd_prot_req is low, indicating that the current transmission is not in the ECC protection area, and the data reading device enters the bypass mode. When aradr_d is not less than data_start_addr, rd_prot_req is high, and ECC verification is performed. When buf_vld is low, it means that the cached data is invalid. The pre-fetch control circuit 20 will generate a read verification data command, and perform timing alignment between the read verification data command and the clock (aclk) to ensure that the setup time and hold time are met and to reduce the generation of metastable states. The read verification data command and the read data command signal (arvalid_new, araddr_new, arid_new) will then be distinguished and output to the external memory 90 through the multiplexer 70.

[0105] When buf_vld is at a high level, the pre-fetch control circuit 20 determines whether there is target sub-check data in the preset cache 60 according to addr_c, and outputs code_valid to indicate valid target sub-check data. code_valid is a multi-bit state register 50 signal, which uses a one-hot code to reduce decoding complexity and reduce the probability of burrs. Each bit of code_valid indicates a sub-check number. When code_valid is all at a low level, it means that there is no target sub-check data in the preset cache 60, and a read check data command needs to be generated to obtain the check data from the outside.

[0106] The preset cache 60 includes a cache unit and a decoding unit. The cache unit is an internal multi-bit register for storing verification data. When the cache unit of the preset cache 60 has corresponding verification data, it will output a high level buf_vld, and at the same time calculate the cache base address (addr_c) corresponding to the cache data and send it to the pre-fetch control circuit 20. The decoding unit receives code_valid designed with a unique hot code to reduce the decoding logic. Output the target sub-verification data to the verification circuit 40 according to the valid bit of code_valid.

[0107] The read data processing circuit 30 also has a built-in dual-port SRAM. When the fifo is full (i.e., multiple data are read in but not read out, causing the fifo to reach the maximum waterline), the rready_m signal will be pulled down to achieve back pressure and ensure pipeline operation. The read data processing circuit 30 has a decoder inside, which identifies the read channel data as target data or verification data according to the input rid signal. If it is verification data, the data is updated to the preset cache 60, and addr_c and buf_vld are updated at the same time. If it is target data, the data and the response control signal are sent to the verification circuit 40. When the transmission data is detected to be abnormal, that is, the input rresp_m signal is not 0, uncorrect_irq (i.e., the second interrupt) will be output through the OR gate, and the CPU will enter the corresponding interrupt service program.

[0108] The verification circuit 40 verifies the target data according to the SECDED64 ECC standard algorithm. If the verification is correct, the target data is returned to the CPU. If it is a single-bit error, the read data error correction is performed and the target data is returned to the CPU, but correct_irq (i.e., the first interrupt) is generated. If it is a multi-bit error, uncorrect_irq (i.e., the second interrupt) is directly generated, and the CPU enters the corresponding interrupt service program.

[0109] For example, if Figure 5 As shown, take the CPU sending three consecutive read target data commands to read a total of 64 bits of data as an example, the read addresses are 0x0, 0x8 and 0x10 respectively. First, reset the data reading device, turn on the ECC check enable of the APB bus configuration register, the ECC data base address (i.e., the second base address) is 0x1_0000, the Data data base address (i.e., the second base address) is 0x0, and the configuration check data is 64 bits. According to the ECC algorithm, 64 bits of data correspond to 8 bits of ECC data.

[0110] When the first read target data command is received, the preset cache is empty at this time, so a read ECC command (i.e., read check data command) will be issued first, and the ARID of the read ECC command is different from the ARID of the read target data command. The read ECC command directly reads 64 bits of check data, rather than the required 8 bits of sub-check data. According to the configured Data data base address and the current read command address offset relationship, it can be known that the read ECC command address is 0x1_0000. The read check data is stored in the preset cache, and the address range of the corresponding check data is recorded at the same time, that is, 0x0-0x40, with each 8 addresses as a group. When the CPU reads data for the first time, the read address is 0x0, and the address of the sub-check data is the first group of the check data address. Then, the first 8 bits of data in the preset cache are taken out for verification, that is, the ECC data at the address 0x1_0000 is taken out. When the CPU reads data for the second time, the read address is 0x8, that is, data of 0x8-0xf. After reading the corresponding target data from the external memory, the second group of 8-bit data is directly obtained from the preset cache for verification, that is, data of 0x1_0001, and there is no need to issue a read ECC command again. Similarly, when the CPU reads data for the third time, there is no need to issue a read ECC command again.

[0111] like Figure 6 The timing diagram of different signals when data is read using the data reading method of the embodiment of the present application is shown. For the sake of simplicity, the remaining signals of AXI and some internal signals are not listed. The timing diagram uses AXI Burst to transmit Arlen=0x1, Arsize=0x2, data_start_addr=0x0, code_start_addr=0x1_0000, and the internal SRAM has not reached the maximum waterline, that is, there is no back pressure.

[0112] At clock edge 3, the read target data command of arddr_s=0x0, arid_s=0x0 issued by the CPU is received. Since buf_vld is at a low level at this moment, that is, there is no valid verification data in the preset cache, the read verification data command is reissued. In this embodiment, the fourth bit of the axi id signal is used to distinguish. After the external memory returns the verification data, the verification data is stored in the data cache, and buf_vld is pulled to a high level at the same time, and then the read target data command signal continues to be issued, and the internal circuit updates code_vld and addr_c according to the read data address. Since the ID signal arriving at the same clock edge as the data is used to distinguish the verification data and the target data, after the target data is returned by rdata_m at clock edge 8, the internal register transmits the signal to rdata_s after a clock delay, that is, clock edges 9 and 10, and the verification is completed at clock edge 10, that is, when there is no target sub-verification data in the preset cache, the verification process takes 8 clock edges.

[0113] After receiving the read target data command of addr_s=0x8, arid_s=0x0 issued by the CPU at clock edge 11, the internal code_vld indicates that there is target sub-verification data in the preset cache, so the read target data command signal is directly sent to the external memory. After one clock delay for timing alignment, the target data is transferred to rdata_s at clock edge 13, and the verification is completed at clock edge 14. When there is target sub-verification data in the preset cache, the verification process takes 4 clock edges, which is twice as efficient as the case where there is no target sub-verification data in the preset cache. In the case of continuous reading of external data, the ECC verification rate will be greatly improved. It should be noted that the verification in this embodiment does not represent a circuit signal, but for the convenience of explanation, it expresses the state of verification at a certain moment.

[0114] The present application also provides a chip, such as Figure 7 As shown, it includes a chip processor 80 and a data reading device 801 in an embodiment of the present application.

[0115] The above-mentioned chip processor can be a general-purpose processor, including CPU, NP (Network Processor), etc.; it can also be DSP (Digital Signal Processing), ASIC (Application Specific Integrated Circuit), FPGA (Field Programmable Gate Array) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.

[0116] In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in a processor or an instruction in the form of software. The steps of the method disclosed in conjunction with the embodiment of the present application can be directly embodied as a hardware processor for execution, or a combination of hardware and software modules in a processor for execution. The software module can be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in a memory, and the processor reads the information in the memory and completes the steps of the above method in conjunction with its hardware. To avoid repetition, it is not described in detail here.

[0117] In various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0118] Those skilled in the art will appreciate that the various illustrative logical blocks (ILBs) and steps described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or in a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0119] The above embodiments are only exemplary embodiments of the present application and are not intended to limit the present application. The protection scope of the present application is defined by the claims. Those skilled in the art may make various modifications or equivalent substitutions to the present application within the essence and protection scope of the present application, and such modifications or equivalent substitutions shall also be deemed to fall within the protection scope of the present application.

Claims

1. A data reading method, characterized in that: include: In response to a read target data command sent by the chip processor, it is determined whether there is check data in the preset cache, wherein the read target data command is used to read target data to be ECC checked from an external memory, wherein the check data includes a plurality of sub-check data, and each of the sub-check data corresponds to a read target data command; If verification data corresponding to the read target data command to the external memory exists in the preset cache, obtaining the target sub-verification data from the preset cache without generating a read verification data command to the external memory; Reading target data from the external memory based on the target data address in the read target data command and a first base address preconfigured in the register; Performing an ECC check based on the target sub-check data and the target data, and returning the target data to the chip processor after the check passes; Also includes: If the verification data corresponding to the command to read the target data from the external memory does not exist in the preset cache, based on the preset data length and the second base address pre-configured in the register, reading the verification data corresponding to the command to read the target data from the external memory from the external memory; Saving the verification data corresponding to the command to read the target data from the external memory to the preset cache; Among them, the preset data length corresponds to multiple sub-check data, and according to the cache address signal and cache valid signal of the preset cache, it is determined whether there is check data corresponding to the read target data instruction in the preset cache. When there is check data corresponding to the read target data command in the preset cache, the target sub-check data is obtained from the preset cache using the check data valid signal, and the check data valid signal is a multi-bit status register signal and each bit signal indicates a sub-check data.

2. The data reading method according to claim 1, wherein: The read target data command includes a first command signal based on the AXI protocol, the target data includes a first data signal corresponding to the first command signal, and based on a preset data length and a second base address pre-configured in the register, reading verification data corresponding to the read target data command to the external memory from the external memory includes: Generate a read verification data command based on a preset data length and the second base address, and add a second command signal based on the AXI protocol to the read verification data command; Aligning the read verification data command with the timing so that the read verification data command meets a preset setup time and a preset hold time; Reading verification data corresponding to a read target data command of the external memory from the external memory based on the timing-aligned read verification data command, and adding a second data signal corresponding to the second command signal to the read verification data; The first command signal is different from the second command signal, and the first data signal is different from the second data signal.

3. The data reading method according to claim 2, wherein: The first command signal and the second command signal belong to ARID under the AXI protocol, and the first data signal and the second data signal belong to RID under the AXI protocol, or, The first command signal and the second command signal belong to ARUSER under the AXI protocol, and the first data signal and the second data signal belong to RUSER under the AXI protocol.

4. The data reading method according to claim 1, characterized in that: The register is also pre-configured with an ECC check enable to control whether to turn on the ECC check function. The determining whether there is check data in the preset cache includes: Generate a check command based on the ECC check enable, and determine whether there is check data corresponding to a command to read target data from an external memory in the preset cache in response to the check command; The first base address, the second base address and the ECC check enable are configured to the register based on the APB bus.

5. A data reading device, characterized in that: It includes a read command processing circuit, a pre-fetch control circuit, a read data processing circuit, a check circuit, a register, a preset cache and a multiplexer. The read command processing circuit is used to obtain a read target data command for an external memory sent by a chip processor, and output the read target data command to the multiplexer and the pre-fetch control circuit; The pre-fetch control circuit is used to determine whether there is verification data corresponding to the read target data instruction in the preset cache according to the cache address signal and the cache valid signal of the preset cache, and when there is verification data corresponding to the read target data command to the external memory in the preset cache, output a verification data valid signal to the preset cache, so as to send the target sub-verification data in the preset cache to the verification circuit, wherein the verification data includes a plurality of sub-verification data, each of which corresponds to a read target data command; The multiplexer is used to output a read target data command signal to the external memory when the ECC verification enable signal is at a first level, so that the external memory returns the target data to the read data processing circuit, wherein the ECC verification enable signal indicates whether an ECC check needs to be performed on the data read from the external memory, and the read target data command signal is generated by the prefetch control circuit according to the target data address in the read target data command and the first base address obtained from the register; The read data processing circuit is used to output the target data to the verification circuit when receiving the target data returned by the external memory; The verification circuit is used to perform ECC verification based on the target sub-verification data and the target data, and return the target data to the chip processor after the verification passes; The prefetch control circuit is further configured to generate a read verification data command based on a preset data length and a second base address obtained from the register when verification data corresponding to a read target data command to the external memory does not exist in the preset cache, and send the read target data command signal and the read verification data command to the external memory via the multiplexer; The read data processing circuit is further used for, when receiving the verification data returned by the external memory, saving the verification data returned by the external memory to the preset cache, and updating the cache address signal and the cache valid signal; The preset data length corresponds to a plurality of sub-check data, the check data valid signal is a multi-bit status register signal and each bit signal indicates a sub-check data.

6. The data reading device according to claim 5, characterized in that: The device also includes: A register configuration circuit, configured to configure the ECC check enable signal, the first base address and the second base address to the register; Among them, the prefetch control circuit is also used to compare the target data address in the read target data command and the first base address, and generate a read protection request signal according to the comparison result, the read protection request signal and the ECC check enable signal in the register are connected through an AND gate to generate the ECC verification enable signal, and the ECC verification enable signal and the read target data command signal are input into the multiplexer.

7. The data reading device according to claim 5, characterized in that: The multiplexer is further configured to transparently transmit the read target data command to the external memory when the ECC verification enable signal is at the second level, so as to read data without ECC verification from the external memory.

8. A chip, characterized in that: It comprises a chip processor and a data reading device as described in any one of claims 5-7.