示例#1
0
        public Cache(ICycleProvider cycleProvider, CacheGeometry geometry)
        {
            this.CycleProvider = cycleProvider;
            this.Geometry = geometry;

            this.Sets = new List<CacheSet> ();
            for (uint i = 0; i < this.NumSets; i++) {
                this.Sets.Add (new CacheSet (this, this.Associativity, i));
            }

            this.Directory = new Directory (this.NumSets, this.Associativity);
        }
示例#2
0
 public CacheConfig(string name, CacheGeometry geometry, uint hitLatency, CacheReplacementPolicy policy)
 {
     this.Name = name;
     this.Geometry = geometry;
     this.HitLatency = hitLatency;
     this.Policy = policy;
 }
示例#3
0
 public TlbConfig(CacheGeometry geometry, uint hitLatency, uint missLatency)
 {
     this.Geometry = geometry;
     this.HitLatency = hitLatency;
     this.MissLatency = missLatency;
 }
示例#4
0
 public static bool IsAligned(this uint addr, CacheGeometry cacheGeometry)
 {
     return addr.GetDisplacement (cacheGeometry) == 0;
 }
示例#5
0
 public static uint GetTag(this uint addr, CacheGeometry cacheGeometry)
 {
     return addr & ~(cacheGeometry.LineMask);
 }
示例#6
0
 public static uint GetIndex(this uint addr, CacheGeometry cacheGeometry)
 {
     return (addr >> (int)cacheGeometry.LineSizeInLog2) % cacheGeometry.NumSets;
 }
示例#7
0
 public static uint GetDisplacement(this uint addr, CacheGeometry cacheGeometry)
 {
     return addr & (cacheGeometry.LineMask);
 }
示例#8
0
 static MemoryConstants()
 {
     MemoryGeometry = new CacheGeometry (1 << 22, 1, 1 << 12);
 }