A counting apparatus, method, device and storage medium of IP events
By using a combination of a counter register, a counter mirror register, and a base register in the system-on-a-chip, the problem of discontinuous counting after the IP function module restarts is solved, accurate IP event counting is achieved, and the resource consumption of the power management system is reduced.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CIX TECH (SHANGHAI) CO LTD
- Filing Date
- 2026-01-16
- Publication Date
- 2026-05-19
AI Technical Summary
In on-chip systems, the power management system cannot accurately count the number of events of IP function modules, especially when IP function modules restart, due to the counting discontinuity caused by counter reset.
A combination of a counter register, a counter mirror register, and a base register is used, connected via hardware wiring, to achieve synchronization and accumulation of count values, ensuring the continuity of counting.
It improves the accuracy of IP event counting, reduces the consumption of power management system hardware and software resources, and simplifies software complexity.
Smart Images

Figure CN121523735B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of electronic information technology, and in particular to a counting device, method, apparatus and storage medium for IP events. Background Technology
[0002] In a System-on-Chip (SoC), the power management system estimates IP power consumption based on the counts of various Intellectual Property (IP) events over a period of time. The power management system typically reads the counts of specific IP events at a fixed frequency and calculates the difference between two consecutive counts. This difference represents the number of times that IP event occurred during that period, and is used to calculate the power consumption of the IP functional module during that time. However, in actual operation, IP functional modules are constantly shut down and restarted as needed. After a restart, all IP counts reset to 0, meaning that two consecutive counts no longer reflect the true number of events that occurred.
[0003] When the power management system (PMS) is responsible for powering on and off the IP, there are no issues because the PMS can detect when the counter will reach zero. However, when the PMS's power-on and power-off are handled by other systems, the PMS cannot determine when the counter will reach zero. To address this, the PMS needs to send a signal to the PMS before and after each reboot. The PMS then calculates the event count for each of these two scenarios (whether a reboot has occurred) using different methods. Summary of the Invention
[0004] This invention provides an IP event counting device, method, apparatus, and storage medium, which can reduce the occupation of power management system hardware and software resources while improving the accuracy of IP event counting.
[0005] In a first aspect, embodiments of the present invention provide an IP event counting device, comprising: an IP function module and a power management module; the IP function module includes a counting register; the power management module includes a counting mirror register and a base register;
[0006] The counting register and the counting mirror register are connected via hardware wiring; the counting register is used to store a first count value; the counting mirror register is used to store a second count value; the base register is used to store a third count value; wherein, the first count value represents the number of times a preset IP event occurs in the IP function module, the second count value is equal to the first count value, and the second count value is synchronized from the counting register;
[0007] When the IP function module is powered off, the IP function module reads the first count value from the counter register and the third count value from the base register, accumulates the first count value and the third count value, and writes the accumulation result into the base register as the new third count value;
[0008] When the IP function module is powered on, the power management module reads the second count value from the counter mirror register at set intervals, and adds the read second count value to the third count value through an adder, and determines the accumulated result as the target count value of the preset IP event.
[0009] Secondly, embodiments of the present invention also provide a method for counting IP events, the method being executed by the IP event counting device described in embodiments of the present invention, comprising:
[0010] When the IP function module is powered off, the IP function module reads a first count value from the counter register and a third count value from the base register; accumulates the first count value and the third count value; and writes the accumulation result into the base register as a new third count value.
[0011] When the IP function module is powered on, the power management module reads the second count value from the counter mirror register at set intervals, and adds the read second count value to the third count value through an adder, and determines the accumulated result as the target count value of the preset IP event.
[0012] Thirdly, embodiments of the present invention also provide an electronic device, the electronic device comprising:
[0013] At least one processor; and
[0014] A memory communicatively connected to the at least one processor; wherein,
[0015] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the IP event counting method described in the embodiments of the present invention.
[0016] Fourthly, embodiments of the present invention also provide a computer-readable storage medium storing computer instructions that are used to cause a processor to execute the IP event counting method described in the embodiments of the present invention.
[0017] This invention discloses an IP event counting device, method, apparatus, and storage medium. The device includes: an IP function module and a power management module; the IP function module includes a counting register; the power management module includes a counting mirror register and a base register; the counting register and the counting mirror register are connected via hardware wiring; the counting register stores a first count value; the counting mirror register stores a second count value; and the base register stores a third count value; wherein the first count value represents the number of times a preset IP event occurs in the IP function module, the second count value is equal to the first count value, and the second count value is synchronized from the counting register; when the IP function module is powered off, the IP function module reads the first count value from the counting register and the third count value from the base register, accumulates the first and third count values, and writes the accumulation result into the base register as a new third count value; when the IP function module is powered on, the power management module reads the second count value from the counting mirror register at set intervals, and accumulates the read second count value with the third count value using an adder, determining the accumulation result as the target count value of the preset IP event. The IP event counting device provided in this embodiment of the invention does not need to consider whether the IP function module has been restarted when acquiring the IP event count, which can reduce the software complexity of the power management module, reduce the occupation of the power management system's hardware and software resources, and improve the accuracy of IP event counting. Attached Figure Description
[0018] Figure 1 This is a schematic diagram of the structure of an IP event counting device according to Embodiment 1 of the present invention;
[0019] Figure 2 This is a schematic diagram of the structure of an IP event counting device according to Embodiment 1 of the present invention;
[0020] Figure 3 This is a flowchart of an IP event counting method according to Embodiment 2 of the present invention;
[0021] Figure 4 This is a schematic diagram of the structure of an electronic device according to Embodiment 3 of the present invention. Detailed Implementation
[0022] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0023] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0024] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.
[0025] Example 1
[0026] Figure 1 This is a schematic diagram of the structure of an IP event counting device provided in Embodiment 1 of the present invention, as shown below. Figure 1 As shown, the device includes: an IP function module 110 and a power management module 120; the IP function module 110 includes a counter register 111; the power management module includes a counter mirror register 121 and a base register 122.
[0027] The counter register 111 and the counter mirror register 121 are connected via hardware wiring. The counter register 111 stores a first count value; the counter mirror register 121 stores a second count value; and the base register 122 stores a third count value. The first count value represents the number of times a preset IP event has occurred in the IP function module, and the second count value is equal to the first count value, which is synchronized from the counter register.
[0028] When the IP function module 110 is powered off, the IP function module 110 reads the first count value from the counter register 111 and the third count value from the base register 122, accumulates the first count value and the third count value, and writes the accumulation result into the base register 122 as the new third count value.
[0029] When the IP function module is powered on, the power management module reads the second count value from the counter mirror register every set time interval, and adds the read second count value to the third count value through an adder, and determines the accumulated result as the target count value of the preset IP event.
[0030] In this embodiment, when the IP function module 110 is powered on, the first count value in the counter register 111 is initialized to 0; subsequently, the count of preset IP events is incremented in real time. The counter mirror register 121 located in the power management module 120 is kept consistent with the value in the counter register 111 via hardware wiring. When the power management module 120 is powered on, the third count value in the base register 122 is initialized to 0.
[0031] In this embodiment, when the IP function module is powered down, the corresponding driver reads the first count value Rc from the count register 111 and the third count value Rb from the base register 122, and writes their sum into the base register 122 as the new third count value Rb (i.e., Rb = Rc + Rb). When the IP is powered on again, the target count value (Rm + Rb) read by the power management module remains continuous and is completely unaffected by the IP power-down and power-on processes and the number of times.
[0032] Optional, Figure 2 This is a schematic diagram of the structure of an IP event counting device provided in an embodiment of the present invention, as shown below. Figure 2 As shown, the power management module also includes a signal monitor 123; the signal monitor 123 is used to receive status signals from the IP function modules. These status signals include high-level signals and low-level signals.
[0033] The status signals of the IP function module can be sent directly to the signal monitor by other power management modules that power the IP function module, or forwarded to the signal monitor by the IP function module.
[0034] In this embodiment, when the IP function module is powered on, the IP status signal is high; when the IP is powered off, the IP status signal is low. This status signal serves as an input signal to the power management module 120. The time when this status signal is sent to the signal monitor 123 must precede the time when the IP function module actually enters the power-on / off state, so that the power management module has time to update the third count value in the base register 122.
[0035] In this embodiment, when the signal monitor receives a low-level signal, the power management module 120 reads the second count value from the count mirror register 121 and the third count value from the base register 122, accumulates the second count value and the third count value, and writes the accumulation result into the base register 122 as the new third count value.
[0036] Specifically, when the signal monitor detects the falling edge of the IP status signal, it reads the first count value Rc from the count register 111 and the third count value Rb from the base register 122, and writes their sum into the base register 122 as the new third count value Rb (i.e., Rb = Rc + Rb). When the IP is powered on again, the count (Rm + Rb) read by the power management module remains continuous and is completely unaffected by the IP's power-on / off process and the number of times it is powered on.
[0037] In this embodiment, the method further includes: determining the difference between two adjacent target count values, and determining the power consumption of a preset IP event within a set duration based on the difference.
[0038] In this embodiment, when the IP function module is powered off, the third count value Rb in the base register will be updated to Rm+Rb or Rc+Rb. When the IP is powered on again, the count (Rm+Rb) read by the power management module will still be continuous and completely unaffected by the IP power-off and power-on process and the number of times.
[0039] The IP event counting device provided in this embodiment includes: an IP function module and a power management module; the IP function module includes a counting register; the power management module includes a counting mirror register and a base register; the counting register and the counting mirror register are connected by a hardware connection; the counting register is used to store a first count value; the counting mirror register is used to store a second count value; the base register is used to store a third count value; wherein, the first count value represents the number of times a preset IP event occurs in the IP function module, the second count value is equal to the first count value, and the second count value is synchronized from the counting register; when the IP function module is powered off, the IP function module reads the first count value from the counting register and the third count value from the base register, accumulates the first count value and the third count value, and writes the accumulation result into the base register as a new third count value; when the IP function module is powered on, the power management module reads the second count value from the counting mirror register at set intervals, and accumulates the read second count value and the third count value through an adder, and determines the accumulation result as the target count value of the preset IP event. The IP event counting device provided in this embodiment of the invention does not need to consider whether the IP function module has been restarted when acquiring the IP event count, which can reduce the software complexity of the power management module, reduce the occupation of the power management system's hardware and software resources, and improve the accuracy of IP event counting.
[0040] Example 2
[0041] Figure 3 This is a flowchart of an IP event counting method provided in Embodiment 2 of the present invention. The method is executed by the IP event counting device of the present invention. Figure 3 As shown, the method includes:
[0042] S310, when the IP function module is powered off, the IP function module reads the first count value from the count register and the third count value from the base register; accumulates the first count value and the third count value; and writes the accumulation result into the base register as the new third count value.
[0043] S320: When the IP function module is powered on, the power management module reads the second count value from the counter mirror register every set time interval, and adds the read second count value to the third count value through the adder, and determines the accumulated result as the target count value of the preset IP event.
[0044] Optionally, the following steps are also included: when the signal monitor in the power management module receives a low-level signal, the power management module reads a second count value from the count mirror register and a third count value from the base register; the second count value and the third count value are accumulated; and the accumulated result is written to the base register as a new third count value.
[0045] Optionally, the method may also include the following steps: determining the difference between two adjacent target count values, and determining the power consumption of a preset IP event within a set duration based on the difference.
[0046] In this embodiment, when the IP function module is powered off, it reads a first count value from the counter register and a third count value from the base register; it accumulates the first and third count values; and it writes the accumulated result into the base register as a new third count value. When the IP function module is powered on, the power management module reads the second count value from the counter mirror register at set intervals, and accumulates the read second count value with the third count value using an adder. The accumulated result is then determined as the target count value for the preset IP event. The IP event counting device provided in this embodiment does not require consideration of whether the IP function module has undergone a restart when acquiring IP event counts. This reduces the software complexity of the power management module, decreases the consumption of power management system hardware and software resources, and improves the accuracy of IP event counting.
[0047] Example 3
[0048] Figure 4A schematic diagram of an electronic device 10 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components, connections and relationships between components, and their functions shown herein are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0049] like Figure 4 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0050] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0051] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as the IP event counting method.
[0052] In some embodiments, the IP event counting method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or mounted on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the IP event counting method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the IP event counting method by any other suitable means (e.g., by means of firmware).
[0053] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0054] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0055] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0056] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0057] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0058] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0059] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0060] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A counting device for IP events, characterized in that, include: An IP function module and a power management module; the IP function module includes a counter register; the power management module includes a counter mirror register and a base register; The counting register and the counting mirror register are connected via hardware wiring; the counting register is used to store a first count value; the counting mirror register is used to store a second count value; the base register is used to store a third count value; wherein, the first count value represents the number of times a preset IP event occurs in the IP function module, the second count value is equal to the first count value, and the second count value is synchronized from the counting register; When the IP function module is powered off, the IP function module reads the first count value from the counter register and the third count value from the base register, accumulates the first count value and the third count value, and writes the accumulation result into the base register as the new third count value; When the IP function module is powered on, the power management module reads the second count value from the counter mirror register at set intervals, and adds the read second count value to the third count value through an adder, and determines the accumulated result as the target count value of the preset IP event.
2. The apparatus according to claim 1, characterized in that, The power management module also includes a signal monitor; the signal monitor is used to receive status signals from the IP function module; wherein the status signals include high-level signals and low-level signals.
3. The apparatus according to claim 2, characterized in that, When the signal monitor receives a low-level signal, the power management module reads the second count value from the counter mirror register and the third count value from the base register, accumulates the second count value and the third count value, and writes the accumulation result into the base register as the new third count value.
4. The apparatus according to claim 1 or 2, characterized in that, Determine the difference between two adjacent target count values, and determine the power consumption of the preset IP event within the set duration based on the difference.
5. The apparatus according to claim 1, characterized in that, When the IP function module is powered on, the first count value in the counter register is initialized to 0; when the power management module is powered on, the third count value in the base register is initialized to 0.
6. A method for counting IP events, characterized in that, The method is performed by the IP event counting device according to any one of claims 1-5, and includes: When the IP function module is powered off, the IP function module reads a first count value from the counter register and a third count value from the base register; accumulates the first count value and the third count value; and writes the accumulation result into the base register as a new third count value. When the IP function module is powered on, the power management module reads the second count value from the counter mirror register at set intervals, and adds the read second count value to the third count value through an adder, and determines the accumulated result as the target count value of the preset IP event.
7. The method according to claim 6, characterized in that, Also includes: When the signal monitor in the power management module receives a low-level signal, the power management module reads a second count value from the counter mirror register and a third count value from the base register. The second count value and the third count value are summed. The accumulated result is written to the base register as a new third count value.
8. The method according to claim 6, characterized in that, Also includes: Determine the difference between two adjacent target count values, and determine the power consumption of the preset IP event within the set duration based on the difference.
9. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform the IP event counting method according to any one of claims 6-8.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the method for counting IP events according to any one of claims 6-8.