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); }
public CacheConfig(string name, CacheGeometry geometry, uint hitLatency, CacheReplacementPolicy policy) { this.Name = name; this.Geometry = geometry; this.HitLatency = hitLatency; this.Policy = policy; }
public TlbConfig(CacheGeometry geometry, uint hitLatency, uint missLatency) { this.Geometry = geometry; this.HitLatency = hitLatency; this.MissLatency = missLatency; }
public static bool IsAligned(this uint addr, CacheGeometry cacheGeometry) { return addr.GetDisplacement (cacheGeometry) == 0; }
public static uint GetTag(this uint addr, CacheGeometry cacheGeometry) { return addr & ~(cacheGeometry.LineMask); }
public static uint GetIndex(this uint addr, CacheGeometry cacheGeometry) { return (addr >> (int)cacheGeometry.LineSizeInLog2) % cacheGeometry.NumSets; }
public static uint GetDisplacement(this uint addr, CacheGeometry cacheGeometry) { return addr & (cacheGeometry.LineMask); }
static MemoryConstants() { MemoryGeometry = new CacheGeometry (1 << 22, 1, 1 << 12); }