WeightedLRUPolicy.cc (12697:cd71b966be1e) | WeightedLRUPolicy.cc (12750:1dde69fad30f) |
---|---|
1/* 2 * Copyright (c) 2013-2015 Advanced Micro Devices, Inc. 3 * All rights reserved. 4 * 5 * For use for simulation and test purposes only 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions are met: --- 78 unchanged lines hidden (view full) --- 87int64_t 88WeightedLRUPolicy::getVictim(int64_t set) const 89{ 90 Tick time, smallest_time; 91 int64_t smallest_index; 92 93 smallest_index = 0; 94 smallest_time = m_last_ref_ptr[set][0]; | 1/* 2 * Copyright (c) 2013-2015 Advanced Micro Devices, Inc. 3 * All rights reserved. 4 * 5 * For use for simulation and test purposes only 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions are met: --- 78 unchanged lines hidden (view full) --- 87int64_t 88WeightedLRUPolicy::getVictim(int64_t set) const 89{ 90 Tick time, smallest_time; 91 int64_t smallest_index; 92 93 smallest_index = 0; 94 smallest_time = m_last_ref_ptr[set][0]; |
95 int smallest_weight = m_last_ref_ptr[set][0]; | 95 int smallest_weight = m_last_occ_ptr[set][0]; |
96 97 for (unsigned i = 1; i < m_assoc; i++) { 98 99 int weight = m_last_occ_ptr[set][i]; 100 if (weight < smallest_weight) { 101 smallest_weight = weight; 102 smallest_index = i; 103 smallest_time = m_last_ref_ptr[set][i]; 104 } else if (weight == smallest_weight) { 105 time = m_last_ref_ptr[set][i]; 106 if (time < smallest_time) { 107 smallest_index = i; 108 smallest_time = time; 109 } 110 } 111 } 112 return smallest_index; 113} | 96 97 for (unsigned i = 1; i < m_assoc; i++) { 98 99 int weight = m_last_occ_ptr[set][i]; 100 if (weight < smallest_weight) { 101 smallest_weight = weight; 102 smallest_index = i; 103 smallest_time = m_last_ref_ptr[set][i]; 104 } else if (weight == smallest_weight) { 105 time = m_last_ref_ptr[set][i]; 106 if (time < smallest_time) { 107 smallest_index = i; 108 smallest_time = time; 109 } 110 } 111 } 112 return smallest_index; 113} |