How to measure power consumption

is there a way to measure the power consumed while the PL is running a code?

2 Likes

Yes. How to do it depends on the board you are using. It would be really helpful to provide this type of information upfront.
ZCU104 can do this, other boards may need external equipment to measure.

Cathal

Thanks Cathal for your reply.
My board is ZC706.

How about PYNQ-Z1 ? Would you please also comment for PYNQ-Z1 ?

Measuring power from PYNQ depends on if the board you are using has onboard power measurement capability.

PMBus is a chip that is often included on development boards to measure power.

There is a PYNQ class to control the PMBus.
https://github.com/Xilinx/PYNQ/blob/image_v2.4/pynq/pmbus.py

For the PYNQ supported boards, PYNQ-Z1, PYNQ-Z2, and ZCU104, only the ZCU104 has the PMBus.
You can see any example notebook here:
https://github.com/Xilinx/PYNQ/blob/image_v2.4/boards/ZCU104/notebooks/common/zcu104_pmbus.ipynb

If you are using the ZC706, the first point is that it is not an officially supported board, so you woudl need to build your own image. However, it has a PMBus chip, so you may be able to use it with the PYNQ pmbus class. You would need to check it is actually accessible to the PS. Sometimes these chips are only intended to be used with an external adapter, and don’t have data connections to the ZYnq chip.You would then need to get this working with your PYNQ image. We can try help - you can post questions here.

For PYNQ-Z1, and PYNQ-Z2, there is no on-chip measurement, but you can use external power measurement devices.

You can buy reasonably inexpensive USB power meters, or socket meters.
I’ve used a similar one to this*:

*other providers are available :wink:

Cathal

4 Likes

Hi, Cathal,

Thanks for your information. However, I have the following questions to clarify.

Q1: Is the core power supply for PS and PL standalone on PYNQ-Z1 which not shared with others ? For example, if the core power supply for PL is shared with some core power of IO pad on the FPGA etc., from the perspective of power mesaurement, it’s hard to pinpoint individual core power consumption from the measurement of the given core power supply.

Q2: As you mentioned, for example, PYNQ-Z1 has the PMBus which is a chip that is often included on development boards to measure power. Assume the user would like to measure the core power of PS and PL only. Where can the user find the corresponding power block doagram which describes which power chip and power rail supply the core power to PL and PS block ? From the user’s view, user can analyze whether the power supply is shared and which power device should be mesaured via the PMBus in terms of PMBus programming.

Q3: For PYNQ-Z1, there is no on-chip measurement. What’s the definition of on-chip measurement ? If it supports PMBus, why does not it support on-chip measurement ?

Q4: You mentioned user can buy reasonably inexpensive USB power meters. However, as far as I know, USB power meter is used for the power measurement of devices charge from USB interface. Since PMBus is I2C based, why does the USB power meters work for PMBUs? I’m confused.

Q5: For external power measurement devices on PYNQ-Z1, where can the user locate the pin location of PMBus interface and so the user can make connection to external power measurement devices ? Which document does the user need to look up as you know ?

Thank you

Q1 PYNQ-Z1 does not have any on board power measurement capability. You need an external meter to measure total board power.
No, with an external monitor, you can’t separate the PS and PL power consumption, you can only measure the total power. On the PYNQ-Z2 if you check schematic, the 1V rail for the PS and PL is common anyway, so you wouldn’t be able to separate PS/PL power consumption even if you have on board monitoring of this rail.

Q2 You may need to check the userguide/schematic for a board to check what is being measured. Where a PMBus is present, you need to check which rails it monitors.
e.g. ZCU104: https://www.xilinx.com/support/documentation/boards_and_kits/zcu104/ug1267-zcu104-eval-bd.pdf

Q3 - There is no chip on the board (PCB) to measure power consumption.

Q4 If you power the PYNQ-Z1/Z2 via USB, you can connect a USB power monitor to measure the total power consumption of the board. If you use wall power, you can use a socket power meter to measure total power.
USB meter is not required if the board has PMBus , or similar.

Q5 - as above, PYNQ-Z1 does not have PMBus

Cathal

1 Like

Thank you Cathal.

Yes, PYNQ’s pmbus api works on ZC706, however, the Rail objects are a little different from that of ZCU104. Each of them has only voltage value or just current value. It makes no problem though as I can multiply voltage and current for power calculation. This is the whole output of the get_rails() function.

{'iout1': Rail {name=iout1, current=Sensor {name=iout1_current, value=0.406A}},
 'iout2': Rail {name=iout2, current=Sensor {name=iout2_current, value=0.093A}},
 'iout3': Rail {name=iout3, current=Sensor {name=iout3_current, value=0.031A}},
 'iout4': Rail {name=iout4, current=Sensor {name=iout4_current, value=0.093A}},
 'iout5': Rail {name=iout5, current=Sensor {name=iout5_current, value=0.062A}},
 'vout1': Rail {name=vout1, voltage=Sensor {name=vout1_voltage, value=0.995V}},
 'vout2': Rail {name=vout2, voltage=Sensor {name=vout2_voltage, value=1.796V}},
 'vout3': Rail {name=vout3, voltage=Sensor {name=vout3_voltage, value=1.494V}},
 'vout4': Rail {name=vout4, voltage=Sensor {name=vout4_voltage, value=2.46V}},
 'vout5': Rail {name=vout5, voltage=Sensor {name=vout5_voltage, value=3.31V}},
 'vout6': Rail {name=vout6, voltage=Sensor {name=vout6_voltage, value=1.725V}}}

My question is How can I determine which power pin should I measure for the proper power measurement of PL operations?

Check Zynq data sheet to understand voltage rails. VCC for PS and PL may be shared or separate.
Check board userguide/schematic to see how the power rails are connected and which rails can be measured.

Cathal

2 Likes

Hi, Cathal,

If I only would like to measure the power consumption while only running C/C++ code on the CPUs on the PYNQ-Z1 FPGA, what I think is to use the USB power monitor you mentioned in the previous thread and measure the difference before/after the C/C++ executable runs on the PYNQ-Z1. Do you see any problem for the plan ?

Thank you.

All the best,
Nan-Sheng

Hello @cathalmccabe ,

I am sorry to jump into this old conversation, but the topic is the same. I am measuring the power of a PYNQ-Z2 board using a DC power supply. I connected the 5V and GRD of the Arduino pins to the power supply, and in this way I can read the current and th voltage (which is always 5V of course).

My question regards what I have found. I accelerated a Runge-Kutta algorithm on FPGA, and I also implemented the same thing with Jupyter Notebook to measure the difference. I expected to see less current (so less power) drained by the FPGA rather than by the CPU. Instead I found something different. When giving power to the board, without doing anything, the current drained is 235mA (1.18W). When I start the computation in FPGA I have a current of 265 mA (1.33W), and when I start the computation in CPU the current drained is still 265mA.

Is there a reason it’s the same amount of current? Am I doing something wrong?

Also, could I safely say that the FPGA adds up 30mA to the current drained, or it’s more complicated than that?

Thank you so much in advance for your help.
Best,
Davide

@davide-giacomini

I can ensure as an hardware engineer, I got more experience on this topic:

  1. DC-DC efficiency is highly determined by the converter itself. What Cath proposed measuring method is not valid and aka very wrong and inaccurate!!! Measure DC Jack input power must do a subtraction inaccurate assumption, which almost meaningless for practical analyzing usage.

A correct way is to insert high-side sensing between 1V rail 1V5 rail and 1V8. Exclude interface consumption accordingly. Efficiency curve at low load is almost same as 25% loading.
This is what good and bad DCDC converter differ and even a better converter cannot break the DCM of PSM efficiency lost.

  1. This is very normal as idle current can be high when IO is not pull-low or enter a low consumption state. The PL of H/L side of the LE is not turned off to a state (VLSI leakage stop).

  2. The power consumption @ low LE usage is almost hard to measure in mA range (1% of 100k LE) what do you expected? And not even including a flop switching behavior.

This is why when designing real engineering FPGA custom board at our side the are always hall-effect system senor @ DC / PCIE power insertion point. Individual high-side shunt sensing / embedded current sense DCDC with IIC is mostly used @ each power rails (1V, 1V2, 1V5, 1V8).

There are many IEEE research paper used FPGA board on VLSI topic but mostly only mentioned throughput or latency but comes to power measurement rarely measured in deep and strict manner. Not because the researchers done in purpose but FPGA boards that can commonly compared are real bad @ power measurement.

ENJOY~

1 Like