Esempio n. 1
0
 public LruStrategy(IPhysicalMemory physicalMemory)
 {
     if (physicalMemory.Any(f => !(f is IFrameWithTimeStamps)))
     {
         throw new Exception("bad frame type");
     }
     _physicalMemory = physicalMemory;
 }
Esempio n. 2
0
 public FifoStrategy(IPhysicalMemory physicalMemory)
 {
     foreach (var frame in physicalMemory)
     {
         _frameGuidList.Add(frame.Id);
     }
     _enumerator = RepeatForever(_frameGuidList).GetEnumerator();
 }
 public ALruStrategy(IPhysicalMemory physicalMemory)
 {
     foreach (var frame in physicalMemory)
     {
         if (!(frame is IFrameWithMarker))
         {
             throw new Exception("bad frame type");
         }
         _queue.Add(frame);
     }
 }
Esempio n. 4
0
        public void ProcessAll()
        {
            _physicalMemory = _physicalMemoryFactory.Create(FrameList);
            _virtualMemory  = _virtualMemoryFactory.Create(PageList);

            Process.PhysicalMemory = _physicalMemory;
            Process.VirtualMemory  = _virtualMemory;

            while (Process.HasNextPageToLoad)
            {
                Process.LoadNextPage();
            }

            StrategyName = Process.ToString();
            PageErrors   = Process.PagesErrors;
        }
Esempio n. 5
0
        /// <summary>
        /// Decodes the instruction in physical memory at the given address.
        /// </summary>
        /// <param name="mem"></param>
        /// <param name="address"></param>
        public Instruction(IPhysicalMemory mem, uint address)
        {
            //
            // Read the first halfword of the instruction in, determine its type and see if we need go further.
            //
            ushort hword = mem.ReadHalfWord(address);

            Op = (Opcode)(hword >> 8);

            Rx = (hword & 0xf0) >> 4;
            Ry = hword & 0xf;

            if ((hword & 0x8000) != 0)
            {
                //
                // This is a memory reference instruction.
                // Is this a short or long displacement instruction?
                //
                if ((hword & 0x1000) != 0)
                {
                    Displacement = (int)mem.ReadWord(address + 2);
                    Length       = 6;
                }
                else
                {
                    Displacement = (short)mem.ReadHalfWord(address + 2);
                    Length       = 4;
                }

                // Compute the displacement address (PC + Displacement) for branches.
                // The LSB is used for branch prediction logic
                BranchAddress = (uint)((address + Displacement) & 0xfffffffe);
            }
            else
            {
                Length = 2;
            }
        }
Esempio n. 6
0
 public FDLP(IPhysicalMemory mem, Processor cpu)
 {
     _mem = mem;
     _cpu = cpu;
 }
Esempio n. 7
0
 public OptStrategy(IPhysicalMemory physicalMemory, List <IPageReference> pageReferences)
 {
     _physicalMemory = physicalMemory;
     _pageReferences = pageReferences;
 }
Esempio n. 8
0
 public Processor(IPhysicalMemory mem, IOBus io)
 {
     _mem = mem;
     _io  = io;
 }
 public RandomStrategy(IPhysicalMemory physicalMemory)
 {
     _frames = physicalMemory.ToList();
 }