Memory device, chip, board card, computer equipment and read-write method
By setting up processing units and reference storage units in the storage device, and calculating and storing data residuals, the problem of high power consumption when writing data to SRAM register files is solved, and the effect of reducing write power consumption is achieved.
Patent Information
- Application Number
- CN202411100821.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-09
- Publication Date
- 2026-02-10
AI Technical Summary
In existing technologies, the power consumption for writing data is relatively high when building register files using SRAM.
A processing unit and a reference storage unit are set up in the storage device. The residual between the written data and the reference data is calculated and stored. The effective number of bits of the residual data is smaller than that of the written data, thereby reducing storage resources and power consumption during writing.
By storing residual data instead of complete data, the storage resource requirements during writing are reduced, and the power consumption of writing data is lowered.
Smart Images

Figure CN121501205A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the chip technical field, and in particular, to a memory device, a chip, a board card, a computer device and a read-write method. BACKGROUND
[0002] Register file, also known as register stack, is a small and fast storage unit set used for storing the operands of a processor in a computer system, which is used for storing and quickly accessing the operands and intermediate results required when the processor executes instructions.
[0003] In the related art, the register file can be implemented by a static random access memory (SRAM), for example, when a register file is constructed by using an SRAM with a bit width of 32 bits, data is written into the register file in units of 32 bits.
[0004] However, when data is written into the register file by using the SRAM to construct the register file, the power consumption of the write operation is high. SUMMARY
[0005] Embodiments of the present application provide a memory device, a chip, a board card, a computer device and a read-write method, which can reduce the power consumption when data is written, and the technical solution is as follows:
[0006] On the one hand, a memory device is provided, which comprises a reference storage unit and a processing unit; the reference storage unit is connected with the processing unit;
[0007] The reference storage unit is configured to store reference data.
[0008] The processing unit is configured to read the reference data from the reference storage unit in the case of writing first data in a first bit width; determine residual data based on the difference between the first data and the reference data, the number of valid data bits of the residual data being less than the number of valid data bits of the first data.
[0009] The processing unit is configured to store the residual data to a target position in a second bit width, the second bit width being less than the first bit width.
[0010] On the other hand, a chip is provided, which comprises the memory device as described above.
[0011] On the other hand, a board card is provided, which comprises the memory device as described above.
[0012] In another aspect, a computer device is provided, the computer device comprising the memory device as described above, or the computer device comprising the chip as described above, or the computer device comprising the board card as described above.
[0013] In another aspect, a read-write method is provided, the method being performed by a memory device, the memory device comprising: a reference storage unit and a processing unit; the method comprising:
[0014] The reference storage unit is configured to store reference data.
[0015] The processing unit is configured to read the reference data from the reference storage unit in a case of first data with a first bit width, and determine residual data based on a difference between the first data and the reference data, the residual data having a number of bits of valid data smaller than a number of bits of valid data of the first data.
[0016] The processing unit is configured to store the residual data to a target location according to a second bit width, the second bit width being smaller than the first bit width.
[0017] In another aspect, a computer device is provided, the computer device comprising a processor and a memory, the memory having stored therein at least one instruction, at least one program, a code set or an instruction set, the at least one instruction, the at least one program, the code set or the instruction set being loaded and executed by the processor to implement any of the read-write methods described above.
[0018] In another aspect, a computer-readable storage medium is provided, the storage medium having stored therein at least one instruction, at least one program, a code set or an instruction set, the at least one instruction, the at least one program, the code set or the instruction set being loaded and executed by a processor to implement any of the read-write methods described above.
[0019] In another aspect, a computer program product or a computer program is provided, the computer program product or the computer program comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to cause the computer device to perform any of the read-write methods described above.
[0020] The technical solutions provided by the embodiments of the present application have at least the following beneficial effects:
[0021] The memory device is provided with a processing unit and a reference storage unit. When writing first data into the memory device, the complete first data is not directly stored, but a residual error between the first data and reference data stored in the reference storage unit is calculated by the processing unit, and the residual error data is stored, wherein the number of valid data bits of the residual error data is less than that of the first data, and the bit width required for storing the residual error data is less than that required for storing the first data, thereby reducing the storage resource required for writing data and lowering the power consumption during writing data. BRIEF DESCRIPTION OF DRAWINGS
[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort.
[0023] Figure 1 is a structural block diagram of a computer system provided by an exemplary embodiment of the present application;
[0024] Figure 2 is a schematic diagram of processing a write request of data by a memory device according to an exemplary embodiment of the present application;
[0025] Figure 3 is a structural block diagram of a memory device according to an exemplary embodiment of the present application;
[0026] Figure 4 is a structural block diagram of a memory device according to another exemplary embodiment of the present application;
[0027] Figure 5 is a structural block diagram of a memory device according to still another exemplary embodiment of the present application;
[0028] Figure 6 is a structural block diagram of a memory device according to yet another exemplary embodiment of the present application;
[0029] Figure 7 is a structural block diagram of a register file access device according to an exemplary embodiment of the present application;
[0030] Figure 8 is a schematic diagram of updating a reference register according to an exemplary embodiment of the present application;
[0031] Figure 9 is a schematic diagram of updating a reference register according to another exemplary embodiment of the present application;
[0032] Figure 10 is a schematic diagram of updating a reference register according to still another exemplary embodiment of the present application;
[0033] Figure 11 This is a schematic diagram illustrating the processing of data read requests by a storage device according to an exemplary embodiment of this application;
[0034] Figure 12 This is an interactive flowchart of a read / write method provided in an exemplary embodiment of this application;
[0035] Figure 13 This is a structural block diagram of a computer device provided in an exemplary embodiment of this application. Detailed Implementation
[0036] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0037] In this application, the terms "first" and "second" are used to distinguish between identical or similar items that have essentially the same function. It should be understood that there is no logical or temporal dependency between "first" and "second", nor is there any limitation on the quantity or execution order.
[0038] It should be noted that this application may display a prompt interface, pop-up window, or output voice prompts before and during the collection of user-related data (e.g., reference data acquired by storage devices, first data, etc.). These prompt interfaces, pop-ups, or voice prompts are used to inform the user that their relevant data is being collected. This ensures that the application only begins executing the steps related to acquiring user-related data after receiving confirmation from the user regarding the prompt interface or pop-up window; otherwise (i.e., without receiving confirmation from the user), the steps to acquire user-related data are terminated, meaning no user-related data is acquired. In other words, all user data collected in this application is collected with the user's consent and authorization, and the collection, use, and processing of related user data must comply with relevant laws, regulations, and standards.
[0039] Figure 1 This is a structural block diagram of a computer system provided in an exemplary embodiment of this application. The computer system 100 can be implemented as the hardware architecture of the storage device provided in the embodiments of this application, or as the system architecture of the read / write method provided in the embodiments of this application. The computer system 100 includes: a terminal 110 and a server 120.
[0040] Terminal 110 may be equipped with the storage device provided in the embodiments of this application, or terminal 110 may be equipped with a chip in which the storage device provided in the embodiments of this application is provided. Optionally, the chip may be implemented as a system-on-a-chip (SoC), which is a highly integrated electronic device that integrates a processor, memory, various interface control modules, various interconnect buses, etc.
[0041] Terminal 110 can be an electronic device such as a mobile phone, tablet computer, vehicle terminal (vehicle system), wearable device, PC (Personal Computer), or unmanned reservation terminal, etc., and this application embodiment does not limit this. A client with a target application can be installed and run on terminal 110. This target application can be an application that applies the read / write method provided in this application embodiment. Furthermore, this application does not limit the form of the target application, including but not limited to Apps (Applications), mini-programs, etc., installed on terminal 110, and can also be in web page form.
[0042] Server 120 may be equipped with the memory provided in this embodiment, or server 120 may be equipped with a board that is equipped with the storage device provided in this embodiment. Furthermore, server 120 may be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services. Server 120 may be a backend server for the aforementioned target application, used to provide backend services to the client of the target application. Optionally, server 120 may also be implemented as a node in a blockchain system.
[0043] Terminal 110 and server 120 can communicate via a network, such as a wired or wireless network. In the read / write method provided in this application, the execution entity for each step can be a storage device in a computer device, which can be the aforementioned terminal 110 and / or server 120.
[0044] A register file, also known as a register stack, is a small, fast set of memory locations in a computer system used to store processor operands. It is a key component for flexible processor programming, used to store and quickly access operands and intermediate results required by the processor during instruction execution. For example, when performing a series of calculations, except for input / output data imported from external memory, intermediate temporary data is stored in the register file. In related technologies, register files are implemented in two ways: small register files can be built using registers, while large register files require SRAM.
[0045] For register files built from SRAM, if the system requires the register file to support 32-bit data operations, a 32-bit SRAM can be used to construct the register file. When performing read and write operations on the register file, the entire SRAM needs to be enabled. When the SRAM has a large bit width, enabling the entire SRAM will result in very high power consumption for each read / write operation.
[0046] Based on this, this application proposes a storage device for receiving data write requests and data read requests. The following explanation uses a data write request as an example. Please refer to [link / reference]. Figure 2 It illustrates a schematic diagram of a storage device processing a data write request.
[0047] like Figure 2 As shown, the storage device provided in this application embodiment includes: a base memory 201 and a processing unit 202.
[0048] When the storage device receives a data write request, the processing unit 202 first obtains the write data in the data write request, such as 0x1010; then the processing unit 202 obtains the register value from the reference register 201 as the reference data, such as obtaining 0x1000 as the reference data; finally, the processing unit 202 calculates the difference 0x10 between the write data 0x1010 and the reference data 0x1000 as the residual data, and stores the residual data in the target location.
[0049] Here, both the write data 0x1010 and the residual data 0x10 refer to hexadecimal numbers. The write data 0x1010 is converted to the binary number 1000000010000, and the residual data 0x10 is converted to the binary number 10000. Therefore, the write data 0x1010 requires a 16-bit wide storage unit for storage, while the residual data 0x10 only requires an 8-bit wide storage unit for storage.
[0050] Optionally, the target location mentioned above can be implemented as an SRAM, such as... Figure 2 As shown, the storage device includes SRAM, which is connected to the processing unit 202. In some embodiments, the SRAM has a bit width of 32 bits and can be divided into four memory slices, each with a bit width of 8 bits. The processing unit 202 sends residual data 0x10 to the SRAM. The SRAM only needs to activate one memory slice to store the residual data 0x10. For example, if memory slice 0 is activated to store the residual data 0x10, memory slice 1, memory slice 2, and memory slice 3 do not need to be activated.
[0051] In summary, the storage device provided in this application embodiment is equipped with a processing unit and a reference register. Each time data needs to be written to the storage device, the processing unit calculates the residual between the written data and the reference data stored in the reference register, and writes the residual into the SRAM. The number of bits of the residual between the written data and the reference data is less than the number of bits of the written data, and the bit width required to store the residual is small. That is to say, only a small number of slice memory areas in the SRAM need to be activated to store the residual, thereby reducing the number of slice memory areas activated in the SRAM when writing data and reducing the power consumption when writing data to the SRAM.
[0052] The memory device provided by the embodiments of the present application is introduced as follows.
[0053] Please refer to Figure 3 The illustration shows a schematic diagram of a storage device 300 provided in an exemplary embodiment, the storage device 300 including: a reference storage unit 310 and a processing unit 320; the reference storage unit 310 is connected to the processing unit 320.
[0054] Optionally, the aforementioned storage device refers to hardware used for writing and reading data. Illustratively, a storage device refers to at least one of hardware such as a chip, a system-on-a-chip (SoC), or a board; this application embodiment does not limit this definition.
[0055] Taking a chip implemented as a processor as an example, the aforementioned memory device is located inside the processor; or, the memory device is set as a separate hardware that is connected to the processor; or, a part of the memory device is located inside the processor, and another part is set as a separate hardware that is connected to the processor, such as the processing unit being located inside the processor and the reference storage unit being set as a separate hardware that is connected to the processor, wherein the processor includes at least one of a central processing unit (CPU), a graphics processing unit (GPU), etc.
[0056] The reference storage unit 310 is used to store reference data.
[0057] The reference storage unit can be implemented as at least one of the following: register, cache, static random access memory, etc. The reference storage unit has a corresponding bit width, which determines the amount of data that the storage unit can store. For example, assuming the reference storage unit is used to store binary data and its bit width is 8 bits, then the maximum number of bits of binary data that the reference storage unit can store is 8 bits.
[0058] Optionally, reference data refers to data stored in a reference storage unit for comparison with the data to be written. Optionally, a single reference storage unit may store one or more reference data, and this application embodiment does not limit this; the following description mainly uses the example of a single reference storage unit storing one reference data. Illustratively, if the reference storage unit is implemented as a register, then the reference data refers to the register value of the register.
[0059] In some embodiments, the baseline storage unit is used to determine and store baseline data based on a configured write strategy. Optionally, the write strategy includes at least one of the following strategies:
[0060] 1. Use the first target data written as the baseline data.
[0061] Optionally, the processing unit receives a target write request, which is used to request the writing of target data. At this time, the reference storage unit in the storage device is empty (i.e., no data is stored). Then the processing unit can write the target data into the reference storage unit, and the reference storage unit stores the target data as reference data.
[0062] 2. Select preset data as the baseline data.
[0063] Optionally, during storage device initialization, the processing unit writes preset data into the reference storage unit, which stores the preset data as reference data. The preset data may be data randomly determined by the developers.
[0064] It should be noted that the above examples of writing strategies are merely illustrative and are not intended to limit the scope of this application.
[0065] In some embodiments, a reference storage unit is used to update stored reference data.
[0066] For strategy 1, optionally, the stored baseline data is updated based on a preset period; or, the stored baseline data is updated based on multiple historical data, where the multiple historical data are data written within a historical time period.
[0067] Schematic: In the first cycle after storage device initialization (the start of the first cycle is the moment target data 1 is written), the first written target data 1 is stored in the reference storage unit as the reference data. In the second cycle, the first written target data 2 is stored in the reference storage unit as the new reference data, and so on. Alternatively, the average, median, or other statistical measure of multiple written data (i.e., the write data included in the data write request) within a historical time period is calculated to obtain write data 1, and write write data 1 is written to the reference storage unit as the new reference data.
[0068] For strategy 2, optionally, the stored baseline data is updated based on a preset period.
[0069] To illustrate, during the initialization of the storage device, preset data 1 is stored in the reference storage unit as reference data. After a preset time (the period of the preset cycle), preset data 2 is stored in the reference storage unit as new reference data, and so on.
[0070] The number of storage cells used to store reference data in the storage device can be one or more. In some embodiments, when the storage device is provided with multiple first storage cells for storing reference data, the multiple first storage cells are respectively connected to the processing unit, and the bit width of different first storage cells can be the same or different, and different first storage cells are used to store different reference data.
[0071] In some embodiments, the storage device is configured to receive a data write request, which requests that data be written into the storage device.
[0072] The following describes the flow of a memory device processing a data write request. Figure 3 The flow of a memory device processing a data write request is shown.
[0073] The processing unit 320 is configured to read reference data from the reference storage unit 310 when writing first data with a first bit width; and determine residual data based on the difference between the first data and the reference data.
[0074] Bit width typically refers to the maximum number of bits of data that a storage unit can store.
[0075] In some embodiments, the first bit width refers to the minimum bit width used to store the first data. For example, assuming the first data has 30 valid data bits, the required minimum bit width is 30 bits, meaning the first bit width is 30 bits.
[0076] In other embodiments, the first bit width indicates the bit width of the minimum preset storage unit used to store the first data. Illustratively, the bit width of the preset storage unit is pre-designed according to requirements; the bit width of the preset storage unit can be 8 bits, 16 bits, 32 bits, etc., and is not limited here. Assuming the number of valid data bits for the first data is 30 bits, then the required minimum preset storage unit bit width is 32 bits, meaning the first bit width is 32 bits.
[0077] It should be noted that the number of bits mentioned in the embodiments of this application refers to the number of basic units required for data, where the data can be binary, decimal, hexadecimal, etc. This embodiment primarily uses the number of bits implemented as a binary number as an example for explanation. The aforementioned effective data bits refer to the number of bits actually containing valid information when representing a number. For example, in the binary number 010000, the effective data bits are the last 5 bits, so the number of effective data bits is 5; in the binary number 100000, the effective data bits are all the bits, so the number of effective data bits is 6.
[0078] After acquiring the first data and the baseline data, the processing unit determines the residual data based on the difference between the first data and the baseline data.
[0079] Schematic, residual data is used to indicate the difference between the reference data and the first data. In the field of general-purpose processors, the residual data between the first data and the reference data is the difference between the first data and the reference data, that is, the result of subtracting the reference data from the first data. The residual data can be implemented as the absolute value of the difference between the first data and the reference data. For example: assuming the first data is 0x1010 (where 0x refers to the hexadecimal identifier, 0x1010 represents the hexadecimal number 1010), and the reference data is 0x1000, then the residual data is 0x1010 - 0x1000 = 0x10.
[0080] Optionally, before determining the residual data, the reference data and the first data need to be converted to the same representation. For example, if the reference data is a binary number and the first data is a hexadecimal number, then the reference data needs to be converted to a hexadecimal number before performing residual calculation with the first data, or the first data needs to be converted to binary before performing residual calculation with the reference data.
[0081] The number of valid data bits in the residual data is less than the number of valid data bits in the first data.
[0082] In some embodiments, if the storage device is provided with a plurality of first storage units for storing reference data, when the plurality of first storage units respectively store reference data, the processing unit determines the residual data corresponding to the plurality of first storage units based on the difference between the first data and the reference data stored in the plurality of first storage units; and determines the storage unit with the smallest residual data among the plurality of first storage units as the reference storage unit.
[0083] Indicatively, the reference data a stored in the first storage unit a is 0x1000, the reference data b stored in the first storage unit b is 0x10, and the first data is 0x1010; the residual data a between the reference data a and the first data is 0x1010-0x1000=0x10, and the residual data b between the reference data b and the first data is 0x1010-0x10=0x1000, where 0x10 is less than 0x1000. Therefore, the first storage unit a corresponding to the reference data a is used as the reference storage unit, and the residual data a is used as the residual data to be stored.
[0084] The processing unit 320 is used to store the residual data into the target location according to the second bit width.
[0085] The width of the second dimension is smaller than that of the first dimension.
[0086] In some embodiments, the first bit width refers to the minimum bit width used to store the first data, and the second bit width refers to the minimum bit width used to store the residual data. For example, assuming the first data has 30 valid data bits, the second bit width is 30 bits; if the residual data has fewer valid data bits than the first data, then the residual data can have 5 valid data bits, and the second bit width is 5 bits, which is less than the first bit width.
[0087] In other embodiments, the first bit width indicates the bit width of the smallest preset storage unit used to store the first data, and the second bit width indicates the bit width of the smallest preset storage unit used to store the residual data. Illustratively, the bit width of the preset storage unit can be 8 bits, 16 bits, 32 bits, etc. Assuming the effective data bits of the first data are 30 bits, a 32-bit preset storage unit can be used to store the first data, then the second bit width is 32 bits. The effective data bits of the residual data are less than the effective data bits of the first data, and the effective data bits of the residual data are less than or equal to the target number of bits, where the target number of bits refers to the number of bits indicated by a preset storage unit (an 8-bit or 16-bit preset storage unit) with a bit width smaller than a 32-bit preset storage unit. Therefore, the effective data bits of the residual data can be 5 bits, and an 8-bit preset storage unit can be used to store the residual data, then the second bit width is 8 bits, which is less than the first bit width.
[0088] Optionally, the target location can be implemented as at least one target storage unit among multiple storage units, the total bit width of the multiple storage units is greater than or equal to the second bit width, and the total bit width of at least one target storage unit is equal to the second bit width.
[0089] In some embodiments, the processing unit is further configured to store identification information in an information table, the identification information including first identification information corresponding to the reference storage unit and second identification information corresponding to the target location, the first identification information and the second identification information being stored together in the information table.
[0090] The first identification information is used to identify the reference storage unit. For example, the first identification information can be implemented as at least one of the following: the ID (identity) of the reference storage unit, the address of the reference storage unit, or other information used to represent the reference storage unit. The second identification information is used to identify the target location. For example, the second identification information can be implemented as at least one of the following: the ID of the target location, the address of the target location, or other information used to represent the target location. This embodiment of the application does not limit this specific implementation.
[0091] As an illustration, the information table includes two list items. The first list item stores the first identifier information; the second list item stores the second identifier information. When the first identifier information is retrieved, the second identifier information can be obtained at the same time, or when the second identifier information is retrieved, the first identifier information can be obtained at the same time.
[0092] In the above embodiments, the first identification information representing the reference storage unit and the second identification information representing the target location are stored together in an information table. When the first data is read from the storage device, the second identification information can be determined through the first identification information, or the first identification information can be determined through the second identification information, thereby improving the efficiency of obtaining residual data and reference data.
[0093] In some embodiments, the processing unit includes: a first processing unit and a second processing unit; the first processing unit is connected to a reference storage unit, and the first processing unit is connected to the second processing unit.
[0094] Optionally, the first processing unit is configured to receive a first write request, which requests the writing of first data; read reference data from a reference storage unit based on the first write request; determine residual data based on the difference between the first data and the reference data; and send a second write request to the second processing unit, which requests the writing of the residual data. The second processing unit is configured to receive the second write request and store the residual data in a target location according to a second bit width based on the second write request.
[0095] The first write request requests the writing of first data, and the first write request contains the first data. Illustratively, after receiving the first write request, the first processing unit reads the reference data stored in the reference storage unit and parses the first write request to obtain the first data. Then, the first processing unit obtains residual data based on the difference between the first data and the reference data, encapsulates the residual data into a second write request, and sends the second write request to the second processing unit. After receiving the second write request, the second processing unit parses the second write request to obtain the residual data and stores the residual data in the target location according to the second bit width.
[0096] In the above embodiments, the processing unit is divided into a first processing unit and a second processing unit. The first processing unit is responsible for determining the residual data, and the second processing unit is responsible for storing the residual data. This decouples the determination and storage of the residual data, reduces the risk of single point of failure, and if one of the processing units fails, the other processing unit can still continue to work, thereby improving the overall reliability of the storage device.
[0097] In summary, the storage device provided in this application embodiment has a processing unit and a reference storage unit. When writing first data to the storage device, the complete first data is not stored directly. Instead, the processing unit calculates the residual between the first data and the reference data stored in the reference register and stores the residual data. The number of valid data bits of the residual data is less than that of the first data, and the bit width required to store the residual data is less than that required to store the first data, thereby reducing the storage resources required when writing data and reducing the power consumption when writing data.
[0098] In some embodiments, the storage device is further configured to receive a data read request, which requests to read data from the storage device.
[0099] The following describes the flow of a memory device processing a data read request. Figure 3 The flow of a memory device processing a data read request is shown.
[0100] The processing unit 320 is also configured to receive a first read request; read reference data from the reference storage unit 310 based on the first read request; and obtain residual data from the target location based on the first read request.
[0101] The first read request is used to read the first data. Upon receiving the first read request, the processing unit will perform the following operations:
[0102] (1) Reading reference data.
[0103] Optionally, the first read request includes first address information, which is used to indicate the storage location of the reference data.
[0104] In some embodiments, the first address information is used to indicate the address of the reference storage unit. Illustratively, after receiving a first read request, the processing unit parses the first read request to obtain the first address information. The processing unit can determine the reference storage unit based on the first address information. After determining the reference storage unit, the processing unit can read reference data from the reference storage unit.
[0105] (2) Obtaining residual data.
[0106] Optionally, the first read request may also include second address information, which is used to indicate the storage location of the residual data.
[0107] In some embodiments, the second address information is used to indicate the address of the target location. Illustratively, after receiving a first read request, the processing unit parses the first read request to obtain the second address information. The processing unit can determine the target location based on the second address information. After determining the target location, the processing unit can read residual data from the target location.
[0108] The processing unit 320 is used to merge the reference data and the residual data to obtain the first data as the request feedback data of the first read request.
[0109] Optionally, after determining the baseline data and residual data, the sum of the baseline data and residual data is calculated to obtain the first data. For example, if the baseline data is 0x1000 and the residual data is 0x10, their sum is calculated to obtain 0x1010, which is used as the first data, that is, the request feedback data of the first read request.
[0110] In summary, the storage device provided in this application embodiment, when reading first data in the storage device, the processing unit obtains reference data from the reference register unit and residual data from the target location, and then merges the reference data and residual data to obtain the first data. The bit width required to store the residual data is smaller than the bit width required to store the first data, thereby reducing the number of storage resources activated when reading the first data in the storage device and reducing the power consumption of reading data in the storage device.
[0111] In some embodiments, the target location is implemented as at least one target storage unit among a plurality of slice storage units. Please refer to Figure 4 , Figure 3 The storage device 300 shown also includes a plurality of slice storage units 330, which are respectively connected to the processing unit 320.
[0112] Optionally, the aforementioned storage device can be implemented as at least one of hardware such as a chip, a system-on-a-chip (SoC), or a board, and this application embodiment does not limit this. Taking a system-on-a-chip as an example, the SoC includes a processor and a memory, with a base storage unit and a processing unit disposed within the processor, and multiple chip storage units disposed within the memory.
[0113] Among them, multiple storage units include n storage units, where n is an integer greater than 1.
[0114] Optionally, the segment storage unit can be implemented as at least one of registers, caches, static random access memory, etc. Each segment storage unit has a corresponding bit width, wherein the bit widths of different segment storage units can be the same or different, and the total bit width of multiple segment storage units is greater than or equal to a second bit width. Optionally, the number of multiple segment storage units and the bit width of each segment storage unit can be preset; this embodiment of the application does not limit this.
[0115] As an illustration, multiple memory cell blocks can be implemented as multiple SRAMs. The bit width of each SRAM can be set to be relatively small, such as using four 8-bit SRAMs as multiple memory cell blocks. These four 8-bit SRAMs can be used to implement a 32-bit register file, which is typically used to store frequently used operands and data in the processor.
[0116] The following describes the flow of a memory device processing a data write request. Figure 4 The flow of a memory device processing a data write request is shown.
[0117] The processing unit 320 is configured to read reference data from the reference storage unit 310 when writing first data with a first bit width; and determine residual data based on the difference between the first data and the reference data.
[0118] The number of valid data bits in the residual data is less than the number of valid data bits in the first data.
[0119] The processing unit 320 is used to determine at least one target storage unit from a plurality of slice storage units 330 based on the number of bits of valid data in the residual data; and to send the residual data to the at least one target storage unit.
[0120] The width of the second dimension is smaller than that of the first dimension.
[0121] After determining the residual data, the processing unit determines the number of valid data bits of the residual data. In this embodiment, the valid data bits refer to the valid data bits after converting the residual data into binary data. For example, if the residual data is 0x10, which is 10000 in binary, then the valid data bits of the residual data are 5 bits.
[0122] The total bit width of at least one target storage cell is the second bit width. For example, if the number of valid data bits in the residual data is 5 bits and the second bit width is 8 bits, then the total bit width of at least one target storage cell is 8 bits.
[0123] Optionally, the processing unit is used to determine the number of storage units of the target storage unit based on the number of bits of the effective data bits of the residual data and the bit width corresponding to the multiple area storage units respectively; and to determine at least one target storage unit from the multiple area storage units based on the storage unit data.
[0124] In illustrative terms, multiple storage units each have a bit width of 8 bits. The effective data bits of the residual data are 15 bits, and the second bit width is 16 bits. Therefore, two storage units are needed to store the residual data. Two storage units are selected from the multiple storage units as target storage units. The multiple storage units are arranged sequentially; the first two storage units can be selected as target storage units. Alternatively, the two storage units with the lowest space utilization can be selected as target storage units. This application does not limit this selection.
[0125] The space utilization rate of a storage unit indicates the degree to which the storage space of a storage unit is effectively utilized. Indicatively, the space utilization rate refers to the ratio between the used storage space of a storage unit and the total storage space.
[0126] In some embodiments, the processing unit is configured to send residual data to a single target storage unit when a single target storage unit is present.
[0127] In other embodiments, the processing unit is configured to, when there are multiple target storage units, split the residual data based on the bit width corresponding to each of the multiple segment storage units to obtain multiple segment residual data, the number of segment residual data corresponding to the number of target storage units; and send the segment residual data to each of the multiple target storage units respectively.
[0128] Optionally, splitting the residual data into multiple segments refers to dividing the multiple sub-values contained in the residual data according to their positions within the residual data. For example, splitting the hexadecimal number 0x2fff into 0x2f and 0xff. Optionally, splitting the residual data into multiple segments can be done evenly or unevenly; there is no limitation here. For example, splitting the hexadecimal number 0x2fff into 0x2ff and 0xf, or splitting the hexadecimal number 0x2fff into 0x2f and 0xff.
[0129] Schematic illustration: The processing unit sends the residual data of the i-th segment to the i-th target storage unit, where i is a positive integer, and the maximum number of data bits indicated by the bit width of the i-th target storage unit is greater than or equal to the number of valid data bits of the residual data of the i-th segment. If the bit width of multiple segment storage units is 8 bits, the processing unit can split the residual data 0x10 into segment residual data 0x1 and segment residual data 0x0, sending segment residual data 0x1 to target storage unit a; and sending segment residual data 0x0 to target storage unit b.
[0130] It should be noted that 0x1 represents the first (most significant) digit in 0x10. The binary representation of 0x1 is 1, so the hexadecimal number 0x1 or the binary number 00000001 can be sent to the target storage unit a; 0x0 represents the second (least significant) digit in 0x10. The binary representation of 0x0 is 0, so the hexadecimal number 0x0 or the binary number 00000000 can be sent to the target storage unit b.
[0131] In the above embodiments, when there are multiple target storage units, the processing unit is responsible for splitting the residual data into multiple fragment residual data and sending these fragment residual data to the corresponding target storage units respectively, ensuring that the residual data is distributed in multiple target storage units. In addition, when a target storage unit fails, only part of the data will be affected, and the entire residual data will not be lost, thus improving data security.
[0132] At least one target storage unit is used to receive and store residual data.
[0133] In some embodiments, where a single target storage unit is present, the single target storage unit receives and stores the residual data.
[0134] In other embodiments, when multiple target storage units exist, each target storage unit receives and stores the segment residual data. Illustratively, target storage unit a receives segment residual data 0x1 and then stores the corresponding binary number 00000001, or target storage unit a receives and stores the binary number 00000001; target storage unit b receives segment residual data 0x0 and then stores the corresponding binary number 00000000, or target storage unit b receives and stores the binary number 00000000.
[0135] In some embodiments, the processing unit is further configured to store identification information in an information table. The identification information includes first identification information corresponding to a reference storage unit and second identification information corresponding to at least one target storage unit. The first identification information and the second identification information are stored together in the information table.
[0136] Optionally, the first identification information is implemented as the ID of the reference storage unit, and the second identification information is implemented as the bit width information required to store the residual data. When processing the first write request, the first identification information and the second identification information can be determined according to the ID of the reference storage unit and the number of valid data bits of the residual data, and then the first identification information and the second identification information are associated and stored in the information table.
[0137] Indicatively, the information table includes two list items. The first list item stores the first identification information, which uniquely identifies the reference storage unit. This first identification information can be implemented as the ID of the reference storage unit, etc. The second list item stores the second identification information, which indicates the bit width required for the residual data to be written by the first write request. Taking multiple storage units as four sequentially arranged storage units as an example, if 8 bits are required, the second identification information can be 00, indicating that the first storage unit among the four storage units is the target storage unit; if 16 bits are required, the second identification information can be 01, indicating that the first two storage units among the four storage units are the target storage units; if 24 bits are required, the second identification information can be 10, indicating that the first three storage units among the four storage units are the target storage units; if 32 bits are required, the second identification information can be 11, indicating that all four storage units are target storage units.
[0138] In summary, the storage device provided in this application embodiment includes a processing unit and a reference storage unit. When writing first data to the storage device, the complete first data is not stored directly. Instead, the processing unit calculates the residual between the first data and the reference data stored in the reference register and stores the residual data. The number of valid data bits in the residual data is less than that of the first data, and the bit width required to store the residual data is less than that required to store the first data. This reduces the storage resources required for writing data and lowers the power consumption during data writing. Furthermore, by setting multiple segmented storage units in the storage device and partitioning the residual data according to the bit width of the segmented storage units, the storage resources required for the residual data (i.e., the number of segmented storage units required) can be controlled more precisely, optimizing the use of storage resources, reducing unnecessary resource waste, and further reducing the power consumption required to store the residual data.
[0139] The following describes the flow of a memory device processing a data read request. Figure 4 The flow of a memory device processing a data read request is shown.
[0140] The processing unit 320 is configured to receive a first read request; read reference data stored in the reference storage unit 310 based on the first read request; determine at least one target storage unit from multiple area storage units 330 based on the first read request; and send a second read request to the at least one target storage unit.
[0141] The first read request is used to read the first data.
[0142] Optionally, the first read request includes first address information and second address information, wherein the first address information is used to indicate the storage address of the reference data, and the second address information is used to indicate the storage location of the residual data.
[0143] In some embodiments, the first address information refers to the storage address of the identification information, wherein the identification information includes first identification information and second identification information. Optionally, the first identification information is implemented as the ID of the base storage unit, and the second identification information is implemented as the bit width information required to store the residual data, wherein the bit width information is used to determine at least one target storage unit for storing the residual data, and the second address information is used to indicate the storage location of the residual data in at least one target storage unit.
[0144] Optionally, after receiving the first read request, the processing unit is used to parse the first read request to obtain first address information and second address information; read first identification information and second identification information from the information table based on the first address information; read reference data from the reference storage unit based on the first identification information; determine at least one target storage unit from multiple area storage units based on the second identification information; and send a second read request to the at least one target storage unit based on the second address information.
[0145] The second read request is used to request the residual data.
[0146] As an illustration, after receiving the first read request, the processing unit parses the first read request to obtain the first address information and the second address information:
[0147] (1) For the first address information The first address information can be implemented as the storage location of the identification information in the information table. After the processing unit obtains the first address information, it reads the identification information from the information table. The identification information includes the first identification information and the second identification information.
[0148] The first identification information can be implemented as a unique identifier of the reference storage unit. The processing unit determines the reference storage unit based on the unique identifier. After determining the reference storage unit, the processing unit can read the reference data from the reference storage unit.
[0149] The second identification information can be implemented as the bit width required for the residual data, i.e., the second bit width. The processing unit is used to determine the required number of slice storage units based on the second bit width; and to determine at least one target storage unit from multiple slice storage units based on the number of slice storage units.
[0150] Taking the implementation of multiple storage units as four sequentially arranged storage units as an example, if the bit width is 8 bits, the second identifier information can be 00, indicating that the first storage unit among the four storage units is the target storage unit; if the bit width is 16 bits, the second identifier information can be 01, indicating that the first two storage units among the four storage units are the target storage units; if the bit width is 24 bits, the second identifier information can be 10, indicating that the first three storage units among the four storage units are the target storage units; if the bit width is 32 bits, the second identifier information can be 11, indicating that all four storage units are target storage units.
[0151] (2) For the second address information After determining at least one target storage unit based on the second identification information, the processing unit may encapsulate the second address information into a second read request and send the second read request to at least one target storage unit.
[0152] If a single target storage unit exists, the second address information refers to the storage location of the residual data in the single target storage unit. The second address information is encapsulated in the second read request, and the second read request is sent to the single target storage unit.
[0153] If multiple target storage units exist, taking target storage unit 1 and target storage unit 2 as examples, the residual data is split into segment residual data a and segment residual data b. Segment residual data a is stored in target storage unit 1, and segment residual data b is stored in target storage unit 2. Then, the second address information includes address 1 and address 2. Address 1 indicates the storage location of segment residual data a in target storage unit 1, and address 2 indicates the storage location of segment residual data b in target storage unit 2. Address 1 is encapsulated in sub-read request 1 and sent to target storage unit 1; address 2 is encapsulated in sub-read request 2 and sent to target storage unit 2.
[0154] At least one target storage unit is used to receive a second read request; and to send residual data to the processing unit 320 based on the second read request.
[0155] Optionally, after receiving the second read request, the target storage unit parses the second read request to obtain the second address information, and reads the residual data according to the second address information.
[0156] If a single target storage unit exists, the single target storage unit reads the residual data stored therein according to the second address information, and then the single target storage unit sends the residual data to the processing unit.
[0157] If there are multiple target storage units, taking target storage unit 1 and target storage unit 2 as examples, target storage unit 1 receives sub-read request 1, parses sub-read request 1 to obtain address 1, and obtains the residual data a of the segment based on address 1. Target storage unit 2 receives sub-read request 2, parses sub-read request 2 to obtain address 2, and obtains the residual data b of the segment based on address 2. Target storage unit 1 sends the residual data a of the segment to the processing unit, and target storage unit 2 sends the residual data b of the segment to the processing unit.
[0158] The processing unit 320 is used to receive reference data and residual data; merge the reference data and residual data to obtain first data as the request feedback data of the first read request.
[0159] Optionally, after receiving the reference data and residual data, the processing unit calculates the sum of the reference data and residual data to obtain the first data.
[0160] If there is a single target storage unit, such as the base data being 0x1000 and the residual data sent by the single target storage unit being 0x10, calculate their sum to obtain 0x1010 as the first data, which is also the request feedback data of the first read request.
[0161] If there are multiple target storage units, taking target storage unit 1 and target storage unit 2 as examples, after receiving the residual data a and residual data b of the segment, the processing unit concatenates the residual data a and residual data b of the segment. For example, if the residual data a of the segment is 0x2f and the residual data b of the segment is 0xff, then they need to be concatenated to obtain 0x2fff, and 0x2fff is used as the residual data. Then, the sum of the residual data and the reference data is calculated as the request feedback data of the first read request.
[0162] In summary, the storage device provided in this application embodiment, when reading first data in the storage device, the processing unit obtains reference data from the reference register and residual data from at least one target storage unit among multiple slice storage units, and then merges the reference data and residual data to obtain the first data. The bit width required to store the residual data is less than the bit width required to store the first data. That is, the number of slice storage units for storing the residual data is less than the number of slice storage units for storing the first data, thereby reducing the number of slice storage units enabled when reading data in the storage device and effectively reducing the power consumption of reading data in the storage device.
[0163] In some embodiments, the storage device may be provided with a plurality of first storage units for storing reference data. When writing data into the storage device, it is necessary to select one reference data from the plurality of reference data as the reference data corresponding to the data to be written.
[0164] Please refer to Figure 5 , Figure 3 The storage device 300 shown includes: a plurality of first storage cells 340; the plurality of first storage cells 340 are respectively connected to the processing unit 320.
[0165] Optionally, the aforementioned storage device can be implemented as at least one of hardware such as a chip, a system-on-a-chip (SoC), or a board, and this application embodiment does not limit this. Taking a chip implemented as a processor as an example, the aforementioned storage device is located inside the processor; or, the storage device is configured as a separate hardware that is connected to the processor; or, a portion of the storage device is located inside the processor, and another portion is configured as a separate hardware that is connected to the processor, such as a processing unit located inside the processor, and multiple first storage units configured as a separate hardware that is connected to the processor.
[0166] Among them, the multiple first storage units include m first storage units, where m is an integer greater than 1.
[0167] The first storage unit can be implemented as at least one of a register, a cache, or a static random access memory. Each first storage unit has a corresponding bit width, which can be the same or different for different first storage units. Optionally, the number of multiple first storage units and the bit width of each first storage unit can be preset; this embodiment does not limit this.
[0168] Processing unit 320 is used to write reference data into a plurality of first storage units.
[0169] Optionally, the processing unit is used to write baseline data into a plurality of first storage units based on a configured write strategy, wherein the write strategy includes at least one of the following strategies:
[0170] 1. Write the target data as the reference data stored in multiple first storage units.
[0171] For illustrative purposes, target data refers to data that needs to be written to a storage device for storage. Target data can be the first data mentioned above. Specific details of this write strategy can be found in the description of determining the baseline storage cell below, and will not be repeated here.
[0172] Optionally, before writing the target data to an empty storage unit, if there is a first storage unit storing reference data among the multiple first storage units, the first reference data corresponding to the first storage unit storing the reference data is obtained, and the residual data between the first reference data and the target data is calculated. If the number of valid data bits in the residual data is greater than the target number of bits, the target data is written to the empty storage unit as the reference data; if the number of valid data bits in the residual data is less than or equal to the target number of bits, writing the target data to the empty storage unit is stopped. The target number of bits can be a preset value.
[0173] The residual data indicates the difference between the target data and the first reference data. If the number of valid data bits in the residual data is greater than the target number of bits, the difference between the target data and the existing reference data is large enough, and the target data is written to an empty storage unit as new reference data. If the number of valid data bits in the residual data is less than or equal to the target number of bits, the difference between the target data and the existing reference data is not large, and the writing of the target data to an empty storage unit is stopped, thereby avoiding the repeated writing of the same or slightly different preset data as new reference data.
[0174] 2. Write preset data as the reference data stored in multiple first storage units.
[0175] Optionally, during storage device initialization, the processing unit receives a data configuration request. This request requests the configuration of preset data for multiple first storage units and sends the preset data to each of the multiple first storage units. Each of the multiple first storage units receives the first preset data and stores the preset data as reference data. Illustratively, the preset data refers to pre-configured data that needs to be written to multiple first storage units as reference data; for example, the preset data could be data randomly determined by the developers.
[0176] In some embodiments, a plurality of first storage units are used to update stored baseline data.
[0177] For strategy 1, optionally, the stored baseline data is updated based on a preset period.
[0178] Indicatively, multiple first storage units each correspond to a preset period. The preset periods for different first storage units can be the same or different. For a single first storage unit a, according to strategy 1, in the first period after storage device initialization (the start time of the first period is the time when target data 1 is written), the first target data 1 selected to be written to first storage unit a is stored in first storage unit a as reference data. In the second period, the first target data 2 selected to be written to first storage unit a is stored in first storage unit a as new reference data, and so on. Alternatively, multiple first storage units correspond to one preset period. The storage device is initialized, and reference data is written to multiple first storage units according to strategy 1 or strategy 2. The time when the reference data is written to the last storage unit among the multiple first storage units is the start time of the period. After a preset duration (the period duration of the preset period), the multiple first storage units are cleared, and reference data is rewritten to multiple first storage units according to strategy 1 or strategy 2, and so on.
[0179] For strategy 1, optionally, the stored baseline data is updated based on multiple historical data, where the multiple historical data are data written within a historical time period.
[0180] Indicatively, after the reference data is written to the first storage unit, it may be selected as the reference storage unit. In the historical time period, for a single first storage unit a, if the first storage unit a is selected as the reference storage unit 3 times, and each time there is a written data, then the average or median or other statistical measure of these 3 written data is calculated to obtain the written data a, and the written data a is written to the first storage unit a as the new reference data.
[0181] In some embodiments, if the number of times the first storage unit a is selected as the reference storage unit within a historical time period is less than or equal to a preset number (e.g., 0 times), the reference data stored in the first storage unit a is cleared, and the reference data is rewritten in the first storage unit a based on the above strategy 1 or strategy 2.
[0182] For strategy 2, optionally, the stored baseline data is updated based on a preset period.
[0183] Indicatively, during storage device initialization, preset data group 1 is stored in multiple first storage units as reference data. Preset data group 1 includes multiple first preset data, and the number of the multiple first preset data is the same as the number of the multiple first storage units. After a preset time (the period of the preset cycle), preset data group 2 is stored in multiple first storage units as new reference data. Preset data group 1 includes multiple second preset data, and the number of the multiple second preset data is the same as the number of the multiple first storage units.
[0184] The following describes the flow of a memory device processing a data write request. Figure 5 The flow of a memory device processing a data write request is shown.
[0185] The processing unit 320 is configured to acquire the storage status of a plurality of first storage cells when writing first data with a first bit width; and determine a reference storage cell from the plurality of first storage cells based on the storage status.
[0186] There are two types of storage states for the multiple first storage units. The first type is when the first storage unit stores reference data, and the second type is when the first storage unit does not store reference data. The first storage unit that does not store reference data can be called an empty storage unit.
[0187] Before writing the first data of the first bit width, one or more storage units need to be selected as the reference storage unit from among the multiple first storage units. The following explanation uses the selection of one storage unit from among the multiple first storage units as an example.
[0188] In some embodiments, if reference data is written into a plurality of first storage units using strategy 1 described above, then the method for determining the reference storage unit from the plurality of first storage units includes at least one of the following methods:
[0189] Method 1: When there are vacant storage units among multiple first storage units, directly write the first data into the vacant storage unit as the reference data.
[0190] An empty storage unit refers to the first storage unit that does not store reference data. Illustratively, if the first storage unit is implemented as a register, then an empty storage unit is a register with a value of 0.
[0191] Optionally, the processing unit is configured to send first data to an vacant storage unit when there is a vacant storage unit among the multiple first storage units; the vacant storage unit is configured to receive the first data; and store the first data as reference data stored in the vacant storage unit.
[0192] To illustrate, if it is determined that there is a first storage unit among multiple first storage units that does not store the reference data, i.e., an empty storage unit, then the first data is stored in that empty storage unit. Specifically, if there is a single target empty storage unit, the single empty storage unit stores the first data; if there are multiple empty storage units, an empty storage unit is randomly selected to store the first data, or, if the multiple first storage units are arranged in sequence, the empty storage unit at the front of the sequence is selected to store the first data.
[0193] After the first data is stored in an empty storage unit, it serves as the reference data for that unit. The reference data stored in the empty storage unit can be used as a reference data for subsequent data writes. It should be noted that when the first data, which serves as the reference data, needs to be read, only the address information indicating the empty storage unit needs to be obtained. For example, a first read request can be sent to the storage device, containing the address of the first storage unit storing the first data. The processing unit then reads the first data based on this address as the request feedback data for the first read request.
[0194] In the above method, when there are vacant storage units among multiple first storage units, the first data is directly written to the vacant storage unit, simplifying the decision-making process and reducing unnecessary comparisons and judgments.
[0195] Method 2: When multiple first storage units are all empty storage units, the first data is directly written into the empty storage units as reference data; when there is at least one first storage unit among the multiple first storage units that stores reference data, the reference data stored in at least one first storage unit is compared with the first data, and the reference storage unit is determined from at least one first storage unit based on the comparison result.
[0196] Optionally, the processing unit is configured to, when there is at least one first storage unit storing reference data among a plurality of first storage units, determine residual data corresponding to each of the at least one first storage unit based on the difference between the first data and the reference data stored in the at least one first storage unit; and determine the reference storage unit from the at least one first storage unit based on the residual data.
[0197] To illustrate, taking multiple first storage units as storage unit 1 and storage unit 2 as an example, if both storage unit 1 and storage unit 2 store reference data, then the difference between the reference data and the first data in storage unit 1 is calculated as residual data a, and the difference between the reference data and the first data in storage unit 2 is calculated as residual data b. The reference storage unit is determined based on the number of valid data bits of residual data a and residual data b. For example, if the number of valid data bits of residual data a is greater than that of residual data b, then storage unit 2 is used as the reference storage unit.
[0198] In the above embodiments, the storage device is provided with a plurality of first storage cells for storing reference data. By comparing the residual data between the reference data and the first data in the plurality of first storage cells, the smallest residual data can be selected as the data to be finally written to the slice storage cell, thereby minimizing the number of slice storage cells used to store the residual and further reducing the power consumption of writing data in the storage device.
[0199] Optionally, the processing unit is configured to determine the first storage unit corresponding to the residual data in the residual data corresponding to at least one first storage unit, wherein the number of valid data bits is less than or equal to the number of preset bits, as the reference storage unit.
[0200] Optionally, the preset bit width is a pre-set bit width. For example, if multiple memory cell segments have the same bit width (8 bits), the preset bit width can be set to 8 bits. When determining the reference memory cell, if there exists a first memory cell whose residual data has a valid data bit width of less than or equal to 8 bits, that first memory cell is used as the reference memory cell. If multiple first memory cells have residual data with a valid data bit width of less than or equal to 8 bits, a first memory cell is randomly selected as the reference memory cell. Alternatively, the first memory cell with the smallest valid data bit width is selected as the reference memory cell, etc.
[0201] The processing unit is configured to determine the first storage unit corresponding to the residual data with the smallest number of valid data bits among the residual data corresponding to at least one first storage unit as the reference storage unit when the number of valid data bits of the residual data corresponding to at least one first storage unit is greater than a preset number of bits and there are no vacant storage units among the multiple first storage units.
[0202] For illustration, when determining the reference storage unit, if there is no first storage unit whose effective data bits of the residual data are less than or equal to 8 bits, it can be determined whether there is a first storage unit that does not store reference data among the multiple first storage units. If not, the storage unit with the smallest effective data bits of the residual data in at least one first storage unit is determined as the reference storage unit.
[0203] In the above embodiments, a preset number of bits is set. The first storage unit is used as the reference storage unit only when the residual data of the first storage unit is less than or equal to the preset number of bits. When the residual data of the first storage unit is greater than the preset number of bits, it is determined whether there is an empty storage unit. If not, the storage unit with the smallest residual data is selected as the reference storage unit to ensure that the final determined residual data is small enough to the greatest extent, thereby reducing the number of area storage units used to store the residual and reducing the power consumption of writing data in the storage device.
[0204] The processing unit is further configured to send first data to an empty storage unit when the residual data corresponding to at least one first storage unit is greater than a preset number of bits and there is an empty storage unit among the multiple first storage units; the empty storage unit is configured to receive the first data and store the first data as reference data stored in the empty storage unit.
[0205] Schematic illustration: If the residual data corresponding to at least one first storage unit is greater than a preset number of bits, and it is determined that there is a first storage unit among the multiple first storage units that does not store the reference data, i.e., an empty storage unit, then the first data is stored in that empty storage unit. Specifically, if there is a single target empty storage unit, the single empty storage unit stores the first data; if there are multiple empty storage units, an empty storage unit is randomly selected to store the first data, or, if the multiple first storage units are arranged in order, the empty storage unit at the front of the list is selected to store the first data.
[0206] In the above embodiments, if the residual data in the first storage unit is greater than the preset number of bits and there is currently an empty storage unit, then an empty storage unit is selected to store the first data as the reference data. In other words, if the first data is significantly different from the currently stored reference data, the first data is stored as the reference data, which ensures the difference between the currently stored reference data and helps to reduce the number of bits of the residual data corresponding to the subsequent write data, thereby reducing the power consumption of writing data in the storage device.
[0207] In some embodiments, the processing unit is configured to send first data to a designated storage unit among the plurality of first storage units when all of the plurality of first storage units are vacant; the designated storage unit is configured to receive the first data; and store the first data as reference data stored in the designated storage unit.
[0208] To illustrate, taking multiple first storage units as storage unit 1 and storage unit 2 as an example, if neither storage unit 1 nor storage unit 2 stores reference data, a storage unit is randomly selected to store the first data. Alternatively, storage units 1 and 2 are arranged in sequence, and storage unit 1 is selected to store the first data. After selecting a storage unit, such as storage unit 1, the first data is written to storage unit 1 as the reference data for storage unit 1.
[0209] In the above embodiments, when multiple first storage units are empty, the first data is directly written into one of the first storage units as the reference data, simplifying the decision-making process and reducing unnecessary comparisons and judgments.
[0210] In some embodiments, the storage state of the first storage cell can be represented by a counter. Optionally, the storage device further includes: a plurality of counters corresponding to the first storage cells respectively; and a processing unit connected to the plurality of counters corresponding to the first storage cells respectively.
[0211] The processing unit is used to obtain the count values of the counters corresponding to the multiple first storage units as storage states; wherein, the count value of the counter is equal to the first preset value, indicating that the first storage unit is an empty storage unit, and the count value of the counter is not equal to the first preset value, indicating that the first storage unit stores reference data.
[0212] Optionally, the first preset value can be set to 0 or other values, and this application embodiment does not limit this. Illustratively, the count values of the counters corresponding to the multiple first storage units are obtained, where a count value of 0 indicates that no reference data is stored in the first storage unit, and a count value of non-zero indicates that reference data is stored in the first storage unit.
[0213] In the above embodiments, the storage state of the first storage unit is obtained by acquiring the counter value. Compared with directly checking the physical state of each storage unit, reading the counter value is usually faster and simpler, thereby improving the processing efficiency of the processing unit.
[0214] In some embodiments, after a first storage unit is selected as the reference storage unit, the count value of the counter corresponding to the first storage unit needs to be updated. The count value is used to characterize the number of times the first storage unit has been selected as the reference storage unit.
[0215] Optionally, the processing unit is configured to, after determining a reference storage cell from at least one first storage cell, send a first control signal to a first counter corresponding to the reference storage cell, the first control signal being used to update the count value of the first counter; the first counter is configured to receive the first control signal and update the count value of the first counter.
[0216] For illustration, if the current count value of the first storage unit is 1, and it is determined to be the base storage unit, the count value of the first storage unit is updated to 2; if the current count value of the first storage unit is 2, and it is determined to be the base storage unit, the count value of the first storage unit is updated to 3.
[0217] In some embodiments, a count value of 0 for the first storage unit indicates that the first storage unit does not store reference data. After writing the first data as reference data to the first storage unit, the count value of the first storage unit is updated to 1. As can be seen from the above, decrementing the counter value by 1 indicates the number of times the first storage unit has been selected as the reference storage unit. For example, when the count value of the first storage unit is 4, it means that the first storage unit has been selected as the reference storage unit 3 times.
[0218] In the above embodiments, when a first storage unit is selected as the reference storage unit, the count value of the counter corresponding to the first storage unit is updated, thereby recording the usage of the first storage unit, so that the storage device can optimize and adjust resources according to the usage of the first storage unit.
[0219] For example, the processing unit is also configured to shut down the target first storage unit when the counter of the target first storage unit remains at a first preset value for a duration longer than a preset duration among a plurality of first storage units.
[0220] Indicatively, the first preset value is 0, indicating that no reference data is stored in the target first storage cell. In other words, when the counter of the target first storage cell among multiple first storage cells is not used for a long time, the target first storage cell can be turned off or disabled, thereby reducing resource waste and improving the overall resource utilization of storage devices.
[0221] In some embodiments, the above strategy 2 is used to write reference data into multiple first storage units, and reference data is stored in multiple first storage units. Then, the method for determining the reference storage unit from multiple first storage units includes: the processing unit determines the residual data corresponding to each of the multiple first storage units based on the difference between the first data and the reference data stored in the multiple first storage units; and the storage unit with the smallest residual data among the multiple first storage units is determined as the reference storage unit.
[0222] The processing unit 320 is used to read reference data from the reference storage unit and determine residual data based on the difference between the first data and the reference data.
[0223] The number of valid data bits in the residual data is less than the number of valid data bits in the first data.
[0224] To illustrate, after determining the reference storage unit, the processing unit reads the reference data from the reference storage unit and calculates the difference between the first data and the reference data as the residual data.
[0225] The processing unit 320 is used to store the residual data into the target location according to the second bit width.
[0226] The width of the second dimension is smaller than that of the first dimension.
[0227] In summary, the storage device provided in this application embodiment can be configured with multiple first storage units for storing reference data, and the reference storage unit can be determined from multiple first storage units by obtaining the storage status of the first storage units. In other words, the storage device can select a suitable reference data from at least one provided reference data and compare it with the first data to obtain residual data, thereby increasing the flexibility in the process of calculating residual data.
[0228] The following describes the flow of a memory device processing a data read request. Figure 5 The flow of a memory device processing a data read request is shown.
[0229] The processing unit 320 is also configured to receive a first read request; determine a reference storage unit from a plurality of first storage units 340 based on the first read request; read reference data from the reference storage unit; and obtain residual data from the target location based on the first read request.
[0230] The first read request is used to read the first data.
[0231] Optionally, the first read request includes first address information, which indicates the storage location of the reference data. In some embodiments, the first address information indicates the address of the reference storage unit, such as the ID of the reference storage unit. Illustratively, after receiving the first read request, the processing unit parses the first read request to obtain the first address information. The processing unit can determine the reference storage unit from multiple first storage units based on the first address information. After determining the reference storage unit, the processing unit can read the reference data from the reference storage unit.
[0232] Optionally, the first read request may also include second address information, which indicates the storage location of the residual data. Illustratively, after receiving the first read request, the processing unit parses the first read request to obtain the second address information. The processing unit can determine the target location based on the second address information. After determining the target location, the processing unit can read the residual data from the target location.
[0233] The processing unit 320 is used to merge the reference data and the residual data to obtain the first data as the request feedback data of the first read request.
[0234] Optionally, after determining the baseline data and residual data, the sum of the baseline data and residual data is calculated to obtain the first data.
[0235] In some embodiments, the processing unit in the storage device includes multiple units, each responsible for different operations. Please refer to... Figure 6 , Figure 3 The processing unit 320 of the storage device 300 shown further includes: a first processing unit 321, a second processing unit 322, a first selection unit 323, a second selection unit 324, and a merging unit 325. The storage device also includes: a plurality of slice storage units 330 and a plurality of first storage units 340.
[0236] Among them, multiple first storage units 340 are respectively connected to the first processing unit 321, the first processing unit 321 is connected to the second processing unit 322, multiple first storage units 340 are respectively connected to the second selection unit 324, the second processing unit 322 is connected to the first selection unit 323, multiple area storage units 330 are respectively connected to the second processing unit 322, the first selection unit 323 is connected to the second selection unit 324, multiple area storage units 330 are respectively connected to the merging unit 325, and the second selection unit 324 is connected to the merging unit 325.
[0237] Optionally, the aforementioned storage device can be implemented as at least one of hardware such as a chip, a system-on-chip (SoC), or a board, and the embodiments of this application do not limit this.
[0238] Taking a system-on-a-chip (SoC) as an example, the SoC includes a processor and a memory. A first processing unit, a second processing unit, a first selection unit, a second selection unit, a merging unit, and multiple first storage units are located within the processor, and multiple slice storage units are located within the memory.
[0239] The following describes the flow of a memory device processing a data write request. Figure 6 The flow of a memory device processing a data write request is shown.
[0240] The first processing unit 321 is configured to receive a first write request; obtain the storage status of a plurality of first storage units 340; and determine a reference storage unit from the plurality of first storage units 340 based on the storage status.
[0241] The first write request is used to request the writing of first data, and the first write request includes the first data. Optionally, the initiator of the first write request includes at least one of the following:
[0242] 1. Processor's instruction execution unit: If an instruction requires writing the first data to a memory device, the instruction execution unit will generate and issue the first write request.
[0243] 2. Micro-operation control unit or microcode engine: In some complex processor designs, micro-operations or microcode may be used to break down complex instructions. These micro-operations or microcode can be generated by a dedicated micro-operation control unit or microcode engine and directly initiate the first write request to the memory device.
[0244] 3. External devices or interfaces: In some embodiments, if the computer system supports direct memory access, external devices or interfaces may initiate the first write request to the storage device directly through a specific interface or protocol.
[0245] The first write request typically includes first data and an operation type, where the operation type indicates that the first write request is a write data request. Upon receiving the first write request, the first processing unit parses the first data within it.
[0246] The method by which the first processing unit determines the reference storage unit from multiple first storage units can be referred to the above description of the processing unit determining the reference storage unit from multiple first storage units, and will not be repeated here.
[0247] In some embodiments, the storage state of the first storage cell can be represented by a counter. Optionally, the storage device further includes: a plurality of counters corresponding to the first storage cells respectively; and the first processing unit is connected to the plurality of counters corresponding to the first storage cells respectively.
[0248] The first processing unit 321 is used to read reference data from the reference storage unit; determine residual data based on the difference between the first data and the reference data; and send a second write request to the second processing unit 322.
[0249] The number of valid data bits in the residual data is less than the number of valid data bits in the first data, and the second write request is used to request that the residual data be stored in multiple storage units according to the second bit width.
[0250] The method for determining residual data in the first processing unit can be found in the description of determining residual data in the above processing unit, and will not be repeated here.
[0251] After obtaining the residual data, the first processing unit encapsulates the residual data into a second write request and sends the second write request to the second processing unit.
[0252] The second processing unit 322 is configured to receive a second write request; determine at least one target storage unit from multiple slice storage units based on the number of valid data bits of the residual data; and send the residual data to the at least one target storage unit.
[0253] Optionally, the second processing unit is used to determine the number of storage units of the target storage unit based on the number of bits of the effective data bits of the residual data and the bit width corresponding to the multiple area storage units respectively; and to determine at least one target storage unit from the multiple area storage units based on the storage unit data.
[0254] The total bit width of multiple storage units is greater than or equal to the second bit width, and the total bit width of at least one target storage unit is equal to the second bit width.
[0255] The method by which the second processing unit determines at least one target storage unit from multiple storage units can refer to the description of the processing unit determining at least one target storage unit from multiple storage units, and is not limited here.
[0256] In some embodiments, the second processing unit is configured to send residual data to a single target storage unit when a single target storage unit is present.
[0257] In other embodiments, the second processing unit is configured to, when there are multiple target storage units, split the residual data based on the bit width corresponding to each of the multiple segment storage units to obtain multiple segment residual data, wherein the number of segment residual data corresponds to the number of target storage units; and send the segment residual data to each of the multiple target storage units respectively.
[0258] At least one target storage unit is used to receive and store residual data.
[0259] In some embodiments, where a single target storage unit is present, the single target storage unit receives and stores the residual data.
[0260] In other embodiments, when there are multiple target storage units, each target storage unit receives and stores the residual data of the segment.
[0261] In some embodiments, the first processing unit is further configured to store identification information in an information table. The identification information includes first identification information corresponding to a reference storage unit and second identification information corresponding to at least one target storage unit. The first identification information and the second identification information are stored together in the information table.
[0262] The following describes the flow of a memory device processing a data read request. Figure 6 The flow of a memory device processing a data read request is shown.
[0263] The first selection unit 323 is used to receive the first read request.
[0264] In some embodiments, the first selection unit may be implemented as a multiplexer, a microcontroller, etc., and the embodiments of this application do not limit this.
[0265] The first read request is used to request the reading of the first data.
[0266] In some embodiments, the first read request includes first address information and second address information, wherein the first address information is used to indicate the storage location of the identification information in the information table; and the second address information is used to indicate the storage location of the residual data in at least one target storage unit.
[0267] Optionally, upon receiving a first read request, the first selection unit is configured to parse the first read request to obtain first address information and second address information.
[0268] Optionally, after parsing the first address information and the second address information, the first selection unit is used to obtain identification information from the information table based on the first address information; wherein the identification information includes first identification information and second identification information, the first identification information is used to indicate the reference storage unit, and the second identification information is used to indicate at least one target storage unit.
[0269] Optionally, after obtaining the first identification information and the second identification information, the first selection unit is used to send the first identification information to the second selection unit and send the second identification information and the second address information to the second processing unit.
[0270] The details of how the first selection unit parses and processes the first read request can be found in the above description of how the processing unit parses and processes the first read request, and are not limited here.
[0271] The second selection unit 324 is used to determine a reference storage unit from a plurality of first storage units 340 based on a first read request; read reference data from the reference storage unit; and send the reference data to the merging unit 325.
[0272] In some embodiments, the second selection unit may be implemented as a multiplexer, a microcontroller, etc., and the embodiments of this application do not limit this.
[0273] Optionally, the second selection unit is configured to receive first identification information and determine a reference storage unit from a plurality of first storage units based on the first identification information.
[0274] The first identification information can be implemented as a unique identifier of the reference storage unit. The second selection unit determines the reference storage unit based on the unique identifier. After determining the reference storage unit, the second selection unit can read the reference data from the reference storage unit and send the reference data to the merging unit.
[0275] In the above embodiments, a first selection unit and a second selection unit are provided in the access device. The first selection unit can directly obtain the identification information from the information table by receiving a read request containing specific address information, which reduces the search time in the data access process and makes the data access more direct and efficient. The second selection unit can accurately determine the reference storage unit and read the reference data therein by receiving the second identification information sent by the first selection unit, which improves the efficiency of data reading.
[0276] The second processing unit 322 is configured to determine at least one target storage unit from a plurality of slice storage units 330 based on a first read request; and send a second read request to the at least one target storage unit.
[0277] The second read request is used to request the residual data.
[0278] The second processing unit is configured to receive second identification information and second address information; determine at least one target storage unit from multiple area storage units based on the second identification information; and send a second read request to the at least one target storage unit based on the second address information.
[0279] The second identification information can be implemented as the bit width required for the residual data, i.e., the second bit width. The second storage unit is used to determine the required number of segment storage units based on the second bit width; and to determine at least one target storage unit from multiple segment storage units based on the number of segment storage units. Illustratively, when writing the first data, multiple segment storage units are arranged sequentially. Based on the number of valid data bits in the residual data, the required bit width for storing the residual data is determined to be 16 bits (i.e., the first bit width). Therefore, the first two segment storage units are selected as target storage units. Similarly, when reading the first data, the first two segment storage units need to be selected as target storage units based on the bit width information indicated by the second identification information.
[0280] Alternatively, the second identification information can directly indicate the identifier of the storage unit in the area. For example, when writing the first data, if the storage units for storing the residual data are determined to be storage unit 1 and storage unit 2, the IDs corresponding to storage units 1 and 2 can be stored as the second identification information in the information table. Then, when reading the first data, the target storage unit is determined based on the ID indicated by the second identification information.
[0281] After determining at least one target storage unit based on the second identification information, the second processing unit may encapsulate the second address information into a second read request and send the second read request to the at least one target storage unit.
[0282] If a single target storage unit exists, the second address information refers to the storage location of the residual data in the single target storage unit. The second address information is encapsulated in the second read request, and the second read request is sent to the single target storage unit.
[0283] If multiple target storage units exist, taking target storage unit 1 and target storage unit 2 as examples, the second address information includes address 1 and address 2. Address 1 indicates the storage location of residual data a in target storage unit 1, and address 2 indicates the storage location of residual data b in target storage unit 2. Address 1 is encapsulated in sub-read request 1 and sent to target storage unit 1; address 2 is encapsulated in sub-read request 2 and sent to target storage unit 2.
[0284] At least one target storage unit is used to receive a second read request; and to send residual data to the merging unit 325 based on the second read request.
[0285] Optionally, after receiving the second read request, the target storage unit parses the second read request to obtain the second address information, and reads the residual data according to the second address information.
[0286] If a single target storage unit exists, the single target storage unit reads the residual data stored therein according to the second address information, and then the single target storage unit sends the residual data to the processing unit.
[0287] If there are multiple target storage units, taking target storage unit 1 and target storage unit 2 as examples, target storage unit 1 receives sub-read request 1, parses sub-read request 1 to obtain address 1, and obtains the residual data a of the segment based on address 1. Target storage unit 2 receives sub-read request 2, parses sub-read request 2 to obtain address 2, and obtains the residual data b of the segment based on address 2. Target storage unit 1 sends the residual data a of the segment to the processing unit, and target storage unit 2 sends the residual data b of the segment to the processing unit.
[0288] The merging unit 325 is used to receive reference data and residual data; merge the reference data and residual data to obtain first data as the request feedback data of the first read request.
[0289] Optionally, after receiving the reference data and residual data, the processing unit calculates the sum of the reference data and residual data to obtain the first data.
[0290] If there is a single target storage unit, such as the reference data being 0x1000 and the residual data sent by the single target storage unit being 0x10, the sum of the reference data and the residual data is calculated to obtain 0x1010 as the first data, which is also the request feedback data of the first read request.
[0291] If there are multiple target storage units, taking target storage unit 1 and target storage unit 2 as examples, after receiving the residual data a and residual data b of the segment, the processing unit concatenates the residual data a and residual data b of the segment. For example, if the residual data a of the segment is 0x2f and the residual data b of the segment is 0xff, then they need to be concatenated to obtain 0x2fff, and 0x2fff is used as the residual data. Then, the sum of the residual data and the reference data is calculated as the request feedback data of the first read request.
[0292] In summary, the method provided in this application divides the processing unit into multiple units, which then handle data write requests or data read requests separately. Even if one unit fails, the other units can continue to work, thereby reducing the risk of overall storage device failure. In addition, by distributing data write requests or data read requests to multiple units, processing time can be significantly reduced. Especially when handling a large number of concurrent requests, multiple units can process multiple requests in parallel, improving the speed of data writing and reading.
[0293] The following description uses an embodiment of the storage device provided in this application as a register file access device as an example. This is illustrative; please refer to [the original text for more details]. Figure 7 The diagram illustrates a register file access device provided in an embodiment of this application.
[0294] like Figure 7 As shown, the register file access device 700 includes: a base register 0, a base register 1, a base register 2, and a base register 3, which are also multiple first storage units; wherein, base register 0 corresponds to counter 0, base register 1 corresponds to counter 1, base register 2 corresponds to counter 2, and base register 3 corresponds to counter 3; a slice memory 0, a slice memory 1, a slice memory 2, and a slice memory 3, which are also multiple slice storage units; an update unit 710, which is also a first processing unit; a request mask unit 720, which is also a second processing unit; a multiplexer 730, which is also a first selection unit; a base register selection unit 740, which is also a second selection unit; and a merging unit 750, which is also a merging unit.
[0295] The write data request and read data request received by the register file access device 700 are described below.
[0296] • Register file access device 700 receives the first write request.
[0297] The first write request is used to request the writing of the first data. After receiving the first write request, the register file access device 700 inputs the first write request to the update unit 710. The update unit 710 is used to complete the comparison and update of the reference register. The specific update strategy is as follows:
[0298] The reference registers whose count values are not zero are detected by the counters corresponding to reference registers 0, 1, 2, and 3, respectively.
[0299] (1) If none of the base registers (base register 0, base register 1, base register 2, and base register 3) has a non-zero count value, select a base register, such as base register 0, and store the first data in base register 0 as the register value (i.e., the base data). (For illustration purposes, please refer to...)Figure 8 In update example 800, the count values of base register 0, base register 1, base register 2 and base register 3 are all 0. At this time, a request is made to write the first data 0x1000. A base register with a count value of 0 is selected, such as base register 0. The first data 0x1000 written this time is used as the register value of base register 0. At the same time, the count value of counter 0 corresponding to base register 0 is updated to 1.
[0300] (2) If there is a reference register with a non-zero count value among reference register 0, reference register 1, reference register 2 and reference register 3, find the difference between the first data and the reference register with a non-zero count value (i.e., the residual data).
[0301] If a base register with a difference of 8 bits or less exists, select one from the base registers with a difference of 8 bits or less and increment the corresponding count value by 1. (For illustration purposes, please refer to [reference source]). Figure 9 In update example 900, a request is made to write the first data 0x1010. Among the reference registers 0, 1, 2 and 3, only the value of reference register 0 is 1. The difference between the first data 0x1010 and the value of reference register 0 is calculated. The difference is 0x10, which can be represented by an 8-bit number. Therefore, reference register 0 is selected as the reference register for this write. The count value of counter 0 of reference register 0 is updated to 2. The difference 0x10 is to be written to memory unit 760.
[0302] If no base register has a difference less than or equal to 8 bits, check if there is a base register with a count value of 0. If so, select a base register, write the first data into it as the register value, and update the base register's count value to 1. If not, select the base register with the smallest difference as the base register for this write, and update its count value. (This is for illustrative purposes only; please refer to the provided text.) Figure 10 In update example 1000, a request is made to write the first data 0x2000. The register value of base register 0 among base registers 0, 1, 2 and 3 is 1. The difference between the first data 0x2000 and the register values of these base registers is calculated. Since the difference is greater than 8 bits and there is no base register with a count value of 0 among these base registers, the base register 0 with the smallest difference is selected as the base register for this write. The count value of counter 0 of base register 0 is updated to 2. The difference between the first data 0x1010 and the register value of base register 0 is 0x1000. The difference of 0x1000 is to be written to memory unit 760.
[0303] After processing the first write request, if the update unit 710 needs to write a difference to the storage unit 760, it encapsulates the difference in a second write request and sends the second write request to the request mask unit 720. The request mask unit 720 determines the number of memory slices to be opened based on the number of valid data bits of the difference. For example, as shown above, if the difference to be written is 0x10, since 0x10 only requires an 8-bit number to represent, when accessing the storage unit 760, only one memory slice needs to be opened to write the difference 0x10; the other three memory slices do not need to be opened. If the difference to be written is 0x1000, since the difference only requires a 16-bit number to represent, when accessing the storage unit 760, only two memory slices need to be opened to write the difference 0x1000; the other two memory slices do not need to be opened.
[0304] In addition, the update unit 710 also needs to store the identifier (id) of the selected reference register and the effective bit width information of the difference into the information table 770. The information table 770 includes two fields, namely the register identifier and the effective bit width information.
[0305] For illustration, if the selected base register for this write is base register 0, then 00 can be written as the register identifier into information table 770. If the difference value written is 0x1000, then the effective bit width information can be 01, representing 16 bits, and 01 is written as the effective bit width information into information table 770, where register identifier 00 and effective bit width information 01 are stored correspondingly. Additionally, effective bit width information 00 represents 8 bits; effective bit width information 10 represents 24 bits; and effective bit width information 11 represents 32 bits.
[0306] • Register file access device 700 receives the first read request.
[0307] The first read request includes a register address, which comprises a base register address and a slice memory address. The base register address indicates the storage location of the field segment information corresponding to the first data in information table 770, and the slice memory address indicates the storage location of the difference corresponding to the first data in slice memory. After receiving the first read request, the register file access device 700 inputs the first read request into the multiplexer 730. The multiplexer 730 selects the corresponding field segment information from information table 770 according to the base register address. The field segment information includes a register identifier and effective bit width information.
[0308] The multiplexer 730 stores the effective bit width information and the difference in the chip memory at the location (i.e., Figure 7The location information shown is sent to the request mask unit 720. After receiving the effective bit width information and the storage location of the difference in the slice memory, the request mask unit 720 opens the corresponding slice memory based on the effective bit width information, encapsulates the storage location of the difference in the slice memory into a second read request, and sends it to the corresponding slice memory. After receiving the second read request, the slice memory reads the difference according to the storage location of the difference in the slice memory and sends the difference to the merging unit 750.
[0309] The multiplexer 730 sends the register identifier to the reference register selection unit 740. After receiving the register identifier, the reference register selection unit 740 reads the register value stored in the corresponding reference register according to the register identifier and sends the register value to the merging unit 750.
[0310] After receiving the difference and register value, the merging unit 750 merges the difference and register value to obtain the first data, and uses the first data as the request feedback data for the first read request, that is, read data.
[0311] This is illustrative; please refer to it. Figure 11 In example 1100, taking the data read as 0x3fff as an example, such as... Figure 11 As shown, the field information read by the multiplexer 730 from the information table 770 includes register id: 00 and valid bit width information: 01. The multiplexer sends the valid bit width information to the request mask unit and sends the register id to the reference register selection unit 740.
[0312] The request mask unit 720 enables slice memory 0 and slice memory 1 according to the effective bit width information 01, and obtains the sub-difference value 0x2f according to the storage location of the difference in slice memory 0, and obtains the sub-difference value 0xff according to the storage location of the difference in slice memory 1. It then concatenates the sub-difference values 0x2f and 0xff to obtain the difference value 0x2fff, and sends the difference value 0x2fff to the merging unit 750; alternatively, it sends the sub-difference values 0x2f and 0xff to the merging unit 750, which merges them to obtain the difference value 0x2fff. The reference register selection unit 740 reads the register value 0x1000 stored in the reference register 0 according to the register ID and sends the register value to the merging unit 750. The merging unit 750 obtains the difference value 0x2ffff and the register value 0x1000 and adds them to obtain the read data 0x3ffff.
[0313] In summary, the register file access apparatus proposed in this application reduces the number of register file segments accessed by utilizing data locality, thereby reducing the power consumption of accessing the register file.
[0314] The following are embodiments of the method of this application. For details not disclosed in the embodiments of the method of this application, please refer to the embodiments of the storage device of this application. Figure 12 This is a flowchart of a read / write method provided in an exemplary embodiment of this application, executed by the aforementioned storage device, which includes a reference storage unit and a processing unit. The method includes steps 1201 to 1203.
[0315] Step 1201: The reference storage unit stores the reference data.
[0316] In some embodiments, the baseline storage unit determines and stores baseline data based on a configured write policy. Optionally, the write policy includes at least one of the following policies:
[0317] 1. Use the first target data written as the baseline data.
[0318] Optionally, the processing unit receives a target write request, which is used to request the writing of target data. At this time, the reference storage unit in the storage device is empty (i.e., no data is stored). Then the processing unit can write the target data into the reference storage unit, and the reference storage unit stores the target data as reference data.
[0319] 2. Select preset data as the baseline data.
[0320] Optionally, during storage device initialization, the processing unit writes preset data into the reference storage unit, which stores the preset data as reference data. The preset data may be data randomly determined by the developers.
[0321] Step 1202: While writing the first data with the first bit width, the processing unit reads the reference data from the reference storage unit; based on the difference between the first data and the reference data, it determines the residual data.
[0322] The number of valid data bits in the residual data is less than the number of valid data bits in the first data.
[0323] In some embodiments, the storage device includes a plurality of first storage cells.
[0324] Optionally, the processing unit acquires the storage status of multiple first storage units; and determines a reference storage unit from the multiple first storage units based on the storage status.
[0325] In some embodiments, the storage device includes: counters corresponding to a plurality of first storage cells.
[0326] Optionally, the processing unit obtains the count values of the counters corresponding to the multiple first storage units as storage states; wherein, the count value of the counter equals the first preset value, indicating that the first storage unit is an empty storage unit, and the count value of the counter is not equal to the first preset value, indicating that the first storage unit stores reference data.
[0327] The method for determining a reference storage cell from multiple first storage cells based on storage state includes at least one of the following methods:
[0328] Method 1: When there are vacant storage units among multiple first storage units, directly write the first data into the vacant storage unit as the reference data.
[0329] Optionally, if there is an empty storage unit among the multiple first storage units, the processing unit sends first data to the empty storage unit. The empty storage unit receives the first data and stores it as reference data stored in the empty storage unit.
[0330] Method 2: When multiple first storage units are all empty storage units, the first data is directly written into the empty storage units as reference data; when there is at least one first storage unit among the multiple first storage units that stores reference data, the reference data stored in at least one first storage unit is compared with the first data, and the reference storage unit is determined from at least one first storage unit based on the comparison result.
[0331] Optionally, if the processing unit has at least one first storage unit storing reference data among the plurality of first storage units, it determines the residual data corresponding to each of the at least one first storage unit based on the difference between the first data and the reference data stored in the at least one first storage unit; and determines the reference storage unit from the at least one first storage unit based on the residual data.
[0332] Optionally, the processing unit determines the first storage unit corresponding to the residual data in the residual data of at least one first storage unit, wherein the number of valid data bits is less than or equal to the preset number of bits, as the reference storage unit.
[0333] Optionally, if the number of valid data bits in the residual data corresponding to at least one first storage unit is greater than a preset number of bits, and there are no empty storage units among the multiple first storage units, the processing unit determines the first storage unit corresponding to the residual data with the smallest number of valid data bits among the residual data corresponding to at least one first storage unit as the reference storage unit.
[0334] Optionally, if the residual data corresponding to at least one of the first storage units is greater than a preset number of bits, and there is an empty storage unit among the multiple first storage units, the processing unit sends the first data to the empty storage unit. The empty storage unit receives the first data and stores the first data as the reference data stored in the empty storage unit.
[0335] Optionally, when all the first storage units are vacant, the processing unit sends first data to a designated storage unit among the multiple first storage units. The designated storage unit receives the first data and stores it as reference data stored in the designated storage unit.
[0336] In some embodiments, the processing unit includes a first processing unit and a second processing unit.
[0337] Optionally, the first processing unit receives a first write request, which is used to request the writing of first data; reads reference data from the reference storage unit based on the first write request; determines residual data based on the difference between the first data and the reference data; and sends a second write request to the second processing unit, which is used to request the writing of the residual data.
[0338] Step 1203: The processing unit stores the residual data into the target location according to the second bit width.
[0339] The second bit width is smaller than the first bit width.
[0340] In some embodiments, the target location refers to at least one target storage unit among a plurality of slice storage units.
[0341] Optionally, the storage device includes: a plurality of slice storage cells. The processing unit determines at least one target storage cell from the plurality of slice storage cells based on the number of valid data bits of the residual data, wherein the total bit width of the at least one target storage cell is a second bit width; and sends the residual data to the at least one target storage cell. The at least one target storage cell receives and stores the residual data.
[0342] Optionally, when multiple target storage units exist, the processing unit splits the residual data based on the bit width corresponding to each of the multiple segment storage units to obtain multiple segment residual data, the number of segment residual data corresponding to the number of target storage units; and sends the segment residual data to each of the multiple target storage units. The multiple target storage units respectively receive and store the segment residual data.
[0343] In some embodiments, the second processing unit receives a second write request; and stores the residual data to the target location according to the second bit width based on the second write request.
[0344] In some embodiments, the processing unit stores identification information in an information table. The identification information includes first identification information corresponding to the reference storage unit and second identification information corresponding to the target location. The first identification information and the second identification information are stored together in the information table.
[0345] In summary, the read / write method provided in this application embodiment sets up a processing unit and a reference storage unit in the storage device. When writing first data to the storage device, the complete first data is not directly stored. Instead, the processing unit calculates the residual between the first data and the reference data stored in the reference register and stores the residual data. The number of valid data bits of the residual data is less than that of the first data, and the bit width required to store the residual data is less than that required to store the first data, thereby reducing the storage resources required when writing data and reducing the power consumption when writing data.
[0346] The following is a flowchart of a read / write method provided by an exemplary embodiment of this application, executed by the aforementioned storage device. The method includes the following steps 1 to 2.
[0347] Step 1: The processing unit receives a first read request; reads reference data from the reference storage unit based on the first read request, and obtains residual data from the target location based on the first read request.
[0348] The first read request is used to read the first data.
[0349] In some embodiments, the storage device includes: a plurality of slice storage units and a plurality of first storage units, and the processing unit includes: a second processing unit, a first selection unit, and a second selection unit.
[0350] Optionally, step 1 above further includes the following steps:
[0351] (1) The first selection unit receives the first read request.
[0352] Optionally, the first read request includes first address information and second address information. The first address information is used to indicate the storage location of the identification information in the information table, and the second address information is used to indicate the storage location of the residual data in at least one target storage unit.
[0353] Indicatively, the first selection unit parses the first read request to obtain first address information and second address information; based on the first address information, it retrieves identification information from the information table; wherein, the identification information includes first identification information and second identification information, the first identification information is used to indicate a reference storage unit, and the second identification information is used to indicate at least one target storage unit; the first identification information is sent to the second selection unit; and the second identification information and second address information are sent to the second processing unit.
[0354] (2) The second selection unit determines the reference storage unit from multiple first storage units based on the first read request; reads reference data from the reference storage unit; and sends the reference data to the merging unit.
[0355] Indicatively, the second selection unit receives first identification information; determines a reference storage unit from a plurality of first storage units based on the first identification information, then reads reference data from the reference storage unit, and sends the reference data to the merging unit.
[0356] (3) The second processing unit determines at least one target storage unit from multiple area storage units based on the first read request; and sends a second read request to the at least one target storage unit, the second read request being used to request the acquisition of residual data.
[0357] Indicatively, the second processing unit receives second identification information and second address information; determines at least one target storage unit from multiple area storage units based on the second identification information; and sends a second read request to the at least one target storage unit based on the second address information.
[0358] (4) At least one target storage unit receives a second read request; based on the second read request, residual data is sent to the merging unit.
[0359] Step 2: The processing unit merges the baseline data and the residual data to obtain the first data as the request feedback data for the first read request.
[0360] In some embodiments, the processing unit further includes a merging unit.
[0361] The merging unit receives the reference data and the residual data; it merges the reference data and the residual data to obtain the first data as the request feedback data for the first read request.
[0362] In summary, the read / write method provided in this application, when reading first data in a storage device, the processing unit obtains reference data from the reference register unit and residual data from the target location, and then merges the reference data and residual data to obtain the first data. The bit width required to store the residual data is smaller than the bit width required to store the first data, thereby reducing the number of storage resources activated when reading the first data in the storage device and reducing the power consumption of reading data in the storage device.
[0363] In some embodiments, this application also provides a chip that includes the memory device described above.
[0364] In some embodiments, this application also provides a board that includes the storage device described above.
[0365] In some embodiments, this application also provides a computer device, which includes a storage device, a chip, or a board. Optionally, if the computer device includes a chip, it can be implemented as a terminal. If the computer device includes a board, it can be implemented as a server.
[0366] Indicative, Figure 13 This is a structural block diagram of a computer device 1300 provided in an exemplary embodiment of this application. Optionally, the computer device 1300 may be implemented as a terminal or a server.
[0367] Typically, computer device 1300 includes a processor 1301 and a memory 1302.
[0368] Processor 1301 may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc. Processor 1301 may be implemented using at least one hardware form selected from Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). Processor 1301 may also include a main processor and a coprocessor. The main processor, also known as a central processing unit (CPU), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 1301 may integrate a Graphics Processing Unit (GPU), which is responsible for rendering and drawing the content required to be displayed on the screen. In some embodiments, processor 1301 may also include an Artificial Intelligence (AI) processor, which is used to handle computational operations related to machine learning.
[0369] The memory 1302 may include one or more computer-readable storage media, which may be non-transitory. The memory 1302 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments, the non-transitory computer-readable storage media in the memory 1302 are used to store at least one instruction, which is executed by the processor 1301 using the read / write methods described above.
[0370] Optionally, the processor 1301 may include the aforementioned memory device, which may be implemented as a register component within the processor 1301. Alternatively, the memory 1302 may include the aforementioned memory device.
[0371] In some embodiments, server 1300 may optionally include an input interface 1303 and an output interface 1304. Processor 1301, memory 1302, and input interfaces 1303 and 1304 can be connected via a bus or signal lines. Various peripheral devices can be connected to input interfaces 1303 and 1304 via a bus, signal lines, or a circuit board. Input interfaces 1303 and 1304 can be used to connect at least one input / output (I / O) related peripheral device to processor 1301 and memory 1302. In some embodiments, processor 1301, memory 1302, and input interfaces 1303 and 1304 are integrated on the same chip or circuit board; in some other embodiments, any one or two of processor 1301, memory 1302, and input interfaces 1303 and 1304 can be implemented on separate chips or circuit boards, and this application does not limit this.
[0372] Those skilled in the art will understand that Figure 13 The structure shown does not constitute a limitation on the computer device 1300, and may include more or fewer components than shown, or combine certain components, or use different component arrangements.
[0373] This application provides a computer-readable storage medium storing a computer program, which is loaded and executed by a processor to implement the above-described read / write method.
[0374] This application provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the processor of the computer device to load and execute to implement the above-described read / write method.
[0375] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0376] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0377] Those skilled in the art will recognize that the functions described in the embodiments of this application in one or more of the above examples can be implemented using hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or code on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein communication media include any medium that facilitates the transfer of a computer program from one place to another. Storage media can be any available medium that can be accessed by a general-purpose or special-purpose computer.
[0378] The above description is merely an optional embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A storage device, characterized in that, The storage device includes: a reference storage unit and a processing unit; the reference storage unit is connected to the processing unit. The reference storage unit is used to store reference data; The processing unit is configured to read the reference data from the reference storage unit when writing the first data with a first bit width; and to determine residual data based on the difference between the first data and the reference data, wherein the number of valid data bits of the residual data is less than the number of valid data bits of the first data. The processing unit is used to store the residual data into the target location according to a second bit width, wherein the second bit width is smaller than the first bit width.
2. The storage device according to claim 1, characterized in that, The storage device includes: a plurality of slice storage units; the plurality of slice storage units are respectively connected to the processing unit; The processing unit is configured to determine at least one target storage unit from the plurality of segment storage units based on the number of valid data bits of the residual data, wherein the total bit width of the at least one target storage unit is the second bit width; and send the residual data to the at least one target storage unit. The at least one target storage unit is used to receive and store the residual data.
3. The storage device according to claim 2, characterized in that, The processing unit is configured to, when there are multiple target storage units, split the residual data based on the bit width corresponding to each of the multiple segment storage units to obtain multiple segment residual data, wherein the number of segment residual data corresponds to the number of target storage units; and send the segment residual data to each of the multiple target storage units.
4. The storage device according to any one of claims 1 to 3, characterized in that, The processing unit includes: a first processing unit and a second processing unit; the first processing unit is connected to the reference storage unit, and the first processing unit is connected to the second processing unit. The first processing unit is configured to receive a first write request, the first write request being used to request writing the first data; read the reference data from the reference storage unit based on the first write request; determine the residual data based on the difference between the first data and the reference data; and send a second write request to the second processing unit, the second write request being used to request writing the residual data. The second processing unit is configured to receive the second write request and store the residual data into the target location according to the second bit width based on the second write request.
5. The storage device according to any one of claims 1 to 3, characterized in that, The storage device includes: a plurality of first storage units; the plurality of first storage units are respectively connected to the processing unit; The processing unit is configured to acquire the storage status of the plurality of first storage units; and determine the reference storage unit from the plurality of first storage units based on the storage status.
6. The storage device according to claim 5, characterized in that, The processing unit is configured to, when at least one of the plurality of first storage units stores the reference data, determine the residual data corresponding to each of the at least one first storage unit based on the difference between the first data and the reference data stored in the at least one first storage unit. The reference storage cell is determined from the at least one first storage cell based on the residual data.
7. The storage device according to claim 6, characterized in that, The processing unit is used to determine the first storage unit corresponding to the residual data in the residual data corresponding to the at least one first storage unit, wherein the number of valid data bits is less than or equal to the number of preset bits, as the reference storage unit. The processing unit is configured to, when the number of valid data bits in the residual data corresponding to the at least one first storage unit is greater than a preset number of bits, and there are no vacant storage units among the plurality of first storage units, determine the first storage unit corresponding to the residual data with the smallest number of valid data bits among the residual data corresponding to the at least one first storage unit as the reference storage unit.
8. The storage device according to claim 7, characterized in that, The processing unit is further configured to send the first data to the vacant storage unit when the residual data corresponding to at least one first storage unit is greater than a preset number of bits and there is a vacant storage unit among the plurality of first storage units. The vacant storage unit is used to receive the first data; The first data is stored as the reference data stored in the vacant storage unit.
9. The storage device according to claim 6, characterized in that, The processing unit is configured to send the first data to a designated storage unit among the plurality of first storage units when all of the plurality of first storage units are empty storage units; The designated storage unit is used to receive the first data; The first data is stored as the reference data stored in the designated storage unit.
10. The storage device according to claim 5, characterized in that, The processing unit is configured to send the first data to the vacant storage unit when there is a vacant storage unit among the plurality of first storage units; The vacant storage unit is used to receive the first data; The first data is stored as the reference data stored in the vacant storage unit.
11. The storage device according to claim 5, characterized in that, The storage device includes: counters corresponding to the plurality of first storage units respectively; the processing unit is connected to the counters corresponding to the plurality of first storage units respectively; The processing unit is used to obtain the count values of the counters corresponding to the plurality of first storage units as the storage state; Wherein, if the counter value is equal to the first preset value, it indicates that the first storage unit is an empty storage unit; if the counter value is not equal to the first preset value, it indicates that the first storage unit stores reference data.
12. The storage device according to any one of claims 1 to 3, characterized in that, The processing unit is further configured to store identification information in an information table, the identification information including first identification information corresponding to the reference storage unit and second identification information corresponding to the target location, the first identification information and the second identification information being stored together in the information table.
13. The storage device according to any one of claims 1 to 3, characterized in that, The processing unit is configured to receive a first read request, the first read request being used to read the first data; read the reference data from the reference storage unit based on the first read request; and obtain the residual data from the target location based on the first read request. The processing unit is used to merge the reference data and the residual data to obtain the first data as the request feedback data of the first read request.
14. The storage device according to claim 13, characterized in that, The storage device includes: a plurality of slice storage units and a plurality of first storage units; the processing unit includes: a second processing unit, a first selection unit, a second selection unit, and a merging unit; the plurality of first storage units are respectively connected to the second selection unit, the second processing unit is connected to the first selection unit, the plurality of slice storage units are respectively connected to the second processing unit, the first selection unit is connected to the second selection unit, the plurality of slice storage units are respectively connected to the merging unit, and the second selection unit is connected to the merging unit; The first selection unit is used to receive the first read request; The second selection unit is configured to determine the reference storage unit from the plurality of first storage units based on the first read request; read the reference data from the reference storage unit; and send the reference data to the merging unit. The second processing unit is configured to determine at least one target storage unit from the plurality of slice storage units based on the first read request; and send a second read request to the at least one target storage unit, the second read request being used to request the acquisition of the residual data; The at least one target storage unit is configured to receive the second read request and send the residual data to the merging unit based on the second read request; The merging unit is used to receive the reference data and the residual data; merge the reference data and the residual data to obtain the first data as the request feedback data of the first read request.
15. The storage device according to claim 14, characterized in that, The first read request includes first address information and second address information. The first address information is used to indicate the storage location of the identification information in the information table, and the second address information is used to indicate the storage location of the residual data in the at least one target storage unit. The first selection unit is used to parse the first read request to obtain the first address information and the second address information; The first selection unit is configured to obtain the identification information from the information table based on the first address information; wherein the identification information includes first identification information and second identification information, the first identification information is used to indicate the reference storage unit, and the second identification information is used to indicate the at least one target storage unit; The first selection unit is configured to send the first identification information to the second selection unit; and to send the second identification information and the second address information to the second processing unit. The second selection unit is configured to receive the first identification information and determine the reference storage unit from the plurality of first storage units based on the first identification information. The second processing unit is configured to receive the second identification information and the second address information; determine the at least one target storage unit from the plurality of segment storage units based on the second identification information; and send the second read request to the at least one target storage unit based on the second address information.
16. A chip, characterized in that, The chip includes a memory device as described in any one of claims 1 to 15.
17. A circuit board, characterized in that, The board includes the storage device as described in any one of claims 1 to 15.
18. A computer device, characterized in that, The computer device includes a storage device as described in any one of claims 1 to 15, or the computer device includes a chip as described in claim 16, or the computer device includes a board as described in claim 17.
19. A reading and writing method, characterized in that, Executed by a storage device, the storage device comprising: a reference storage unit and a processing unit; the method comprising: The reference storage unit is used to store reference data; The processing unit is configured to read the reference data from the reference storage unit when writing the first data with a first bit width; and to determine residual data based on the difference between the first data and the reference data, wherein the number of valid data bits of the residual data is less than the number of valid data bits of the first data. The processing unit is used to store the residual data into the target location according to a second bit width, wherein the second bit width is smaller than the first bit width.
20. The method according to claim 19, characterized in that, The method further includes: The processing unit is further configured to receive a first read request, the first read request being used to read the first data; read the reference data from the reference storage unit based on the first read request; and obtain the residual data from the target location based on the first read request. The processing unit is used to merge the reference data and the residual data to obtain the first data as the request feedback data of the first read request.