[0001] The subject of the invention is a method for determining energy consumption by a
programmable integrated digital circuit for execution of individual machine instructions.
[0002] The constantly growing number of mobile devices as well as their degree of development
and complexity result in an increase in the energy consumption necessary to power
them from limited sources, such as batteries or accumulators. Optimization and reduction
of energy consumption by mobile devices is an important element affecting the reliability
and effectiveness of their operation. Reducing energy consumption involves, among
other things, optimizing power consumption by software running in a device, which
is carried out based on accurate power consumption models which are characteristic
for a programmable IDC (integrated digital circuit) used in the device.
[0003] Functions implemented in digital systems are represented by single machine instructions
or entire blocks of them, which are executed by IDC. Each instruction is characterized
by a variable number and complexity of elementary operations (e.g. bit shifts, reading/writing
operands from memory, etc.) and is often an industrial secret of the digital circuit
manufacturer. A clear and precise determination of the energy demand of a digital
circuit comes down to measuring the current consumed by the integrated digital circuit
during the implementation of its functions, which consists of a series of instructions
executed one after another. Single instructions draw currents below 10
-9 A and are executed at a clock speed of several GHz. The measurement of such currents
and, consequently, power requires a system with high resolution and measurement accuracy,
as well as a precise and non-invasive method of determining the time window in which
the execution of the measured instruction took place - its start and end time. Knowledge
of the energy consumed by the IDC for the implementation of individual machine instructions
allows for a more precise estimation of its energy demand already at the stage of
designing the functions it implements in the target digital system, and not, as was
the case before, by measuring energy consumption only during the operation of the
device.
[0004] A method for determining the value of energy necessary to implement a single instruction
is known, consisting in repeated (up to 1000 times) execution of the instruction being
tested and instructions supporting its implementation by measuring current consumption
and a supply voltage value in order to calculate and average values of the energy
consumed by the instruction being tested.
[0005] From the article
V. Tiwari et al "Power Analysis of Embedded Software: A First Step Towards Software
Power Minimization,"IEEE Transaction on Very Large Scale Integration (VLSI) Systems,
Vol.2, No.4, pp. 437-445, 1994, a method for determining the instruction energy consumption by a microprocessor
when executing a specific instruction is known. In this method, the energy consumption
of instructions was determined by measuring the average current consumed by the microprocessor
during repeated execution (in a loop) of the same instruction. The current was measured
using an ammeter.
In the publication
J. T. Russell et al, "Software power estimation and optimization for high performance,
32-bit embedded processors," Proc. - IEEE Int. Conf. Comput. Des. VLSI Comput. Process.,
pp. 328-333, 1998, the method presented in the publication mentioned above was used to measure the
power consumption of machine instructions, introducing a different method for determining
current consumption during repeated execution of instructions. This difference consisted
in determining the current from measuring the voltage drop across the measuring resistor
measured using an oscilloscope. The use of an oscilloscope allows direct measurement
of the time of repeated execution of instructions.
A number of well-known publications discuss methods of measuring and determining the
power and energy consumption of instructions, which basically use the method of measuring
current during repeated execution of instructions and execution time, introducing
modifications involving the use of various methods and tools for measuring current.
In the publication
Ch. Guo et al "A Survey of Energy Consumption Measurement in Embedded Systems", IEEE
Access, 9, 60516 2021 [6], a review of methods for measuring the energy consumption of embedded systems
was presented, in particular known methods of measuring the energy consumption of
machine instructions were discussed. These methods use a method that involves measuring
the current during repeated execution of instructions and their execution time. The
current measurement is performed directly using an ammeter or indirectly as a voltage
drop across a reference resistor, which is measured with an oscilloscope or a system
consisting of an amplifier, an analog-to-digital converter and a microcontroller.
Methods for determining the energy consumption of machine instructions known from
the state of the art are subject to an error in determining the energy of a single
machine instruction because they require repeated and long-term averaging of the energy
consumed by looped, repeated execution of the measured instruction. This results in
averaging also the supporting instructions of the loop or jump in the performed measurement.
Due to this, the obtained result is composed of two elements: the average value of
measured instruction and supporting instructions. In this approach, additional loop
instructions generate additional energy consumption, which cannot be removed from
the averaging process, which increases the error in determining the energy of a single
instruction.
[0006] The inventive problem is to provide a method for measuring energy consumption during
the execution of a single machine instruction of an integrated digital circuit that
is free from errors of averaging additional supporting instructions.
[0007] The object of the invention is to eliminate the error in determining the energy needed
to execute a single machine instruction, which consists in the inability to exclude
the value of energy consumed by supporting instructions from the measurements when
determining the energy value of the measured instruction. This object is achieved
by using the method according to the invention, which uses additional information
gathered during the measurement of magnetic field generated by a programmable integrated
digital circuit, performed simultaneously with the execution of the single instruction.
[0008] The essence of a method for determining energy consumption by a programmable integrated
digital circuit, for execution of a single machine instruction, according to the invention
consists in obtaining a characteristic of instantaneous power consumption within a
specified operating time of the programmable integrated digital circuit, implementing
an iteration of a single instruction being tested, the implementation of which is
supervised by a central control unit, and is characterized by placing the programmable
integrated digital circuit, IDC, programmed with a test program that implements a
loop of the single machine instruction being tested, in a measurement installation
consisting of a power supply system, a power measurement system, a magnetic field
probe, a field measurement system and a central control and recording unit, and then
initiating an iteration process of the machine instruction being tested. During the
iteration of the machine instruction being tested, a continuous measurement of the
instantaneous power consumed by the IDC with a resolution of not less than 100 pW
and a measurement of a magnetic radiation value E
IDC, generated by the IDC, are performed. Instantaneous values of the power consumed
by the IDC and the magnetic field radiation values E
IDC, generated by the IDC, are simultaneously stored in an operating memory of the central
control unit and synchronized in the time domain, during the implementation of the
iteration of the machine instruction being tested, with a resolution of not less than
10 × machine cycle duration of the instruction being tested,
[0009] After the iteration is completed and power the IDC is turned off, a time domain characteristic
of the measured values of the magnetic field E
IDC generated by the IDC during the implementation of the iteration of the machine instruction
being tested is analyzed and a repeating pattern of field changes is marked, with
a matching coefficient of not less than 90%, and with a duration equal to the number
of cycles per instruction being tested × machine cycle duration of this instruction.
From the group of marked patterns one pattern is selected which is directly adjacent
to the marked identical patterns on both sides. A time interval T
i is determined for the selected pattern by determining its start t
0 and its end t
1.
[0010] Next, samples recorded during the time interval t
0 - t
1 are extracted from the instantaneous power measurements, and an average value of
energy consumed during the implementation of the instruction being tested is determined
by summing the extracted instantaneous power measurements over the time interval t
0-t
1.
[0011] The measurements of the values of the magnetic field E
IDC in the method implementation are performed while ensuring the conditions for their
correct realization, by placing the magnetic field probe with detection efficiency
of not less than 1nT in the immediate vicinity of the tested integrated circuit IDC,
and both elements of the measurement system are arranged in the space covered by a
Faraday cage.
[0012] The measurements in the method implementation are performed while ensuring the conditions
for their correct realization, by implementing all the connections of the measurement
system with shielded cables.
[0013] The advantage of the method according to the invention is the development of a method
for determining a time window based on the magnetic field analysis in order to determine
the power time course, which allows to effectively and efficiently determine the energy
consumed by the IDC for the implementation of individual machine instructions of each
type, regardless of their complexity (required number of changes in the logical states
of the system).
[0014] The method according to the invention is explained in an exemplary embodiment shown
in the drawing in which Fig. 1 shows a block diagram of an algorithm of the method,
Fig. 2 shows a graph of power absorbed by the IDC and magnetic field, and Fig. 3 shows
a block diagram of a measurement installation.
[0015] For the implementation of an example of the invention relating to the method for
determining energy consumption by a programmable integrated digital circuit (IDC),
during execution of individual machine instructions a measurement installation is
used, the block diagram of which is presented in fig. 3.
[0016] The measurement installation intended for implementing the method according to the
invention consists of: a power supply system 1, a power measurement system 2, a development
system for the IDC 3, a central control and recording unit 4, a field measurement
system 5, and a magnetic field probe 6.
[0017] As the power measurement system 1 in the implementation of the invention example
a laboratory power supply: Keysight E36311A was used. The power measurement system
2 included a current-voltage converter (transimpedance amplifier DHPCA-100). As the
development system for the IDC 3 a development module STMicroelectronics NUCLEO-F334R8
was used. As the central control and recording unit 4 a PC-class computer comprising
a PCIe Gen 3 slot (8 lane) equipped with a measuring card - AlazarTech ATS9373 was
used. As the field measurement system 5 an amplifier of the field probe with a power
supply: EMI-NF-AMP was used. Whereas as the magnetic field probe 6 a field probe:
Tektronix EMI-NF-PROBE H20 was used.
[0018] The measurement installation was used for testing the IDC in the form of a STM32F334R8
type microcontroller.
[0019] The measurement installation was arranged in such a way that to power supply terminals
of the development system for the IDC 3 the power supply system 1 was connected, whose
current efficiency and output voltage were consistent with the levels specified by
the IDC manufacturer. In the power supply path of the development system for the IDC
3 the power measurement system 2 was placed, the measurement resolution of which enables
measurement of the power consumed by the IDC with a resolution of not less than 100
pW at a sampling frequency of not less than
30x the frequency of one clock cycle of a measured instruction.
[0020] The field probe 6 was placed in an orientation allowing for the correct measurement
of the magnetic radiation emitted by the IDC and at a distance ensuring maximum dynamics
of the performed measurements.
[0021] The field probe 6 was connected to the field measurement system 5. The field measurement
system 5 together with the provided field probe 6 enables measurement of magnetic
radiation with a frequency not less than 30x the frequency of one cycle clock of a
measured instruction and with magnetic field detection efficiency of not less than
1nT.
[0022] The central control and recording unit 4 was connected to the field measurement system
5, the power measurement system 2 and the development system for the IDC 3.
[0023] The power supply system was implemented using the laboratory power supply 1 and was
connected to the development module for the tested IDC 3 in such a way that the output
terminal of the positive pole of the power supply 1 was connected to the JP6 connector
of the development module 3 and the output terminal of the negative pole of the power
supply (ground in asymmetric mode) was connected to the GND connector of the development
module 3. The power measurement system 2 was implemented using channel A of the measuring
card included in the central control and recording unit 4 and the current-voltage
converter connected in such a way that the current input of the converter was connected
to the positive pole of the power supply of the power supply system 1 and the current
output of the converter to the JP3 connector of the development module 3 (in a manner
consistent with the converter manufacturer's guidelines), while the voltage output
of the converter was connected to channel A of the measuring card (power measurement
was carried out indirectly, as the quotient of the supply voltage value from the power
supply system 1 and the current measured on channel A of the measuring card). The
field measurement system 5, implemented using the field probe 6, the amplifier and
channel B of the measuring card, which is part of the central control and recording
unit 4, was connected in such way that the amplifier output was connected to channel
B of the measuring card included in the central control and recording unit 4, and
the amplifier input to the field probe 6.
[0024] The field probe 6 is placed in contact with the tested IDC installed on the development
module 3 in such a way that magnetic field generated by the integrated digital circuit
passes through the measurement plane of the field probe 6 - field measurement is to
be consistent with the art of field measurement.
[0025] The amplifier of the field measurement system 5 is powered by a dedicated power supply.
[0026] The Auxiliary I/O control signal of the measuring card, which is part of the central
control and recording unit 4, was connected to the CN3 connector slot of the development
module 3, and the signal ground of the Auxiliary I/O connector to the GND connector
of the development module 3. The measuring card, which is part of the central control
and recording unit 4, was installed in the PC-class computer having a compatible communication
bus, thus implementing the central control unit of the measurement installation.
[0027] The batch program for the IDC was prepared in such a way that the microprocessor
(STM32F334R8) was clocked at 20 MHz (configuration of the external 8MHz oscillator
fed to the internal PLL loop) and the main program after detecting a rising edge on
the input port of the digital integrated circuit connected to the central control
and recording unit 4 began executing an infinite program loop in which the measured
instruction was called 10 times (not less than 3 times according to the method of
the invention) - for example, the logical "AND" instruction was used.
[0028] After uploading the software to the IDC and completing the installation, the power
supply system 1 was started to supply the development module with voltage of 2V. Then,
at the software level of PC, the measuring card, which is part of the central control
and recording unit 4, was configured to ensure the maximum frequency and measurement
resolution (2GS/s for 12bit) while simultaneously recording measurements on both measurement
channels (A and B) and so that the measurement and recording cycle begins when the
high state is activated (change from 0V to 2V) at the Auxiliary I/O output and that
this beginning lasts for at least the duration of 10 instruction calls - for the exemplary
AND instruction, the duration of one call is 1 clock cycle = 50ns .
[0029] From the level of the control application of the measuring card, which is part of
the central control and recording unit 4, the high state at the Auxiliary I/O output
was activated, thus activating an infinite loop of execution of the set of instructions
on the integrated digital circuit and starting the measurement and recording process
of the card.
[0030] The collected measurement data (for field and current), synchronized in time by the
measurement card, were analyzed using external software.
[0031] In the field measurements, a repeating pattern was searched for with a length equal
to the duration of a single call of the instruction being tested (50ns in the example),
so that the repeating pattern occurred no less than 3 times in succession. A correlation
method with a matching coefficient of not less than 95% was used in the example. As
the searched pattern a section of the recorded signal equal to the duration of the
measured instruction was used (50ns in the example, which corresponds to a block size
of 2GS/s * 50ns = 100 samples). In subsequent iterations of running the correlation
algorithm, this section was selected such that the first sample of the block has the
number N, where N={1,...,N
MAX}, N
MAX=7*2GS/s*50ns = 700. Subsequent iterations were performed until groups of at least
3 directly repeating patterns in the recorded field signal were detected or until
N
MAX iteration was reached. From the group of repeating patterns, one was selected which
was directly adjacent to the other detected patterns on both its left and right sides
(at least one on each side). For the selected pattern, the number of its first sample
(S0) was read and the number of the last one (S1) was determined by adding the block
size to the first sample (S1 = S0 +100). Sample numbers S0 and S1 represent the discrete
start and end times of the selected pattern.
[0032] As channels A and B of the measuring card were synchronized in the time domain, the
sample numbers of both channels of the measuring card, which is part of the central
control and recording unit 4, corresponded to the same moments of time both for the
measurement of the instantaneous value of the field and the instantaneous value of
the current consumed by the integrated digital circuit. Using this property, the instantaneous
value of the power consumed by the measured instruction for individual current measurement
samples was determined as the product of the instantaneous value of the current and
the supply voltage:

where
n is a measurement sample index (from the range S0 - S1),
I(n) is a value of the measured current for sample n,
P(n) is a determined instantaneous value of power for sample n
and this, in turn, allowed to calculate the energy consumed by the programmable integrated
digital circuit during the execution of the measured instruction according to the
formula:

, where W is the energy consumed by IDC during execution of the instruction being
tested.
[0033] The determined value of energy consumed by the programmable IDC during the execution
of the AND instruction being tested in the exemplary implementation of the invention
was W ~ = 823.01 [nJ].
[0034] The invention will find application in the design of electronic systems, e.g. battery-powered
sensors, used in hard-to-reach places, installed in an inaccessible way, which excludes
or significantly complicates battery replacement and wired data transmission. Maximum
reduction of energy consumption of designed electronic systems is one of the factors
increasing the operating time of such systems and ensuring longer failure-free operation,
which affects the operating costs, especially when a large number of devices of this
type are used.
1. A method for determining energy consumption by a programmable integrated digital circuit,
for execution of individual machine instructions, consisting in obtaining a characteristic
of instantaneous power consumption within a specified operating time, of the programmable
integrated digital circuit implementing an iteration of a single instruction being
tested, the implementation of which is supervised by a central control unit,
characterized by
- placing the programmable integrated digital circuit, IDC (3), programmed with a
test program that implements a loop of the single machine instruction being tested,
in a measurement installation consisting of a power supply system (1), a power measurement
system (2), a field probe (6), a field measurement system (5), and a central control
and recording unit (4)
- initiating an iteration process of the machine instruction being tested,
- performing a continuous measurement of the instantaneous power consumed by the IDC
with a resolution of not less than 100 pW and a measurement of a radiation value of
magnetic field EIDC, generated by the IDC, during the implementation of the iteration of the machine
instruction being tested,
- simultaneously storing, in an operating memory of the central control unit (4),
and synchronizing in the time domain, instantaneous values of the power consumed by
the IDC and EIDC, with a resolution of not less than 10 × machine cycle duration of the instruction
being tested,
- analyzing, after the iteration is completed and power of the IDC is turned off,
a time course characteristic of the measured values of the magnetic field EIDC generated by the IDC during the implementation of the iteration of the machine instruction
being tested and marking a repeating pattern of field changes, with a matching coefficient
of not less than 90%, with a duration equal to the number of cycles per instruction
being tested × machine cycle duration of this instruction,
- selecting, from the group of marked patterns, one pattern which is directly adjacent
to the marked patterns on both sides,
- determining a time interval Ti for the selected pattern by determining its start t0 and its end t1
- extracting, from the instantaneous power measurements, samples recorded during the
time interval t0 - t1.
- determining energy consumed in the implementation process of the single instruction
being tested by summing the extracted instantaneous power measurements over the time
interval t0-t1
2. The method for determining energy consumption according to claim 1 characterized in that the magnetic field probe is situated in the immediate vicinity of the tested IDC
and both elements of the measurement system are preferably arranged in the space covered
by a Faraday cage.
3. The method for determining energy consumption according to claim 1 characterized in that all the connections of the measurement system are made of shielded cables.
4. The method for determining energy consumption according to claim 1 characterized in that the field probe is a magnetic field probe with detection efficiency of not less than
1nT.