public BranchTargetBuffer(uint numSets, uint associativity) { this.NumSets = numSets; this.Associativity = associativity; this.Entries = new BranchTargetBufferEntry[this.NumSets * this.Associativity]; for (uint i = 0; i < this.NumSets * this.Associativity; i++) { this[i] = new BranchTargetBufferEntry (); } if (this.Associativity > 1) { for (uint i = 0; i < this.NumSets * this.Associativity; i++) { if (i % this.Associativity != (this.Associativity - 1)) { this[i].Next = this[i + 1]; } else { this[i].Next = null; } if (i % this.Associativity != (this.Associativity - 1)) { this[i + 1].Prev = this[i]; } } } }
public ReturnAddressStack(uint size) { this.Size = size; this.Entries = new BranchTargetBufferEntry[this.Size]; for (uint i = 0; i < this.Size; i++) { this[i] = new BranchTargetBufferEntry (); } this.TopOfStack = this.Size - 1; }