예제 #1
0
 public void clearMemory()
  {
      stack = new int[256];
      cache = new Cache(cacheSize);
      readMissCounter = 0;
      readHitCounter = 0;
      writeHitCounter = 0;
      writeMissCounter = 0;
      spatialCounter = 0;
  }
예제 #2
0
 public Memory(int cacheSize, int blockSize, bool addressMode)
 {
     binaryInstructions = new List<short>(10); // Default instruction size is 10
     assemblyInstructions = new List<string>(10); // Default instruction size 10
     stack = new int[256]; // Default memory size is 256
     cache = new Cache(cacheSize);
     copyCache = new string[cacheSize];
     initializeCopyCache();
     this.cacheSize = cacheSize;
     this.addressMode = addressMode;
     this.blockSize = blockSize;
     readHitCounter = 0;
     readMissCounter = 0;
     writeHitCounter = 0;
     writeMissCounter = 0;
     spatialCounter = 0;
     Debug.WriteLine("Just made a new memory object with stack of size 256 and cache of size " + cacheSize +
         " with address mode:" + (addressMode ? "2-way" : "1-way") + " and block size of " + blockSize);
 }