ID management system, control method thereof, electronic device, and storage medium

By introducing a mechanism of read pointer and head and tail pointer in the ID management system, combined with pre-store and prefetch rules, ID management in continuous and discrete modes is realized, which solves the problem that traditional ID management modules cannot meet complex working modes and improves resources Utilization efficiency and system flexibility.

CN119025277APending Publication Date: 2024-11-26SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411144544.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-20
Publication Date
2024-11-26

AI Technical Summary

Technical Problem

The traditional ID management module can only support the management of continuous IDs and cannot meet the memory requirements in complex working modes. Especially when ID releases are discontinuous, it leads to low resource utilization efficiency and inability to meet the needs of complex applications.

Method used

Design an ID management system, including multiple memory modules and ID management modules, manage the acquisition and release of IDs in continuous mode and discrete mode respectively through read pointers and head and tail pointers, and supports the bit width of RAM to be larger than the bit width of ID. Implement management in continuous and discrete modes of ID, and use pre-store and prefetch rules to synchronize the working timing of the two modes.

Benefits of technology

It realizes the management of both continuous ID and discrete ID in complex working modes, improves resource utilization efficiency, can flexibly respond to the needs of different working modes, and avoids the waste of ID resources and inconsistent state problems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119025277A_ABST
    Figure CN119025277A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an ID management system and a control method thereof, electronic equipment and a storage medium, and belongs to the field of computers. The system comprises a plurality of memory modules, an ID management module and a plurality of areas used for managing each memory module, each area is distributed with an ID, and the ID management module is provided with a plurality of RAMs used for storing the IDs; the CPU is used for applying for IDs from the ID management module and distributing the IDs to the peripherals according to working modes, receiving the IDs released by the peripherals and transmitting the IDs back to the ID management module, and the working modes comprise a continuous mode and a discrete mode; in the continuous mode, the CPU continuously acquires or releases the ID from the RAM through the read pointer; and in the discrete mode, the CPU continuously acquires or releases the ID from the RAM through the head and tail pointers. The designed ID management system can support continuous ID release and discrete ID release according to a working mode, and can cope with a complex working mode.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to an ID management system and a control method thereof, an electronic device and a storage medium. Background Art

[0002] In computers, memory resources are limited. Program loading, instructions, and data storage all require memory. The goal of memory management is to improve the operating efficiency of each module. A better solution is to design a hardware module to manage memory. One hardware management method is to divide the entire memory into several areas and assign IDs to these areas. Design an ID management module. The CPU applies for an ID from the ID management module and passes the ID to the peripheral. When the peripheral is used, the ID is sent back to the ID management module.

[0003] The traditional design is a continuous ID management module. When the CPU needs an ID, it will read the acquisition interface of the ID management module. It can parse 32 IDs from the read data and know whether these 32 IDs are available. If you want to get more IDs, you can read the acquisition interface multiple times, and you can get 32 ​​new IDs each time. Moreover, the IDs are used in the order of first getting and then releasing. The acquired IDs can only be continuous. If you cannot get a continuous ID at present, you need to wait for the peripheral to complete the corresponding work. After releasing the corresponding ID, the CPU can get it. However, this solution is suitable for operations with simple working modes but large memory requirements, and cannot meet complex working modes. Summary of the invention

[0004] The purpose of the embodiments of the present invention is to provide an ID management system and a control method thereof, an electronic device and a storage medium, which are used to completely or at least partially solve the technical problems existing in the above-mentioned prior art.

[0005] In order to achieve the above object, an embodiment of the present invention provides an ID management system, including:

[0006] A plurality of memory modules, wherein each memory module stores a plurality of groups of IDs;

[0007] An ID management module, used for managing multiple areas of each memory module, each area is assigned an ID, and the ID management module has multiple RAMs for storing IDs, wherein the bit width of the RAM is greater than the bit width of the ID;

[0008] The CPU is used to apply for an ID from the ID management module and allocate it to the peripheral device according to the working mode, and to receive the ID released by the peripheral device and transmit it back to the ID management module. The working mode includes a continuous mode and a discrete mode. In the continuous mode, the CPU continuously obtains or releases the ID from the RAM through the read pointer; in the discrete mode, the CPU continuously obtains or releases the ID from the RAM through the head and tail pointers.

[0009] Optionally, when configuring the continuous mode, write 0 to the RAM to initialize the RAM, and when configuring the discrete mode, ensure that all released IDs have been acquired.

[0010] Optionally, in continuous mode, the CPU continuously obtains or releases IDs from RAM via the read pointer, including:

[0011] Set the read pointer to point to the address of the data to be read in the RAM.

[0012] Initialization step, write all RAM data to 0 to indicate that all IDs have not been acquired;

[0013] When obtaining the ID, determine whether the data pointed to by the read pointer is 0. If it is 0, return the ID pointed to by the current pointer, write all the data corresponding to the ID to 1, and increase the read pointer by 1; if it is not 0, return that the ID is unavailable and the read pointer does not move;

[0014] When the ID needs to be released, write 0 to the bit corresponding to the ID to indicate that the release is complete.

[0015] Optionally, in discrete mode, the CPU continuously fetches or releases IDs from RAM via head and tail pointers, including:

[0016] Set the head and tail pointers to mark the range of IDs stored in RAM;

[0017] When the peripheral releases an ID, the head pointer in the head and tail pointers points to the lower 16 bits of the data, and the ID is released again. The next ID is written into the upper 16 bits, and the head pointer is incremented by one to mark the RAM as not empty.

[0018] When the ID needs to be obtained, if the head and tail pointers are not equal, the data pointed to by the tail pointer is returned directly, and the tail pointer is increased by one; if the head and tail pointers are equal and the RAM is not empty, the lower 16-bit data pointed to by the tail pointer plus an empty ID are returned; if the head and tail pointers are equal and the RAM is empty, two empty IDs are returned.

[0019] Optionally, pre-storage and pre-fetch rules are pre-designed in the CPU to synchronize the working timings of the discrete mode and the continuous mode.

[0020] Optionally, a pre-storage pre-fetch rule is pre-designed in the CPU to synchronize the working timings of the discrete mode and the continuous mode, including:

[0021] Design a pre-stored register out_data_r. If the RAM is empty, write to the register out_data_r at the same time as writing to the RAM. If an ID is released, the ID will be written to the lower 16 bits of the register out_data_r. If another ID is released, the upper 16 bits will be written, and the RAM will be marked as not empty.

[0022] Modify the tail pointer. After the RAM is empty and two data are written, add one to the tail pointer. After that, read the RAM from the position of the tail pointer each time you fetch data. The return value is RDATA, and the tail pointer is added by one.

[0023] Design a pre-fetch signal rd_out_data. When the RAM is empty, pull the pre-fetch signal rd_out_data high to indicate reading data from the register out_data_r. After the data is fetched, pull the pre-fetch signal rd_out_data low to indicate fetching data from the RAM later.

[0024] Among them, each time a data fetch command is received, it is determined whether to fetch the prefetch signal out_data_r or RDATA according to the prefetch signal rd_out_data; when fetching data for the first time, if rd_out_data is high, data is fetched from out_data_r, and then RDATA is updated for standby. When fetching data subsequently, the previously standby RDATA is first fetched, and then RDATA is updated.

[0025] Optionally, a register READ_DATA is designed. When a check is required, RDATA is first sent to READ_DATA, and then RDATA is updated. The next time data is retrieved, data is directly retrieved from READ_DATA to avoid the influence of RAM operations on the normal data retrieval function.

[0026] The switching process between discrete mode and continuous mode includes:

[0027] Design a mode configuration interface, configure the corresponding use mode before formal use, when the CPU finishes writing data in the mode configuration interface, initialize the RAM controller according to the parameters configured by the CPU, among which, when the CPU configures any one of the multiple RAM controllers, the other RAM controllers work normally;

[0028] When the configured mode is continuous mode, the entire RAM is initialized and the initialization completion signal is sent to the corresponding CPU interface;

[0029] Before initialization, it is checked whether the initialization preparation of the RAM controller is completed. In the continuous mode, all the acquired IDs have been released, and in the discrete mode, all the released IDs have been acquired, indicating that the preparation is completed.

[0030] On the other hand, the present invention also provides a control method applied to an ID management system, comprising:

[0031] When the CPU needs an ID, according to the working mode, the CPU applies for an ID from the ID management module and allocates it to the peripheral device, and receives the ID released by the peripheral device and transmits it back to the ID management module, wherein the working mode includes a continuous mode and a discrete mode, and the ID management module is used to manage multiple areas of each memory module, each area is allocated with an ID, and the ID management module has multiple RAMs for storing IDs, wherein the bit width of the RAM is greater than the bit width of the ID;

[0032] In continuous mode, the CPU continuously obtains or releases IDs from the RAM through the read pointer; in discrete mode, the CPU continuously obtains or releases IDs from the RAM through the head and tail pointers.

[0033] On the other hand, the present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the control method of the ID management system described above when executing the program.

[0034] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the control method of the ID management system described above are implemented.

[0035] Through the above technical solution, the designed ID management system can support both continuous ID release and discrete ID release according to the working mode, and can cope with complex working modes.

[0036] Other features and advantages of the embodiments of the present invention will be described in detail in the subsequent detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] The accompanying drawings are used to provide a further understanding of the embodiments of the present invention and constitute a part of the specification. Together with the following specific implementations, they are used to explain the embodiments of the present invention, but do not constitute a limitation on the embodiments of the present invention. In the accompanying drawings:

[0038] Figure 1 It is a structural diagram of an ID management system provided by an embodiment of the present invention;

[0039] Figure 2It is a schematic diagram of an acquisition and release process of an ID in a continuous mode provided by an embodiment of the present invention;

[0040] Figure 3 It is a schematic diagram of an acquisition and release process of an ID in a discrete mode provided by an embodiment of the present invention;

[0041] Figure 4 is a timing diagram of discrete mode data output provided by an embodiment of the present invention;

[0042] Figure 5 is a schematic diagram of a switching process between a discrete mode and a continuous mode provided by an embodiment of the present invention;

[0043] Figure 6 It is a schematic diagram of the interaction process between a CPU and an ID management module provided by an embodiment of the present invention;

[0044] Figure 7 It is an implementation flow chart of a control method applied to an ID management system provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0045] The specific implementation of the embodiment of the present invention is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described here is only used to illustrate and explain the embodiment of the present invention, and is not used to limit the embodiment of the present invention.

[0046] See also Figure 1 FIG. 1 is a schematic diagram of a structure of an ID management system provided by an embodiment of the present invention, including:

[0047] A plurality of memory modules, wherein each memory module stores a plurality of groups of IDs;

[0048] An ID management module, used for managing multiple areas of each memory module, each area is assigned a unique ID, the ID management module has multiple RAMs for storing IDs, wherein the bit width of the RAM is greater than the bit width of the ID;

[0049] The CPU is used to apply for an ID from the ID management module and allocate it to the peripheral device according to the working mode, and to receive the ID released by the peripheral device and transmit it back to the ID management module. The working mode includes a continuous mode and a discrete mode. In the continuous mode, the CPU continuously obtains or releases the ID from the RAM through the read pointer; in the discrete mode, the CPU continuously obtains or releases the ID from the RAM through the head and tail pointers.

[0050] In some implementations, a system has multiple memory modules, each of which can correspond to multiple ID groups, and each ID group will be stored in the RAM corresponding to the ID management module. Generally, the CPU obtains the ID and assigns it to the peripheral device, and the peripheral device releases the ID back to the management module after use. The default ID is a 16-bit number, and the RAM bit width is 32 bits. The CPU can read a 32-bit number at a time.

[0051] In some implementations, when configuring the continuous mode, a write-0 operation is performed on the RAM to initialize the RAM, and when configuring the discrete mode, it is ensured that all released IDs have been acquired.

[0052] In some implementations, in continuous mode, the CPU continuously obtains or releases the ID from the RAM through the read pointer, including the following steps:

[0053] S10: Set a read pointer to point to the address of the data to be read in the RAM.

[0054] Initializes the basis for the read operation. By setting a clear starting point (i.e., read pointer), the CPU can retrieve data from the RAM in an orderly manner. The introduction of the read pointer is the key to managing continuous data access, ensuring the continuity and predictability of data reading.

[0055] S11: Initialization step, writing all RAM data to 0 to indicate that all IDs have not been acquired.

[0056] Initializing all data in RAM to 0 is critical for restoring the system to a known state after booting or resetting. It ensures that all IDs are in an "unobtained" state at the beginning, simplifies the complexity of ID management, and provides a clear starting point for subsequent operations.

[0057] S12: When obtaining the ID, determine whether the data pointed to by the read pointer is 0. If it is 0, return the ID pointed to by the current pointer, write all the data corresponding to the ID to 1, and increase the read pointer by 1; if it is not 0, return that the ID is unavailable and the read pointer does not move.

[0058] By checking whether the data currently pointed to by the read pointer is 0, the system can determine whether the ID has been occupied. This mechanism effectively avoids the repeated allocation of IDs and ensures the uniqueness and validity of the ID. When an unused ID is found (that is, the data is 0), the system assigns the ID to the requester and writes all the corresponding data bits to 1 to mark that the ID has been occupied. This instant marking method ensures the instant update of the ID status and avoids the problem of inconsistent status. After the ID is successfully allocated, the read pointer is increased by 1 to prepare for the next ID allocation. This ensures the continuous allocation of IDs and improves the efficiency of resource utilization. If the data pointed to by the read pointer is not 0, it means that the ID has been occupied, and the system returns a prompt of "ID unavailable" and keeps the read pointer position unchanged. This instant feedback mechanism helps the requester understand the ID allocation situation and may take other measures (such as waiting or trying other IDs).

[0059] S13: When the ID needs to be released, the bit corresponding to the ID is written to 0 to indicate that the release is complete.

[0060] When an ID is no longer needed, the system can recycle the ID and re-mark it as "not acquired" by writing its corresponding bit back to 0. This step is an important part of resource recycling, ensuring the reusability of ID resources and avoiding resource waste. At the same time, since the release of the ID is immediate and predictable (by directly manipulating the bits in the RAM), the system can maintain efficient management of ID resources.

[0061] In some embodiments, in continuous mode, after initialization, all IDs are in the management module, each ID has its specific position, and the ID released by the peripheral will be put back to the initial position. In continuous mode, all IDs acquired by the CPU are continuous. If the CPU wants to acquire 32 IDs, the ID management module will find the location of the currently acquired ID, and look for 32 IDs backwards. If these IDs have not been acquired or have been released, these 32 IDs will be returned. Otherwise, it will return that the ID is unavailable. The continuous mode ensures that the acquired IDs are continuous.

[0062] For details, see Figure 2As shown, it is a schematic diagram of the acquisition and release process of an ID in a continuous mode provided by an embodiment of the present invention. In the continuous mode, the ID is stored in the RAM. The bit width of the RAM is 32 and the depth is 2048. In the continuous mode, the ID is stored in a bitmap manner, that is, one ID corresponds to 1 bit of the RAM. The read pointer is designed to point to the address of 32 data. After initialization, the RAM data is 0. When it is necessary to obtain the ID, determine whether the data pointed to by the read pointer is 0. If it is 0, the read pointer is returned, indicating that the 32 IDs pointed to by the current pointer are valid. Write all 32-bit numbers pointed to by the current pointer to 1, and then add 1 to the read pointer (loop addition). If the reading is not 0, it returns that the ID is unavailable and the read pointer does not move. When the ID needs to be released, the bit corresponding to the ID needs to be written to 0, indicating that the release is complete.

[0063] In some implementations, in discrete mode, the CPU continuously obtains or releases IDs from the RAM through the head and tail pointers, including the following steps:

[0064] S20: Set the head and tail pointers to mark the range of IDs stored in the RAM.

[0065] By setting the head and tail pointers, the system can mark the range of IDs currently stored in RAM. The head pointer points to the location of the next ID to be released (or the first free location), while the tail pointer is used to track the location of the last ID acquired. This dual pointer mechanism allows the system to flexibly manage the allocation and release of IDs, and can work effectively even when the acquisition and release of IDs are not strictly continuous.

[0066] S21: After the peripheral releases an ID, the ID is written to the head pointer in the head and tail pointers to point to the lower 16 bits of the data, and the ID is continued to be released, the next ID is written to the upper 16 bits, and the head pointer is increased by one to mark the RAM as not empty.

[0067] When the peripheral releases an ID, the system writes the ID to the lower 16 bits of the RAM location pointed to by the head pointer. If multiple IDs need to be released in succession, the next ID can be written to the upper 16 bits of the same location. However, this design may require additional logic in actual applications to distinguish whether both the upper 16 bits and the lower 16 bits contain valid IDs, because usually only one ID is stored in a location. Each time an ID is released, the head pointer is increased by one, indicating that there are now more IDs available in the RAM. At the same time, the RAM is marked as not empty so that the system can know whether there are still IDs available for allocation.

[0068] S22: When the ID needs to be obtained, if the head and tail pointers are not equal, the data pointed to by the tail pointer is directly returned, and the tail pointer is increased by one; if the head and tail pointers are equal and the RAM is not empty, the lower 16-bit data pointed to by the tail pointer plus an empty ID are returned; if the head and tail pointers are equal and the RAM is empty, two empty IDs are returned.

[0069] If the head and tail pointers are not equal, it means that there is an available ID in the RAM. At this time, the system directly returns the data pointed to by the tail pointer and increases the tail pointer by one so that the next acquisition operation can point to the next ID.

[0070] In some embodiments, in discrete mode, after initialization, all IDs are in the hands of the CPU, and there is no ID in the management module. The CPU needs to wait for the peripheral to release it before it can successfully obtain it. The IDs are saved in the management module in the order in which the peripherals are released. When the CPU wants to obtain the ID, the management module will return the first released ID. The management module will return two 16-bit IDs to the CPU at a time. If there is one ID left, the remaining 16 bits will be filled with an empty ID and returned to the CPU.

[0071] For details, see Figure 3 As shown, it is a schematic diagram of the acquisition and release process of an ID in a discrete mode provided by an embodiment of the present invention. In the discrete mode, the ID is stored in the RAM as 16-bit data. Since the RAM bit width is 32 bits, one RAM data can represent two IDs. The bit width of the CPU reading is also 32 bits, so in the discrete mode, a read operation can return one RAM data to the CPU, that is, two IDs. The head and tail pointers are designed. After initialization, the head and tail pointers are together, marking the RAM as empty, and returning two empty IDs when the CPU needs to read. When an ID is released outside, this ID will be written to the lower 16 bits of the data pointed to by the head pointer, and the ID will continue to be released. The next ID will be written to the upper 16 bits, and then the head pointer will be increased by one, marking the RAM as not empty. When it is necessary to obtain the ID, if the head and tail pointers are not equal, the data pointed to by the tail pointer is directly returned, and the tail pointer is increased by one. If the head and tail pointers are equal, but there is another data in the RAM, the lower 16-bit data pointed to by the tail pointer plus an empty ID is returned. If the RAM is empty, two empty IDs are returned.

[0072] The problem of not supporting discrete ID release is solved. The management module designed in this application supports discrete ID release. In discrete mode, the use of ID follows the method of releasing first and then acquiring. After initialization, all IDs are in the hands of the CPU. The CPU first gives the ID to the peripheral device, and then releases it to the management module after the peripheral device is used up. When the CPU uses up all the IDs in its hands, it will acquire the ID from the ID management module and use it.

[0073] The discrete mode needs to directly return the data in the RAM, but the RAM reading takes some time. After the data is read out, the logic is done, which will cause the returned data to be slower than the continuous mode. The asynchronous working timing of the discrete and continuous modes will cause troubles in use, so a pre-storage and pre-fetching solution is designed.

[0074] In some implementations, pre-stored pre-fetching rules are pre-designed in the CPU to synchronize the working timings of the discrete mode and the continuous mode.

[0075] For details, see Figure 4 As shown, a timing diagram of a discrete mode data output provided by an embodiment of the present invention is provided. A pre-storage pre-fetching rule is pre-designed in the CPU to synchronize the working timings of the discrete mode and the continuous mode, including the following steps:

[0076] S30: Design a pre-stored register out_data_r. If the RAM is empty, write to the register out_data_r at the same time as writing to the RAM. If an ID is released, the ID will be written to the lower 16 bits of the register out_data_r. If another ID is released, the upper 16 bits will be written, and the RAM will be marked as not empty.

[0077] Preferably, the pre-stored register out_data_r is 32 bits.

[0078] By introducing a 32-bit pre-storage register out_data_r, the system can temporarily store the IDs to be released when the RAM is empty. When the peripheral releases the IDs, these IDs are first written to the lower 16 bits or the upper 16 bits of out_data_r. Even when the RAM is empty, the system can immediately provide the ID to the requester without waiting for the new ID to be written to the RAM. In addition, by marking the RAM as not empty, the system can track the filling status of the RAM so that data can be read from the RAM at the appropriate time.

[0079] S31: Modify the tail pointer. After the RAM is empty and two data are written, the tail pointer is incremented by one. After that, each time data is retrieved, the RAM is read from the position of the tail pointer. The return value is RDATA, and the tail pointer is incremented by one.

[0080] After the RAM is empty and two data are successfully written to out_data_r, the tail pointer is incremented by one. This is to prepare to continue reading data from the RAM after the data in out_data_r is read. In each subsequent data fetch operation, the system reads the data (RDATA) in the RAM from the location pointed to by the tail pointer, and increments the tail pointer by one so that it can point to the next ID when reading next time. This ensures continuous reading of data and efficient use of resources in the RAM when the RAM is not empty.

[0081] S32: Design a pre-fetch signal rd_out_data. When the RAM is empty, pull the pre-fetch signal rd_out_data high to indicate reading data from the register out_data_r. After the data is fetched, pull the pre-fetch signal rd_out_data low to indicate fetching data from the RAM later.

[0082] Among them, each time a data fetch command is received, it is determined whether to fetch the prefetch signal out_data_r or RDATA according to the prefetch signal rd_out_data; when fetching data for the first time, if rd_out_data is high, data is fetched from out_data_r, and then RDATA is updated for standby. When fetching data subsequently, the previously standby RDATA is first fetched, and then RDATA is updated.

[0083] The introduction of the prefetch signal rd_out_data is to instruct the system to read data from out_data_r instead of RAM when the RAM is empty. When rd_out_data is pulled high, it means that the system should read data from out_data_r; when the data is fetched and the RAM is filled with new data, rd_out_data is pulled low, indicating that the system should read data from RAM afterwards. This mechanism ensures that the system can seamlessly provide data to the requester even when the RAM is temporarily empty, avoiding data interruption or delay.

[0084] In some implementations, when the RAM needs to be checked, RDATA will change accordingly, affecting the normal data retrieval function. A register READ_DATA is designed. When a check is required, RDATA is first sent to READ_DATA, and then RDATA is updated. The next time data is retrieved, data is directly retrieved from READ_DATA to avoid the impact of RAM operations on the normal data retrieval function.

[0085] In some embodiments, the switching process between the discrete mode and the continuous mode includes the following steps:

[0086] S1: Design mode configuration interface. Configure the corresponding usage mode before formal use. When the CPU finishes writing data in the mode configuration interface, initialize the RAM controller according to the parameters configured by the CPU. When the CPU configures any one of the multiple RAM controllers, the remaining RAM controllers work normally.

[0087] In some embodiments, there are multiple RAM controllers inside the ID management module, and each controller corresponds to a different ID area. For each RAM controller, a corresponding configuration interface is set. The configuration interface can configure the working mode and number of IDs of the RAM controller. When the CPU needs to use the RAM, it can find a RAM controller in a ready state and configure the working mode and number of IDs. When the RAM controller receives the configuration parameters, it will automatically complete the initialization work according to the configuration parameters, and then it can release and obtain the ID from this RAM controller. After the release and acquisition of the ID operation, the corresponding RAM control will enter the working state.

[0088] When all acquired IDs in continuous mode have been released, or all released IDs in discrete mode have been acquired, the corresponding RAM controller enters the ready state and the working mode can be reconfigured. For each RAM controller, a status register is added to indicate whether the management module is in the working state or in the ready state. When the RAM controller is in the working state, the configuration parameters cannot be written to the RAM controller, which avoids the misoperation of the ID management module causing the entire system to malfunction. When the RAM controller is in the ready state, the working mode of the RAM controller can be reconfigured.

[0089] For each RAM controller, their working modes are independent of each other and do not affect each other. During normal operation, some RAM controllers will be configured as continuous mode and others as discrete mode as needed. When some RAM controllers are in working state, others are in ready state. The CPU can configure the working mode and ID number for the corresponding RAM controller as needed. Based on such functions, the configuration registers and status registers of each RAM controller are independent.

[0090] By designing the mode configuration interface, users can select the working mode (discrete mode or continuous mode) that suits the current application scenario before officially using the system. This improves the flexibility of the system and enables it to adapt to different usage scenarios and requirements. The introduction of the configuration interface simplifies the process of mode switching. Users can complete the mode configuration through simple operations without having to deeply understand the internal implementation of the system.

[0091] S2: When the configured mode is continuous mode, the entire RAM is initialized and the initialization completion signal is sent to the corresponding CPU interface.

[0092] Before initialization, it is checked whether the initialization preparation of the RAM controller is completed. In the continuous mode, all the acquired IDs have been released, and in the discrete mode, all the released IDs have been acquired, indicating that the preparation is completed.

[0093] Before switching to continuous mode, the entire RAM is initialized to ensure that the data in the RAM is in a consistent and predictable state. This helps reduce errors and anomalies caused by inconsistent data. Before initialization, the system checks the initialization preparation of the RAM controller to ensure that all necessary conditions have been met. This improves the reliability and stability of the system and avoids initialization failures or system anomalies caused by incomplete preparations. With clear initialization signals and preparation checks, the system can smoothly switch from one mode to another, reducing uncertainty and risk during mode switching.

[0094] Specifically, the switching process between discrete mode and continuous mode is as follows: discrete mode and continuous mode are two completely different working modes, but both allocate the same memory space, so the two working modes can be implemented in the same RAM controller.

[0095] Design a mode configuration interface and configure the corresponding usage mode before formal use. When the CPU finishes writing data in the mode configuration interface, the RAM controller is immediately initialized according to the parameters configured by the CPU. Note that there may be many RAM controllers in the ID management module. When the CPU configures a RAM controller, the corresponding RAM controller is initialized, while other controllers work normally. When the configured mode is continuous mode, since the movement of the read pointer needs to see whether the data in the RAM is 0, the data in the RAM needs to be initialized at this time, that is, 0 needs to be written to the entire RAM. After the initialization is completed, the initialization completion signal is placed on the corresponding CPU interface. Since the mode switching will cause the RAM controller to be initialized, if there is an erroneous operation, the entire ID management module will be unable to recover, so it is necessary to check whether the initialization is ready before initialization. The sign that the RAM controller is ready is: in continuous mode, all acquired IDs have been released, and in discrete mode, all released IDs have been acquired. When trying to configure the mode, if the RAM controller is not ready, the mode cannot be successfully configured and the initialization operation will not be performed. The whole process is as follows Figure 5 shown.

[0096] The problem of single working mode is solved. The present invention designs a multifunctional ID management module, which supports both continuous ID release and discrete ID release, and can switch to the corresponding working mode when needed.

[0097] In some embodiments, see Figure 6As shown, it is a schematic diagram of the interaction process between a CPU and an ID management module provided by an embodiment of the present invention, and the specific process is as follows: the CPU needs to obtain an ID from the ID management module. The existing operation mode is that the CPU needs to read the corresponding interface to obtain the ID, and 32 IDs are obtained at a time in the continuous mode, and two IDs are obtained at a time in the discrete mode. In many cases, the IDs obtained at one time are always insufficient, but the ID management module cannot always meet the needs of the CPU. For example, the number of IDs required in the continuous mode is 96, but the ID management module can only provide 64. At this time, the CPU has 64 IDs in hand but cannot distribute them, which will increase the burden of the entire system. In order to solve this problem, it is necessary to design the interaction between the ID management module and the CPU. The CPU should first configure a parameter for obtaining the number of IDs to the ID management module, and the ID management module will feedback whether so many IDs can be provided. If so many IDs cannot be provided, the CPU may need to reallocate tasks and then re-propose the ID requirement. If the ID management module can meet the needs of the current task, the CPU can read the ID acquisition interface. It only needs to be read once, and the ID management module can send a certain number of IDs to the CPU according to the needs of the CPU. If the current working mode is the continuous mode, the ID parsing work can be placed in the ID management module, and the CPU can directly obtain a certain number of real IDs.

[0098] By adding the interactive logic between the CPU and the ID management module, the CPU sends the requirements to the ID management module, and the ID management module sends the results to the CPU. If the CPU needs a large number of IDs, the ID management module will check the number of remaining IDs. If it is not enough to meet the requirements, it will return a signal of insufficient IDs. If it meets the requirements, it will return the corresponding number of real IDs at one time.

[0099] See also Figure 7 As shown, it is an implementation flow chart of a control method applied to an ID management system provided by an embodiment of the present invention, including the following execution steps:

[0100] Step 700: When the CPU needs an ID, it applies for an ID from the ID management module and allocates it to the peripheral device according to the working mode, and receives the ID released by the peripheral device and transmits it back to the ID management module.

[0101] Among them, the working mode includes a continuous mode and a discrete mode, the ID management module is used to manage multiple areas of each memory module, each area is assigned a unique ID, and the ID management module has multiple RAMs for storing IDs, wherein the bit width of the RAM is greater than the bit width of the ID.

[0102] Step 701: In the continuous mode, the CPU continuously obtains or releases the ID from the RAM through the read pointer; in the discrete mode, the CPU continuously obtains or releases the ID from the RAM through the head and tail pointers.

[0103] On the other hand, the present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the control method of the ID management system described above when executing the program.

[0104] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the control method of the ID management system described above are implemented.

[0105] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0106] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0107] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0108] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0109] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0110] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0111] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0112] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0113] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.

Claims

1. An ID management system, characterized in that: include: A plurality of memory modules, wherein each memory module stores a plurality of groups of IDs; An ID management module, used for managing multiple areas of each memory module, each area is assigned an ID, and the ID management module has multiple RAMs for storing IDs, wherein the bit width of the RAM is greater than the bit width of the ID; The CPU is used to apply for an ID from the ID management module and allocate it to the peripheral device according to the working mode, and to receive the ID released by the peripheral device and transmit it back to the ID management module. The working mode includes a continuous mode and a discrete mode. In the continuous mode, the CPU continuously obtains or releases the ID from the RAM through the read pointer; in the discrete mode, the CPU continuously obtains or releases the ID from the RAM through the head and tail pointers.

2. The ID management system according to claim 1, characterized in that: When configuring the continuous mode, write 0 to the RAM to initialize the RAM. When configuring the discrete mode, ensure that all released IDs have been acquired.

3. The ID management system according to claim 2, characterized in that: In continuous mode, the CPU continuously obtains or releases IDs from RAM through the read pointer, including: Set the read pointer to point to the address of the data to be read in the RAM. Initialization step, write all RAM data to 0 to indicate that all IDs have not been acquired; When obtaining the ID, determine whether the data pointed to by the read pointer is 0. If it is 0, return the ID pointed to by the current pointer, write all the data corresponding to the ID to 1, and increase the read pointer by 1; if it is not 0, return that the ID is unavailable and the read pointer does not move; When the ID needs to be released, write 0 to the bit corresponding to the ID to indicate that the release is complete.

4. The ID management system according to claim 2, characterized in that: In discrete mode, the CPU continuously obtains or releases IDs from RAM through the head and tail pointers, including: Set the head and tail pointers to mark the range of IDs stored in RAM; When the peripheral releases an ID, the head pointer in the head and tail pointers points to the lower 16 bits of the data, and the ID is released again. The next ID is written into the upper 16 bits, and the head pointer is incremented by one to mark the RAM as not empty. When the ID needs to be obtained, if the head and tail pointers are not equal, the data pointed to by the tail pointer is returned directly, and the tail pointer is increased by one; if the head and tail pointers are equal and the RAM is not empty, the lower 16-bit data pointed to by the tail pointer plus an empty ID are returned; if the head and tail pointers are equal and the RAM is empty, two empty IDs are returned.

5. The ID management system according to claim 1, characterized in that: Pre-storage and pre-fetch rules are designed in the CPU in advance to synchronize the working timing of discrete mode and continuous mode, including: Design a pre-stored register out_data_r. If the RAM is empty, write to the register out_data_r at the same time as writing to the RAM. If an ID is released, the ID will be written to the lower 16 bits of the register out_data_r. If another ID is released, the upper 16 bits will be written, and the RAM will be marked as not empty. Modify the tail pointer. After the RAM is empty and two data are written, add one to the tail pointer. After that, read the RAM from the position of the tail pointer each time you fetch data. The return value is RDATA, and the tail pointer is added by one. Design a pre-fetch signal rd_out_data. When the RAM is empty, pull the pre-fetch signal rd_out_data high to indicate reading data from the register out_data_r. After the data is fetched, pull the pre-fetch signal rd_out_data low to indicate fetching data from the RAM later. Among them, each time a data fetch command is received, it is determined whether to fetch the prefetch signal out_data_r or RDATA according to the prefetch signal rd_out_data; when fetching data for the first time, if rd_out_data is high, data is fetched from out_data_r, and then RDATA is updated for standby. When fetching data subsequently, the previously standby RDATA is first fetched, and then RDATA is updated.

6. The ID management system according to claim 5, characterized in that: Design a register READ_DATA. When a check is required, send RDATA to READ_DATA first, then update RDATA. The next time you retrieve data, retrieve data directly from READ_DATA to avoid the impact of RAM operations on the normal data retrieval function.

7. The ID management system according to claim 1, characterized in that: The switching process between discrete mode and continuous mode includes: Design a mode configuration interface, configure the corresponding use mode before formal use, when the CPU finishes writing data in the mode configuration interface, initialize the RAM controller according to the parameters configured by the CPU, among which, when the CPU configures any one of the multiple RAM controllers, the other RAM controllers work normally; When the configured mode is continuous mode, the entire RAM is initialized and the initialization completion signal is sent to the corresponding CPU interface; Before initialization, it is checked whether the initialization preparation of the RAM controller is completed. In the continuous mode, all the acquired IDs have been released, and in the discrete mode, all the released IDs have been acquired, indicating that the preparation is completed.

8. A control method for the ID management system according to any one of claims 1 to 7, characterized in that: include: When the CPU needs an ID, according to the working mode, the CPU applies for an ID from the ID management module and allocates it to the peripheral device, and receives the ID released by the peripheral device and transmits it back to the ID management module, wherein the working mode includes a continuous mode and a discrete mode, and the ID management module is used to manage multiple areas of each memory module, each area is allocated with an ID, and the ID management module has multiple RAMs for storing IDs, wherein the bit width of the RAM is greater than the bit width of the ID; In continuous mode, the CPU continuously obtains or releases IDs from the RAM through the read pointer; in discrete mode, the CPU continuously obtains or releases IDs from the RAM through the head and tail pointers.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the control method of the ID management system according to claim 8 are implemented.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the control method of the ID management system according to claim 8 are implemented.