Skip to content

Commit

Permalink
SpecTek: add Speed Grade
Browse files Browse the repository at this point in the history
  • Loading branch information
PeratX committed Dec 2, 2019
1 parent 8dc80ab commit fb53f54
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 10 deletions.
26 changes: 19 additions & 7 deletions FlashDetector/src/iTXTech/FlashDetector/Decoder/Micron.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,17 +143,23 @@ class Micron extends Decoder{
"N" => [true, true, false]
];
protected const SPEED_GRADE = [
"12" => "166 MT/s",
"10" => "200 MT/s",
"6" => "333 MT/s",
"5" => "400 MT/s",
"37" => "533 MT/s",
"3" => "667 MT/s"
"15" => "NV-DDR TM3 133MT/s",
"12" => "NV-DDR TM4 166MT/s",
"10" => "NV-DDR TM5 200MT/s",
"75" => "NV-DDR2 TM5 266MT/s",
"6" => "NV-DDR2 TM6 333MT/s",
"5" => "NV-DDR2 TM7 400MT/s",
"37" => "NV-DDR2 TM8 533MT/s",
"3" => "NV-DDR3 TM9 666MT/s",
"25" => "NV-DDR3 TM10 800MT/s",
"18" => "NV-DDR3 TM11 1066MT/s",
"16" => "NV-DDR3 TM12 1200MT/s"
];
protected const OPERATING_TEMP_RANGE = [
"AAT" => Constants::MICRON_OTR_AAT,
"AIT" => Constants::MICRON_OTR_AIT,
"IT" => Constants::MICRON_OTR_IT,
"ET" => Constants::MICRON_OTR_IT,
"WT" => Constants::MICRON_OTR_WT,
];
protected const FEATURES = [
Expand Down Expand Up @@ -231,6 +237,13 @@ public static function decode(string $partNumber) : FlashInfo{
->setPackage(self::getOrDefault(self::shiftChars($partNumber, 2), self::PACKAGE));

if(self::shiftChars($partNumber, 1) == "-"){
foreach(self::PROD_STATUS as $k => $stat){
if(StringUtil::contains($partNumber, $k)){
$extra[Constants::PROD_STATUS] = $stat;
$partNumber = str_replace($k, "", $partNumber);
break;
}
}
$speed = self::matchFromStart($partNumber, self::SPEED_GRADE);
if($speed != Constants::UNKNOWN){
$extra[Constants::SPEED_GRADE] = $speed;
Expand All @@ -240,7 +253,6 @@ public static function decode(string $partNumber) : FlashInfo{
if($features != Constants::UNKNOWN){
$extra[Constants::FEATURES] = $features;
}
$extra[Constants::PROD_STATUS] = self::matchFromStart($partNumber, self::PROD_STATUS, Constants::MICRON_P);
if(self::shiftChars($partNumber, 1) == ":" and ($rev = self::shiftChars($partNumber, 1)) != ""){
$extra[Constants::DESIGN_REV] = $rev;
}
Expand Down
10 changes: 8 additions & 2 deletions FlashDetector/src/iTXTech/FlashDetector/Decoder/SpecTek.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,14 @@ public static function decode(string $partNumber) : FlashInfo{
if($ifInfo !== ""){
$extra["interfaceInfo"] = $ifInfo;
}
$flashInfo->setExtraInfo($extra);

return $flashInfo;
if(self::shiftChars($partNumber, 1) == "-"){
$speed = self::matchFromStart($partNumber, self::SPEED_GRADE);
if($speed != Constants::UNKNOWN){
$extra[Constants::SPEED_GRADE] = $speed;
}
}

return $flashInfo->setExtraInfo($extra);
}
}
2 changes: 1 addition & 1 deletion FlashDetector/src/iTXTech/FlashDetector/FlashDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public static function registerDecoder(string $decoder) : bool{
}

public static function detect(string $partNumber, bool $combineFdb = true) : FlashInfo{
$partNumber = strtoupper($partNumber);
$partNumber = str_replace([" ", ",", "&", ".", "|"], "", strtoupper($partNumber));
foreach(self::$decoders as $decoder){
if($decoder::check($partNumber)){
$info = $decoder::decode($partNumber);
Expand Down

0 comments on commit fb53f54

Please sign in to comment.