Show
Ignore:
Timestamp:
12/11/08 16:59:24 (3 years ago)
Author:
khali
Message:

Get rid of $l in decode_sdr_sdram().

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • i2c-tools/trunk/eeprom/decode-dimms

    r5556 r5557  
    437437{ 
    438438        my $bytes = shift; 
    439         my ($l, $temp); 
     439        my $temp; 
    440440 
    441441# SPD revision 
     
    481481                ceil($tras/$ctime)); 
    482482 
    483         $l = "Number of Row Address Bits"; 
    484         if ($bytes->[3] == 0) { printl($l, "Undefined!"); } 
    485         elsif ($bytes->[3] == 1) { printl($l, "1/16"); } 
    486         elsif ($bytes->[3] == 2) { printl($l, "2/17"); } 
    487         elsif ($bytes->[3] == 3) { printl($l, "3/18"); } 
    488         else { printl($l, $bytes->[3]); } 
    489  
    490         $l = "Number of Col Address Bits"; 
    491         if ($bytes->[4] == 0) { printl($l, "Undefined!"); } 
    492         elsif ($bytes->[4] == 1) { printl($l, "1/16"); } 
    493         elsif ($bytes->[4] == 2) { printl($l, "2/17"); } 
    494         elsif ($bytes->[4] == 3) { printl($l, "3/18"); } 
    495         else { printl($l, $bytes->[4]); } 
    496  
    497         $l = "Number of Module Rows"; 
    498         if ($bytes->[5] == 0 ) { printl($l, "Undefined!"); } 
    499         else { printl($l, $bytes->[5]); } 
    500  
    501         $l = "Data Width"; 
    502         if ($bytes->[7] > 1) { 
    503                 printl($l, "Undefined!"); 
    504         } else { 
    505                 $temp = ($bytes->[7] * 256) + $bytes->[6]; 
    506                 printl($l, $temp); 
    507         } 
    508  
    509         $l = "Module Interface Signal Levels"; 
    510         if ($bytes->[8] == 0) { printl($l, "5.0 Volt/TTL"); } 
    511         elsif ($bytes->[8] == 1) { printl($l, "LVTTL"); } 
    512         elsif ($bytes->[8] == 2) { printl($l, "HSTL 1.5"); } 
    513         elsif ($bytes->[8] == 3) { printl($l, "SSTL 3.3"); } 
    514         elsif ($bytes->[8] == 4) { printl($l, "SSTL 2.5"); } 
    515         elsif ($bytes->[8] == 255) { printl($l, "New Table"); } 
    516         else { printl($l, "Undefined!"); } 
    517  
    518         $l = "Module Configuration Type"; 
    519         if ($bytes->[11] == 0) { printl($l, "No Parity"); } 
    520         elsif ($bytes->[11] == 1) { printl($l, "Parity"); } 
    521         elsif ($bytes->[11] == 2) { printl($l, "ECC");  } 
    522         else { printl($l, "Undefined!"); } 
    523  
    524         $l = "Refresh Type"; 
    525         if ($bytes->[12] > 126) { printl($l, "Self Refreshing"); } 
    526         else { printl($l, "Not Self Refreshing"); } 
    527  
    528         $l = "Refresh Rate"; 
     483        if ($bytes->[3] == 0) { $temp = "Undefined!"; } 
     484        elsif ($bytes->[3] == 1) { $temp = "1/16"; } 
     485        elsif ($bytes->[3] == 2) { $temp = "2/17"; } 
     486        elsif ($bytes->[3] == 3) { $temp = "3/18"; } 
     487        else { $temp = $bytes->[3]; } 
     488        printl("Number of Row Address Bits", $temp); 
     489 
     490        if ($bytes->[4] == 0) { $temp = "Undefined!"; } 
     491        elsif ($bytes->[4] == 1) { $temp = "1/16"; } 
     492        elsif ($bytes->[4] == 2) { $temp = "2/17"; } 
     493        elsif ($bytes->[4] == 3) { $temp = "3/18"; } 
     494        else { $temp = $bytes->[4]; } 
     495        printl("Number of Col Address Bits", $temp); 
     496 
     497        if ($bytes->[5] == 0) { $temp = "Undefined!"; } 
     498        else { $temp = $bytes->[5]; } 
     499        printl("Number of Module Rows", $temp); 
     500 
     501        if ($bytes->[7] > 1) { $temp = "Undefined!"; } 
     502        else { $temp = ($bytes->[7] * 256) + $bytes->[6]; } 
     503        printl("Data Width", $temp); 
     504 
     505        if ($bytes->[8] == 0) { $temp = "5.0 Volt/TTL"; } 
     506        elsif ($bytes->[8] == 1) { $temp = "LVTTL"; } 
     507        elsif ($bytes->[8] == 2) { $temp = "HSTL 1.5"; } 
     508        elsif ($bytes->[8] == 3) { $temp = "SSTL 3.3"; } 
     509        elsif ($bytes->[8] == 4) { $temp = "SSTL 2.5"; } 
     510        elsif ($bytes->[8] == 255) { $temp = "New Table"; } 
     511        else { $temp = "Undefined!"; } 
     512        printl("Module Interface Signal Levels", $temp); 
     513 
     514        if ($bytes->[11] == 0) { $temp = "No Parity"; } 
     515        elsif ($bytes->[11] == 1) { $temp = "Parity"; } 
     516        elsif ($bytes->[11] == 2) { $temp = "ECC";  } 
     517        else { $temp = "Undefined!"; } 
     518        printl("Module Configuration Type", $temp); 
     519 
     520        if ($bytes->[12] > 126) { $temp = "Self Refreshing"; } 
     521        else { $temp = "Not Self Refreshing"; } 
     522        printl("Refresh Type", $temp); 
     523 
    529524        $temp = $bytes->[12] & 0x7f; 
    530         if ($temp == 0) { printl($l, "Normal (15.625 us)"); } 
    531         elsif ($temp == 1) { printl($l, "Reduced (3.9 us)"); } 
    532         elsif ($temp == 2) { printl($l, "Reduced (7.8 us)"); } 
    533         elsif ($temp == 3) { printl($l, "Extended (31.3 us)"); } 
    534         elsif ($temp == 4) { printl($l, "Extended (62.5 us)"); } 
    535         elsif ($temp == 5) { printl($l, "Extended (125 us)"); } 
    536         else { printl($l, "Undefined!"); } 
    537  
    538         $l = "Primary SDRAM Component Bank Config"; 
    539         if ($bytes->[13] > 126) { printl($l, "Bank2 = 2 x Bank1"); } 
    540         else { printl($l, "No Bank2 OR Bank2 = Bank1 width"); } 
    541  
    542         $l = "Primary SDRAM Component Widths"; 
     525        if ($temp == 0) { $temp = "Normal (15.625 us)"; } 
     526        elsif ($temp == 1) { $temp = "Reduced (3.9 us)"; } 
     527        elsif ($temp == 2) { $temp = "Reduced (7.8 us)"; } 
     528        elsif ($temp == 3) { $temp = "Extended (31.3 us)"; } 
     529        elsif ($temp == 4) { $temp = "Extended (62.5 us)"; } 
     530        elsif ($temp == 5) { $temp = "Extended (125 us)"; } 
     531        else { $temp = "Undefined!"; } 
     532        printl("Refresh Rate", $temp); 
     533 
     534        if ($bytes->[13] > 126) { $temp = "Bank2 = 2 x Bank1"; } 
     535        else { $temp = "No Bank2 OR Bank2 = Bank1 width"; } 
     536        printl("Primary SDRAM Component Bank Config", $temp); 
     537 
    543538        $temp = $bytes->[13] & 0x7f; 
    544         if ($temp == 0) { printl($l, "Undefined!"); } 
    545         else { printl($l, $temp); } 
    546  
    547         $l = "Error Checking SDRAM Component Bank Config"; 
    548         if ($bytes->[14] > 126) { printl($l, "Bank2 = 2 x Bank1"); } 
    549         else { printl($l, "No Bank2 OR Bank2 = Bank1 width"); } 
    550  
    551         $l = "Error Checking SDRAM Component Widths"; 
     539        if ($temp == 0) { $temp = "Undefined!"; } 
     540        printl("Primary SDRAM Component Widths", $temp); 
     541 
     542        if ($bytes->[14] > 126) { $temp = "Bank2 = 2 x Bank1"; } 
     543        else { $temp = "No Bank2 OR Bank2 = Bank1 width"; } 
     544        printl("Error Checking SDRAM Component Bank Config", $temp); 
     545 
    552546        $temp = $bytes->[14] & 0x7f; 
    553         if ($temp == 0) { printl($l, "Undefined!"); } 
    554         else { printl($l, $temp); } 
    555  
    556         $l = "Min Clock Delay for Back to Back Random Access"; 
    557         if ($bytes->[15] == 0) { printl($l, "Undefined!"); } 
    558         else { printl($l, $bytes->[15]); } 
    559  
    560         $l = "Supported Burst Lengths"; 
     547        if ($temp == 0) { $temp = "Undefined!"; } 
     548        printl("Error Checking SDRAM Component Widths", $temp); 
     549 
     550        if ($bytes->[15] == 0) { $temp = "Undefined!"; } 
     551        else { $temp = $bytes->[15]; } 
     552        printl("Min Clock Delay for Back to Back Random Access", $temp); 
     553 
    561554        my @array; 
    562555        for ($ii = 0; $ii < 4; $ii++) { 
     
    566559        if (@array) { $temp = join ', ', @array; } 
    567560        else { $temp = "None"; } 
    568         printl($l, $temp); 
    569  
    570         $l = "Number of Device Banks"; 
    571         if ($bytes->[17] == 0) { printl($l, "Undefined/Reserved!"); } 
    572         else { printl($l, $bytes->[17]); } 
    573  
    574         $l = "Supported CAS Latencies"; 
    575         printl($l, cas_latencies(@cas)); 
    576  
    577         $l = "Supported CS Latencies"; 
     561        printl("Supported Burst Lengths", $temp); 
     562 
     563        if ($bytes->[17] == 0) { $temp = "Undefined/Reserved!"; } 
     564        else { $temp = $bytes->[17]; } 
     565        printl("Number of Device Banks", $temp); 
     566 
     567        printl("Supported CAS Latencies", cas_latencies(@cas)); 
     568 
    578569        @array = (); 
    579570        for ($ii = 0; $ii < 7; $ii++) { 
     
    582573        if (@array) { $temp = join ', ', @array; } 
    583574        else { $temp = "None"; } 
    584         printl($l, $temp); 
    585  
    586         $l = "Supported WE Latencies"; 
     575        printl("Supported CS Latencies", $temp); 
     576 
    587577        @array = (); 
    588578        for ($ii = 0; $ii < 7; $ii++) { 
     
    591581        if (@array) { $temp = join ', ', @array; } 
    592582        else { $temp = "None"; } 
    593         printl($l, $temp); 
     583        printl("Supported WE Latencies", $temp); 
    594584 
    595585        if (@cas >= 1) { 
    596                 $l = "Cycle Time at CAS ".$cas[$#cas]; 
    597                 printl($l, "$ctime ns"); 
    598  
    599                 $l = "Access Time at CAS ".$cas[$#cas]; 
     586                printl("Cycle Time at CAS ".$cas[$#cas], "$ctime ns"); 
     587 
    600588                $temp = ($bytes->[10] >> 4) + ($bytes->[10] & 0xf) * 0.1; 
    601                 printl($l, "$temp ns"); 
     589                printl("Access Time at CAS ".$cas[$#cas], "$temp ns"); 
    602590        } 
    603591 
    604592        if (@cas >= 2 && spd_written(@$bytes[23..24])) { 
    605                 $l = "Cycle Time at CAS ".$cas[$#cas-1]; 
    606593                $temp = $bytes->[23] >> 4; 
    607                 if ($temp == 0) { printl($l, "Undefined!"); } 
     594                if ($temp == 0) { $temp = "Undefined!"; } 
    608595                else { 
    609                         if ($temp < 4 ) { $temp += 15; } 
    610                         printl($l, $temp + (($bytes->[23] & 0xf) * 0.1) . " ns"); 
    611                 } 
    612  
    613                 $l = "Access Time at CAS ".$cas[$#cas-1]; 
     596                        $temp += 15 if $temp < 4; 
     597                        $temp += ($bytes->[23] & 0xf) * 0.1; 
     598                        $temp .= " ns"; 
     599                } 
     600                printl("Cycle Time at CAS ".$cas[$#cas-1], $temp); 
     601 
    614602                $temp = $bytes->[24] >> 4; 
    615                 if ($temp == 0) { printl($l, "Undefined!"); } 
     603                if ($temp == 0) { $temp = "Undefined!"; } 
    616604                else { 
    617                         if ($temp < 4 ) { $temp += 15; } 
    618                         printl($l, $temp + (($bytes->[24] & 0xf) * 0.1) . " ns"); 
    619                 } 
     605                        $temp += 15 if $temp < 4; 
     606                        $temp += ($bytes->[24] & 0xf) * 0.1; 
     607                        $temp .= " ns"; 
     608                } 
     609                printl("Access Time at CAS ".$cas[$#cas-1], $temp); 
    620610        } 
    621611 
    622612        if (@cas >= 3 && spd_written(@$bytes[25..26])) { 
    623                 $l = "Cycle Time at CAS ".$cas[$#cas-2]; 
    624613                $temp = $bytes->[25] >> 2; 
    625                 if ($temp == 0) { printl($l, "Undefined!"); } 
    626                 else { printl($l, $temp + ($bytes->[25] & 0x3) * 0.25 . " ns"); } 
    627  
    628                 $l = "Access Time at CAS ".$cas[$#cas-2]; 
     614                if ($temp == 0) { $temp = "Undefined!"; } 
     615                else { 
     616                        $temp += ($bytes->[25] & 0x3) * 0.25; 
     617                        $temp .= " ns"; 
     618                } 
     619                printl("Cycle Time at CAS ".$cas[$#cas-2], $temp); 
     620 
    629621                $temp = $bytes->[26] >> 2; 
    630                 if ($temp == 0) { printl($l, "Undefined!"); } 
    631                 else { printl($l, $temp + ($bytes->[26] & 0x3) * 0.25 . " ns"); } 
    632         } 
    633  
    634         $l = "SDRAM Module Attributes"; 
     622                if ($temp == 0) { $temp = "Undefined!"; } 
     623                else { 
     624                        $temp += ($bytes->[26] & 0x3) * 0.25; 
     625                        $temp .= " ns"; 
     626                } 
     627                printl("Access Time at CAS ".$cas[$#cas-2], $temp); 
     628        } 
     629 
    635630        $temp = ""; 
    636631        if ($bytes->[21] & 1) { $temp .= "Buffered Address/Control Inputs\n"; } 
     
    643638        if ($bytes->[21] & 128) { $temp .= "Undefined (bit 7)\n"; } 
    644639        if ($bytes->[21] == 0) { $temp .= "(None Reported)\n"; } 
    645         printl($l, $temp); 
    646  
    647         $l = "SDRAM Device Attributes (General)"; 
     640        printl("SDRAM Module Attributes", $temp); 
     641 
    648642        $temp = ""; 
    649643        if ($bytes->[22] & 1) { $temp .= "Supports Early RAS# Recharge\n"; } 
     
    657651        if ($bytes->[22] & 64) { $temp .= "Undefined (bit 6)\n"; } 
    658652        if ($bytes->[22] & 128) { $temp .= "Undefined (bit 7)\n"; } 
    659         printl($l, $temp); 
    660  
    661         $l = "Minimum Row Precharge Time"; 
    662         if ($bytes->[27] == 0) { printl($l, "Undefined!"); } 
    663         else { printl($l, "$bytes->[27] ns"); } 
    664  
    665         $l = "Row Active to Row Active Min"; 
    666         if ($bytes->[28] == 0) { printl($l, "Undefined!"); } 
    667         else { printl($l, "$bytes->[28] ns"); } 
    668  
    669         $l = "RAS to CAS Delay"; 
    670         if ($bytes->[29] == 0) { printl($l, "Undefined!"); } 
    671         else { printl($l, "$bytes->[29] ns"); } 
    672  
    673         $l = "Min RAS Pulse Width"; 
    674         if ($bytes->[30] == 0) { printl($l, "Undefined!"); } 
    675         else { printl($l, "$bytes->[30] ns"); } 
    676  
    677         $l = "Row Densities"; 
     653        printl("SDRAM Device Attributes (General)", $temp); 
     654 
     655        if ($bytes->[27] == 0) { $temp = "Undefined!"; } 
     656        else { $temp = "$bytes->[27] ns"; } 
     657        printl("Minimum Row Precharge Time", $temp); 
     658 
     659        if ($bytes->[28] == 0) { $temp = "Undefined!"; } 
     660        else { $temp = "$bytes->[28] ns"; } 
     661        printl("Row Active to Row Active Min", $temp); 
     662 
     663        if ($bytes->[29] == 0) { $temp = "Undefined!"; } 
     664        else { $temp = "$bytes->[29] ns"; } 
     665        printl("RAS to CAS Delay", $temp); 
     666 
     667        if ($bytes->[30] == 0) { $temp = "Undefined!"; } 
     668        else { $temp = "$bytes->[30] ns"; } 
     669        printl("Min RAS Pulse Width", $temp); 
     670 
    678671        $temp = ""; 
    679672        if ($bytes->[31] & 1) { $temp .= "4 MByte\n"; } 
     
    686679        if ($bytes->[31] & 128) { $temp .= "512 MByte\n"; } 
    687680        if ($bytes->[31] == 0) { $temp .= "(Undefined! -- None Reported!)\n"; } 
    688         printl($l, $temp); 
     681        printl("Row Densities", $temp); 
    689682 
    690683        if (($bytes->[32] & 0xf) <= 9) { 
    691                 $l = "Command and Address Signal Setup Time"; 
    692684                $temp = (($bytes->[32] & 0x7f) >> 4) + ($bytes->[32] & 0xf) * 0.1; 
    693                 printl($l, (($bytes->[32] >> 7) ? -$temp : $temp) . " ns"); 
     685                printl("Command and Address Signal Setup Time", 
     686                       (($bytes->[32] >> 7) ? -$temp : $temp) . " ns"); 
    694687        } 
    695688 
    696689        if (($bytes->[33] & 0xf) <= 9) { 
    697                 $l = "Command and Address Signal Hold Time"; 
    698690                $temp = (($bytes->[33] & 0x7f) >> 4) + ($bytes->[33] & 0xf) * 0.1; 
    699                 printl($l, (($bytes->[33] >> 7) ? -$temp : $temp) . " ns"); 
     691                printl("Command and Address Signal Hold Time", 
     692                       (($bytes->[33] >> 7) ? -$temp : $temp) . " ns"); 
    700693        } 
    701694 
    702695        if (($bytes->[34] & 0xf) <= 9) { 
    703                 $l = "Data Signal Setup Time"; 
    704696                $temp = (($bytes->[34] & 0x7f) >> 4) + ($bytes->[34] & 0xf) * 0.1; 
    705                 printl($l, (($bytes->[34] >> 7) ? -$temp : $temp) . " ns"); 
     697                printl("Data Signal Setup Time", 
     698                       (($bytes->[34] >> 7) ? -$temp : $temp) . " ns"); 
    706699        } 
    707700 
    708701        if (($bytes->[35] & 0xf) <= 9) { 
    709                 $l = "Data Signal Hold Time"; 
    710702                $temp = (($bytes->[35] & 0x7f) >> 4) + ($bytes->[35] & 0xf) * 0.1; 
    711                 printl($l, (($bytes->[35] >> 7) ? -$temp : $temp) . " ns"); 
     703                printl("Data Signal Hold Time", 
     704                       (($bytes->[35] >> 7) ? -$temp : $temp) . " ns"); 
    712705        } 
    713706}