Ejemplo n.º 1
0
 public RequestSegmentation(HostInterfaceNVMe HI, NVMeIODispatcherRPB handler, FTL ftl)
 {
     myHI      = HI;
     myHandler = handler;
     myFTL     = ftl;
     Locked    = false;
 }
Ejemplo n.º 2
0
 public void AllocatePlaneToWriteTransaction(InternalWriteRequest internalReq)
 {
     if (myFTL.AddressMapper.AddressMappingDomains[internalReq.RelatedIORequest.StreamID].MappingTable.State[internalReq.LPN] != 0)
     {
         if ((internalReq.State & myFTL.AddressMapper.AddressMappingDomains[internalReq.RelatedIORequest.StreamID].MappingTable.State[internalReq.LPN])
             != myFTL.AddressMapper.AddressMappingDomains[internalReq.RelatedIORequest.StreamID].MappingTable.State[internalReq.LPN])
         {
             myFTL.TotalPageReads++;
             myFTL.PageReadsForWorkload++;
             myFTL.PageReadsForUpdate++;
             InternalReadRequest update = new InternalReadRequest();
             myFTL.AddressMapper.ConvertPPNToPageAddress(myFTL.AddressMapper.AddressMappingDomains[internalReq.RelatedIORequest.StreamID].MappingTable.PPN[internalReq.LPN], update.TargetPageAddress);
             update.TargetFlashChip     = myFTL.FlashChips[update.TargetPageAddress.OverallFlashChipID];
             update.LPN                 = internalReq.LPN;
             update.PPN                 = myFTL.AddressMapper.AddressMappingDomains[internalReq.RelatedIORequest.StreamID].MappingTable.PPN[internalReq.LPN];
             update.State               = ((myFTL.AddressMapper.AddressMappingDomains[internalReq.RelatedIORequest.StreamID].MappingTable.State[internalReq.LPN] ^ internalReq.State) & 0x7fffffff);
             update.SizeInSubpages      = FTL.SizeInSubpages(update.State);
             update.SizeInByte          = update.SizeInSubpages * FTL.SubPageCapacity;
             update.BodyTransferCycles  = update.SizeInByte / FTL.ChannelWidthInByte;
             update.Type                = InternalRequestType.Read;
             update.IsUpdate            = true;
             update.RelatedWrite        = internalReq;
             update.RelatedIORequest    = internalReq.RelatedIORequest;
             internalReq.UpdateRead     = update;
             internalReq.State          = (internalReq.State | update.State);
             internalReq.SizeInSubpages = FTL.SizeInSubpages(internalReq.State);
         }
     }
     myFTL.AddressMapper.AllocatePlaneForWrite(internalReq.RelatedIORequest.StreamID, internalReq);
 }
Ejemplo n.º 3
0
        public HostInterfaceNVMe(
            string id,
            FTL ftl,
            Controller controller,
            int numberOfTraces,
            InputStreamBase[] inputStreams,
            bool RTLoggingEnabled,
            string RTLogFilePath)
            : base(id)
        {
            FTL                   = ftl;
            Controller            = controller;
            this.RTLoggingEnabled = RTLoggingEnabled;

            numberOfStreams = numberOfTraces;
            _inputStreams   = inputStreams;
            loggingCntr     = new ulong[numberOfTraces];
            for (int i = 0; i < numberOfTraces; i++)
            {
                loggingCntr[i] = 0;
            }

            if (RTLoggingEnabled)
            {
                this.RTLogFilePath = RTLogFilePath;
                this.RTLogFile     = new StreamWriter(RTLogFilePath);
                this.RTLogFile.WriteLine("Time(us)\tAverageResponseTime(us)\tThisRoundAverageResponseTime(us)\tMultiplaneReadCommandRatio\tInterleavedReadCommandRatio\tMultiplaneWriteCommandRatio\tInterleavedWriteCommandRatio\tAverageRatePerMillisecond(gc/s)\tAverageRatePerMillisecondThisRound(gc/s)\tAverageReadCMDWaitingTime(us)\tAverageProgramCMDWaitingTime(us)");
                this.RTLogFileR = new StreamWriter(RTLogFilePath.Remove(RTLogFilePath.LastIndexOf(".log")) + "-R.log");
                this.RTLogFileR.WriteLine("Time(us)\tAverageResponseTime(us)\tThisRoundAverageResponseTime(us)");
                this.RTLogFileW = new StreamWriter(RTLogFilePath.Remove(RTLogFilePath.LastIndexOf(".log")) + "-W.log");
                this.RTLogFileW.WriteLine("Time(us)\tAverageResponseTime(us)\tThisRoundAverageResponseTime(us)");
            }
        }
Ejemplo n.º 4
0
 public NVMeIODispatcherSimple(string id, FTL ftl, HostInterface HI, uint streamCount, uint requestWindow) : base(id, ftl, HI as HostInterfaceNVMe)
 {
     RequestWindow              = requestWindow;
     this.streamCount           = streamCount;
     executingRequestsPerStream = new uint[streamCount];
     for (int i = 0; i < streamCount; i++)
     {
         executingRequestsPerStream[i] = 0;
     }
     dispatcherLocked = false;
 }
        public HostInterfaceSynthetic(
            string id,
            uint NCQSize,
            FTL ftl,
            Controller controller,
            AddressMappingDomain mappingDomain,
            HostInterface.ReqeustGenerationMode mode,
            ulong numberOfRequestsToBeGenerated,
            ulong averageRequestInterArrivalTime,
            uint readPercentage,
            InputStreamSynthetic.DistributionType addressDistributionType,
            double addressDistributionParam1,
            double addressDistributionParam2,
            InputStreamSynthetic.DistributionType requestSizeDistributionType,
            uint requestSizeDistributionParam1B,
            uint requestSizeDistributionParam2B,
            int seed,
            bool RTLoggingEnabled,
            string RTLogFilePath)
            : base(id)
        {
            this.NCQSize    = NCQSize;
            this.FTL        = ftl;
            this.Controller = controller;
            this.Mode       = mode;

            this.numberOfRequestsToBeSeen = numberOfRequestsToBeGenerated;
            this.reqNoUnit = numberOfRequestsToBeGenerated;
            this.averageRequestInterArrivalTime = averageRequestInterArrivalTime;
            this.readRatio = (double)readPercentage / (double)100;

            inputStream = new InputStreamSynthetic("SynthFlow0", StreamPriorityClass.High, mappingDomain, numberOfRequestsToBeGenerated,
                                                   averageRequestInterArrivalTime, readPercentage, addressDistributionType, addressDistributionParam1, addressDistributionParam2,
                                                   requestSizeDistributionType, requestSizeDistributionParam1B, requestSizeDistributionParam2B, seed++);

            this.RTLoggingEnabled = RTLoggingEnabled;
            if (RTLoggingEnabled)
            {
                this.RTLogFilePath = RTLogFilePath;
                this.RTLogFile     = new StreamWriter(RTLogFilePath);
                //this.RTLogFile.WriteLine("Time(us)\tAverageResponseTime(us)\tThisRoundAverageResponseTime(us)\tAverageRatePerMillisecond(gc/s)\tAverageRatePerMillisecondThisRound(gc/s)");
                this.RTLogFile.WriteLine("Time(us)\tAverageResponseTime(us)\tThisRoundAverageResponseTime(us)\tMultiplaneReadCommandRatio\tInterleavedReadCommandRatio\tMultiplaneWriteCommandRatio\tInterleavedWriteCommandRatio\tAverageRatePerMillisecond(gc/s)\tAverageRatePerMillisecondThisRound(gc/s)\tAverageReadCMDWaitingTime(us)\tAverageProgramCMDWaitingTime(us)");
                this.RTLogFileR = new StreamWriter(RTLogFilePath.Remove(RTLogFilePath.LastIndexOf(".log")) + "-R.log");
                this.RTLogFileR.WriteLine("Time(us)\tAverageResponseTime(us)\tThisRoundAverageResponseTime(us)");
                this.RTLogFileW = new StreamWriter(RTLogFilePath.Remove(RTLogFilePath.LastIndexOf(".log")) + "-W.log");
                this.RTLogFileW.WriteLine("Time(us)\tAverageResponseTime(us)\tThisRoundAverageResponseTime(us)");
            }
        }
Ejemplo n.º 6
0
 public NVMeIODispatcherRPB(string id, FTL ftl, HostInterface HI, uint maxInternalQueueCapacityPerFlow,
                            InputStreamBase[] inputStreams, uint channelCount, ulong historyUpdateInterval) : base(id, ftl, HI as HostInterfaceNVMe)
 {
     Flows = new FlowInformation[inputStreams.Length];
     for (int i = 0; i < inputStreams.Length; i++)
     {
         Flows[i] = new FlowInformation(maxInternalQueueCapacityPerFlow, inputStreams[i].PriorityClass);
     }
     IOFetchEngine                          = new IOFetchEngine(HI as HostInterfaceNVMe, this);
     RequestSegmenter                       = new RequestSegmentation(HI as HostInterfaceNVMe, this, ftl);
     this.historyUpdateInterval             = historyUpdateInterval;
     ftl.ResourceAccessTable                = new RPBResourceAccessTable();
     ftl.ResourceAccessTable.ChannelEntries = new ResourceAccessTableEntry[ftl.ChannelCount];
     ftl.ResourceAccessTable.DieEntries     = new ResourceAccessTableEntry[ftl.ChannelCount][][];
     ftl.ResourceAccessTable.PlaneEntries   = new ResourceAccessTableEntry[ftl.ChannelCount][][][];
     for (int i = 0; i < ftl.ChannelCount; i++)
     {
         ftl.ResourceAccessTable.ChannelEntries[i] = new ResourceAccessTableEntry();
         ftl.ResourceAccessTable.DieEntries[i]     = new ResourceAccessTableEntry[ftl.ChipNoPerChannel][];
         ftl.ResourceAccessTable.PlaneEntries[i]   = new ResourceAccessTableEntry[ftl.ChipNoPerChannel][][];
         for (int chipCntr = 0; chipCntr < ftl.ChipNoPerChannel; chipCntr++)
         {
             ftl.ResourceAccessTable.DieEntries[i][chipCntr]   = new ResourceAccessTableEntry[ftl.DieNoPerChip];
             ftl.ResourceAccessTable.PlaneEntries[i][chipCntr] = new ResourceAccessTableEntry[ftl.DieNoPerChip][];
             for (int dieCntr = 0; dieCntr < ftl.DieNoPerChip; dieCntr++)
             {
                 ftl.ResourceAccessTable.DieEntries[i][chipCntr][dieCntr]   = new ResourceAccessTableEntry();
                 ftl.ResourceAccessTable.PlaneEntries[i][chipCntr][dieCntr] = new ResourceAccessTableEntry[ftl.PlaneNoPerDie];
                 for (int planeCntr = 0; planeCntr < ftl.PlaneNoPerDie; planeCntr++)
                 {
                     ftl.ResourceAccessTable.PlaneEntries[i][chipCntr][dieCntr][planeCntr] = new ResourceAccessTableEntry();
                 }
             }
         }
     }
 }
Ejemplo n.º 7
0
 public IOSchedulerBase(string id, FTL ftl) : base(id)
 {
     _FTL = ftl;
 }
Ejemplo n.º 8
0
        public Controller BuildControllerBus(
            string id,
            uint rowCount,
            uint chipNoPerRow,
            uint channelWidth,
            ulong readTransferCycleTime,
            ulong writeTransferCycleTime,
            ulong readCommandAddressCycleCount,
            ulong writeCommandAddressCycleCount,
            ulong eraseCommandAddressCycleCount,
            ulong dummyBusyTime,
            ulong readDataOutputReadyTime,
            ulong ALEtoDataStartTransitionTime,
            ulong WEtoRBTransitionTime,
            ulong suspendProgramTime,
            ulong suspendEraseTime,
            ulong readLatency,  /*page read delay in nano-seconds*/
            ulong writeLatency, /*page write delay in nano-seconds*/
            ulong eraseLatency, /*block erase delay in nano-seconds*/
            uint dieNoPerChip,
            uint planeNoPerDie,
            uint blockNoPerPlane,
            uint pageNoPerBlock,
            uint pageCapacity,
            uint blockEraseLimit,
            uint hostBufferSize,
            GarbageCollector.GCPolicyType GCType,
            uint RGAConstant,
            uint WGreedyWindowSize,
            bool dynamicWearLevelingEnabled,
            HostInterface.HostInterfaceType hostInterfaceType,
            InitialStatus initialStatus,
            uint percentageOfValidPages,
            uint validPagesStdDev,
            double overprovisionRatio,
            bool dataCachingEnabled,
            uint dataCacheCapacity,
            bool dftlEnabled,
            uint dftlCapacity,
            IOSchedulingPolicy ioSchedulingPolicy,
            uint windowSize,
            PlaneAllocationSchemeType planeAllocationScheme,
            BlockAllocationSchemeType blockAllocationScheme,
            bool twainBlockManagementEnabled,
            bool copyBackEnabled,
            bool copyBackOddEvenPageConstraint,
            bool multiplaneCMDEnabled,
            bool iBAConstraintForMultiplane,
            bool interleavedCMDEnabled,
            uint readToWritePrioritizationFactor,
            uint writeToErasePrioritizationFactor,
            WorkloadParameterSet[] Workloads,
            bool LoggingEnabled,
            MultistageSchedulingParameters copParameters,
            string RTLogFilePath,//path of response time log file: Used to record each response time of each request
            FlashChip[][] flashChips,
            int seed
            )
        {
            Controller ctrl = new Controller(id, initialStatus, percentageOfValidPages, validPagesStdDev, null, ++seed);

            GarbageCollector gc = new GarbageCollector(id + ".GC", GCType, RGAConstant, WGreedyWindowSize, overprovisionRatio,
                                                       rowCount * chipNoPerRow, pageNoPerBlock * blockNoPerPlane, blockNoPerPlane, pageNoPerBlock,
                                                       dynamicWearLevelingEnabled, copyBackEnabled, copyBackOddEvenPageConstraint, multiplaneCMDEnabled,
                                                       interleavedCMDEnabled, LoggingEnabled,
                                                       twainBlockManagementEnabled, RTLogFilePath, ++seed);
            int numberOfInputStreams = Workloads.Length;

            AddressMappingDomain[] addressMappingDomains = new AddressMappingDomain[numberOfInputStreams];
            for (int i = 0; i < Workloads.Length; i++)
            {
                string[] channelIDs = Workloads[i].ChannelIDs.Split(Separator);
                uint[]   channels   = new uint[channelIDs.Length];
                for (int j = 0; j < channels.Length; j++)
                {
                    channels[j] = uint.Parse(channelIDs[j]);
                }
                Array.Sort(channels);
                if (channels[channels.Length - 1] >= rowCount)
                {
                    throw new Exception("Bad channel number specified for workload No " + i + "!");
                }

                string[] chiplIDs = Workloads[i].ChipIDs.Split(Separator);
                uint[]   chips    = new uint[chiplIDs.Length];
                for (int j = 0; j < chips.Length; j++)
                {
                    chips[j] = uint.Parse(chiplIDs[j]);
                }
                Array.Sort(chips);
                if (chips[chips.Length - 1] >= chipNoPerRow)
                {
                    throw new Exception("Bad chip number specified for workload No  " + i + "!");
                }

                string[] dieIDs = Workloads[i].DieIDs.Split(Separator);
                uint[]   dies   = new uint[dieIDs.Length];
                for (int j = 0; j < dies.Length; j++)
                {
                    dies[j] = uint.Parse(dieIDs[j]);
                }
                Array.Sort(dies);
                if (dies[dies.Length - 1] >= dieNoPerChip)
                {
                    throw new Exception("Bad die number specified for workload No " + i + "!");
                }

                string[] planesIDs = Workloads[i].PlaneIDs.Split(Separator);
                uint[]   planes    = new uint[planesIDs.Length];
                for (int j = 0; j < planes.Length; j++)
                {
                    planes[j] = uint.Parse(planesIDs[j]);
                }
                Array.Sort(planes);
                if (planes[planes.Length - 1] >= planeNoPerDie)
                {
                    throw new Exception("Bad die number specified for stream No " + i + "!");
                }

                addressMappingDomains[i] = new AddressMappingDomain(planeAllocationScheme, blockAllocationScheme, channels, chips, dies, planes,
                                                                    blockNoPerPlane, pageNoPerBlock, pageCapacity / FTL.SubPageCapacity, overprovisionRatio, dftlEnabled, dftlCapacity);
            }

            FTL ftl = new FTL(id + ".FTL",
                              planeAllocationScheme, blockAllocationScheme, ioSchedulingPolicy, false, multiplaneCMDEnabled,
                              iBAConstraintForMultiplane, interleavedCMDEnabled, null, GCType,
                              gc, addressMappingDomains, flashChips, rowCount,
                              chipNoPerRow, dieNoPerChip, planeNoPerDie, blockNoPerPlane, pageNoPerBlock,
                              pageCapacity, blockEraseLimit, overprovisionRatio,
                              readLatency, writeLatency, eraseLatency, seed++);

            ctrl.AddXObject(ftl);
            ftl.Controller = ctrl;
            gc.FTL         = ftl;
            ctrl.FTL       = ftl;

            DRAMDataCache dram = new DRAMDataCache(ftl, dataCacheCapacity);

            ftl.DRAM  = dram;
            ctrl.DRAM = dram;

            HostInterface        HI            = null;
            NVMeIODispatcherBase nvmeIOHandler = null;
            IOSchedulerBase      ioScheduler   = null;

            switch (hostInterfaceType)
            {
            case HostInterface.HostInterfaceType.SATATraceBased:
                HI = new HostInterface(id + ".HostInterface", hostBufferSize, ftl, ctrl,
                                       NotListedMessageGenerationParameterSet.Mode, (Workloads[0] as TraceBasedParameterSet).FilePath, (Workloads[0] as TraceBasedParameterSet).PercentageToBeSimulated,
                                       LoggingEnabled, RTLogFilePath,
                                       (Workloads[0] as TraceBasedParameterSet).ReplayCount, NotListedMessageGenerationParameterSet.FoldAddress, NotListedMessageGenerationParameterSet.IgnoreUnallocatedReads);

                ioScheduler = new IOSchedulerSprinkler(id + ".IOScheduler", ftl, readToWritePrioritizationFactor, suspendProgramTime, suspendEraseTime, readTransferCycleTime, writeTransferCycleTime);
                break;

            case HostInterface.HostInterfaceType.NVMe:
            {
                InputStreamBase[] inputStreams = new InputStreamBase[numberOfInputStreams];
                for (int i = 0; i < numberOfInputStreams; i++)
                {
                    WorkloadParameterSet streamParameter = Workloads[i];
                    if (streamParameter is TraceBasedParameterSet)
                    {
                        int fileNameStartIndex = 0;
                        if ((streamParameter as TraceBasedParameterSet).FilePath.IndexOf("/") >= 0)
                        {
                            fileNameStartIndex = (streamParameter as TraceBasedParameterSet).FilePath.LastIndexOf("/");
                        }
                        else
                        if ((streamParameter as TraceBasedParameterSet).FilePath.IndexOf("\\") >= 0)
                        {
                            fileNameStartIndex = (streamParameter as TraceBasedParameterSet).FilePath.LastIndexOf("\\");
                        }
                        inputStreams[i] = new InputStreamTraceBased((streamParameter as TraceBasedParameterSet).FilePath.Remove(0, fileNameStartIndex),
                                                                    (streamParameter as TraceBasedParameterSet).FilePath, (streamParameter as TraceBasedParameterSet).PriorityClass,
                                                                    (streamParameter as TraceBasedParameterSet).PercentageToBeSimulated,
                                                                    (streamParameter as TraceBasedParameterSet).ReplayCount, 10000, addressMappingDomains[i], ++seed);
                    }
                    else
                    {
                        inputStreams[i] = new InputStreamSynthetic("SynthFlow" + i,
                                                                   (streamParameter as SyntheticParameterSet).PriorityClass,
                                                                   addressMappingDomains[i],
                                                                   (streamParameter as SyntheticParameterSet).TotalNumberOfRequests,
                                                                   (streamParameter as SyntheticParameterSet).AverageRequestInterArrivalTime,
                                                                   (streamParameter as SyntheticParameterSet).ReadRatio,
                                                                   (streamParameter as SyntheticParameterSet).AddressDistType,
                                                                   (streamParameter as SyntheticParameterSet).AddressDistParam1,
                                                                   (streamParameter as SyntheticParameterSet).AddressDistParam2,
                                                                   (streamParameter as SyntheticParameterSet).reqSizeDistType,
                                                                   (streamParameter as SyntheticParameterSet).reqSizeDistParam1,
                                                                   (streamParameter as SyntheticParameterSet).reqSizeDistParam2, ++seed);
                    }
                }

                HI = new HostInterfaceNVMe(id + ".HostInterface", ftl, ctrl, numberOfInputStreams, inputStreams, LoggingEnabled, RTLogFilePath);

                switch (ioSchedulingPolicy)
                {
                case IOSchedulingPolicy.Sprinkler:
                    nvmeIOHandler = new NVMeIODispatcherSimple(id + ".HILogic", ftl, HI, (uint)numberOfInputStreams, windowSize);
                    ioScheduler   = new IOSchedulerSprinkler(id + ".IOScheduler", ftl, readToWritePrioritizationFactor, suspendProgramTime, suspendEraseTime, readTransferCycleTime, writeTransferCycleTime);
                    break;

                case IOSchedulingPolicy.MultiStageAllFair:
                case IOSchedulingPolicy.MultiStageSoftQoS:
                case IOSchedulingPolicy.MultiStageMultiplePriorities:
                    nvmeIOHandler = new NVMeIODispatcherRPB(id + ".HILogic", ftl, HI, 1024, inputStreams, rowCount, copParameters.HistoryUpdateInterval);
                    ioScheduler   = new IOSchedulerRPB(id + ".IOScheduler", ftl, ioSchedulingPolicy, nvmeIOHandler as NVMeIODispatcherRPB, copParameters.BatchSize, numberOfInputStreams,
                                                       readToWritePrioritizationFactor, writeToErasePrioritizationFactor, copParameters.RateControllerEnabled, copParameters.PriorityControllerEnabled, copParameters.ReadWriteBalancerEnabled,
                                                       suspendProgramTime, suspendEraseTime, readTransferCycleTime, writeTransferCycleTime);
                    break;
                }
            }
            break;

            case HostInterface.HostInterfaceType.SATASynthetic:
            /*HI = new HostInterfaceSynthetic(id + ".HostInterface", hostBufferSize, ftl, ctrl, NotListedMessageGenerationParameterSet.Mode,
             *  workloadProperties.SyntheticGenerationProperties[0].TotalNumberOfRequests, workloadProperties.SyntheticGenerationProperties[0].AverageRequestInterArrivalTime,
             *  workloadProperties.SyntheticGenerationProperties[0].ReadPercentage,
             *  workloadProperties.SyntheticGenerationProperties[0].AddressDistType,
             *  workloadProperties.SyntheticGenerationProperties[0].AddressDistParam1, workloadProperties.SyntheticGenerationProperties[0].AddressDistParam2,
             *  workloadProperties.SyntheticGenerationProperties[0].reqSizeDistType,
             *  workloadProperties.SyntheticGenerationProperties[0].reqSizeDistParam1, workloadProperties.SyntheticGenerationProperties[0].reqsizeDistParam2,
             ++seed, workloadProperties.LoggingEnabled, RTLogFilePath);
             * break;*/
            default:
                throw new Exception("Unknown HostInterface type!");
            }
            ftl.HostInterface  = HI;
            ftl.IOScheduler    = ioScheduler;
            ctrl.HostInterface = HI;
            ctrl.AddXObject(HI);
            ctrl.AddXObject(nvmeIOHandler);
            //readDataOutputReadyTime += readTransferCycleTime;
            FCCBase fcc = null;

            switch (ioSchedulingPolicy)
            {
            case IOSchedulingPolicy.Sprinkler:
                fcc = new FCCMultiChannelBusSimple(id + ".FCC", readTransferCycleTime, writeTransferCycleTime, readCommandAddressCycleCount,
                                                   writeCommandAddressCycleCount, eraseCommandAddressCycleCount, dummyBusyTime, readDataOutputReadyTime, ALEtoDataStartTransitionTime,
                                                   WEtoRBTransitionTime, readLatency, writeLatency, eraseLatency, pageCapacity,
                                                   channelWidth / FTL.ByteSize, ftl, flashChips, ftl.ChannelInfos as BusChannelSprinkler[], HI);
                break;

            case IOSchedulingPolicy.MultiStageAllFair:
            case IOSchedulingPolicy.MultiStageSoftQoS:
            case IOSchedulingPolicy.MultiStageMultiplePriorities:
                fcc = new FCCMultiChannelBusRPB(id + ".FCC", readTransferCycleTime, writeTransferCycleTime, readCommandAddressCycleCount,
                                                writeCommandAddressCycleCount, eraseCommandAddressCycleCount, dummyBusyTime, readDataOutputReadyTime, ALEtoDataStartTransitionTime,
                                                WEtoRBTransitionTime, readLatency, writeLatency, eraseLatency, suspendProgramTime, suspendEraseTime, copParameters.HistoryUpdateInterval, pageCapacity,
                                                channelWidth / FTL.ByteSize, ftl, flashChips, ftl.ChannelInfos as BusChannelRPB[], HI);
                break;

            default:
                throw new Exception("Unhandled scheduling type!");
            }
            ftl.FCC  = fcc;
            ctrl.FCC = fcc;

            return(ctrl);
        }
        public override void Preprocess()
        {
            loggingStep = numberOfRequestsToBeSeen / totalLinesInLogfile;
            if (loggingStep == 0)
            {
                loggingStep = 1;
            }

            uint[] State = new uint[FTL.AddressMapper.AddressMappingDomains[AddressMappingModule.DefaultStreamID].TotalPagesNo];
            for (uint i = 0; i < FTL.AddressMapper.AddressMappingDomains[AddressMappingModule.DefaultStreamID].TotalPagesNo; i++)
            {
                State[i] = 0;
            }

            Console.WriteLine("\n");
            Console.WriteLine(".................................................\n");
            Console.WriteLine("Preprocess started\n");

            ulong reqCntr = 0;
            ulong lsn = 0;
            uint  reqSize = 0, sub_size, add_size;
            uint  streamID = 0;

            while (reqCntr < numberOfRequestsToBeSeen)
            {
                #region RequestGeneration
                reqCntr++;
                switch (addressDistributionType)
                {
                case InputStreamSynthetic.DistributionType.Uniform:
                    lsn = randomAddressGenerator1.UniformULong(addressDistributionParam1, addressDistributionParam2);
                    break;

                case InputStreamSynthetic.DistributionType.Normal:
                    double templsn = randomAddressGenerator1.Normal(addressDistributionParam1, addressDistributionParam2);
                    lsn = (ulong)templsn;
                    if (templsn < 0)
                    {
                        lsn = 0;
                    }
                    else if (templsn > this.FTL.AddressMapper.LargestLSN)
                    {
                        lsn = this.FTL.AddressMapper.LargestLSN;
                    }
                    break;

                case InputStreamSynthetic.DistributionType.Fixed:
                    lsn = addressDistributionParam1;
                    break;

                case InputStreamSynthetic.DistributionType.HotCold:
                    if (randomHotColdRatioGenerator.Uniform(0, 1) < hotTrafficRate)
                    {
                        lsn = addressDistributionParam1 + randomHotAddressGenerator.UniformULong(0, hotAddressRange);
                    }
                    else
                    {
                        lsn = randomAddressGenerator1.UniformULong(0, this.FTL.AddressMapper.LargestLSN - hotAddressRange);
                        if (lsn > addressDistributionParam1)
                        {
                            lsn += hotAddressRange;
                        }
                    }
                    break;

                default:
                    throw new Exception("Unknown distribution type for address.");
                }

                switch (requestSizeDistributionType)
                {
                case InputStreamSynthetic.DistributionType.Uniform:
                    double tempReqSize = randomRequestSizeGenerator.Uniform(requestSizeDistributionParam1B, requestSizeDistributionParam2B);
                    reqSize = (uint)(Math.Ceiling(tempReqSize / (double)FTL.SubPageCapacity));
                    if (reqSize == 0)
                    {
                        reqSize = 1;
                    }
                    break;

                case InputStreamSynthetic.DistributionType.Normal:
                    tempReqSize = randomRequestSizeGenerator.Normal(requestSizeDistributionParam1B, requestSizeDistributionParam2B);
                    reqSize     = (uint)(Math.Ceiling(tempReqSize / (double)FTL.SubPageCapacity));
                    if (tempReqSize < 0)
                    {
                        reqSize = 1;
                    }
                    break;

                case InputStreamSynthetic.DistributionType.Fixed:
                    reqSize = (uint)(Math.Ceiling(requestSizeDistributionParam1B / (double)FTL.SubPageCapacity));
                    break;

                default:
                    throw new Exception("Uknown distribution type for requset size.");
                }
                #endregion

                add_size = 0;
                if (randomRequestTypeGenerator.Uniform(0, 1) < readRatio)//read request
                {
                    while (add_size < reqSize)
                    {
                        lsn      = lsn % this.FTL.AddressMapper.LargestLSN;
                        sub_size = FTL.SubpageNoPerPage - (uint)(lsn % FTL.SubpageNoPerPage);
                        if (add_size + sub_size >= reqSize)
                        {
                            sub_size  = reqSize - add_size;
                            add_size += sub_size;
                        }

                        if ((sub_size > FTL.SubpageNoPerPage) || (add_size > reqSize))
                        {
                            Console.WriteLine("preprocess sub_size:{0}\n", sub_size);
                        }
                        ulong lpn = lsn / FTL.SubpageNoPerPage;

                        if (State[lpn] == 0)
                        {
                            State[lpn] = FTL.SetEntryState(lsn, sub_size);
                            FTL.HandleMissingReadAccessTarget(lsn, State[lpn]);
                        }
                        else //if (State[lpn] > 0)
                        {
                            uint map_entry_new = FTL.SetEntryState(lsn, sub_size);
                            uint map_entry_old = State[lpn];
                            uint modify_temp   = map_entry_new | map_entry_old;
                            State[lpn] = modify_temp;

                            if (((map_entry_new ^ map_entry_old) & map_entry_new) != 0)
                            {
                                uint map_entry_old_real_map = FTL.AddressMapper.AddressMappingDomains[AddressMappingModule.DefaultStreamID].MappingTable.State[lpn];
                                uint modify_real_map        = ((map_entry_new ^ map_entry_old) & map_entry_new) | map_entry_old_real_map;
                                if (FTL.AddressMapper.AddressMappingDomains[AddressMappingModule.DefaultStreamID].MappingTable.State[lpn] == 0)
                                {
                                    FTL.HandleMissingReadAccessTarget(lsn, modify_real_map);
                                }
                                else
                                {
                                    FTL.ModifyPageTableStateforMissingRead(lpn, modify_real_map);
                                }
                            }
                        }//else if(Controller.DRAM.Map.Entry[lpn].state>0)

                        lsn       = lsn + sub_size;
                        add_size += sub_size;
                    }//while(add_size<size)
                }
                else
                {
                    while (add_size < reqSize)
                    {
                        lsn      = lsn % this.FTL.AddressMapper.LargestLSN;
                        sub_size = FTL.SubpageNoPerPage - (uint)(lsn % FTL.SubpageNoPerPage);
                        if (add_size + sub_size >= reqSize)
                        {
                            sub_size  = reqSize - add_size;
                            add_size += sub_size;
                        }

                        if ((sub_size > FTL.SubpageNoPerPage) || (add_size > reqSize))
                        {
                            Console.WriteLine("preprocess sub_size:{0}\n", sub_size);
                        }

                        ulong lpn = lsn / FTL.SubpageNoPerPage;
                        if (State[lpn] == 0)
                        {
                            State[lpn] = FTL.SetEntryState(lsn, sub_size);   //0001
                        }
                        else
                        {
                            uint map_entry_new = FTL.SetEntryState(lsn, sub_size);
                            uint map_entry_old = FTL.AddressMapper.AddressMappingDomains[streamID].MappingTable.State[lpn];
                            uint modify        = map_entry_new | map_entry_old;
                            State[lpn] = modify;
                        }
                        lsn       = lsn + sub_size;
                        add_size += sub_size;
                    }
                }
            }
            randomRequestSizeGenerator  = new RandomGenerator(requestSizeGenerationSeed);
            randomRequestTypeGenerator  = new RandomGenerator(requestTypeGenerationSeed);
            randomAddressGenerator1     = new RandomGenerator(addressGenerationSeed1);
            randomHotColdRatioGenerator = new RandomGenerator(addressGenerationSeed2);
            randomHotAddressGenerator   = new RandomGenerator(addressGenerationSeed3);
            Console.WriteLine("Preprocess complete!\n");
            Console.WriteLine(".................................................\n");
        }
Ejemplo n.º 10
0
        public override void SendResponseToHost(InternalRequest internalReq)
        {
            sumOfInternalRequestLifeTime      += (XEngineFactory.XEngine.Time - internalReq.IssueTime) / 1000;                                                          //Nanoseconds is converted to microseconds
            sumOfInternalRequestExecutionTime += internalReq.ExecutionTime / 1000;                                                                                      //Nanoseconds is converted to microseconds
            sumOfInternalRequestTransferTime  += internalReq.TransferTime / 1000;                                                                                       //Nanoseconds is converted to microseconds
            sumOfInternalRequestWaitingTime   += (XEngineFactory.XEngine.Time - (internalReq.IssueTime + internalReq.ExecutionTime + internalReq.TransferTime)) / 1000; //Nanoseconds is converted to microseconds
            totalFlashOperations++;

            if (gcStarted)
            {
                sumOfInternalRequestLifeTime_AGC      += (XEngineFactory.XEngine.Time - internalReq.IssueTime) / 1000;
                sumOfInternalRequestExecutionTime_AGC += internalReq.ExecutionTime / 1000;
                sumOfInternalRequestTransferTime_AGC  += internalReq.TransferTime / 1000;
                sumOfInternalRequestWaitingTime_AGC   += (XEngineFactory.XEngine.Time - (internalReq.IssueTime + internalReq.ExecutionTime + internalReq.TransferTime)) / 1000;
                totalFlashOperations_AGC++;
            }

            if (internalReq.Type == InternalRequestType.Read)
            {
                sumOfReadRequestLifeTime      += (XEngineFactory.XEngine.Time - internalReq.IssueTime) / 1000;
                sumOfReadRequestExecutionTime += internalReq.ExecutionTime / 1000;
                sumOfReadRequestTransferTime  += internalReq.TransferTime / 1000;
                sumOfReadRequestWaitingTime   += (XEngineFactory.XEngine.Time - (internalReq.IssueTime + internalReq.ExecutionTime + internalReq.TransferTime)) / 1000;
                totalReadOperations++;
                if (gcStarted)
                {
                    sumOfReadRequestLifeTime_AGC      += (XEngineFactory.XEngine.Time - internalReq.IssueTime) / 1000;
                    sumOfReadRequestExecutionTime_AGC += internalReq.ExecutionTime / 1000;
                    sumOfReadRequestTransferTime_AGC  += internalReq.TransferTime / 1000;
                    sumOfReadRequestWaitingTime_AGC   += (XEngineFactory.XEngine.Time - (internalReq.IssueTime + internalReq.ExecutionTime + internalReq.TransferTime)) / 1000;
                    totalReadOperations_AGC++;
                }
            }
            else
            {
                FTL.OnLPNServiced(internalReq.RelatedIORequest.StreamID, internalReq.LPN);
                sumOfProgramRequestLifeTime      += (XEngineFactory.XEngine.Time - internalReq.IssueTime) / 1000;
                sumOfProgramRequestExecutionTime += internalReq.ExecutionTime / 1000;
                sumOfProgramRequestTransferTime  += internalReq.TransferTime / 1000;
                sumOfProgramRequestWaitingTime   += (XEngineFactory.XEngine.Time - (internalReq.IssueTime + internalReq.ExecutionTime + internalReq.TransferTime)) / 1000;
                totalProgramOperations++;
                if (gcStarted)
                {
                    sumOfProgramRequestLifeTime_AGC      += (XEngineFactory.XEngine.Time - internalReq.IssueTime) / 1000;
                    sumOfProgramRequestExecutionTime_AGC += internalReq.ExecutionTime / 1000;
                    sumOfProgramRequestTransferTime_AGC  += internalReq.TransferTime / 1000;
                    sumOfProgramRequestWaitingTime_AGC   += (XEngineFactory.XEngine.Time - (internalReq.IssueTime + internalReq.ExecutionTime + internalReq.TransferTime)) / 1000;
                    totalProgramOperations_AGC++;
                }
            }
            IORequest targetIORequest = internalReq.RelatedIORequest;

            if (_inputStreams[targetIORequest.StreamID].WriteToCompletionQueue(internalReq, requestProcessingTime))
            {
                checked
                {
                    try
                    {
                        sumResponseTime += (targetIORequest.ResponseTime / 1000);
                    }
                    catch (OverflowException ex)
                    {
                        Console.WriteLine("Overflow exception occured while calculating statistics in HostInterface.");
                        if (overflowOccured)
                        {
                            throw new Exception("I can just handle one overflow event, but I received the second one!");
                        }
                        overflowOccured = true;
                        XEngineFactory.XEngine.StopSimulation();
                        return;
                    }
                }
                thisRoundSumResponseTime += targetIORequest.ResponseTime / 1000;
                if (minResponseTime > targetIORequest.ResponseTime)
                {
                    minResponseTime = targetIORequest.ResponseTime;
                }
                else if (maxResponseTime < targetIORequest.ResponseTime)
                {
                    maxResponseTime = targetIORequest.ResponseTime;
                }
                transferredBytesCount += targetIORequest.SizeInByte;
                handledRequestsCount++;          //used for general statistics
                thisRoundHandledRequestsCount++; //used in replay
                if (gcStarted)
                {
                    sumResponseTime_AGC += (targetIORequest.ResponseTime / 1000);
                    if (minResponseTime_AGC > targetIORequest.ResponseTime)
                    {
                        minResponseTime_AGC = targetIORequest.ResponseTime;
                    }
                    else if (maxResponseTime_AGC < targetIORequest.ResponseTime)
                    {
                        maxResponseTime_AGC = targetIORequest.ResponseTime;
                    }
                    transferredBytesCount_AGC += targetIORequest.SizeInByte;
                    handledRequestsCount_AGC++;//used for general statistics
                }
                if (targetIORequest.Type == IORequestType.Write)
                {
                    sumResponseTimeW          += (targetIORequest.ResponseTime / 1000);
                    thisRoundSumResponseTimeW += (targetIORequest.ResponseTime / 1000);
                    transferredBytesCountW    += targetIORequest.SizeInByte;
                    handledWriteRequestsCount++;
                    thisRoundHandledWriteRequestsCount++;
                    if (minResponseTimeW > targetIORequest.ResponseTime)
                    {
                        minResponseTimeW = targetIORequest.ResponseTime;
                    }
                    else if (maxResponseTimeW < targetIORequest.ResponseTime)
                    {
                        maxResponseTimeW = targetIORequest.ResponseTime;
                    }
                    if (gcStarted)
                    {
                        sumResponseTimeW_AGC       += (targetIORequest.ResponseTime / 1000);
                        transferredBytesCountW_AGC += targetIORequest.SizeInByte;
                        handledWriteRequestsCount_AGC++;
                        if (minResponseTimeW_AGC > targetIORequest.ResponseTime)
                        {
                            minResponseTimeW_AGC = targetIORequest.ResponseTime;
                        }
                        else if (maxResponseTimeW_AGC < targetIORequest.ResponseTime)
                        {
                            maxResponseTimeW_AGC = targetIORequest.ResponseTime;
                        }
                    }
                }
                else
                {
                    sumResponseTimeR          += (targetIORequest.ResponseTime / 1000);
                    thisRoundSumResponseTimeR += (targetIORequest.ResponseTime / 1000);
                    transferredBytesCountR    += targetIORequest.SizeInByte;
                    handledReadRequestsCount++;
                    thisRoundHandledReadRequestsCount++;
                    if (minResponseTimeR > targetIORequest.ResponseTime)
                    {
                        minResponseTimeR = targetIORequest.ResponseTime;
                    }
                    else if (maxResponseTimeR < targetIORequest.ResponseTime)
                    {
                        maxResponseTimeR = targetIORequest.ResponseTime;
                    }
                    if (gcStarted)
                    {
                        sumResponseTimeR_AGC       += (targetIORequest.ResponseTime / 1000);
                        transferredBytesCountR_AGC += targetIORequest.SizeInByte;
                        handledReadRequestsCount_AGC++;
                        if (minResponseTimeR_AGC > targetIORequest.ResponseTime)
                        {
                            minResponseTimeR_AGC = targetIORequest.ResponseTime;
                        }
                        else if (maxResponseTimeR_AGC < targetIORequest.ResponseTime)
                        {
                            maxResponseTimeR_AGC = targetIORequest.ResponseTime;
                        }
                    }
                }

                if ((handledRequestsCount / (double)totalRequestsToGenerate) > nextAnnouncementMilestone)
                {
                    nextAnnouncementMilestone += announcementStep;
                    OnStatReady();
                }

                OnIORequestCompleted(targetIORequest.StreamID);
            }//_inputStreams[targetIORequest.StreamID].WriteToCompletionQueue...
        }
Ejemplo n.º 11
0
 public DRAMDataCache(FTL ftl, uint cacheCapacityInSecotr)
 {
     _FTL         = ftl;
     DRAMCapacity = cacheCapacityInSecotr;
     Buffer       = new Cache(cacheCapacityInSecotr / FTL.SubPageCapacity);
 }
Ejemplo n.º 12
0
 public NVMeIODispatcherBase(string id, FTL ftl, HostInterfaceNVMe HI)
     : base(id)
 {
     FTL           = ftl;
     HostInterface = HI;
 }