Esempio n. 1
0
 public FlashChipDie(uint channelID, uint overallChipID, uint localChipID, uint dieID,
                     uint PlanesNoPerDie, uint BlocksNoPerPlane, uint PagesNoPerBlock)
 {
     CurrentActivePlaneID = 0;
     Planes = new FlashChipPlane[PlanesNoPerDie];
     for (uint i = 0; i < PlanesNoPerDie; i++)
     {
         Planes[i] = new FlashChipPlane(channelID, overallChipID, localChipID, dieID, i, BlocksNoPerPlane, PagesNoPerBlock);
     }
     BlockInfoAbstract = new BlockGroupData[BlocksNoPerPlane];
     for (uint i = 0; i < BlocksNoPerPlane; i++)
     {
         BlockInfoAbstract[i] = new BlockGroupData(i, PagesNoPerBlock * PlanesNoPerDie);
     }
 }
Esempio n. 2
0
        public void prepare()
        {
            IntegerPageAddress tempAddress = new IntegerPageAddress(0, 0, 0, 0, 0, 0, 0);

            switch (InitialSSDStatus)
            {
            case InitialStatus.SteadyState:
                double validPagesAverage    = ((double)initialPercentageOfValidPages / 100) * FTL.PagesNoPerBlock;
                double validPagesStdDev     = ((double)initialPercentagesOfValidPagesStdDev / 100) * FTL.PagesNoPerBlock;
                uint   totalAvailableBlocks = FTL.BlockNoPerPlane - (FTL.GarbageCollector.EmergencyThreshold_PlaneFreePages / FTL.PagesNoPerBlock) - 1;
                for (uint channelID = 0; channelID < FTL.ChannelCount; channelID++)
                {
                    for (uint chipID = 0; chipID < FTL.ChipNoPerChannel; chipID++)
                    {
                        for (uint dieID = 0; dieID < FTL.DieNoPerChip; dieID++)
                        {
                            for (uint planeID = 0; planeID < FTL.PlaneNoPerDie; planeID++)
                            {
                                FlashChipPlane targetPlane = FTL.ChannelInfos[channelID].FlashChips[chipID].Dies[dieID].Planes[planeID];
                                for (uint blockID = 0; blockID < totalAvailableBlocks; blockID++)
                                {
                                    double randomValue = pageStatusRandomGenerator.Normal(validPagesAverage, validPagesStdDev);
                                    if (randomValue < 0)
                                    {
                                        randomValue = validPagesAverage + (validPagesAverage - randomValue);
                                    }
                                    uint numberOfValidPages = Convert.ToUInt32(randomValue);    // * FTL.PagesNoPerBlock);
                                    if (numberOfValidPages > FTL.PagesNoPerBlock)
                                    {
                                        numberOfValidPages = FTL.PagesNoPerBlock;
                                    }
                                    for (uint pageID = 0; pageID < numberOfValidPages; pageID++)
                                    {
                                        FTL.MakePageValid(channelID, chipID, dieID, planeID, blockID, pageID);
                                    }
                                    for (uint pageID = numberOfValidPages; pageID < FTL.PagesNoPerBlock; pageID++)
                                    {
                                        FTL.MakePageInvalid(channelID, chipID, dieID, planeID, blockID, pageID);
                                    }

                                    if (FTL.ChannelInfos[channelID].FlashChips[chipID].Dies[dieID].Planes[planeID].Blocks[blockID].FreePageNo != 0)
                                    {
                                        throw new Exception("Huh for free pages");
                                    }
                                    if (FTL.ChannelInfos[channelID].FlashChips[chipID].Dies[dieID].Planes[planeID].Blocks[blockID].LastWrittenPageNo != 255)
                                    {
                                        throw new Exception("Huh for last written page no");
                                    }
                                }
                            }
                        }
                    }
                }
                break;

            case InitialStatus.Empty:
                break;

            default:
                throw new Exception("Unhandled initial status!");
            }
        }