Extended instruction set processor, method and chip

By extending the instruction set processor and adopting the RISC-V standard power metering decoding and scheduling units, efficient and accurate metering of complex power signals is achieved, solving the problem of fixed algorithms in traditional ASIC chips and providing a flexible power metering solution.

CN121764528APending Publication Date: 2026-03-31BEIJING SMARTCHIP MICROELECTRONICS TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-22
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

Existing power metering chips are implemented using ASICs, with fixed algorithms that are difficult to adapt to the grid connection of distributed power sources and energy storage devices of different scales and types, as well as the intermittency and volatility of new energy power generation. This results in insufficient flexibility in the metering algorithms, which cannot meet the accuracy and dynamic response requirements of complex power signals.

Method used

An extended instruction set processor is provided, which adopts the RISC-V standard and includes an energy metering decoding unit, a scheduling unit, and multiple energy metering execution units. Through the energy metering extended instruction set, flexible energy metering methods are realized, and efficient and accurate execution of various energy metering algorithms is supported.

Benefits of technology

While ensuring computational efficiency, it provides a more flexible power metering method, which can adapt to the power metering needs in different scenarios, reduce hardware replacement costs, and achieve accurate power metering data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121764528A_ABST
    Figure CN121764528A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of processors, in particular to an extended instruction set processor, a method and a chip, and the extended instruction set processor is designed to be used for executing electric energy metering instructions in an electric energy metering extended instruction set. The method specifically comprises the steps that an electric energy metering decoding unit decodes electric energy metering length instructions used for processing specified electric power data, and decoding results of multiple electric energy metering instructions in the electric energy metering length instructions are obtained; the electric energy metering scheduling unit sequentially controls corresponding electric energy metering execution modules in the plurality of electric energy metering execution units to execute corresponding electric energy metering instructions according to the decoding result and the execution sequence, and when the specified electric power data comprises a plurality of pieces of electric power data, the electric energy metering execution modules in the plurality of electric energy metering execution units execute the corresponding electric energy metering instructions. And the electric energy metering execution unit Pi sequentially processes the plurality of data to be processed. According to the invention, the operation efficiency of the electric energy metering algorithm is ensured, and the flexible design requirements of the electric energy metering algorithm in different scenes are met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of processor technology, and specifically to an extended instruction set processor, method, and chip. Background Technology

[0002] In recent years, with the high proportion of new energy power generation connected to the grid and the large-scale application of power electronic equipment, the core characteristics of power grid operation are changing. A large number of high-order harmonics and interharmonics have emerged in voltage and current signals, resulting in a significant widening of the signal spectrum range and increasingly prominent time-varying characteristics. This transformation has made power signals complex and non-steady-state signals, thus bringing new challenges to the measurement accuracy and dynamic response speed of existing power metering systems.

[0003] Currently, electricity metering is mainly implemented through dedicated electricity metering chips using ASICs, with fixed metering algorithms. However, the grid connection of distributed power sources and energy storage devices of different scales and types, as well as the intermittency and volatility of new energy power generation, will have different impacts on the characteristics of power signals. Therefore, there is an urgent need for a more flexible electricity metering method that can meet the electricity metering needs in different scenarios while ensuring the computational efficiency of the electricity metering algorithm. Summary of the Invention

[0004] To address the problems in the related technologies, embodiments of this disclosure provide an extended instruction set processor, method, and chip.

[0005] In a first aspect, embodiments of this disclosure provide an extended instruction set processor for processing an extended instruction set for electricity metering. The extended instruction set for electricity metering includes multiple sets of electricity metering instructions, and each long electricity metering instruction includes multiple instruction slots S having an execution order. i 1≤i≤N, N≥4, each instruction slot corresponds to an energy metering instruction set and carries any energy metering instruction in the corresponding energy metering instruction set. The extended instruction set processor includes: The system includes an energy metering decoding unit, an energy metering dispatching unit, and multiple energy metering execution units P. i The power metering execution unit P i Corresponding to instruction slot S i And execute instruction slot S i The unit carries the power metering command; the power metering execution unit includes multiple power metering execution modules. The power metering decoding unit decodes the power metering long command used to process specified power data to obtain the decoding results of multiple power metering commands in the power metering long command. According to the decoding result and the execution order, the power metering scheduling unit sequentially controls the corresponding power metering execution modules in the plurality of power metering execution units to execute the corresponding power metering instructions. Specifically, in power metering execution unit P... i After the energy metering execution module in the middle executes the corresponding energy metering instructions on its own data to be processed and saves the execution results, the energy metering execution unit P... i+1 The energy metering execution module in the middle uses the execution result as its own data to be processed and executes the corresponding energy metering instructions. The data to be processed by the energy metering execution unit P1 is the specified power data. When the specified power data includes multiple power data, the energy metering execution unit P1... i The multiple self-processing data of the power metering execution unit P1 are processed sequentially, and the multiple self-processing data of the power metering execution unit P1 are the multiple power data.

[0006] According to embodiments of this disclosure: The plurality of energy metering execution modules correspond to the respective energy metering instructions in the corresponding instruction slots of the energy metering execution unit; The power metering execution unit P i The system processes multiple self-registered data sequentially, including: the power metering execution unit P. i The energy metering execution module executes the corresponding energy metering command for its current data to be processed and saves the current execution result, then continues to execute the corresponding energy metering command for the next data to be processed; the energy metering execution unit P i+1 The energy metering execution module in the unit uses the current execution result as its own data to be processed, and executes the corresponding energy metering instruction on the current execution result. Specifically, the execution of the corresponding energy metering instruction for the next data to be processed and the execution of the corresponding energy metering instruction for the current execution result are respectively performed in the energy metering execution unit P. i and P i+1 It is executed in parallel within the power metering execution module.

[0007] According to embodiments of this disclosure: The decoding result of the power metering command includes the power metering operation code, the data to be processed register address, and the execution result register address; According to the decoding result and the execution order, the power metering scheduling unit sequentially controls the corresponding power metering execution modules in the plurality of power metering execution units to execute corresponding power metering instructions, including: Based on the decoding result of the energy metering command, the energy metering scheduling unit obtains the data to be processed according to the data to be processed register address, generates an execution module control signal according to the energy metering operation code, and sends the data to be processed, the execution module control signal, and the execution result register address to the corresponding energy metering execution unit. The corresponding energy metering execution unit selects the corresponding energy metering execution module to execute the corresponding energy metering command on the data to be processed according to the received execution module control signal, and saves the execution result to the storage location indicated by the execution result register address.

[0008] According to embodiments of this disclosure, the set of electricity metering instructions all includes idle instructions, and the decoding result of the idle instructions is an idle opcode; The power metering and dispatching unit identifies the command slot S i When the decoding result of the carried energy metering command is an idle operation code, the energy metering execution unit P... i No action is taken.

[0009] According to embodiments of this disclosure: The address of the data to be processed is the address of the register that stores the data to be processed, or the address of the register that stores the address of the first memory, where the first memory address is the address of the memory that stores the data to be processed. The execution result register address is either the address of the register storing the execution result or the address of the register storing the second memory address, which is the address of the memory storing the execution result.

[0010] According to embodiments of this disclosure, the extended instruction set for electricity metering is obtained through the following steps: Decompose each of the multiple energy metering algorithms to obtain the multiple energy metering operation requirements of the multiple energy metering algorithms; Based on the multiple power metering calculation requirements, multiple power metering instructions based on the RISC-V standard are set. These multiple power metering instructions include multiple power data access instructions, multiple advanced power calculation instructions, and multiple basic power calculation instructions. The power metering extended instruction set is set based on the multiple power metering instructions.

[0011] According to embodiments of this disclosure: The plurality of power data access instructions include: data loading instruction, data writing instruction, and data loading shift instruction; The aforementioned advanced power operation instructions include: digital filtering operation instructions, discrete Fourier operation instructions, complex multiplication operation instructions, complex butterfly transformation operation instructions, squaring operation instructions, integral operation instructions, window function operation instructions, square root operation instructions, and phasor operation instructions. The basic power operation instructions include: addition operation instructions, multiplication / multiplication-addition operation instructions, data accumulation operation instructions, and data shift operation instructions.

[0012] According to embodiments of this disclosure, the electricity metering algorithm includes any one of the following: Power signal high-pass filtering algorithm, power signal low-pass filtering algorithm, current and voltage RMS value calculation algorithm, active power calculation algorithm, reactive power calculation algorithm, fundamental frequency spectrum analysis algorithm, and harmonic frequency spectrum analysis algorithm.

[0013] According to embodiments of this disclosure, when N=4, the extended power metering instruction set includes four power metering instruction sets; wherein, The union of any two sets of electricity metering instructions is a set of multiple electricity data access instructions, and the union of the remaining two sets of electricity metering instructions is a set of multiple advanced electricity calculation instructions and multiple basic electricity calculation instructions.

[0014] According to embodiments of this disclosure, when N=4, the plurality of energy metering execution units include 4 energy metering execution units; wherein, The first energy metering execution unit includes multiple energy metering execution modules, including: a first memory address generation module, a first memory read / write control module, and a first data shifting module; The second energy metering execution unit includes multiple energy metering execution modules, including: a second memory address generation module, a second memory read / write control module, and a second data shifting module; The third energy metering execution unit includes multiple energy metering execution modules: a first selector, and a first multiplier, a first adder-accumulator, a first shifter, and a first operation control module connected to the first selector; the first operation control module controls the combination of the first multiplier, the first adder-accumulator, and the first shifter to serve as the energy metering execution module for the advanced power operation instructions; The fourth power metering execution unit includes multiple power metering execution modules: a second selector, and a second multiplier, a second adder-accumulator, a second shifter, a second operation control module, and a phasor calculation module connected to the second selector; the second operation control module acts as the power metering execution module for the advanced power operation instructions by controlling the combination of the second multiplier, the second adder-accumulator, and the second shifter.

[0015] According to embodiments of this disclosure, the energy metering decoding unit includes an energy metering instruction judgment module and an energy metering instruction decoding module; The power metering instruction judgment module obtains an operation instruction with a first preset number of digits and determines whether the lowest two digits of the operation instruction with the first preset number of digits are a set field; When the lowest two bits of the first preset bit operation instruction are the set field, the power metering instruction decoding module combines the first preset bit operation instruction with the adjacent second preset bit operation instruction into a complete instruction to obtain the power metering long instruction.

[0016] According to embodiments of this disclosure, the extended instruction set processor further includes: a tightly coupled memory group and an extended register group; The tightly coupled memory group is used to store the specified power data and the power metering results obtained by processing the specified power data; The extended register group is used to store the execution results.

[0017] According to embodiments of this disclosure, the power metering and scheduling unit includes: a register access control module and a power metering and scheduling control module; Based on the decoding result of the energy metering instruction, the register access control module generates a register access control signal. The register access control signal is used to read the data to be processed from the extended register group and write the execution result into the extended register group. Based on the decoding result, the energy metering scheduling control module generates an execution module control signal to control the corresponding energy metering execution unit to select the corresponding energy metering execution module to execute the corresponding energy metering instruction on the data to be processed.

[0018] Secondly, embodiments of this disclosure provide an extended instruction set processing method. This method processes an extended instruction set for electricity metering, which includes multiple sets of electricity metering instructions. Each long electricity metering instruction includes multiple instruction slots S with an execution order. i 1≤i≤N, N≥4, each instruction slot corresponds to an energy metering instruction set and carries any energy metering instruction in the corresponding energy metering instruction set, the processing method includes: The power metering decoding unit decodes the power metering long command used to process specified power data to obtain the decoding results of multiple power metering commands in the power metering long command. Based on the decoding result and the execution order, the power metering scheduling unit sequentially controls the corresponding power metering execution modules in multiple power metering execution units to execute corresponding power metering instructions. Specifically, in controlling power metering execution unit P...i After the energy metering execution module in the middle executes the corresponding energy metering instructions on its own data to be processed and saves the execution results, the energy metering execution unit P... i+1 The power metering execution module in the middle uses the execution result as its own data to be processed and executes the corresponding power metering instructions. The power metering execution unit P1's own data to be processed is the specified power data. When the specified power data includes multiple power data, the power metering execution unit P1 is controlled. i The multiple self-to-process data are processed sequentially, and the multiple self-to-process data of the power metering execution unit P1 are the multiple power data; Among them, the power metering execution unit P i Corresponding to instruction slot S i And execute instruction slot S i The power metering execution unit carries power metering instructions; the power metering execution unit includes multiple power metering execution modules, each corresponding to a power metering instruction in the corresponding instruction slot of the power metering execution unit.

[0019] According to embodiments of this disclosure, the control power metering execution unit P i Multiple data sets to be processed are processed sequentially, including: By controlling the power metering execution unit P i The energy metering execution module executes the corresponding energy metering command for its current data to be processed and saves the current execution result, then continues to execute the corresponding energy metering command for the next data to be processed; by controlling the energy metering execution unit P i+1 The energy metering execution module in the unit uses the current execution result as its own data to be processed, and executes the corresponding energy metering instruction on the current execution result. Specifically, the execution of the corresponding energy metering instruction for the next data to be processed and the execution of the corresponding energy metering instruction for the current execution result are respectively performed in the energy metering execution unit P. i and P i+1 It is executed in parallel within the power metering execution module.

[0020] According to embodiments of this disclosure, the extended instruction set for electricity metering is obtained through the following steps: Decompose each of the multiple energy metering algorithms to obtain the multiple energy metering operation requirements of the multiple energy metering algorithms; Based on the multiple power metering calculation requirements, multiple power metering instructions based on the RISC-V standard are set. These multiple power metering instructions include multiple power data access instructions, multiple advanced power calculation instructions, and multiple basic power calculation instructions. The power metering extended instruction set is set based on the multiple power metering instructions.

[0021] According to embodiments of this disclosure, the method further includes: The specified power data and the power metering results obtained by processing the specified power data are stored in a tightly coupled memory group; The execution results are stored in an extended register set.

[0022] Thirdly, embodiments of this disclosure provide an extended instruction set processing chip, the extended instruction set processing chip including an extended instruction set processor as described in any of the first aspects.

[0023] Fourthly, embodiments of this disclosure provide a computer-readable storage medium having computer instructions stored thereon that, when executed by a processor, implement the method as described in any of the second aspects.

[0024] Fifthly, embodiments of this disclosure provide a computer program product including computer instructions that, when executed by a processor, implement the method as described in any of the second aspects.

[0025] This disclosure provides an extended instruction set processor for processing an extended power metering instruction set. The extended instruction set includes multiple power metering instruction sets, with each instruction slot corresponding to one power metering instruction set and carrying any power metering instruction from that set. A power metering decoding unit decodes a long power metering instruction used to process specified power data, obtaining the decoding results of multiple power metering instructions within the long instruction. A power metering scheduling unit then, based on the decoding results and according to the execution order of the instruction slots, sequentially controls the corresponding power metering execution modules in the multiple power metering execution units to execute the corresponding power metering instructions. Specifically, in the power metering execution unit P... i After the energy metering execution module in the middle executes the corresponding energy metering instructions on its own data to be processed and saves the execution results, the energy metering execution unit P... i+1 The power metering execution module in the middle uses the execution result as its own data to be processed and executes the corresponding power metering instructions. The power metering execution unit P1's own data to be processed is the specified power data.

[0026] This disclosure enables efficient execution of a self-designed extended instruction set for electricity metering. Each long instruction for electricity metering consists of multiple instruction slots with a fixed execution order. Each instruction slot encapsulates a functionally independent electricity metering operation based on the RISC-V standard extension. This allows for efficient and accurate execution of complex metering algorithms under various conditions, including grid connection of distributed power sources and energy storage devices of different scales and types, as well as the intermittency and volatility of new energy power generation. While ensuring computational efficiency, it provides a more flexible electricity metering method, providing users with accurate electricity metering data. This solves the problem of traditional ASIC chip algorithms being fixed and difficult to change after leaving the factory, leading to the need to replace hardware when facing new harmonic types or metering standards, resulting in extremely high costs.

[0027] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0028] Other features, objects, and advantages of this disclosure will become more apparent from the following detailed description of non-limiting embodiments, taken in conjunction with the accompanying drawings. In the drawings: Figure 1 A schematic diagram of the structure of an extended instruction set processor according to an embodiment of the present disclosure is shown; Figure 2 A schematic diagram of a long-term power metering command in an embodiment of this disclosure is shown; Figure 3 A schematic diagram of an extended instruction set for electricity metering according to an embodiment of the present disclosure is shown; Figure 4 A schematic diagram is shown of another extended instruction set for electricity metering according to an embodiment of the present disclosure; Figure 5 A schematic diagram illustrating a power signal filtering algorithm based on an extended instruction set for power metering according to an embodiment of the present disclosure is shown. Figure 6 A schematic diagram is shown illustrating an algorithm for calculating the effective value of current / voltage based on an extended instruction set for energy metering according to an embodiment of the present disclosure; Figure 7 A schematic diagram illustrating an active power calculation algorithm based on an extended instruction set for electricity metering according to an embodiment of the present disclosure is shown. Figure 8 A schematic diagram illustrating a reactive power calculation algorithm based on an extended instruction set for electricity metering according to an embodiment of the present disclosure is shown. Figure 9 A schematic diagram illustrating a fundamental frequency spectrum analysis algorithm based on an extended instruction set for electricity metering, according to an embodiment of this disclosure; Figure 10A schematic diagram illustrating a harmonic spectrum analysis algorithm based on an extended instruction set for electricity metering, according to an embodiment of the present disclosure; Figure 11 A schematic diagram of a first energy metering execution unit according to an embodiment of the present disclosure is shown; Figure 12 A schematic diagram of a second energy metering execution unit according to an embodiment of the present disclosure is shown; Figure 13 A schematic diagram of a third energy metering execution unit according to an embodiment of the present disclosure is shown; Figure 14 A schematic diagram of a fourth energy metering execution unit according to an embodiment of the present disclosure is shown; Figure 15 Multiple energy metering execution units P according to embodiments of the present disclosure are shown. i A diagram illustrating the sequential processing of multiple self-registered data sets. Figure 16 A schematic diagram is shown illustrating the control of the power metering execution unit by the power metering scheduling unit according to an embodiment of this disclosure; Figure 17 A flowchart illustrating an extended instruction set processing method according to an embodiment of the present disclosure is shown. Detailed Implementation

[0029] In the following, exemplary embodiments of the present disclosure will be described in detail with reference to the accompanying drawings to enable those skilled in the art to readily implement them. Furthermore, for clarity, portions unrelated to the description of exemplary embodiments have been omitted from the drawings.

[0030] In this disclosure, it should be understood that terms such as “comprising” or “having” are intended to indicate the presence of features, figures, steps, behaviors, components, parts or combinations thereof disclosed in this specification, and are not intended to exclude the possibility of the presence or addition of one or more other features, figures, steps, behaviors, components, parts or combinations thereof.

[0031] It should also be noted that, unless otherwise specified, the embodiments and features described in this disclosure can be combined with each other. This disclosure will now be described in detail with reference to the accompanying drawings and embodiments.

[0032] As mentioned earlier, with the diversified grid connection of distributed power sources and energy storage devices, and the inherent intermittency and volatility of new energy power generation, the characteristics of power grid signals are becoming increasingly complex, placing higher demands on the flexibility and adaptability of electricity metering technology. However, mainstream dedicated metering chips (ASIC chips) adopt a fixed algorithm implementation method, which is difficult to cope with this dynamic change.

[0033] Based on this, the inventors focused on the RISC-V (RISC Five, the fifth-generation computer architecture using a reduced instruction set) instruction set architecture. This architecture reserves ample space for custom instruction coding, supporting hardware-level extensions for specific domains. This provides an ideal technical path to overcome the flexibility bottleneck of existing metering chips and build an energy metering solution that combines high efficiency and high adaptability.

[0034] This disclosure provides an extended instruction set processor for processing an extended instruction set for electricity metering. The extended instruction set includes multiple sets of electricity metering instructions, and each long electricity metering instruction includes multiple instruction slots S with an execution order. i 1≤i≤N, N≥4, each instruction slot corresponds to an energy metering instruction set and carries any energy metering instruction in the corresponding energy metering instruction set. The extended instruction set processor includes: The system includes an energy metering decoding unit, an energy metering dispatching unit, and multiple energy metering execution units P. i The power metering execution unit P i Corresponding to instruction slot S i And execute instruction slot S i The unit carries the power metering command; the power metering execution unit includes multiple power metering execution modules. The power metering decoding unit decodes the power metering long command used to process specified power data to obtain the decoding results of multiple power metering commands in the power metering long command. According to the decoding result and the execution order, the power metering scheduling unit sequentially controls the corresponding power metering execution modules in the plurality of power metering execution units to execute the corresponding power metering instructions. Specifically, in power metering execution unit P... i After the energy metering execution module in the middle executes the corresponding energy metering instructions on its own data to be processed and saves the execution results, the energy metering execution unit P... i+1 The energy metering execution module in the middle uses the execution result as its own data to be processed and executes the corresponding energy metering instructions. The data to be processed by the energy metering execution unit P1 is the specified power data. When the specified power data includes multiple power data, the energy metering execution unit P1... i The multiple self-processing data of the power metering execution unit P1 are processed sequentially, and the multiple self-processing data of the power metering execution unit P1 are the multiple power data.

[0035] This disclosure enables efficient execution of our independently designed extended instruction set for electricity metering. Each long instruction for electricity metering consists of multiple instruction slots with a fixed execution order. Each instruction slot encapsulates a functionally independent electricity metering operation based on the RISC-V standard extension. The corresponding instruction slots can be flexibly combined to obtain the required long instruction for electricity metering. This design, through tightly coupled dedicated electricity metering hardware—an electricity metering decoding unit, an electricity metering scheduling unit, and an electricity metering execution unit—achieves efficient and accurate execution of complex metering algorithms. While ensuring computational efficiency, it provides a more flexible electricity metering method and offers users more accurate electricity metering data.

[0036] Figure 1 A schematic diagram of the structure of an extended instruction set processor according to an embodiment of the present disclosure is shown.

[0037] The extended instruction set processor disclosed herein is used to process an extended instruction set for electricity metering. This extended instruction set includes multiple sets of electricity metering instructions, and each long electricity metering instruction includes multiple instruction slots S with an execution order. i 1≤i≤N, N≥4, each instruction slot corresponds to an energy metering instruction set and carries any energy metering instruction in the corresponding energy metering instruction set.

[0038] like Figure 1 As shown, the extended instruction set processor includes: an energy metering decoding unit, an energy metering scheduling unit, and multiple energy metering execution units P. i The power metering execution unit P i Corresponding to instruction slot S i And execute instruction slot S i The unit carries the power metering command; the power metering execution unit includes multiple power metering execution modules.

[0039] The plurality of energy metering execution modules correspond to the respective energy metering instructions in the corresponding instruction slots of the energy metering execution unit.

[0040] That is, the extended instruction set processor includes an energy metering decoding unit, an energy metering scheduling unit, and energy metering execution units corresponding to multiple instruction slots, each energy metering execution unit P i Used to execute instruction slot S i The power metering command carried.

[0041] Specifically, the power metering decoding unit decodes the power metering long instruction used to process specified power data to obtain the decoding results of multiple power metering instructions in the power metering long instruction; the power metering scheduling unit, according to the decoding results and the execution order, sequentially controls the corresponding power metering execution modules in the multiple power metering execution units to execute the corresponding power metering instructions.

[0042] Among them, in the power metering execution unit P i After the energy metering execution module in the middle executes the corresponding energy metering instructions on its own data to be processed and saves the execution results, the energy metering execution unit P... i+1 The energy metering execution module in the middle uses the execution result as its own data to be processed and executes the corresponding energy metering instructions. The data to be processed by the energy metering execution unit P1 is the specified power data. When the specified power data includes multiple power data, the energy metering execution unit P1... i The multiple self-processing data of the power metering execution unit P1 are processed sequentially, and the multiple self-processing data of the power metering execution unit P1 are the multiple power data.

[0043] In this disclosure, the specified power data can be voltage data, current data, etc.

[0044] In the extended instruction set processor disclosed herein, in addition to the aforementioned energy metering decoding unit, energy metering scheduling unit, and multiple energy metering execution units P i In addition, it also includes an instruction fetch unit, a RISC-V instruction decoding unit, a RISC-V instruction scheduling unit, and a RISC-V instruction execution unit.

[0045] Specifically, after the instruction fetch unit receives the operation instruction, it sends the operation instruction to the energy metering decoding unit. The energy metering decoding unit determines whether the operation instruction is related to energy metering. If it is, after obtaining a complete energy metering long instruction, it is processed by the subsequent energy metering scheduling unit and multiple energy metering execution units. Otherwise, if the operation instruction is determined to be a general RISC-V instruction, a control signal is sent to the RISC-V instruction decoding unit so that the RISC-V instruction decoding unit, RISC-V instruction scheduling unit, and RISC-V instruction execution unit can process the general RISC-V instruction.

[0046] According to an embodiment of this disclosure, the energy metering decoding unit includes an energy metering instruction judgment module and an energy metering instruction decoding module; the energy metering instruction judgment module obtains an operation instruction with a first preset number of bits and determines whether the lowest two bits of the operation instruction with the first preset number of bits are a setting field; when the lowest two bits of the operation instruction with the first preset number of bits are the setting field, the energy metering instruction decoding module combines the operation instruction with the operation instruction with the adjacent operation instruction with the second preset number of bits into a complete instruction to obtain the energy metering long instruction.

[0047] That is, the number of bits in the long command for electricity metering is the sum of the first preset number of bits and the second preset number of bits.

[0048] According to an embodiment of this disclosure, the power metering decoding unit further includes a control signal generation module; when the lowest two bits of the first preset bit operation instruction are not the set field, the control signal generation module generates a general decoding control signal, which is used to control the extended instruction set processor to decode the general instruction.

[0049] The following uses a 64-bit long power metering instruction as an example to illustrate how to obtain the long power metering instruction in this disclosure. Those skilled in the art should understand that the number of bits in the long power metering instruction is only an illustrative example and is not intended to limit the scope of protection of this disclosure. The number of bits in the long power metering instruction may also be 32 bits, 128 bits, etc.

[0050] Assuming the field is set to 01, and both the first and second preset bit lengths are 32 bits, the energy metering instruction judgment module, after obtaining the 32-bit operation instruction, determines whether the lowest two bits of the instruction are 01. If so, the energy metering instruction decoding module combines the 32-bit operation instruction with the next 32-bit operation instruction to obtain a complete 64-bit energy metering long instruction. Otherwise, the instruction is a general RISC-V instruction. In this case, the control signal generation module generates a general decoding control signal and sends it to the RISC-V instruction decoding unit, enabling the RISC-V instruction decoding unit to directly decode the 32-bit general RISC-V instruction.

[0051] Figure 2 A schematic diagram of a long-term power metering command is shown in an embodiment of this disclosure.

[0052] exist Figure 2In the example shown, the long energy metering instruction comprises 64 bits. Bits 0-1 are used to distinguish the instruction type; for example, when Bits 0-1 are 01, the instruction is a long energy metering instruction. Bit 2 is used to distinguish the data type; for example, Bit 2 being 0 indicates that the data type of the instruction is an integer, and Bit 2 being 1 indicates that the data type of the instruction is a floating-point number. Bits 3-23 are instruction slot 4, Bits 24-39 are instruction slot 3, Bits 40-51 are instruction slot 2, and Bits 52-63 are instruction slot 1. Each instruction slot is used to carry any energy metering instruction from the corresponding energy metering instruction set.

[0053] This disclosure supports electricity metering operations for multiple data types, including: single-precision floating-point, 16-bit integer, and 32-bit integer; all three data types also support real number data types and complex number data types.

[0054] As mentioned earlier, the long command for electricity metering includes multiple command slots S with an execution order. i However, this execution order is not necessarily the order of the instruction slot numbers. Figure 2 Taking the four instruction slots shown as an example, the execution order of these four instruction slots can be instruction slot 1, instruction slot 3, instruction slot 4, instruction slot 2, or instruction slot 1, instruction slot 2, instruction slot 3, instruction slot 4, and so on. Therefore, the execution order of the instruction slots can be flexibly set according to requirements.

[0055] After research, the inventors discovered that since electricity metering involves a variety of electricity metering algorithms, in order to obtain electricity metering long instructions that can flexibly implement various electricity metering operations, it is necessary to set up an electricity metering extended instruction set and obtain different electricity metering long instructions based on this instruction set.

[0056] According to embodiments of this disclosure, the extended instruction set for electricity metering is obtained through the following steps: decomposing each of a plurality of electricity metering algorithms to obtain a plurality of electricity metering operation requirements of the plurality of electricity metering algorithms; setting a plurality of electricity metering instructions based on the plurality of electricity metering operation requirements, the plurality of electricity metering instructions including a plurality of power data access instructions, a plurality of advanced power operation instructions and a plurality of basic power operation instructions; and setting the extended instruction set for electricity metering based on the plurality of electricity metering instructions.

[0057] The RISC-V standard-based power data access instructions include: Data Loading Instruction (EMLD), Data Writing Instruction (EMST), and Data Load Shift Instruction (EMLDS); the advanced power operation instructions include: Digital Filtering Instruction (EMFIR / EMIIR, FIR Filtering / IIR Filtering), Discrete Fourier Transform Instruction (EMDFT), Complex Multiplication Instruction (EMCMUL), Complex Butterfly Transform Instruction (EMCBFLY), Squaring Instruction (EMSQUR), Integrating Instruction (EMITG), Window Function Instruction (EMWDF), Square Root Instruction (EMSQRT), and Phasor Instruction (EMPHC); the basic power operation instructions include: Addition Instruction (EMADD / EMCADD, Real Number Addition / Complex Number Addition), Multiplication / Multiply-Add Instruction (EMMUL / EMMAC), Data Accumulation Instruction (EMACC / EMCACC, Real Number Accumulation / Complex Number Accumulation), and Data Shift Instruction (EMSL / EMSR, Real Number Shift / Complex Number Shift).

[0058] Specifically, this disclosure decomposes the energy metering algorithm to obtain multiple energy metering operation requirements for each energy metering algorithm. Since energy metering involves multiple energy metering algorithms, there may be duplicate energy metering operation requirements among each energy metering algorithm. In this case, it is necessary to deduplicate and filter the duplicate energy metering operation requirements in order to obtain multiple energy metering operation requirements for the multiple energy metering algorithms.

[0059] Next, set corresponding electricity metering instructions for each type of electricity metering operation requirement. For example, if the obtained electricity metering operation requirement is a data loading operation requirement or a data filtering operation requirement, then set the corresponding data loading operation instructions and data filtering operation instructions according to this operation requirement.

[0060] Finally, based on the obtained multiple power metering instructions, including multiple power data access instructions, multiple advanced power calculation instructions, and multiple basic power calculation instructions, an extended instruction set for power metering is set.

[0061] Each self-designed long power metering instruction in this disclosure consists of multiple instruction slots with a fixed execution order. Each instruction slot encapsulates a functionally independent power metering operation based on the RISC-V standard extension. This enables more flexible power metering methods while ensuring computational efficiency, providing users with accurate power consumption data under various conditions, including grid connection of distributed power sources and energy storage devices of different scales and types, and the intermittency and volatility of new energy power generation.

[0062] This disclosure also provides direct hardware support for dedicated instructions through tightly coupled dedicated hardware for energy metering—an energy metering decoding unit, an energy metering scheduling unit, and an energy metering execution unit—reducing the instruction overhead and intermediate errors required for metering algorithms in general-purpose processors. It overcomes the drawbacks of traditional fixed-function ASIC metering chips, such as fixed algorithms, difficulty in upgrading, and poor adaptability to various scenarios, achieving a "hardware-efficient, software-defined" metering solution.

[0063] The following explanation uses four instruction slots as an example to illustrate the extended instruction set for electricity metering. The number of electricity metering instruction sets included in the extended instruction set is the same as the number of instruction slots. Therefore, when the number of instruction slots changes, corresponding electricity metering instruction sets need to be set accordingly. For example, five instruction slots correspond to five electricity metering instruction sets.

[0064] In this disclosure, when the long power metering instruction includes four instruction slots, the power metering extended instruction set correspondingly includes four power metering instruction sets. Each power metering instruction set includes multiple power metering instructions, and any one of these multiple power metering instructions is carried through a corresponding instruction slot.

[0065] According to an embodiment of this disclosure, when N=4, the extended power metering instruction set includes 4 power metering instruction sets; wherein, the union of any two power metering instruction sets is a plurality of power data access instructions, and the union of the remaining two power metering instruction sets is a plurality of advanced power operation instructions and a plurality of basic power operation instructions.

[0066] According to embodiments of this disclosure, either of the remaining two sets of power metering instructions further includes the power data access instruction, such as a data loading instruction.

[0067] According to embodiments of this disclosure, the set of power metering instructions all include the idle instruction EMNOP.

[0068] As can be seen, the set of electricity metering instructions in the electricity metering extended instruction set disclosed herein can be flexibly set according to the needs of electricity metering.

[0069] The following section continues to illustrate the set of electricity metering instructions included in the electricity metering extended instruction set disclosed herein, using four instruction slots as an example.

[0070] Assuming there are 4 instruction slots S i The corresponding sets of electricity metering instructions are the first set of electricity metering instructions, the second set of electricity metering instructions, the third set of electricity metering instructions, and the fourth set of electricity metering instructions: The union of the first and second sets of power metering instructions can be set to multiple power data access instructions, and the union of the third and fourth sets of power metering instructions can be set to multiple advanced power calculation instructions and multiple basic power calculation instructions. The power data access instructions included in the first and second sets of power metering instructions can be the same or different, and the power data access instructions included in the third and fourth sets of power metering instructions can be the same or different.

[0071] Alternatively, the union of the second and third sets of electricity metering instructions can be set to multiple electricity data access instructions, and the union of the first and fourth sets of electricity metering instructions can be set to multiple advanced electricity calculation instructions and multiple basic electricity calculation instructions. The electricity data access instructions included in the second and third sets of electricity metering instructions can be the same or different, and the electricity data access instructions included in the first and fourth sets of electricity metering instructions can be the same or different.

[0072] The following is based on Figure 3 and Figure 4 The two specific implementation methods shown illustrate the extended set of electricity metering instructions disclosed herein and the various sets of electricity metering instructions included therein. Figure 3 and Figure 4 The examples shown are merely two technical means to implement the extended instruction set for electricity metering of this disclosure, and do not limit the scope of protection of this disclosure.

[0073] Figure 3 A schematic diagram of an extended instruction set for electricity metering according to an embodiment of the present disclosure is shown.

[0074] like Figure 3 As shown, the first and second sets of electricity metering instructions each include multiple electricity data access instructions, specifically: data loading instruction, data writing instruction, data loading shift instruction, and idle instruction; the third set of electricity metering instructions includes: digital filtering operation instruction, discrete Fourier operation instruction, complex multiplication operation instruction, addition operation instruction, multiplication / multiplication-addition operation instruction, data accumulation operation instruction, data shift operation instruction, and idle instruction; the fourth set of electricity metering instructions includes: squaring operation instruction, integral operation instruction, window function operation instruction, complex butterfly transformation operation instruction, square root operation instruction, phasor operation instruction, addition operation instruction, multiplication / multiplication-addition operation instruction, data accumulation operation instruction, data shift operation instruction, and idle instruction.

[0075] Figure 4 A schematic diagram of another extended set of power metering instructions according to an embodiment of the present disclosure is shown.

[0076] like Figure 4As shown, the first set of electricity metering instructions includes: data loading instruction, data writing instruction, and idle instruction; the second set of electricity metering instructions includes: data loading instruction, data loading shift instruction, and idle instruction; the third set of electricity metering instructions includes: digital filtering operation instruction, discrete Fourier operation instruction, complex multiplication operation instruction, multiplication / multiplication-addition operation instruction, data accumulation operation instruction, data shift operation instruction, and idle instruction; the fourth set of electricity metering instructions includes: squaring operation instruction, integral operation instruction, window function operation instruction, complex butterfly transformation operation instruction, square root operation instruction, phasor operation instruction, addition operation instruction, data accumulation operation instruction, data shift operation instruction, and idle instruction.

[0077] The power metering algorithms disclosed herein include any of the following: power signal high-pass filtering algorithm, power signal low-pass filtering algorithm, current and voltage RMS value calculation algorithm, active power calculation algorithm, reactive power calculation algorithm, fundamental frequency spectrum analysis algorithm, and harmonic frequency spectrum analysis algorithm.

[0078] Specifically, taking four instruction slots as an example, we will explain how each power metering algorithm is implemented based on the power metering extended instruction set.

[0079] Figure 5 This diagram illustrates a power signal filtering algorithm implemented based on an extended instruction set for power metering according to an embodiment of the present disclosure; as shown. Figure 5 As shown, a power signal filtering algorithm can be implemented using a single long power metering instruction. Specifically, instruction slots S1-S4 respectively carry the data loading instruction (EMLD), data writing instruction (EMST), digital filtering operation instruction (EMIIR), and idle instruction (EMNOP). To achieve filtering for N power data points, this long power metering instruction needs to be executed N times in a loop.

[0080] Figure 6 This diagram illustrates an algorithm for calculating the effective value of current / voltage based on an extended instruction set for energy metering, according to an embodiment of this disclosure; as shown. Figure 6As shown, the current / voltage RMS value calculation algorithm can be implemented through four long energy metering instructions. Specifically, the instruction slots S1-S4 of long energy metering instruction 1 carry the data loading instruction (EMLD), idle instruction (EMNOP), addition operation instruction (EMADD), and square operation instruction (EMSQUR), respectively; the instruction slots S1-S4 of long energy metering instruction 2 carry the idle instruction (EMNOP), idle instruction (EMNOP), digital filtering operation instruction (EMIIR), and accumulation operation instruction (EMACC), respectively; the instruction slots S1-S4 of long energy metering instruction 3 carry three idle instructions (EMNOP) and one data shift operation instruction (EMSR), respectively; the instruction slots S1-S4 of long energy metering instruction 4 carry three idle instructions (EMNOP) and one square root operation instruction (EMSQRT), respectively. Assuming that the number of sampling points (the number of data to be processed) is N, it is necessary to execute long energy metering instruction 1 and long energy metering instruction 2 a total of N times.

[0081] Figure 7 This diagram illustrates an active power calculation algorithm based on an extended instruction set for electricity metering, according to an embodiment of this disclosure; as shown. Figure 7 As shown, the active power calculation algorithm can be implemented through three long power metering instructions. Specifically, the instruction slots S1-S4 of long power metering instruction 1 carry the data loading instruction (EMLD), the data loading instruction (EMLD), the multiplication operation instruction (EMMUL), and the digital filtering operation instruction (EMIIR), respectively; the instruction slots S1-S4 of long power metering instruction 2 carry the idle instruction (EMNOP), the idle instruction (EMNOP), the multiply-accumulate operation instruction (EMMAC), and the integration operation instruction (EMITG), respectively; the instruction slots S1-S4 of long power metering instruction 3 carry three idle instructions (EMNOP) and one data shift operation instruction (EMSR), respectively. Assuming that the number of sampling points is N, it is necessary to execute long power metering instruction 1 and long power metering instruction 2 a total of N times.

[0082] Figure 8 This diagram illustrates a reactive power calculation algorithm based on an extended instruction set for electricity metering, according to an embodiment of this disclosure; as shown. Figure 8As shown, the reactive power calculation algorithm can be implemented through four long energy metering instructions. Specifically, the instruction slots S1-S4 of long energy metering instruction 1 carry the data loading instruction (EMLD), data loading instruction (EMLD), multiplication operation instruction (EMMUL), and digital filtering operation instruction (EMIIR), respectively; the instruction slots S1-S4 of long energy metering instruction 2 carry the idle instruction (EMNOP), idle instruction (EMNOP), digital filtering operation instruction (EMIIR), and multiply-accumulate operation instruction (EMMAC), respectively; the instruction slots S1-S4 of long energy metering instruction 3 carry the idle instruction (EMNOP), idle instruction (EMNOP), digital filtering operation instruction (EMIIR), and integration operation instruction (EMITG), respectively; and the instruction slots S1-S4 of long energy metering instruction 4 carry three idle instructions (EMNOP) and one data shift operation instruction (EMSR), respectively. Assuming the number of sampling points is N, long energy metering instruction 1, long energy metering instruction 2, and long energy metering instruction 3 are executed N times in a loop.

[0083] Figure 9 This diagram illustrates a fundamental frequency spectrum analysis algorithm implemented based on an extended instruction set for electricity metering according to an embodiment of this disclosure; as shown... Figure 9 As shown, the fundamental frequency spectrum analysis algorithm can be implemented through three long power metering instructions. Specifically, the instruction slots S1-S4 of power metering long instruction 1 carry the data loading instruction (EMLD), the data loading instruction (EMLD), the idle instruction (EMNOP), and the window function operation instruction (EMWDF), respectively; the instruction slots S1-S4 of power metering long instruction 2 carry the data loading instruction (EMLD), the idle instruction (EMNOP), the discrete Fourier transform operation instruction (EMDFT), and the idle instruction (EMNOP), respectively; the instruction slots S1-S4 of power metering long instruction 3 carry three idle instructions (EMNOP) and one phasor operation instruction (EMPHC), respectively. Assuming that the number of sampling points is N, power metering instruction 1 and power metering instruction 2 are executed N times in a loop.

[0084] Figure 10 This diagram illustrates a harmonic spectrum analysis algorithm implemented based on an extended instruction set for electricity metering according to an embodiment of the present disclosure; as shown. Figure 10As shown, the harmonic spectrum analysis algorithm can be implemented through four long instructions for electricity metering. Specifically, instruction slots S1-S4 of long instruction 1 for electricity metering carry the data loading instruction (EMLD), data writing instruction (EMST), data loading instruction (EMLD), and window function operation instruction (EMWDF), respectively; instruction slots S1-S4 of long instruction 2 for electricity metering carry the data loading instruction (EMLD), data loading instruction (EMLD), idle instruction (EMNOP), and complex butterfly transformation operation instruction (EMBFLY), respectively. The instruction slots S1-S4 of the long power metering instruction 3 carry the data loading instruction (EMLD), data writing instruction (EMST), idle instruction (EMNOP), and complex multiplication operation instruction (EMCMUL), respectively; the instruction slots S1-S4 of the long power metering instruction 4 carry three idle instructions (EMNOP) and one phasor operation instruction (EMPHC), respectively; assuming the number of sampling points is N, power metering instruction 1 is executed N times in a loop, and power metering instruction 2 and power metering instruction 3 are executed in a loop according to the number of fast Fourier transforms.

[0085] By flexibly combining multiple instruction slots in the aforementioned energy metering instructions, the programmable instruction set provides flexibility while maintaining computational efficiency, supporting dynamic adaptation to various energy metering algorithms and scenario requirements. This realizes the evolution of the energy metering field from "fixed hardware implementation" to "programmable metering architecture," while providing users with more accurate and reliable electricity consumption data.

[0086] According to embodiments of this disclosure, the decoding result of the energy metering command includes the energy metering operation code, the data to be processed register address, and the execution result register address.

[0087] The power metering scheduling unit, based on the decoding result and the execution order, sequentially controls the corresponding power metering execution modules among the plurality of power metering execution units to execute the corresponding power metering instructions. This includes: based on the decoding result of the power metering instructions, the power metering scheduling unit obtains the data to be processed according to the data to be processed register address, generates an execution module control signal according to the power metering operation code, and sends the data to be processed, the execution module control signal, and the execution result register address to the corresponding power metering execution unit; the corresponding power metering execution unit selects the corresponding power metering execution module to execute the corresponding power metering instructions on the data to be processed according to the received execution module control signal, and saves the execution result to the storage location indicated by the execution result register address.

[0088] According to embodiments of this disclosure, the decoding result of the energy metering instruction further includes an immediate value. For example, when the energy metering instruction is a digital filtering operation instruction, the decoding result of the digital filtering operation instruction includes an immediate value.

[0089] According to embodiments of this disclosure, the decoding result of the idle instruction is an idle opcode; the power metering and scheduling unit identifies the instruction slot S i When the decoding result of the carried energy metering command is an idle operation code, the energy metering execution unit P... i No action is taken.

[0090] That is, when the power metering and scheduling unit identifies an instruction slot as an idle instruction, the power metering execution unit corresponding to that instruction slot does not need to perform any operation, while the power metering execution unit corresponding to the next non-idle instruction slot can directly read the data it needs.

[0091] For example, in Figure 10 In the long power metering instruction 2 shown, it is assumed that the execution order of the long power metering instruction 2 is instruction slot S1, instruction slot S2, instruction slot S3, and instruction slot S4. Since instruction slot S3 carries the idle instruction (EMNOP), when the power metering scheduling unit identifies instruction slot S3, the power metering execution unit corresponding to instruction slot S3 does not need to perform any operation. The power metering execution unit corresponding to instruction slot S4 can directly obtain the corresponding execution results from the power metering execution units corresponding to instruction slots S1 and S2 to execute the complex butterfly transformation operation instruction.

[0092] For example, in Figure 10 In the long power metering instruction 3 shown, it is assumed that the execution order of the long power metering instruction 3 is instruction slot S1, instruction slot S4, instruction slot S3, and instruction slot S2. Since instruction slot S3 carries the idle instruction (EMNOP), when the power metering scheduling unit identifies instruction slot S3, the power metering execution unit corresponding to instruction slot S3 does not need to perform any operation. The power metering execution unit corresponding to instruction slot S2 can directly obtain the corresponding execution result from the power metering execution unit corresponding to instruction slot S4 to execute the complex multiplication operation instruction.

[0093] Electricity metering execution unit P i+1 Power metering execution unit P i-1 The execution result is used as its own data to be processed and the corresponding electricity metering command is executed.

[0094] In this disclosure, the address of the data to be processed is the address of a register storing the data to be processed, or the address of a register storing a first memory address, where the first memory address is the address of the memory storing the data to be processed; the address of the execution result register is the address of a register storing the execution result, or the address of a register storing a second memory address, where the second memory address is the address of the memory storing the execution result.

[0095] Since there are many memory devices and their storage capacity is large, it is necessary to store the memory addresses in corresponding registers. The memory addresses can be read from the corresponding registers, and then the memory locations can be located based on the memory addresses.

[0096] According to an embodiment of this disclosure, when N=4, the plurality of energy metering execution units include 4 energy metering execution units; wherein, the plurality of energy metering execution modules of the first energy metering execution unit include: a first memory address generation module, a first memory read / write control module, and a first data shifting module; The second energy metering execution unit includes multiple energy metering execution modules, including: a second memory address generation module, a second memory read / write control module, and a second data shifting module; The third energy metering execution unit includes multiple energy metering execution modules: a first selector, and a first multiplier, a first adder-accumulator, a first shifter, and a first operation control module connected to the first selector; the first operation control module controls the combination of the first multiplier, the first adder-accumulator, and the first shifter to serve as the energy metering execution module for the advanced power operation instructions; The fourth power metering execution unit includes multiple power metering execution modules: a second selector, and a second multiplier, a second adder-accumulator, a second shifter, a second operation control module, and a phasor calculation module connected to the second selector; the second operation control module acts as the power metering execution module for the advanced power operation instructions by controlling the combination of the second multiplier, the second adder-accumulator, and the second shifter.

[0097] The following is for reference. Figure 11-14 The following describes several electricity metering execution units disclosed herein: Figure 11 A schematic diagram of a first energy metering execution unit according to an embodiment of the present disclosure is shown. Figure 12 A schematic diagram of a second energy metering execution unit according to an embodiment of the present disclosure is shown.

[0098] like Figure 11 and Figure 12 As shown, the first energy metering execution unit includes multiple energy metering execution modules: a first memory address generation module, a first memory read / write control module, and a first data shifting module; the second energy metering execution unit includes multiple energy metering execution modules: a second memory address generation module, a second memory read / write control module, and a second data shifting module.

[0099] Therefore, in Figure 11 and Figure 12In the specific implementation shown, both the first and second energy metering execution units support data loading, data loading shifting, and data writing operations. The memory address generation module generates access addresses for the tightly coupled memory group. The memory read / write control module generates control signals for reading and writing to the tightly coupled memory group. The data shifting module performs shifting operations on the read data.

[0100] Figure 13 A schematic diagram of a third energy metering execution unit according to an embodiment of the present disclosure is shown.

[0101] like Figure 13 As shown, the third energy metering execution unit comprises multiple energy metering execution modules, including: a first selector, and a first multiplier, a first adder-accumulator, a first shifter, and a first operation control module connected to the first selector; the first operation control module controls the combination of the first multiplier, the first adder-accumulator, and the first shifter to serve as the energy metering execution module for advanced power calculation instructions (e.g., FIR / IIR / DFT); the third energy metering execution unit also includes a data loading module. The third energy metering execution unit selects the corresponding energy metering execution module through the first selector to execute the corresponding energy metering instructions.

[0102] Therefore, in Figure 13 In the specific implementation shown, the third energy metering execution unit supports data loading operation, FIR digital filtering operation, IIR digital filtering operation, discrete Fourier operation, complex multiplication operation, addition operation, multiplication / multiply-add operation, data accumulation operation, and data shift operation.

[0103] Figure 14 A schematic diagram of a fourth energy metering execution unit according to an embodiment of the present disclosure is shown.

[0104] like Figure 14 As shown, the fourth energy metering execution unit includes multiple energy metering execution modules: a second selector, and a second multiplier, a second adder-accumulator, a second shifter, a second operation control module, and a phasor calculation module connected to the second selector; the second operation control module controls the combination of the second multiplier, the second adder-accumulator, and the second shifter to serve as an energy metering execution module for advanced power operation instructions (e.g., integral / butterfly transformation); the fourth energy metering execution unit selects the corresponding energy metering execution module through the second selector to execute the corresponding energy metering instructions.

[0105] Therefore, in Figure 14In the specific implementation shown, the fourth energy metering execution unit supports square operation, integral operation, window function operation, complex butterfly transformation operation, square root calculation, addition / subtraction operation, multiplication / multiply-addition operation, data accumulation operation, and data shift operation.

[0106] In this disclosure, the first energy metering execution unit is not energy metering execution unit P1, but rather multiple energy metering execution units P1. i Any one of the energy metering execution units in the P, and similarly, the second to fourth energy metering execution units are also multiple energy metering execution units P. i Any different power metering execution unit in the system.

[0107] According to embodiments of this disclosure, the power metering execution unit P i The system processes multiple self-registered data sequentially, including: the power metering execution unit P. i The energy metering execution module executes the corresponding energy metering command for its current data to be processed and saves the current execution result, then continues to execute the corresponding energy metering command for the next data to be processed; the energy metering execution unit P i+1 The energy metering execution module in the unit uses the current execution result as its own data to be processed, and executes the corresponding energy metering instruction on the current execution result. Specifically, the execution of the corresponding energy metering instruction for the next data to be processed and the execution of the corresponding energy metering instruction for the current execution result are respectively performed in the energy metering execution unit P. i and P i+1 It is executed in parallel within the power metering execution module.

[0108] Figure 15 Multiple energy metering execution units P according to embodiments of the present disclosure are shown. i A diagram illustrating the sequential processing of multiple self-registered data sets.

[0109] like Figure 15 As shown, the example illustrates data filtering of multiple self-processing data sets. (Refer to...) Figure 5 The power metering long instruction shown implements the power signal filtering algorithm: Instruction slots S1-S4 respectively carry the data loading instruction (EMLD), data writing instruction (EMST), digital filtering operation instruction (EMIIR), and idle instruction (EMNOP). Power metering execution units P1-P4 are used to execute the data loading instruction (EMLD), data writing instruction (EMST), digital filtering operation instruction (EMIIR), and idle instruction (EMNOP), respectively. Wherein: Starting with the first self-to-process data among the multiple self-to-process data of the power metering execution units P1-P4, the power metering execution units P1-P4 sequentially execute the four power metering commands EMLD-1, EMIIR-1, EMNOP-1, and EMST-1. Similarly, for the second self-to-process data, the power metering execution units P1-P4 sequentially execute the four power metering commands EMLD-2, EMIIR-2, EMNOP-2, and EMST-2. The subsequent execution principle is the same.

[0110] Therefore, when energy metering execution unit P1 executes EMLD-2, energy metering execution unit P3 is executing EMIIR-1; when energy metering execution unit P1 executes EMLD-3, energy metering execution unit P3 is executing EMIIR-2, and energy metering execution unit P4 is executing EMNOP-1; when energy metering execution unit P1 executes EMLD-4, energy metering execution unit P2 is executing EMST-1, energy metering execution unit P3 is executing EMIIR-3, and energy metering execution unit P4 is executing EMNOP-2; when energy metering execution unit P1 executes EMLD-5, energy metering execution unit P2 is executing EMST-2, energy metering execution unit P3 is executing EMIIR-4, and energy metering execution unit P4 is executing EMNOP-3.

[0111] That is, although multiple energy metering execution units execute the corresponding energy metering instructions sequentially according to the execution order of the instruction slots when dealing with multiple data to be processed, they execute the corresponding energy metering instructions in parallel when dealing with different data to be processed.

[0112] According to embodiments of this disclosure, the extended instruction set processor further includes: a tightly coupled memory group and an extended register group; the tightly coupled memory group is used to store the specified power data and the power metering result obtained by processing the specified power data; the extended register group is used to store the execution result.

[0113] This disclosure adds a dedicated extended register set for temporarily storing data to be processed and execution results. The extended register set includes an extended integer register set and an extended floating-point register set, each including multiple (e.g., 15) general-purpose registers and at least one extended accumulator register. The extended accumulator register is a special-function register used for storing intermediate results of integration, digital filtering, and data accumulation operations.

[0114] The tightly coupled memory group includes multiple tightly coupled memories, each tightly coupled to the extended instruction set processor, used to store the final power metering results. In one specific embodiment, three tightly coupled memories are provided, which can support three data access operations to be executed simultaneously.

[0115] Figure 16 This diagram illustrates a control of an energy metering execution unit by an energy metering scheduling unit according to an embodiment of the present disclosure.

[0116] According to an embodiment of this disclosure, the energy metering and scheduling unit includes: a register access control module and an energy metering and scheduling control module; for the decoding result of the energy metering instruction, the register access control module generates a register access control signal based on the decoding result, the register access control signal being used to read the data to be processed from the extended register group and write the execution result into the extended register group; the energy metering and scheduling control module generates an execution module control signal based on the decoding result, to control the corresponding energy metering execution unit to select the corresponding energy metering execution module to execute the corresponding energy metering instruction on the data to be processed.

[0117] like Figure 16 As shown, the register access control module generates a register access control signal based on the register address obtained from the decoding result to read the data to be processed from the extended register group; and stores the specified power data in the extended register group; the power metering and scheduling control module generates an execution module control signal according to the power metering opcode in the decoding result to control the corresponding power metering execution unit to select the corresponding power metering execution module to execute the corresponding power metering instruction on the data to be processed. The data to be processed is the specified power data obtained from the extended register or the execution result of the previous operation instruction, and may also include immediate values. After selection by the third selector, it is sent to the corresponding power metering execution module in the power metering execution unit to obtain the execution result, and the execution result is stored in the extended register group or the tightly coupled memory group.

[0118] Figure 17 A flowchart is shown illustrating an extended instruction set processing method according to an embodiment of the present disclosure. The processing method is used to process an extended instruction set for electricity metering, such as… Figure 17 As shown, the extended instruction set processing method includes steps S1701~S1702: In this disclosure, the extended instruction set for electricity metering includes multiple sets of electricity metering instructions, and the long instruction for electricity metering includes multiple instruction slots S with an execution order. i1≤i≤N, N≥4, each instruction slot corresponds to an energy metering instruction set and carries any energy metering instruction in the corresponding energy metering instruction set.

[0119] In step S1701, the long power metering instruction used to process specified power data is decoded by the power metering decoding unit to obtain the decoding results of multiple power metering instructions in the long power metering instruction. In step S1702, the power metering scheduling unit, based on the decoding result and according to the execution order, sequentially controls the corresponding power metering execution modules in multiple power metering execution units to execute corresponding power metering commands. Specifically, in controlling the power metering execution unit P... i After the energy metering execution module in the middle executes the corresponding energy metering instructions on its own data to be processed and saves the execution results, the energy metering execution unit P... i+1 The power metering execution module in the middle uses the execution result as its own data to be processed and executes the corresponding power metering instructions. The power metering execution unit P1's own data to be processed is the specified power data. When the specified power data includes multiple power data, the power metering execution unit P1 is controlled. i The multiple self-processing data of the power metering execution unit P1 are processed sequentially, and the multiple self-processing data of the power metering execution unit P1 are the multiple power data.

[0120] Among them, the power metering execution unit P i Corresponding to instruction slot S i And execute instruction slot S i The power metering execution unit carries power metering instructions; the power metering execution unit includes multiple power metering execution modules, each corresponding to a power metering instruction in the corresponding instruction slot of the power metering execution unit.

[0121] According to embodiments of this disclosure, the control power metering execution unit P i The system processes multiple self-registered data sequentially, including controlling the power metering execution unit P. i The energy metering execution module executes the corresponding energy metering command for its current data to be processed and saves the current execution result, then continues to execute the corresponding energy metering command for the next data to be processed; by controlling the energy metering execution unit P i+1 The energy metering execution module in the unit uses the current execution result as its own data to be processed, and executes the corresponding energy metering instruction on the current execution result. Specifically, the execution of the corresponding energy metering instruction for the next data to be processed and the execution of the corresponding energy metering instruction for the current execution result are respectively performed in the energy metering execution unit P. i and P i+1 It is executed in parallel within the power metering execution module.

[0122] According to embodiments of this disclosure, the extended instruction set for electricity metering is obtained through the following steps: Each of the multiple energy metering algorithms is decomposed to obtain multiple energy metering operation requirements of the multiple energy metering algorithms; based on the multiple energy metering operation requirements, multiple energy metering instructions based on the RISC-V standard are set, the multiple energy metering instructions include multiple power data access instructions, multiple high-level power operation instructions and multiple basic power operation instructions; the energy metering extended instruction set is set based on the multiple energy metering instructions.

[0123] According to embodiments of this disclosure, the method further includes: storing the specified power data and the power metering result obtained by processing the specified power data through a tightly coupled memory group; and storing the execution result through an extended register group.

[0124] This disclosure also provides an extended instruction set processing chip, which includes an extended instruction set processor as described in any of the previous embodiments.

[0125] In particular, according to embodiments of this disclosure, the methods described above can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program tangibly embodied on a machine-readable medium, the computer program containing program code for performing the methods described above. In such embodiments, the computer program can be downloaded and installed from a network via a communication component, and / or installed from a removable medium.

[0126] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0127] The units or modules described in the embodiments of this disclosure can be implemented in software or programmable hardware. The described units or modules can also be located in a processor, and the names of these units or modules do not necessarily constitute a limitation on the unit or module itself.

[0128] In another aspect, this disclosure also provides a computer-readable storage medium, which may be a computer-readable storage medium included in the electronic device or computer system described above; or it may be a standalone computer-readable storage medium not assembled into a device. The computer-readable storage medium stores one or more programs, which are used by one or more processors to perform the methods described in this disclosure.

[0129] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of the invention involved in this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the inventive concept. For example, technical solutions formed by substituting the above-described features with (but not limited to) technical features disclosed in this disclosure that have similar functions.

Claims

1. An extended instruction set processor, characterized in that, The extended instruction set processor is used to process the extended instruction set for electricity metering. The extended instruction set for electricity metering includes multiple sets of electricity metering instructions, and each long electricity metering instruction includes multiple instruction slots S with an execution order. i 1≤i≤N, N≥4, each instruction slot corresponds to an energy metering instruction set and carries any energy metering instruction in the corresponding energy metering instruction set. The extended instruction set processor includes: The system includes an energy metering decoding unit, an energy metering dispatching unit, and multiple energy metering execution units P. i The power metering execution unit P i Corresponding to instruction slot S i And execute instruction slot S i The unit carries the power metering command; the power metering execution unit includes multiple power metering execution modules. The power metering decoding unit decodes the power metering long command used to process specified power data to obtain the decoding results of multiple power metering commands in the power metering long command. According to the decoding result and the execution order, the power metering scheduling unit sequentially controls the corresponding power metering execution modules in the plurality of power metering execution units to execute the corresponding power metering instructions. Specifically, in power metering execution unit P... i After the energy metering execution module in the middle executes the corresponding energy metering instructions on its own data to be processed and saves the execution results, the energy metering execution unit P... i+1 The energy metering execution module in the middle uses the execution result as its own data to be processed and executes the corresponding energy metering instructions. The data to be processed by the energy metering execution unit P1 is the specified power data. When the specified power data includes multiple power data, the energy metering execution unit P1... i The multiple self-processing data of the power metering execution unit P1 are processed sequentially, and the multiple self-processing data of the power metering execution unit P1 are the multiple power data.

2. The extended instruction set processor according to claim 1, characterized in that: The plurality of energy metering execution modules correspond to the respective energy metering instructions in the corresponding instruction slots of the energy metering execution unit; The power metering execution unit P i The system processes multiple self-registered data sequentially, including: the power metering execution unit P. i The energy metering execution module executes the corresponding energy metering command for its current data to be processed and saves the current execution result, then continues to execute the corresponding energy metering command for the next data to be processed; the energy metering execution unit P i+1 The energy metering execution module in the unit uses the current execution result as its own data to be processed, and executes the corresponding energy metering instruction on the current execution result. Specifically, the execution of the corresponding energy metering instruction for the next data to be processed and the execution of the corresponding energy metering instruction for the current execution result are respectively performed in the energy metering execution unit P. i and P i+1 It is executed in parallel within the power metering execution module.

3. The extended instruction set processor according to claim 1, characterized in that: The decoding result of the power metering command includes the power metering operation code, the data to be processed register address, and the execution result register address; According to the decoding result and the execution order, the power metering scheduling unit sequentially controls the corresponding power metering execution modules in the plurality of power metering execution units to execute corresponding power metering instructions, including: Based on the decoding result of the energy metering command, the energy metering scheduling unit obtains the data to be processed according to the data to be processed register address, generates an execution module control signal according to the energy metering operation code, and sends the data to be processed, the execution module control signal, and the execution result register address to the corresponding energy metering execution unit. The corresponding energy metering execution unit selects the corresponding energy metering execution module to execute the corresponding energy metering command on the data to be processed according to the received execution module control signal, and saves the execution result to the storage location indicated by the execution result register address.

4. The extended instruction set processor according to claim 3, characterized in that, The set of electricity metering instructions all includes idle instructions; The power metering and scheduling unit identifies the instruction slot S i When the decoding result of the carried energy metering command is an idle operation code, the energy metering execution unit P... i No action is taken.

5. The extended instruction set processor according to claim 3, characterized in that: The address of the data to be processed is the address of the register that stores the data to be processed, or the address of the register that stores the address of the first memory, where the first memory address is the address of the memory that stores the data to be processed. The execution result register address is either the address of the register storing the execution result or the address of the register storing the second memory address, which is the address of the memory storing the execution result.

6. The extended instruction set processor according to claim 1, characterized in that, The extended instruction set for electricity metering is obtained through the following steps: Decompose each of the multiple energy metering algorithms to obtain the multiple energy metering operation requirements of the multiple energy metering algorithms; Based on the multiple power metering calculation requirements, multiple power metering instructions based on the RISC-V standard are set. These multiple power metering instructions include multiple power data access instructions, multiple advanced power calculation instructions, and multiple basic power calculation instructions. The power metering extended instruction set is set based on the multiple power metering instructions.

7. The extended instruction set processor according to claim 6, characterized in that: The plurality of power data access instructions include: data loading instruction, data writing instruction, and data loading shift instruction; The aforementioned advanced power operation instructions include: digital filtering operation instructions, discrete Fourier operation instructions, complex multiplication operation instructions, complex butterfly transformation operation instructions, squaring operation instructions, integral operation instructions, window function operation instructions, square root operation instructions, and phasor operation instructions. The basic power operation instructions include: addition operation instructions, multiplication / multiplication-addition operation instructions, data accumulation operation instructions, and data shift operation instructions.

8. The extended instruction set processor according to claim 6, characterized in that, The energy metering algorithm includes any of the following: Power signal high-pass filtering algorithm, power signal low-pass filtering algorithm, current and voltage RMS value calculation algorithm, active power calculation algorithm, reactive power calculation algorithm, fundamental frequency spectrum analysis algorithm, and harmonic frequency spectrum analysis algorithm.

9. The extended instruction set processor according to claim 6, characterized in that, When N=4, the extended power metering instruction set includes four power metering instruction sets; among them, The union of any two sets of electricity metering instructions is a set of multiple electricity data access instructions, and the union of the remaining two sets of electricity metering instructions is a set of multiple advanced electricity calculation instructions and multiple basic electricity calculation instructions.

10. The extended instruction set processor according to claim 9, characterized in that, When N=4, the plurality of energy metering execution units includes 4 energy metering execution units; wherein, The first energy metering execution unit includes multiple energy metering execution modules, including: a first memory address generation module, a first memory read / write control module, and a first data shifting module; The second energy metering execution unit includes multiple energy metering execution modules, including: a second memory address generation module, a second memory read / write control module, and a second data shifting module; The third energy metering execution unit includes multiple energy metering execution modules: a first selector, and a first multiplier, a first adder-accumulator, a first shifter, and a first operation control module connected to the first selector; the first operation control module controls the combination of the first multiplier, the first adder-accumulator, and the first shifter to serve as the energy metering execution module for the advanced power operation instructions; The fourth power metering execution unit includes multiple power metering execution modules: a second selector, and a second multiplier, a second adder-accumulator, a second shifter, a second operation control module, and a phasor calculation module connected to the second selector; the second operation control module acts as the power metering execution module for the advanced power operation instructions by controlling the combination of the second multiplier, the second adder-accumulator, and the second shifter.

11. The extended instruction set processor according to claim 1, characterized in that, The energy metering decoding unit includes an energy metering instruction judgment module and an energy metering instruction decoding module. The power metering instruction judgment module obtains an operation instruction with a first preset number of digits and determines whether the lowest two digits of the operation instruction with the first preset number of digits are a set field; When the lowest two bits of the first preset bit operation instruction are the set field, the power metering instruction decoding module combines the first preset bit operation instruction with the adjacent second preset bit operation instruction into a complete instruction to obtain the power metering long instruction.

12. The extended instruction set processor according to claim 1, characterized in that, The extended instruction set processor also includes: a tightly coupled memory group and an extended register group; The tightly coupled memory group is used to store the specified power data and the power metering results obtained by processing the specified power data; The extended register group is used to store the execution results.

13. The extended instruction set processor according to claim 12, characterized in that, The power metering and scheduling unit includes: a register access control module and a power metering and scheduling control module; Based on the decoding result of the energy metering instruction, the register access control module generates a register access control signal. The register access control signal is used to read the data to be processed from the extended register group and write the execution result into the extended register group. Based on the decoding result, the energy metering scheduling control module generates an execution module control signal to control the corresponding energy metering execution unit to select the corresponding energy metering execution module to execute the corresponding energy metering instruction on the data to be processed.

14. A method for processing an extended instruction set, characterized in that, The processing method is used to process an extended instruction set for electricity metering, which includes multiple sets of electricity metering instructions. Each long electricity metering instruction includes multiple instruction slots S with an execution order. i 1≤i≤N, N≥4, each instruction slot corresponds to an energy metering instruction set and carries any energy metering instruction in the corresponding energy metering instruction set, the processing method includes: The power metering decoding unit decodes the power metering long command used to process specified power data to obtain the decoding results of multiple power metering commands in the power metering long command. Based on the decoding result and the execution order, the power metering scheduling unit sequentially controls the corresponding power metering execution modules in multiple power metering execution units to execute corresponding power metering instructions. Specifically, in controlling power metering execution unit P... i After the energy metering execution module in the middle executes the corresponding energy metering instructions on its own data to be processed and saves the execution results, the energy metering execution unit P... i+1 The power metering execution module in the middle uses the execution result as its own data to be processed and executes the corresponding power metering instructions. The power metering execution unit P1's own data to be processed is the specified power data. When the specified power data includes multiple power data, the power metering execution unit P1 is controlled. i The multiple self-to-process data are processed sequentially, and the multiple self-to-process data of the power metering execution unit P1 are the multiple power data; Among them, the power metering execution unit P i Corresponding to instruction slot S i And execute instruction slot S i The power metering execution unit carries power metering instructions; the power metering execution unit includes multiple power metering execution modules, each corresponding to a power metering instruction in the corresponding instruction slot of the power metering execution unit.

15. The processing method according to claim 14, characterized in that, The control power metering execution unit P i Multiple data sets to be processed are processed sequentially, including: By controlling the power metering execution unit P i The energy metering execution module executes the corresponding energy metering command for its current data to be processed and saves the current execution result, then continues to execute the corresponding energy metering command for the next data to be processed; by controlling the energy metering execution unit P i+1 The energy metering execution module in the unit uses the current execution result as its own data to be processed, and executes the corresponding energy metering instruction on the current execution result. Specifically, the execution of the corresponding energy metering instruction for the next data to be processed and the execution of the corresponding energy metering instruction for the current execution result are respectively performed in the energy metering execution unit P. i and P i+1 It is executed in parallel within the power metering execution module.

16. The processing method according to claim 14, characterized in that, The extended instruction set for electricity metering is obtained through the following steps: Decompose each of the multiple energy metering algorithms to obtain the multiple energy metering operation requirements of the multiple energy metering algorithms; Based on the multiple power metering calculation requirements, multiple power metering instructions based on the RISC-V standard are set. These multiple power metering instructions include multiple power data access instructions, multiple advanced power calculation instructions, and multiple basic power calculation instructions. The power metering extended instruction set is set based on the multiple power metering instructions.

17. The processing method according to claim 14, characterized in that, The method further includes: The specified power data and the power metering results obtained by processing the specified power data are stored in a tightly coupled memory group; The execution results are stored in an extended register set.

18. An extended instruction set processing chip, characterized in that, The extended instruction set processing chip includes the extended instruction set processor as described in any one of claims 1 to 13.

19. A computer-readable storage medium storing computer instructions thereon, characterized in that, When the computer instructions are executed by the processor, they implement the method of any one of claims 14 to 17.

20. A computer program product, characterized in that, Includes computer instructions that, when executed by a processor, implement the method of any one of claims 14 to 17.