FPGA, SoC, And CPLD Boards And Kits
FPGA Evaluation and Development Kits
5931 Discussions

Programming the power Monitor

Altera_Forum
Honored Contributor II
1,072 Views

Hi, 

 

I am working on the Cyclone III LS dev kit. 

I am using the Power Monitor software included into Quartus in order to measure power consumption. The software is very simple and is working well. 

 

But, in order to develop an automated test bench, I am looking for API for power consumption measurement. 

 

Is it possible to measure the power consumption from Java or C/C++ language ? 

 

Maybe the best solution is to measure directly across the shunt resistors on the dev board with my digitizer. 

 

Thanks a lot 

 

Mickael
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
358 Views

You can use system-console to automate it. 

 

For more information about the system-console, please take a look at  

http://nioswiki.com/systemconsole 

 

 

You can do like this 

 

 

set vj [ lindex [ get_service_paths sld ] 0 ] 

 

You need to find out something like this by changing the last digit. 

/connections/USB-Blaster on localhost [USB-0]/EPM2210@2/[MFG:110 ID:8 INST:0 VER:0]  

You need to try few times to get the access to the power monitor. 

set vj [ lindex [ get_service_paths sld ] 0 ] 

set vj [ lindex [ get_service_paths sld ] 1 ] 

set vj [ lindex [ get_service_paths sld ] 2 ] 

and so on…it will be depending on the FPGA design. If the FPGA has jtag node, it will be changed. If FPGA does not have any jtag node in it, you’ll need to find the  

[MFG:110 ID:8 INST:0 VER:0] 

 

[MFG:110 ID:8 INST:123 VER:0] is used for configuration 

[MFG:110 ID:8 INST:124 VER:0] is used for clock control for some other boards. 

 

 

 

After finding out the node, open the service by typing 

open_service sld $vj 

 

 

Now you need to select which power rail to read from 

sld_access_ir $vj 2 2 

sld_access_dr $vj 4 1 3 

 

 

The first line is the command to set the read address. 

The second line is the command to value of address. 

In this example, setting address(rail) to 0x3 

If you want to set to address to 0x06, then  

sld_access_ir $vj 2 2 

sld_access_dr $vj 4 1 6 

 

 

Now start reading power data 

You need to change the command to read command by typing 

sld_access_ir $vj 1 2 

 

Read 16 bits of power data by typing 

sld_access_dr $vj 16 1 [list 0x00 0x00 ]  

 

The [list 0x00 0x00 ] is feeding dummy data to push jtag data out. 

 

 

 

If you want to read address 0 to 3 then 

 

sld_access_ir $vj 2 2 

sld_access_dr $vj 4 1 0 

sld_access_ir $vj 1 2 

sld_access_dr $vj 16 1 [list 0x00 0x00 ] 

sld_access_ir $vj 2 2 

sld_access_dr $vj 4 1 1 

sld_access_ir $vj 1 2 

sld_access_dr $vj 16 1 [list 0x00 0x00 ] 

sld_access_ir $vj 2 2 

sld_access_dr $vj 4 1 2 

sld_access_ir $vj 1 2 

sld_access_dr $vj 16 1 [list 0x00 0x00 ] 

sld_access_ir $vj 2 2 

sld_access_dr $vj 4 1 3 

sld_access_ir $vj 1 2 

sld_access_dr $vj 16 1 [list 0x00 0x00 ] 

 

You’ll be able to read them. 

 

Here is the address and the data 

"0000" average_volt; 

"0001" average_amp; 

"0010" average_watt; 

"0011" max_volt; 

"0100" max_amp; 

"0101" max_watt; 

"0110" min_volt; 

"0111" min_amp; 

"1000" min_watt;
0 Kudos
Altera_Forum
Honored Contributor II
358 Views

Hi there, would you happen to know what the equivalent would be for the Cyclone V SoC Dev Kit?

0 Kudos
Altera_Forum
Honored Contributor II
358 Views

I've created a script to read the current values from a command line, using system-console. It's been tested with the 'Cyclone IV GX Transceiver Starter Kit' and 'Cyclone IV GX FPGA Development Kit' boards, but it should be easy to adapt to other platforms. 

 

https://github.com/ricardo-jasinski/power_monitor_automation 

 

Good luck!
0 Kudos
Reply