PYNQ: PYTHON PRODUCTIVITY FOR ZYNQ

How to measure power consumption

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

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

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

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

1 Like

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