diff options
author | Andres Lugo-Reyes <aalugore@us.ibm.com> | 2018-01-25 11:23:45 -0600 |
---|---|---|
committer | Andres A. Lugo-Reyes <aalugore@us.ibm.com> | 2018-01-26 12:48:52 -0500 |
commit | f72f857b7e5ab25a5616b1655005b963405eb350 (patch) | |
tree | ca1917a05db95048670dfee8292156e63eb5e3db | |
parent | 577915f28604090d3b9a16e7a5a109d3afff87f9 (diff) | |
download | talos-occ-f72f857b7e5ab25a5616b1655005b963405eb350.tar.gz talos-occ-f72f857b7e5ab25a5616b1655005b963405eb350.zip |
WOF: Fix incorrect scaling of IQ currents
-increase precision when interpolating between two data points
Change-Id: Id7022f37af5afd5c327eea8f9eb50f2b927b13e8
CQ:SW414955
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/52644
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Martha Broyles <mbroyles@us.ibm.com>
Reviewed-by: Francesco A. Campisano <campisan@us.ibm.com>
Reviewed-by: Christopher J. Cain <cjcain@us.ibm.com>
Reviewed-by: Andres A. Lugo-Reyes <aalugore@us.ibm.com>
-rw-r--r-- | src/occ_405/wof/wof.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/occ_405/wof/wof.c b/src/occ_405/wof/wof.c index 68b2f5c..ce8e925 100644 --- a/src/occ_405/wof/wof.c +++ b/src/occ_405/wof/wof.c @@ -1258,7 +1258,7 @@ inline int32_t interpolate_linear( int32_t i_X, int32_t i_y1, int32_t i_y2 ) { - return (i_X - i_x1)*((i_y2 - i_y1) / (i_x2 - i_x1)) + i_y1; + return ( ((i_X - i_x1)*(i_y2 - i_y1)) / (i_x2 - i_x1) ) + i_y1; } /** @@ -1940,10 +1940,12 @@ uint32_t scale_and_interpolate( uint16_t * i_leak_arr, int16_t upper_delta = i_base_temp - (i_avgtemp_arr[i_idx+1] >> 1); // Scale the currents based on the delta temperature + // Note: leakage arrays are in 0.5mA. Multiply by 5 to convert + // to 10mA uint32_t scaled_lower_leak = scale( i_leak_arr[i_idx], - lower_delta ); + lower_delta )*5; uint32_t scaled_upper_leak = scale( i_leak_arr[i_idx+1], - upper_delta ); + upper_delta )*5; // Approximate current between the scaled currents using linear // interpolation and return the result |