Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* * *************************************************************
- * Copyright notice
- *
- * (c) 2014 Chi Hoang (info@chihoang.de)
- * All rights reserved
- *
- * For family 10h processor the right formula is:
- * (100*(Fid+16))/(2^Did)
- * Inverse formulas are:
- * fid = (((2^Did) * freq) / 100) - 16
- * did = log2 ((100 * (fid +16))/f)
- * **************************************************************/
- class convertFreq {
- var $fixme;
- var $cpu=array();
- var $input=array();
- function convertFreq ($cpu,$type,$input) {
- $this->fixme=$cpu;
- $this->cpu=$type;
- $this->input=$input;
- }
- function tofreq () {
- $fixme=($this->fixme[$this->cpu]);
- $c=0;
- foreach ($this->input as $key=>$arr)
- {
- $vid=abs(($arr["vcore"]-1.55)/0.0125);
- $did=0;
- do {
- $fid = (((1 << (int) $did) * (float) $arr["freq"]) / 100) - $fixme;
- if ($fid < 0)
- {
- $did++;
- }
- } while ($fid < 0);
- if ($fid > 63)
- {
- $fid = 63;
- }
- $result[$c] = array ("vid"=>$vid,
- "fid"=>$fid,
- "did"=>$did);
- $c++;
- }
- return $result;
- }
- }
- ?>
- // -----------------------------------------------------------------------------------------------------------------------
- <?php
- /* * *************************************************************
- * Copyright notice
- *
- * (c) 2014 Chi Hoang (info@chihoang.de)
- * All rights reserved
- * **************************************************************/
- require_once("main.php");
- $cpu=array("1"=>16,"2"=>8);
- $type="2";
- $input=array("0"=> array("freq"=>"2400","vcore"=>"1.175"),
- "1"=> array("freq"=>"2000","vcore"=>"1.175")
- );
- $convert=new convertFreq($cpu,$type,$input);
- $result=$convert->tofreq();
- print_r($result);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement