Storage partitioning method and device, equipment and storage medium
By using a hardware-level partitioning method for irreversibly programmable memory cells, the reliability and flexibility issues of memory partitioning schemes are solved. Hardware-level reliable isolation and dynamic partitioning are achieved, which is applicable to various memory banks, prevents tampering, and improves the security and applicability of the system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NATIONZ TECH INC
- Filing Date
- 2026-01-23
- Publication Date
- 2026-05-26
AI Technical Summary
Existing memory partitioning technologies suffer from poor reliability and insufficient flexibility in systems where multiple users or tasks share the same storage. Software partitioning schemes have high runtime overhead and are easily corrupted, while fixed hardware partitioning schemes cannot adapt to the storage space allocation needs of different application scenarios.
It adopts irreversible programmable storage units, and through flexible configuration before leaving the factory, calculates the physical address boundaries of storage blocks and generates access signals to achieve hardware-level reliable isolation and dynamic partition adjustment. The hardware automatically completes permission checks to prevent tampering.
It achieves physical anti-tampering, strong hardware verification, dynamic partitioning, and is suitable for various storage media. It does not require modification of the storage medium, thus improving the security and flexibility of the system.
Smart Images

Figure CN122086320A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of memory technology, and more specifically, to a memory partitioning method, apparatus, device, and storage medium. Background Technology
[0002] In systems where multiple users or tasks share the same storage, how to securely and reliably partition storage resources is a critical issue. Existing memory partitioning technologies mainly include software partitioning schemes and fixed hardware partitioning schemes, both of which have shortcomings.
[0003] Software partitioning schemes rely on operating system software for dynamic memory management, which incurs runtime overhead and is prone to partition corruption due to program errors, resulting in poor reliability and determinism.
[0004] Fixed hardware partitioning schemes fix partition sizes during the chip design phase, lacking flexibility and unable to adapt to the storage space allocation needs of different customers or application scenarios.
[0005] Therefore, a memory partitioning scheme that can provide both hardware-level reliable isolation and flexible configuration before shipment is needed. Summary of the Invention
[0006] According to one aspect of this application, a method for partitioning a memory is provided. The memory includes an irreversibly programmable memory cell and a main memory cell. The partitioning method includes: obtaining user partition configurations corresponding to multiple preset user partitions in the irreversibly programmable memory cell; calculating the physical address boundaries of multiple memory blocks in the main memory cell corresponding to the multiple user partitions based on the user partition configurations; obtaining memory access addresses; comparing the memory access addresses with the physical address boundaries of the multiple memory blocks, and generating access signals for the multiple memory blocks.
[0007] According to some embodiments, before calculating the physical address boundaries of multiple storage blocks in the main storage unit corresponding to multiple user partitions according to the user partition configuration, it is determined whether the capacity of the multiple storage blocks is a preset value according to the user partition configuration; if the capacity of the storage block corresponding to any user partition in the multiple user partitions is not a preset value, the physical address boundaries of the multiple storage blocks are calculated according to the user partition configuration.
[0008] According to some embodiments, determining whether the capacity of multiple storage blocks is a preset value based on user partition configuration includes: determining that the capacity of the storage block corresponding to any user partition is a preset value when the user partition configuration of any user partition is empty; and determining that the capacity of the storage block corresponding to any user partition is not a preset value when the user partition configuration of any user partition is not empty.
[0009] According to some embodiments, when the capacity of the storage block corresponding to any user partition in multiple user partitions is not a preset value, the physical address boundaries of multiple storage blocks are calculated according to the user partition configuration, including: obtaining a preset partition granularity; and calculating the physical address boundaries of multiple storage blocks in a preset order according to the user partition configuration and partition granularity.
[0010] According to some embodiments, the physical address boundaries of multiple storage blocks are calculated sequentially in a preset order based on user partition configuration and partition granularity, including: obtaining the total capacity of the main storage unit; calculating the product of the number of user partition configuration granularities and the partition granularity corresponding to each storage block in the multiple storage blocks, as the capacity of each storage block; and calculating the physical address boundaries of multiple storage blocks sequentially in a preset order based on the total capacity of the main storage unit and the capacity of each storage block.
[0011] According to some embodiments, comparing a storage access address with the physical address boundaries of multiple storage blocks and generating access signals for multiple storage blocks includes: obtaining the start address and end address of any storage block among the multiple storage blocks based on the physical address boundaries of the multiple storage blocks; comparing the storage access address with the start address and end address of any storage block to determine the user partition corresponding to the storage access address; and generating an access signal for the storage block corresponding to the user partition based on the user partition corresponding to the storage access address.
[0012] According to some embodiments, comparing a storage access address with the start and end addresses of any storage block to determine the user partition corresponding to the storage access address includes: determining whether the storage access address is within the range of the start and end addresses of any storage block; and determining the user partition corresponding to the storage access address if the storage access address is within the range of the start and end addresses of any storage block.
[0013] According to one aspect of this application, a memory partitioning device is provided, comprising: a data acquisition module for acquiring user partition configurations corresponding to multiple user partitions preset in an irreversibly programmable memory cell of the memory; an address calculation module for calculating, based on the user partition configurations, the physical address boundaries of multiple memory blocks in the main memory cell corresponding to the multiple user partitions; and a decoding and comparison module for acquiring a memory access address and comparing the memory access address with the physical address boundaries of the multiple memory blocks to generate access signals for the multiple memory blocks.
[0014] According to one aspect of this application, an electronic device is provided, comprising: one or more processors; a storage device for storing one or more programs; and, when the one or more programs are executed by the one or more processors, causing the one or more processors to perform the method as described above.
[0015] According to one aspect of this application, a computer-readable storage medium is provided that stores a computer program or instructions thereon, which, when executed by a processor, implement the method as described above.
[0016] According to the embodiments of this application, the technical solution of this application can achieve at least one of the following technical effects.
[0017] 1. Physical protection against tampering. The configuration information in the irreversible programmable storage unit is programmable once written and irreversibly fixed, eliminating the physical path for secondary modification and preventing attackers from bypassing access control through software or side-channel attacks.
[0018] 2. Strong hardware verification. Permission checks are performed automatically by hardware, without relying on software, thus preventing unauthorized access caused by software vulnerabilities.
[0019] 3. Dynamic partitioning. The size and number of user partitions can be adjusted through irreversibly programmable storage units, making it suitable for different application scenarios (such as multi-user systems) without the need for predefined fixed partitions.
[0020] 4. Compatibility. Applicable to various memory media such as SRAM, Flash, and MRAM, without requiring modification to the memory medium itself. It should be understood that the above general description and the following detailed description are merely exemplary and do not limit this application. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application.
[0022] Figure 1 A flowchart illustrating a memory partitioning method according to an example embodiment of this application is shown.
[0023] Figures 2A-2D A schematic diagram illustrating dynamic partitioning of the main storage unit according to an example embodiment of this application is shown.
[0024] Figure 3 A schematic diagram of a memory partitioning device according to an example embodiment of this application is shown.
[0025] Figure 4 A block diagram of an electronic device according to an example embodiment of this application is shown. Detailed Implementation
[0026] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the embodiments set forth herein; rather, they are provided so that this application will be thorough and complete, and will fully convey the concept of the exemplary embodiments to those skilled in the art. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted.
[0027] The described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to give a full understanding of embodiments of this application. However, those skilled in the art will recognize that the technical solutions of this application can be practiced without one or more of these specific details, or other methods, components, materials, apparatus, or operations may be employed. In these cases, well-known structures, methods, apparatuses, implementations, materials, or operations will not be shown or described in detail.
[0028] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily have to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.
[0029] The terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.
[0030] This application provides a method, apparatus, device, and storage medium for partitioning a memory, which enables hardware-based firmware permissions and allows for dynamic adjustment of the size and number of user areas.
[0031] The irreversible programmable storage unit in this application embodiment is a non-volatile storage device. Its core feature is that it only supports one-time programming operation, and after programming, the stored data is permanently fixed through irreversible physical changes, and there is no physical path for erasure or secondary rewriting.
[0032] The typical implementation forms of irreversible programmable memory units include the following two categories.
[0033] Firstly, native OTP memory cells based on fuse / anti-fuse architecture: By applying a programming voltage to blow the fuse or break down the anti-fuse medium, data is recorded using the permanent change in physical structure, and cannot be recovered after being written.
[0034] Secondly, the Flash-based OTP storage module: based on the general Flash storage architecture, it disables the native repeated erase and write function by means of hardware fuse erase and write control circuit or firmware permanent lock erase and write instructions, so that the data written once has irreversible solidification characteristics.
[0035] The data in the irreversible programmable memory cell is not lost after power failure, and it can resist tampering methods such as software rewriting and side-channel attacks.
[0036] A memory partitioning method, apparatus, device, and storage medium according to embodiments of this application will now be described in detail with reference to the accompanying drawings.
[0037] Figure 1 A flowchart illustrating a memory partitioning method according to an example embodiment of this application is shown.
[0038] like Figure 1 As shown, in step S100, the user partition configurations corresponding to the preset multiple user partitions in the irreversible programmable storage unit are obtained.
[0039] For example, in step S100, the partitioning device obtains the preset user partition configuration through the irreversible programmable storage unit in the memory.
[0040] According to some embodiments, the memory includes an irreversibly programmable memory unit and a main memory unit. The irreversibly programmable memory unit stores configuration values for multiple preset user partitions. The main memory unit has a fixed capacity.
[0041] The partitioning device obtains the user partition configurations corresponding to the multiple preset user partitions in the irreversible programmable storage unit.
[0042] According to some embodiments, after the system is powered on or reset, the partitioning device starts an initialization sequence based on control logic, and reads the granularity (PCG) of the user partition configuration corresponding to the multiple user partitions burned according to user needs in the irreversible programmable memory unit by accessing the irreversible programmable memory unit interface. useri Partition GranularityCount), for example, PGC user1 PGC user2 ... PGC userN-1 Each PCG useri (1≤i≤N) 1) is an integer representing the number of partition granularities occupied by user i partition.
[0043] In step S200, the physical address boundaries of multiple storage blocks in the main storage unit corresponding to multiple user partitions are calculated according to the user partition configuration.
[0044] For example, in step S200, the partitioning device first determines whether the capacity of the multiple storage blocks corresponding to the multiple user partitions is a preset value based on the read user partition configuration, and calculates the physical address boundaries of the multiple storage blocks if the capacity of the storage block corresponding to any user partition is not a preset value.
[0045] Based on the user partition configuration, the partitioning device determines whether the capacity of the multiple storage blocks in the main storage unit corresponding to the multiple user partitions is the preset value.
[0046] According to some embodiments, the preset value of the storage block capacity can be 0 by default. If the preset value of the capacity of all storage blocks in multiple storage blocks is not set, then after hardware decoding, the multiple storage blocks are assumed to correspond to only one user partition, and the capacity of the storage block corresponding to the user partition is the capacity of the main storage unit.
[0047] When any user partition in a multi-user partition configuration is empty, the hardware partitioning device determines the capacity of the storage block corresponding to that user partition to be a preset value.
[0048] According to some embodiments, an empty user partition configuration state means that the configuration value of the corresponding user partition in the irreversibly programmable memory cell is in a factory-unprogrammed state. Different types of non-volatile memory correspond to different factory-unprogrammed states; for native OTP memory cells based on a fuse architecture, the unprogrammed state is characterized by a conducting fuse, with the corresponding memory bit having a logical default value of 1; for native OTP memory cells based on an antifuse architecture, the unprogrammed state is characterized by an insulated antifuse dielectric layer, with the corresponding memory bit having a logical default value of 0. All of the above unprogrammed states are the initial physical state of the memory cell at the time of manufacture, without any programming intervention.
[0049] If the user partition configuration of any user partition is not empty, the partitioning device determines that the capacity of the storage block corresponding to that user partition is not the preset value.
[0050] If the capacity of the storage block corresponding to the user partition is not the preset value, the partitioning device obtains the preset partition granularity size.
[0051] According to some embodiments, the preset partition granularity is a fixed value (e.g., 4KB).
[0052] The partitioning device calculates the product of the number of user partition granularity configurations corresponding to each storage block and the partition granularity, and uses this product as the capacity of each storage block.
[0053] For example, all user partition configuration states are not empty, the first N The i-th user partition in a user storage block (1≤i≤N) 1) The formula for the capacity of its storage blocks is as follows.
[0054] , formula (1) The capacity of the Nth user storage block is calculated by subtracting the capacity of the first N blocks from the total capacity of the main storage. The sum of the capacities of one user storage block is obtained, and the calculation formula is as follows.
[0055] , formula (2) Among them, PCG useri Capacity is the number of granularities for the i-th user partition. Total The total capacity of the main storage.
[0056] Based on the capacity of each storage block in the main storage unit, the partitioning device calculates the physical address boundaries of multiple storage blocks in a preset order.
[0057] According to some embodiments, the preset order can be from low address to high address. The partitioning device calculates the physical address boundaries of the storage blocks corresponding to each user partition, such as user partition 1, user partition 2, ... in the preset order.
[0058] For example, if the capacity of the main memory unit is a fixed value, and the end address of the physical address of the main memory unit is AddrEnd, then... Total Then the physical address range of the main memory unit is 0. AddrEnd Total .
[0059] The start and end addresses of the physical address of the storage block corresponding to user partition 1 are: , .
[0060] The start and end addresses of the physical address of the storage block corresponding to user partition 2 are: , .
[0061] And so on, for the i-th user partition (1≤i≤N) 1) Its address boundaries satisfy the following general formula. , formula (3) , formula (4) The end address of the Nth partition is equal to the end address of main memory, and the first N... The total capacity of the first partition plus the capacity of the Nth partition equals the total main memory capacity. The start and end addresses of the physical address of the storage block corresponding to the last user partition N are... , .
[0062] According to some embodiments, dynamic partitioning of the main memory unit can be achieved by calculating the physical address boundaries of the storage blocks, such as... Figures 2A-2D As shown.
[0063] In this embodiment, the irreversible programmable memory cell adopts the following bit definition rule: a binary bit value of 1 indicates that the memory is not programmed at the factory, and a binary bit value of 0 indicates that the memory is programmed.
[0064] In the irreversible programmable memory cell, the first N 1 user partition (1≤i≤N) 1) Each is allocated a 4-bit binary configuration space, denoted as Cfg. useri This 4-bit configuration value is used to store the configuration value corresponding to the i-th user partition. This configuration value can represent 0. The integer range is 15, where the binary bit value 1111 corresponds to the initial state before being programmed at the factory, and the binary bit values from 0000 to 1110 correspond to the programmed state after one-time programming.
[0065] In this embodiment, the configuration value Cfg burned into the irreversible programmable memory unit useri (4-bit binary value, corresponding to decimal 0) 15) The actual number of granularities in the user partition (PGC) useri It is not a simple one-to-one correspondence, but rather an association through preset mapping rules.
[0066] When the burned binary value is 0000 At 11:10, Cfg useri Decimal values and PGC useri They exhibit a linear mapping relationship, satisfying At this point, each programmed value corresponds to a unique number of granularities.
[0067] When the burned binary value is 1111, this value is the initial state before it was burned at the factory. The number of granularities corresponding to this value needs to be determined in combination with the system partition configuration scenario. The same burning value can correspond to multiple different numbers of granularities.
[0068] If 2≤i≤N 1. This programming value corresponds to .
[0069] If i=1 and the system is configured with only 1 user partition (N=1), this burning value corresponds to (That is, the total number of granularities in main memory).
[0070] like Figure 2A As shown, in the irreversible programmable storage unit, all user partitions are configured with Cfg. useri All are in their initial, unprogrammed state (Cfg) upon leaving the factory. useri =1111, 1≤i≤N 1) The main storage unit contains only one storage block, user1, corresponding to a user partition. The capacity of user1 is [Capacity]. user1 Equal to the actual capacity of the main storage unit. Total .
[0071] like Figure 2B As shown, in the irreversible programmable memory cell, only user partition 1 is programmed (Cfg). user1 ≠1111, Cfg useri =1111, 2≤i≤N In case 1), the main storage unit is divided into two storage blocks, user1 and userN, corresponding to two user partitions. The number of granularities in user1 satisfies... The corresponding partition capacity is .
[0072] The capacity of userN is .
[0073] like Figure 2C As shown, there is user partition 1 Cfg in the irreversible programmable memory unit. user1 and user partition 2Cfg user2 When programmed, the main storage unit is divided into three user partitions: user1, user2, and userN. The granularity of user1 satisfies... The corresponding capacity is .
[0074] The number of granularities in user2 satisfies The corresponding capacity is . The capacity of userN is .
[0075] like Figure 2D As shown, there is user partition 1 Cfg in the irreversible programmable memory unit. user1 User partition 2Cfg user1 ..., User partition N-1 Cfg userN-1 When programmed, the main storage unit is divided into N user partitions corresponding to storage blocks user1, user2, ..., userN-1 and userN. The capacity of user1 is... .
[0076] user2's capacity is .
[0077] And so on, the capacity of userN-1 is .
[0078] The capacity of userN is , 1≤i≤N 1.
[0079] In step S300, the storage access address is obtained.
[0080] For example, in step S300, the partitioning device can obtain the storage access address via the CPU or the bus.
[0081] In step S400, the storage access address is compared with the physical address boundaries of multiple storage blocks, and access signals for multiple storage blocks are generated.
[0082] For example, in step S400, the partitioning device compares the storage access address with the start and end addresses of any of the multiple storage blocks to determine the user partition corresponding to the storage access address and generates an access signal for the storage block corresponding to the user partition.
[0083] According to some embodiments, the memory also includes an address decoder. The address decoder embeds a digital comparator for determining in real time the user partition to which the address belongs based on the received access address and the user partition configuration in the irreversibly programmable memory unit, and generating a corresponding access signal.
[0084] Based on the physical address boundaries of multiple storage blocks, the partitioning device obtains the start and end addresses of any one of the storage blocks.
[0085] The partitioning device determines whether the storage access address is within the range of the start and end addresses of any storage block, and if the storage access address is within the range of the start and end addresses of the storage block, it determines the user partition corresponding to the storage access address.
[0086] For example, suppose the starting address of any memory block X among multiple memory blocks is AddrStart. userx The end address is AddrEnd userx If AddrStart userx ≤Storage access address≤AddrEnd userx Then the partitioning device determines that the storage access address corresponds to user partition X.
[0087] Furthermore, based on the user partition corresponding to the storage access address, the partitioning device generates an access signal for the storage block corresponding to the user partition.
[0088] According to some embodiments, the partitioning device generates an access enable signal for the corresponding storage block in the main storage unit through an address decoder to complete read and write operations.
[0089] According to embodiments of this application, firmware permissions can be hardware-based, achieving physical anti-tampering and completely eliminating software-level permission bypass attacks. Furthermore, the size and number of user areas can be dynamically adjusted to suit different application scenarios (such as multi-user systems), without the need for predefined fixed partitions.
[0090] Figure 3 A schematic diagram of a memory partitioning device according to an example embodiment of this application is shown.
[0091] like Figure 3 As shown, the partitioning device 100 includes a data acquisition module 110, an address calculation module 120, and a decoding comparison module 130.
[0092] The data acquisition module 110 acquires the user partition configurations corresponding to the multiple preset user partitions in the irreversible programmable storage unit.
[0093] Based on the user partition configuration, the address calculation module 120 determines whether the capacity of the multiple storage blocks in the main storage unit corresponding to the multiple user partitions is the preset value.
[0094] If any user partition in a user partition is configured to be empty, the address calculation module 120 determines that the capacity of the storage block corresponding to that user partition is a preset value.
[0095] If the user partition configuration of any user partition in multiple user partitions is not empty, the address calculation module 120 determines that the capacity of the storage block corresponding to that user partition is not the preset value.
[0096] If the capacity of the storage block corresponding to the user partition is not the preset value, the address calculation module 120 obtains the preset partition granularity and the total capacity of the main storage unit.
[0097] The address calculation module 120 calculates the product of the number of user partition granularities and the partition granularity for each storage block in the multiple storage blocks, and uses this product as the capacity of each storage block.
[0098] Based on the total capacity of the main storage unit and the capacity of each storage block, the address calculation module 120 calculates the physical address boundaries of multiple storage blocks in a preset order.
[0099] The decoding and comparison module 130 obtains the storage access address.
[0100] Based on the physical address boundaries of multiple storage blocks, the decoding and comparison module 130 obtains the start and end addresses of any one of the multiple storage blocks.
[0101] The decoding comparison module 130 determines whether the storage access address is within the range of the start and end addresses of any storage block, and if the storage access address is within the range of the start and end addresses of the storage block, it determines the user partition corresponding to the storage access address.
[0102] Based on the user partition corresponding to the storage access address, the decoding and comparison module 130 generates the access signal for the storage block corresponding to the user partition.
[0103] Figure 4 A block diagram of an electronic device according to an example embodiment of this application is shown.
[0104] like Figure 4 As shown, the electronic device 600 is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0105] like Figure 4 As shown, the electronic device 600 is manifested in the form of a general-purpose computing device. The components of the electronic device 600 may include, but are not limited to: at least one processing unit 610, at least one storage unit 620, a bus 630 connecting different system components (including the storage unit 620 and the processing unit 610), a display unit 640, etc. The storage unit stores program code, which can be executed by the processing unit 610, causing the processing unit 610 to perform the methods described in this specification according to the various exemplary embodiments of this application. For example, the processing unit 610 can perform, for example... Figure 1 The method shown.
[0106] Storage unit 620 may include readable media in the form of volatile storage units, such as random access memory (RAM) 6201 and / or cache memory 6202, and may further include read-only memory (ROM) 6203.
[0107] Storage unit 620 may also include a program / utility 6204 having a set (at least one) program module 6205, such program module 6205 including but not limited to: operating system, one or more application programs, other program modules and program data, each or some combination of these examples may include an implementation of a network environment.
[0108] Bus 630 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.
[0109] Electronic device 600 can also communicate with one or more external devices 700 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with electronic device 600, and / or with any device that enables electronic device 600 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 650. Furthermore, electronic device 600 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 660. Network adapter 660 can communicate with other modules of electronic device 600 via bus 630. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 600, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0110] Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. The technical solutions according to the embodiments of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, mobile terminal, or network device, etc.) to execute the methods according to the embodiments of this application.
[0111] Software products may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: electrical connections with one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0112] Computer-readable storage media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable storage medium may also be any readable medium other than a readable storage medium that can transmit, propagate, or transfer a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.
[0113] Program code for performing the operations of this application can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java and C++, and conventional procedural programming languages such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0114] The aforementioned computer-readable medium carries one or more programs, which, when executed by a device, cause the computer-readable medium to perform the aforementioned functions.
[0115] Those skilled in the art will understand that the above modules can be distributed in the device as described in the embodiments, or they can be modified accordingly and placed in one or more devices that are unique to this embodiment. The modules in the above embodiments can be combined into one module, or they can be further divided into multiple sub-modules.
[0116] The embodiments of this application have been described in detail above. These descriptions are solely for the purpose of helping to understand the method and core ideas of this application. Furthermore, any changes or modifications made by those skilled in the art based on the ideas of this application, its specific implementation methods, and its application scope, are all within the scope of protection of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for partitioning a memory, the memory comprising irreversibly programmable memory cells and main memory cells, characterized in that, The method includes: Obtain the user partition configurations corresponding to the preset multiple user partitions in the irreversible programmable storage unit; Based on the user partition configuration, calculate the physical address boundaries of multiple storage blocks in the main storage unit that correspond to the multiple user partitions respectively; Get the storage access address; The storage access address is compared with the physical address boundaries of the plurality of storage blocks, and access signals for the plurality of storage blocks are generated.
2. The method according to claim 1, characterized in that, Before calculating the physical address boundaries of multiple storage blocks in the main storage unit corresponding to the multiple user partitions according to the user partition configuration, the method further includes: Based on the user partition configuration, determine whether the capacity of the multiple storage blocks is a preset value; If the capacity of the storage block corresponding to any of the multiple user partitions is not the preset value, the physical address boundaries of the multiple storage blocks are calculated according to the user partition configuration.
3. The method according to claim 2, characterized in that, Based on the user partition configuration, determining whether the capacity of the plurality of storage blocks is a preset value includes: If the user partition of any user partition is configured to be empty, the capacity of the storage block corresponding to any user partition is determined to be the preset value; If the user partition configuration of any user partition is not empty, it is determined that the capacity of the storage block corresponding to any user partition is not the preset value.
4. The method according to claim 2, characterized in that, If the capacity of the storage block corresponding to any of the plurality of user partitions is not the preset value, the physical address boundaries of the plurality of storage blocks are calculated according to the user partition configuration, including: Obtain the preset partition granularity; Based on the user partition configuration and the partition granularity, the physical address boundaries of the multiple storage blocks are calculated sequentially in a preset order.
5. The method according to claim 4, characterized in that, Based on the user partition configuration and the partition granularity, the physical address boundaries of the multiple storage blocks are calculated sequentially in a preset order, including: Obtain the total capacity of the main storage unit; Calculate the product of the number of user partition configuration granularities corresponding to each of the plurality of storage blocks and the partition granularity, and use it as the capacity of each storage block; Based on the total capacity of the main storage unit and the capacity of each storage block, the physical address boundaries of the multiple storage blocks are calculated sequentially in a preset order.
6. The method according to claim 1, characterized in that, The process of comparing the storage access address with the physical address boundaries of the plurality of storage blocks and generating access signals for the plurality of storage blocks includes: Based on the physical address boundaries of the plurality of storage blocks, obtain the start address and end address of any one of the plurality of storage blocks; The storage access address is compared with the start and end addresses of any storage block to determine the user partition corresponding to the storage access address; Based on the user partition corresponding to the storage access address, an access signal for the storage block corresponding to the user partition is generated.
7. The method according to claim 6, characterized in that, Comparing the storage access address with the start and end addresses of any storage block to determine the user partition corresponding to the storage access address includes: Determine whether the storage access address is within the range of the start and end addresses of any of the storage blocks; If the storage access address is within the range of the start and end addresses of any of the storage blocks, the user partition corresponding to the storage access address is determined.
8. A partitioning device for a memory, characterized in that, include: The data acquisition module is used to acquire the user partition configurations corresponding to the preset multiple user partitions in the irreversible programmable storage unit of the memory. The address calculation module is used to calculate the physical address boundaries of multiple storage blocks in the main storage unit of the memory that correspond to the multiple user partitions, based on the user partition configuration. The decoding and comparison module is used to obtain the storage access address; The storage access address is compared with the physical address boundaries of the plurality of storage blocks to generate access signals for the plurality of storage blocks.
9. An electronic device, characterized in that, include: One or more processors; Storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-7.
10. A computer-readable storage medium having a computer program or instructions stored thereon, characterized in that, When the computer program or instructions are executed by a processor, they implement the method as described in any one of claims 1-7.