Changeset 3298

Show
Ignore:
Timestamp:
05/17/06 00:08:56 (7 years ago)
Author:
ruik
Message:

Add the size computation for SDRAM, DDR and DDR2

Add the most common timing characteristics of SDRAM/DDR/DDR2 as brief output

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/prog/eeprom/decode-dimms.pl

    r3295 r3298  
    385385        my ($l, $temp); 
    386386 
     387#size computation 
     388 
     389        my $a = $bytes->[3]; 
     390        my $b = $bytes->[4]; 
     391        my $c = $bytes->[5]; 
     392        my $d = $bytes->[17]; 
     393        my $k=0; 
     394        my $ii=0; 
     395         
     396        $ii = (($a) & 0x0f) + (( $b) & 0x0f) - 17; 
     397        if (( $c <= 8) && ( $d <= 8)) { 
     398                 $k = ( $c) * ( $d); 
     399        } 
     400         
     401        if($ii > 0 && $ii <= 12 && $k > 0) { 
     402                printl "Size", ((1 << $ii) * $k) . "MB"; } 
     403        else {  
     404                printl "INVALID SIZE", $a . "," . $b . "," . $c . "," . $d; 
     405        } 
     406 
     407        my $highestCAS = 0; 
     408        my $trcd; 
     409        my $trp; 
     410        my $tras; 
     411        my $ctime = ($bytes->[9] >> 4) + ($bytes->[9] & 0xf) * 0.1; 
     412 
     413        if ($bytes->[18] & 1) { $highestCAS = 1; } 
     414        if ($bytes->[18] & 2) { $highestCAS = 2; } 
     415        if ($bytes->[18] & 4) { $highestCAS = 3; } 
     416        if ($bytes->[18] & 8) { $highestCAS = 4; } 
     417        if ($bytes->[18] & 16) { $highestCAS = 5; } 
     418        if ($bytes->[18] & 32) { $highestCAS = 6; } 
     419        if ($bytes->[18] & 64) { $highestCAS = 7; } 
     420        if ($bytes->[18] & 128) { $highestCAS = 8; } 
     421 
     422        $trcd =$bytes->[29]; 
     423        $trp =$bytes->[27];; 
     424        $tras =$bytes->[30]; 
     425 
     426        printl "tCL-tRCD-tRP-tRAS:" ,  $highestCAS .  "-" . ($trcd/$ctime) . "-" . ($trp/$ctime) . "-" . ($tras/$ctime); 
     427 
    387428        $l = "Number of Row Address Bits"; 
    388429        if ($bytes->[3] == 0) { printl $l, "Undefined!"; } 
     
    651692        $ddrclk = int ($ddrclk); 
    652693        printl $l, "${ddrclk}MHz (PC${pcclk})"; 
     694 
     695#size computation 
     696 
     697        my $a = $bytes->[3]; 
     698        my $b = $bytes->[4]; 
     699        my $c = $bytes->[5]; 
     700        my $d = $bytes->[17]; 
     701        my $k=0; 
     702        my $ii=0; 
     703         
     704        $ii = (($a) & 0x0f) + (( $b) & 0x0f) - 17; 
     705        if (( $c <= 8) && ( $d <= 8)) { 
     706                 $k = ( $c) * ( $d); 
     707        } 
     708         
     709        if($ii > 0 && $ii <= 12 && $k > 0) { 
     710                printl "Size", ((1 << $ii) * $k) . "MB"; } 
     711        else {  
     712                printl "INVALID SIZE", $a . "," . $b . "," . $c . "," . $d; 
     713        } 
     714 
     715        my $highestCAS = 0; 
     716        my $trcd; 
     717        my $trp; 
     718        my $tras; 
     719        my $ctime = ($bytes->[9] >> 4) + ($bytes->[9] & 0xf) * 0.1; 
     720 
     721        if ($bytes->[18] & 1) { $highestCAS = 1; } 
     722        if ($bytes->[18] & 2) { $highestCAS = 1.5; } 
     723        if ($bytes->[18] & 4) { $highestCAS = 2; } 
     724        if ($bytes->[18] & 8) { $highestCAS = 2.5; } 
     725        if ($bytes->[18] & 16) { $highestCAS = 3.5; } 
     726        if ($bytes->[18] & 32) { $highestCAS = 4; } 
     727        if ($bytes->[18] & 64) { $highestCAS = 4.5; } 
     728        if ($bytes->[18] & 128) { $highestCAS = 5; } 
     729         
     730        $trcd =($bytes->[29] >> 2)+(($bytes->[29] & 3)*0.25); 
     731        $trp =($bytes->[27] >> 2)+(($bytes->[27] & 3)*0.25); 
     732        $tras = $bytes->[30]; 
     733 
     734        printl "tCL-tRCD-tRP-tRAS:" ,  $highestCAS .  "-" . ($trcd/$ctime) . "-" . ($trp/$ctime) . "-" . ($tras/$ctime); 
     735 
    653736} 
    654737 
     
    669752        $ddrclk = int ($ddrclk); 
    670753        printl $l, "${ddrclk}MHz (PC${pcclk})"; 
     754 
     755#size computation 
     756        my $a = $bytes->[3]; 
     757        my $b = $bytes->[4]; 
     758        my $c = $bytes->[5]; 
     759        my $d = $bytes->[17]; 
     760        my $k=0; 
     761        my $ii=0; 
     762 
     763        $ii = ($a & 0x0f) + ($b & 0x0f) - 17; 
     764        $k = (($c & 0x7) + 1) * $d; 
     765         
     766        if($ii > 0 && $ii <= 12 && $k > 0) { 
     767                printl "Size", ((1 << $ii) * $k) . "MB";  
     768        } else { 
     769                printl "INVALID SIZE", $a . "," . $b . "," . $c . "," . $d; 
     770        } 
     771 
     772        my $highestCAS = 0; 
     773        my $trcd; 
     774        my $trp; 
     775        my $tras; 
     776        my $ctime = ($bytes->[9] >> 4) + ($bytes->[9] & 0xf) * 0.1; 
     777 
     778        if ($bytes->[18] & 4) { $highestCAS = 2; } 
     779        if ($bytes->[18] & 8) { $highestCAS = 3; } 
     780        if ($bytes->[18] & 16) { $highestCAS = 4; } 
     781        if ($bytes->[18] & 32) { $highestCAS = 5; } 
     782         
     783        $trcd =($bytes->[29] >> 2)+(($bytes->[29] & 3)*0.25); 
     784        $trp =($bytes->[27] >> 2)+(($bytes->[27] & 3)*0.25); 
     785        $tras =$bytes->[30]; 
     786 
     787        printl "tCL-tRCD-tRP-tRAS:" ,  $highestCAS .  "-" . ($trcd/$ctime) . "-" . ($trp/$ctime) . "-" . ($tras/$ctime); 
     788 
     789 
    671790} 
    672791