}
- structure(DirEntry, desc="...") {
+ structure(DirEntry, desc="...", interface="AbstractEntry") {
NetDest Sharers, desc="Set of the internal processors that want the block in shared state";
MachineID Owner, desc="ID of the L1 cache to forward the block to once we get a response";
bool OwnerValid, default="false", desc="true if Owner means something";
return (localDirectory.isTagPresent(addr) );
}
+ DirEntry getDirEntry(Address address), return_by_pointer="yes" {
+ return localDirectory.lookup(address);
+ }
+
bool isOnlySharer(Entry cache_entry, Address addr, MachineID shar_id) {
if (is_valid(cache_entry)) {
assert (localDirectory.isTagPresent(addr) == false);
}
}
else if (localDirectory.isTagPresent(addr)){
- if (localDirectory[addr].Sharers.count() > 1) {
+ DirEntry dir_entry := getDirEntry(addr);
+ if (dir_entry.Sharers.count() > 1) {
return false;
}
- else if (localDirectory[addr].Sharers.count() == 1) {
- if (localDirectory[addr].Sharers.isElement(shar_id)) {
+ else if (dir_entry.Sharers.count() == 1) {
+ if (dir_entry.Sharers.isElement(shar_id)) {
return true;
}
else {
assert(localDirectory.isTagPresent(addr) == false);
assert(is_valid(cache_entry));
localDirectory.allocate(addr);
- localDirectory[addr].DirState := cache_entry.CacheState;
- localDirectory[addr].Sharers := cache_entry.Sharers;
- localDirectory[addr].Owner := cache_entry.Owner;
- localDirectory[addr].OwnerValid := cache_entry.OwnerValid;
+ DirEntry dir_entry := getDirEntry(addr);
+ dir_entry.DirState := cache_entry.CacheState;
+ dir_entry.Sharers := cache_entry.Sharers;
+ dir_entry.Owner := cache_entry.Owner;
+ dir_entry.OwnerValid := cache_entry.OwnerValid;
}
void copyDirToCache(Entry cache_entry, Address addr) {
assert(is_valid(cache_entry));
- cache_entry.Sharers := localDirectory[addr].Sharers;
- cache_entry.Owner := localDirectory[addr].Owner;
- cache_entry.OwnerValid := localDirectory[addr].OwnerValid;
+ DirEntry dir_entry := getDirEntry(addr);
+ cache_entry.Sharers := dir_entry.Sharers;
+ cache_entry.Owner := dir_entry.Owner;
+ cache_entry.OwnerValid := dir_entry.OwnerValid;
}
else {
if (localDirectory.isTagPresent(addr) == false) {
localDirectory.allocate(addr);
- localDirectory[addr].Sharers.clear();
- localDirectory[addr].OwnerValid := false;
+ DirEntry dir_entry := getDirEntry(addr);
+ dir_entry.Sharers.clear();
+ dir_entry.OwnerValid := false;
}
- localDirectory[addr].Sharers.add(shar_id);
+ DirEntry dir_entry := getDirEntry(addr);
+ dir_entry.Sharers.add(shar_id);
}
}
if (localDirectory.isTagPresent(addr) == false) {
localDirectory.allocate(addr);
}
- localDirectory[addr].Sharers.clear();
- localDirectory[addr].OwnerValid := true;
- localDirectory[addr].Owner := exc_id;
+ DirEntry dir_entry := getDirEntry(addr);
+ dir_entry.Sharers.clear();
+ dir_entry.OwnerValid := true;
+ dir_entry.Owner := exc_id;
}
}
cache_entry.OwnerValid := false;
}
else {
- localDirectory[addr].Sharers.clear();
- localDirectory[addr].OwnerValid := false;
+ DirEntry dir_entry := getDirEntry(addr);
+ dir_entry.Sharers.clear();
+ dir_entry.OwnerValid := false;
}
}
cache_entry.Sharers.remove(sender);
}
else {
- localDirectory[addr].Sharers.remove(sender);
+ DirEntry dir_entry := getDirEntry(addr);
+ dir_entry.Sharers.remove(sender);
}
}
cache_entry.OwnerValid := false;
}
else {
- localDirectory[addr].OwnerValid := false;
+ DirEntry dir_entry := getDirEntry(addr);
+ dir_entry.OwnerValid := false;
}
}
return cache_entry.Sharers.isElement(shar_id);
}
else {
- return localDirectory[addr].Sharers.isElement(shar_id);
+ DirEntry dir_entry := getDirEntry(addr);
+ return dir_entry.Sharers.isElement(shar_id);
}
}
return cache_entry.Sharers;
}
else {
- return localDirectory[addr].Sharers;
+ DirEntry dir_entry := getDirEntry(addr);
+ return dir_entry.Sharers;
}
}
return cache_entry.Owner;
}
else {
- return localDirectory[addr].Owner;
+ DirEntry dir_entry := getDirEntry(addr);
+ return dir_entry.Owner;
}
}
return cache_entry.Sharers.count();
}
else {
- return localDirectory[addr].Sharers.count();
+ DirEntry dir_entry := getDirEntry(addr);
+ return dir_entry.Sharers.count();
}
}
return cache_entry.OwnerValid;
}
else {
- return localDirectory[addr].OwnerValid;
+ DirEntry dir_entry := getDirEntry(addr);
+ return dir_entry.OwnerValid;
}
}
}
}
else {
- if (localDirectory[addr].Sharers.isElement(requestor)) {
- return ( localDirectory[addr].Sharers.count() - 1 );
+ DirEntry dir_entry := getDirEntry(addr);
+ if (dir_entry.Sharers.isElement(requestor)) {
+ return ( dir_entry.Sharers.count() - 1 );
}
else {
- return localDirectory[addr].Sharers.count();
+ return dir_entry.Sharers.count();
}
}
}
} else if (is_valid(cache_entry)) {
return cache_entry.CacheState;
} else if (isDirTagPresent(addr)) {
- return localDirectory[addr].DirState;
+ DirEntry dir_entry := getDirEntry(addr);
+ return dir_entry.DirState;
} else {
return State:NP;
}
}
}
else if (localDirectory.isTagPresent(addr)) {
- localDirectory[addr].DirState := state;
+ DirEntry dir_entry := getDirEntry(addr);
+ dir_entry.DirState := state;
}
}
out_msg.Requestor := in_msg.Requestor;
out_msg.RequestorMachine := MachineType:L1Cache;
// should randomize this so one node doesn't get abused more than others
- out_msg.Destination.add(localDirectory[in_msg.Addr].Sharers.smallestElement(MachineType:L1Cache));
+ DirEntry dir_entry := getDirEntry(in_msg.Addr);
+ out_msg.Destination.add(dir_entry.Sharers.smallestElement(MachineType:L1Cache));
out_msg.MessageSize := MessageSizeType:Forwarded_Control;
}
}
out_msg.Type := CoherenceRequestType:GETX;
out_msg.Requestor := tbe.L1_GetX_ID;
out_msg.RequestorMachine := MachineType:L1Cache;
- out_msg.Destination.add(localDirectory[address].Owner);
+ DirEntry dir_entry := getDirEntry(address);
+ out_msg.Destination.add(dir_entry.Owner);
out_msg.MessageSize := MessageSizeType:Forwarded_Control;
out_msg.Acks := 1 + tbe.Local_GETX_IntAcks;
}
DataBlock DataBlk, desc="data for the block";
}
- structure(DirEntry, desc="...") {
+ structure(DirEntry, desc="...", interface="AbstractEntry") {
Set Sharers, desc="Set of the internal processors that want the block in shared state";
bool exclusive, default="false", desc="if local exclusive is likely";
}
return cache_entry;
}
+ DirEntry getDirEntry(Address address), return_by_pointer="yes" {
+ return localDirectory.lookup(address);
+ }
+
void functionalRead(Address addr, Packet *pkt) {
testAndRead(addr, getCacheEntry(addr).DataBlk, pkt);
}
void removeSharer(Address addr, NodeID id) {
if (localDirectory.isTagPresent(addr)) {
- localDirectory[addr].Sharers.remove(id);
- if (localDirectory[addr].Sharers.count() == 0) {
+ DirEntry dir_entry := getDirEntry(addr);
+ dir_entry.Sharers.remove(id);
+ if (dir_entry.Sharers.count() == 0) {
localDirectory.deallocate(addr);
}
}
bool sharersExist(Address addr) {
if (localDirectory.isTagPresent(addr)) {
- if (localDirectory[addr].Sharers.count() > 0) {
+ DirEntry dir_entry := getDirEntry(addr);
+ if (dir_entry.Sharers.count() > 0) {
return true;
}
else {
bool exclusiveExists(Address addr) {
if (localDirectory.isTagPresent(addr)) {
- if (localDirectory[addr].exclusive) {
+ DirEntry dir_entry := getDirEntry(addr);
+ if (dir_entry.exclusive) {
return true;
}
else {
// assumes that caller will check to make sure tag is present
Set getSharers(Address addr) {
- return localDirectory[addr].Sharers;
+ DirEntry dir_entry := getDirEntry(addr);
+ return dir_entry.Sharers;
}
void setNewWriter(Address addr, NodeID id) {
if (localDirectory.isTagPresent(addr) == false) {
localDirectory.allocate(addr);
}
- localDirectory[addr].Sharers.clear();
- localDirectory[addr].Sharers.add(id);
- localDirectory[addr].exclusive := true;
+ DirEntry dir_entry := getDirEntry(addr);
+ dir_entry.Sharers.clear();
+ dir_entry.Sharers.add(id);
+ dir_entry.exclusive := true;
}
void addNewSharer(Address addr, NodeID id) {
if (localDirectory.isTagPresent(addr) == false) {
localDirectory.allocate(addr);
}
- localDirectory[addr].Sharers.add(id);
- // localDirectory[addr].exclusive := false;
+ DirEntry dir_entry := getDirEntry(addr);
+ dir_entry.Sharers.add(id);
+ // dir_entry.exclusive := false;
}
void clearExclusiveBitIfExists(Address addr) {
if (localDirectory.isTagPresent(addr)) {
- localDirectory[addr].exclusive := false;
+ DirEntry dir_entry := getDirEntry(addr);
+ dir_entry.exclusive := false;
}
}