Revision 54
wattch/power.c  

202  202 
static double total_parasitic_cc1 = 0.0; 
203  203 
static double total_parasitic_cc2 = 0.0; 
204  204 
static double total_parasitic_cc3 = 0.0; 
205 
static double offchip_parasitic_cc1 = 0.0; 

206 
static double offchip_parasitic_cc2 = 0.0; 

207 
static double offchip_parasitic_cc3 = 0.0; 

208 
static double onchip_parasitic_cc1 = 0.0; 

209 
static double onchip_parasitic_cc2 = 0.0; 

210 
static double onchip_parasitic_cc3 = 0.0; 

205  211 
#define PARASITIC_OHM 0.002 
206  212 
static double max_amp = 0.00; 
207  213 
static double min_amp = 1000.00; 
...  ...  
670  676 
} 
671  677  
672  678 
if (current < 0.5) { 
673 
total_parasitic_cc1 += offchip_ploss[0];


674 
total_parasitic_cc2 += offchip_ploss[0];


675 
total_parasitic_cc3 += offchip_ploss[0];


679 
offchip_parasitic_cc1 += offchip_ploss[0];


680 
offchip_parasitic_cc2 += offchip_ploss[0];


681 
offchip_parasitic_cc3 += offchip_ploss[0];


676  682 
} else if (current < 1) { 
677 
total_parasitic_cc1 += offchip_ploss[1];


678 
total_parasitic_cc2 += offchip_ploss[1];


679 
total_parasitic_cc3 += offchip_ploss[1];


683 
offchip_parasitic_cc1 += offchip_ploss[1];


684 
offchip_parasitic_cc2 += offchip_ploss[1];


685 
offchip_parasitic_cc3 += offchip_ploss[1];


680  686 
} else if (current < 1.5) { 
681 
total_parasitic_cc1 += offchip_ploss[2];


682 
total_parasitic_cc2 += offchip_ploss[2];


683 
total_parasitic_cc3 += offchip_ploss[2];


687 
offchip_parasitic_cc1 += offchip_ploss[2];


688 
offchip_parasitic_cc2 += offchip_ploss[2];


689 
offchip_parasitic_cc3 += offchip_ploss[2];


684  690 
} else if (current < 2) { 
685 
total_parasitic_cc1 += offchip_ploss[3];


686 
total_parasitic_cc2 += offchip_ploss[3];


687 
total_parasitic_cc3 += offchip_ploss[3];


691 
offchip_parasitic_cc1 += offchip_ploss[3];


692 
offchip_parasitic_cc2 += offchip_ploss[3];


693 
offchip_parasitic_cc3 += offchip_ploss[3];


688  694 
} else if (current < 2.5) { 
689 
total_parasitic_cc1 += offchip_ploss[4];


690 
total_parasitic_cc2 += offchip_ploss[4];


691 
total_parasitic_cc3 += offchip_ploss[4];


695 
offchip_parasitic_cc1 += offchip_ploss[4];


696 
offchip_parasitic_cc2 += offchip_ploss[4];


697 
offchip_parasitic_cc3 += offchip_ploss[4];


692  698 
} else if (current < 3) { 
693 
total_parasitic_cc1 += offchip_ploss[5];


694 
total_parasitic_cc2 += offchip_ploss[5];


695 
total_parasitic_cc3 += offchip_ploss[5];


699 
offchip_parasitic_cc1 += offchip_ploss[5];


700 
offchip_parasitic_cc2 += offchip_ploss[5];


701 
offchip_parasitic_cc3 += offchip_ploss[5];


696  702 
} else if (current < 3.5) { 
697 
total_parasitic_cc1 += offchip_ploss[6];


698 
total_parasitic_cc2 += offchip_ploss[6];


699 
total_parasitic_cc3 += offchip_ploss[6];


703 
offchip_parasitic_cc1 += offchip_ploss[6];


704 
offchip_parasitic_cc2 += offchip_ploss[6];


705 
offchip_parasitic_cc3 += offchip_ploss[6];


700  706 
} else if (current < 4) { 
701 
total_parasitic_cc1 += offchip_ploss[7];


702 
total_parasitic_cc2 += offchip_ploss[7];


703 
total_parasitic_cc3 += offchip_ploss[7];


707 
offchip_parasitic_cc1 += offchip_ploss[7];


708 
offchip_parasitic_cc2 += offchip_ploss[7];


709 
offchip_parasitic_cc3 += offchip_ploss[7];


704  710 
} else if (current < 4.5) { 
705 
total_parasitic_cc1 += offchip_ploss[8];


706 
total_parasitic_cc2 += offchip_ploss[8];


707 
total_parasitic_cc3 += offchip_ploss[8];


711 
offchip_parasitic_cc1 += offchip_ploss[8];


712 
offchip_parasitic_cc2 += offchip_ploss[8];


713 
offchip_parasitic_cc3 += offchip_ploss[8];


708  714 
} else if (current < 5) { 
709 
total_parasitic_cc1 += offchip_ploss[9];


710 
total_parasitic_cc2 += offchip_ploss[9];


711 
total_parasitic_cc3 += offchip_ploss[9];


715 
offchip_parasitic_cc1 += offchip_ploss[9];


716 
offchip_parasitic_cc2 += offchip_ploss[9];


717 
offchip_parasitic_cc3 += offchip_ploss[9];


712  718 
} else if (current < 5.5) { 
713 
total_parasitic_cc1 += offchip_ploss[10];


714 
total_parasitic_cc2 += offchip_ploss[10];


715 
total_parasitic_cc3 += offchip_ploss[10];


719 
offchip_parasitic_cc1 += offchip_ploss[10];


720 
offchip_parasitic_cc2 += offchip_ploss[10];


721 
offchip_parasitic_cc3 += offchip_ploss[10];


716  722 
} else if (current < 6) { 
717 
total_parasitic_cc1 += offchip_ploss[11];


718 
total_parasitic_cc2 += offchip_ploss[11];


719 
total_parasitic_cc3 += offchip_ploss[11];


723 
offchip_parasitic_cc1 += offchip_ploss[11];


724 
offchip_parasitic_cc2 += offchip_ploss[11];


725 
offchip_parasitic_cc3 += offchip_ploss[11];


720  726 
} else if (current < 6.5) { 
721 
total_parasitic_cc1 += offchip_ploss[12];


722 
total_parasitic_cc2 += offchip_ploss[12];


723 
total_parasitic_cc3 += offchip_ploss[12];


727 
offchip_parasitic_cc1 += offchip_ploss[12];


728 
offchip_parasitic_cc2 += offchip_ploss[12];


729 
offchip_parasitic_cc3 += offchip_ploss[12];


724  730 
} else if (current < 7) { 
725 
total_parasitic_cc1 += offchip_ploss[13];


726 
total_parasitic_cc2 += offchip_ploss[13];


727 
total_parasitic_cc3 += offchip_ploss[13];


731 
offchip_parasitic_cc1 += offchip_ploss[13];


732 
offchip_parasitic_cc2 += offchip_ploss[13];


733 
offchip_parasitic_cc3 += offchip_ploss[13];


728  734 
} else if (current < 7.5) { 
729 
total_parasitic_cc1 += offchip_ploss[14];


730 
total_parasitic_cc2 += offchip_ploss[14];


731 
total_parasitic_cc3 += offchip_ploss[14];


735 
offchip_parasitic_cc1 += offchip_ploss[14];


736 
offchip_parasitic_cc2 += offchip_ploss[14];


737 
offchip_parasitic_cc3 += offchip_ploss[14];


732  738 
} else if (current < 8) { 
733 
total_parasitic_cc1 += offchip_ploss[15];


734 
total_parasitic_cc2 += offchip_ploss[15];


735 
total_parasitic_cc3 += offchip_ploss[15];


739 
offchip_parasitic_cc1 += offchip_ploss[15];


740 
offchip_parasitic_cc2 += offchip_ploss[15];


741 
offchip_parasitic_cc3 += offchip_ploss[15];


736  742 
} else if (current < 8.5) { 
737 
total_parasitic_cc1 += offchip_ploss[16];


738 
total_parasitic_cc2 += offchip_ploss[16];


739 
total_parasitic_cc3 += offchip_ploss[16];


743 
offchip_parasitic_cc1 += offchip_ploss[16];


744 
offchip_parasitic_cc2 += offchip_ploss[16];


745 
offchip_parasitic_cc3 += offchip_ploss[16];


740  746 
} else if (current < 9) { 
741 
total_parasitic_cc1 += offchip_ploss[17];


742 
total_parasitic_cc2 += offchip_ploss[17];


743 
total_parasitic_cc3 += offchip_ploss[17];


747 
offchip_parasitic_cc1 += offchip_ploss[17];


748 
offchip_parasitic_cc2 += offchip_ploss[17];


749 
offchip_parasitic_cc3 += offchip_ploss[17];


744  750 
} else if (current < 9.5) { 
745 
total_parasitic_cc1 += offchip_ploss[18];


746 
total_parasitic_cc2 += offchip_ploss[18];


747 
total_parasitic_cc3 += offchip_ploss[18];


751 
offchip_parasitic_cc1 += offchip_ploss[18];


752 
offchip_parasitic_cc2 += offchip_ploss[18];


753 
offchip_parasitic_cc3 += offchip_ploss[18];


748  754 
} else if (current < 10) { 
749 
total_parasitic_cc1 += offchip_ploss[19];


750 
total_parasitic_cc2 += offchip_ploss[19];


751 
total_parasitic_cc3 += offchip_ploss[19];


755 
offchip_parasitic_cc1 += offchip_ploss[19];


756 
offchip_parasitic_cc2 += offchip_ploss[19];


757 
offchip_parasitic_cc3 += offchip_ploss[19];


752  758 
} else if (current < 10.5) { 
753 
total_parasitic_cc1 += offchip_ploss[20];


754 
total_parasitic_cc2 += offchip_ploss[20];


755 
total_parasitic_cc3 += offchip_ploss[20];


759 
offchip_parasitic_cc1 += offchip_ploss[20];


760 
offchip_parasitic_cc2 += offchip_ploss[20];


761 
offchip_parasitic_cc3 += offchip_ploss[20];


756  762 
} else if (current < 11) { 
757 
total_parasitic_cc1 += offchip_ploss[21];


758 
total_parasitic_cc2 += offchip_ploss[21];


759 
total_parasitic_cc3 += offchip_ploss[21];


763 
offchip_parasitic_cc1 += offchip_ploss[21];


764 
offchip_parasitic_cc2 += offchip_ploss[21];


765 
offchip_parasitic_cc3 += offchip_ploss[21];


760  766 
} else if (current < 11.5) { 
761 
total_parasitic_cc1 += offchip_ploss[22];


762 
total_parasitic_cc2 += offchip_ploss[22];


763 
total_parasitic_cc3 += offchip_ploss[22];


767 
offchip_parasitic_cc1 += offchip_ploss[22];


768 
offchip_parasitic_cc2 += offchip_ploss[22];


769 
offchip_parasitic_cc3 += offchip_ploss[22];


764  770 
} else if (current < 12) { 
765 
total_parasitic_cc1 += offchip_ploss[23];


766 
total_parasitic_cc2 += offchip_ploss[23];


767 
total_parasitic_cc3 += offchip_ploss[23];


771 
offchip_parasitic_cc1 += offchip_ploss[23];


772 
offchip_parasitic_cc2 += offchip_ploss[23];


773 
offchip_parasitic_cc3 += offchip_ploss[23];


768  774 
} else if (current < 12.5) { 
769 
total_parasitic_cc1 += offchip_ploss[24];


770 
total_parasitic_cc2 += offchip_ploss[24];


771 
total_parasitic_cc3 += offchip_ploss[24];


775 
offchip_parasitic_cc1 += offchip_ploss[24];


776 
offchip_parasitic_cc2 += offchip_ploss[24];


777 
offchip_parasitic_cc3 += offchip_ploss[24];


772  778 
} else if (current < 13) { 
773 
total_parasitic_cc1 += offchip_ploss[25];


774 
total_parasitic_cc2 += offchip_ploss[25];


775 
total_parasitic_cc3 += offchip_ploss[25];


779 
offchip_parasitic_cc1 += offchip_ploss[25];


780 
offchip_parasitic_cc2 += offchip_ploss[25];


781 
offchip_parasitic_cc3 += offchip_ploss[25];


776  782 
} else { 
777 
total_parasitic_cc1 += offchip_ploss[26];


778 
total_parasitic_cc2 += offchip_ploss[26];


779 
total_parasitic_cc3 += offchip_ploss[26];


783 
offchip_parasitic_cc1 += offchip_ploss[26];


784 
offchip_parasitic_cc2 += offchip_ploss[26];


785 
offchip_parasitic_cc3 += offchip_ploss[26];


780  786 
} 
781  787  
782 
total_parasitic_cc1 += pow(current, 2) * PARASITIC_OHM;


783 
total_parasitic_cc2 += pow(current, 2) * PARASITIC_OHM;


784 
total_parasitic_cc3 += pow(current, 2) * PARASITIC_OHM;


788 
offchip_parasitic_cc1 += pow(current, 2) * PARASITIC_OHM;


789 
offchip_parasitic_cc2 += pow(current, 2) * PARASITIC_OHM;


790 
offchip_parasitic_cc3 += pow(current, 2) * PARASITIC_OHM;


785  791  
786  792 
// Onchip regulator paraisitc loss 
787  793 
if (speed_grade == 0) { 
788 
total_parasitic_cc1 += ONCHIP_VREG_LOSS_LOW;


789 
total_parasitic_cc2 += ONCHIP_VREG_LOSS_LOW;


790 
total_parasitic_cc3 += ONCHIP_VREG_LOSS_LOW;


794 
onchip_parasitic_cc1 += ONCHIP_VREG_LOSS_LOW;


795 
onchip_parasitic_cc2 += ONCHIP_VREG_LOSS_LOW;


796 
onchip_parasitic_cc3 += ONCHIP_VREG_LOSS_LOW;


791  797 
} else { 
792 
total_parasitic_cc1 += ONCHIP_VREG_LOSS_HIGH;


793 
total_parasitic_cc2 += ONCHIP_VREG_LOSS_HIGH;


794 
total_parasitic_cc3 += ONCHIP_VREG_LOSS_HIGH;


798 
onchip_parasitic_cc1 += ONCHIP_VREG_LOSS_HIGH;


799 
onchip_parasitic_cc2 += ONCHIP_VREG_LOSS_HIGH;


800 
onchip_parasitic_cc3 += ONCHIP_VREG_LOSS_HIGH;


795  801 
} 
802 


803 
total_parasitic_cc1 += onchip_parasitic_cc1 + offchip_parasitic_cc1; 

804 
total_parasitic_cc2 += onchip_parasitic_cc2 + offchip_parasitic_cc2; 

805 
total_parasitic_cc3 += onchip_parasitic_cc3 + offchip_parasitic_cc3; 

796  806  
797  807 
max_cycle_power_cc1 = MAX(max_cycle_power_cc1,current_total_cycle_power_cc1); 
798  808 
max_cycle_power_cc2 = MAX(max_cycle_power_cc2,current_total_cycle_power_cc2); 
...  ...  
1227  1237  
1228  1238 
stat_reg_double(sdb, "max_cycle_power_cc3", "maximum cycle power usage of cc3", &max_cycle_power_cc3, 0, NULL); 
1229  1239  
1230 
stat_reg_double(sdb, "parasitic_power_cc1", "parasitic power cc1", &total_parasitic_cc1, 0, NULL);


1231 
stat_reg_double(sdb, "parasitic_power_cc2", "parasitic power cc2", &total_parasitic_cc2, 0, NULL);


1232 
stat_reg_double(sdb, "parasitic_power_cc3", "parasitic power cc3", &total_parasitic_cc3, 0, NULL);


1240 
stat_reg_double(sdb, "parasitic_power_cc3", "total parasitic power cc3", &total_parasitic_cc3, 0, NULL);


1241 
stat_reg_double(sdb, "onchip parasitic_power_cc3", "onchip parasitic power cc3", &onchip_parasitic_cc3, 0, NULL);


1242 
stat_reg_double(sdb, "offchip parasitic_power_cc3", "offchip parasitic power cc3", &offchip_parasitic_cc3, 0, NULL);


1233  1243 
stat_reg_double(sdb, "min amperage", "min amperage", &min_amp, 0, NULL); 
1234  1244 
stat_reg_double(sdb, "max amperage", "max amperage", &max_amp, 0, NULL); 
1235  1245 
stat_reg_double(sdb, "slow_cycles", "slow cycles", &slow_cycles, 0, NULL); 
Also available in: Unified diff