Compare commits
No commits in common. "correction" and "master" have entirely different histories.
correction
...
master
|
@ -139,53 +139,48 @@ public: // everything is public, because IDGAF
|
|||
// Loop through all 16 sets
|
||||
for (int Index = 0; Index < 16; Index++) {
|
||||
|
||||
// create a temporary set of associativity
|
||||
struct Set temp_set;
|
||||
struct Set current_set = Sets[Index];
|
||||
struct Set incoming_set = In.Sets[Index];
|
||||
|
||||
// create a temporary set of associativity
|
||||
struct Set temp_set;
|
||||
temp_set.Associativity = {{(unsigned int)0, {{}}},
|
||||
{(unsigned int)1, {{}}},
|
||||
{(unsigned int)2, {{}}},
|
||||
{(unsigned int)3, {{}}}};
|
||||
|
||||
int new_age = 0;
|
||||
|
||||
// loop through all Ages
|
||||
for (int current_age = 0; current_age < 4; current_age++) {
|
||||
|
||||
std::list<unsigned int> new_block_list;
|
||||
|
||||
auto current_age_entry = current_set.Associativity[current_age];
|
||||
std::list<unsigned int> current_age_blocklist =
|
||||
current_age_entry.Blocks;
|
||||
for (auto associativity_map : current_set.Associativity) {
|
||||
|
||||
auto current_associativity_age = associativity_map.first;
|
||||
std::list<unsigned int> current_associativity_blocklist =
|
||||
associativity_map.second.Blocks;
|
||||
// for every element of associativity_block_list
|
||||
for (auto block : current_age_blocklist) {
|
||||
// look through ALL incoming_set.Blocklists for occurrences
|
||||
for (auto block : current_associativity_blocklist) {
|
||||
// look through ALL incoming_set.Associativities.Entry.Blocklists for
|
||||
// occurrences
|
||||
for (auto incoming_associativity : incoming_set.Associativity) {
|
||||
int age = incoming_associativity.first;
|
||||
auto age = incoming_associativity.first;
|
||||
struct Entry entry = incoming_associativity.second;
|
||||
|
||||
auto ret =
|
||||
std::find(entry.Blocks.begin(), entry.Blocks.end(), block);
|
||||
if (ret !=
|
||||
entry.Blocks.end()) { // if current block found amongst incoming
|
||||
if (ret != entry.Blocks.end()) {
|
||||
|
||||
// compare the ages and take the maximum age
|
||||
new_age = std::max(current_age, age);
|
||||
// take the maximum age
|
||||
auto new_age = std::max(current_associativity_age, age);
|
||||
|
||||
new_block_list.push_front((unsigned int)*ret);
|
||||
// create a new entry at the maximum age and
|
||||
std::list<unsigned int> new_block_list;
|
||||
new_block_list.push_back((unsigned int) *ret);
|
||||
struct Entry new_entry = {new_block_list};
|
||||
|
||||
// add it to temporary set
|
||||
temp_set.Associativity.insert(
|
||||
std::pair<unsigned int, struct Entry>(new_age, new_entry));
|
||||
}
|
||||
}
|
||||
// update the temporary
|
||||
temp_set.Associativity[new_age].Blocks.merge(new_block_list);
|
||||
}
|
||||
// print_block_list(associativity_age, associativity_block_list);
|
||||
|
||||
Sets[Index] = temp_set;
|
||||
}
|
||||
}
|
||||
// Here should be Sets[Index] = temp_set;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue