2c2
< * Copyright (c) 2004-2006 The Regents of The University of Michigan
---
> * Copyright (c) 2004-2005 The Regents of The University of Michigan
26a27,28
> *
> * Authors: Kevin Lim
33c35
< : SSITSize(_SSIT_size), LFSTSize(_LFST_size)
---
> : SSIT_size(_SSIT_size), LFST_size(_LFST_size)
37c39
< SSITSize, LFSTSize);
---
> SSIT_size, LFST_size);
39c41
< SSIT.resize(SSITSize);
---
> SSIT = new SSID[SSIT_size];
41c43
< validSSIT.resize(SSITSize);
---
> validSSIT.resize(SSIT_size);
43c45
< for (int i = 0; i < SSITSize; ++i)
---
> for (int i = 0; i < SSIT_size; ++i)
46c48
< LFST.resize(LFSTSize);
---
> LFST = new InstSeqNum[LFST_size];
48c50
< validLFST.resize(LFSTSize);
---
> validLFST.resize(LFST_size);
50,53c52
< for (int i = 0; i < LFSTSize; ++i) {
< validLFST[i] = false;
< LFST[i] = 0;
< }
---
> SSCounters = new int[LFST_size];
55,85c54,55
< indexMask = SSITSize - 1;
<
< offsetBits = 2;
< }
<
< StoreSet::~StoreSet()
< {
< }
<
< void
< StoreSet::init(int _SSIT_size, int _LFST_size)
< {
< SSITSize = _SSIT_size;
< LFSTSize = _LFST_size;
<
< DPRINTF(StoreSet, "StoreSet: Creating store set object.\n");
< DPRINTF(StoreSet, "StoreSet: SSIT size: %i, LFST size: %i.\n",
< SSITSize, LFSTSize);
<
< SSIT.resize(SSITSize);
<
< validSSIT.resize(SSITSize);
<
< for (int i = 0; i < SSITSize; ++i)
< validSSIT[i] = false;
<
< LFST.resize(LFSTSize);
<
< validLFST.resize(LFSTSize);
<
< for (int i = 0; i < LFSTSize; ++i) {
---
> for (int i = 0; i < LFST_size; ++i)
> {
87c57
< LFST[i] = 0;
---
> SSCounters[i] = 0;
90c60
< indexMask = SSITSize - 1;
---
> index_mask = SSIT_size - 1;
92c62
< offsetBits = 2;
---
> offset_bits = 2;
95d64
<
102c71
< assert(load_index < SSITSize && store_index < SSITSize);
---
> assert(load_index < SSIT_size && store_index < SSIT_size);
119c88
< assert(new_set < LFSTSize);
---
> assert(new_set < LFST_size);
120a90,92
> SSCounters[new_set]++;
>
>
131c103
< assert(load_SSID < LFSTSize);
---
> assert(load_SSID < LFST_size);
132a105,106
> SSCounters[load_SSID]++;
>
142a117,119
> // Because we are having a load point to an already existing set,
> // the size of the store set is not incremented.
>
150c127
< assert(load_SSID < LFSTSize && store_SSID < LFSTSize);
---
> assert(load_SSID < LFST_size && store_SSID < LFST_size);
152,153c129,134
< // The store set with the lower number wins
< if (store_SSID > load_SSID) {
---
> int load_SS_size = SSCounters[load_SSID];
> int store_SS_size = SSCounters[store_SSID];
>
> // If the load has the bigger store set, then assign the store
> // to the same store set as the load. Otherwise vice-versa.
> if (load_SS_size > store_SS_size) {
156c137,140
< DPRINTF(StoreSet, "StoreSet: Load had smaller store set: %i; "
---
> SSCounters[load_SSID]++;
> SSCounters[store_SSID]--;
>
> DPRINTF(StoreSet, "StoreSet: Load had bigger store set: %i; "
162c146,149
< DPRINTF(StoreSet, "StoreSet: Store had smaller store set: %i; "
---
> SSCounters[store_SSID]++;
> SSCounters[load_SSID]--;
>
> DPRINTF(StoreSet, "StoreSet: Store had bigger store set: %i; "
177,178c164
< StoreSet::insertStore(Addr store_PC, InstSeqNum store_seq_num,
< unsigned tid)
---
> StoreSet::insertStore(Addr store_PC, InstSeqNum store_seq_num)
184c170
< assert(index < SSITSize);
---
> assert(index < SSIT_size);
192c178
< assert(store_SSID < LFSTSize);
---
> assert(store_SSID < LFST_size);
199,200d184
< storeList[store_seq_num] = store_SSID;
<
213c197
< assert(index < SSITSize);
---
> assert(index < SSIT_size);
224c208
< assert(inst_SSID < LFSTSize);
---
> assert(inst_SSID < LFST_size);
253c237
< assert(index < SSITSize);
---
> assert(index < SSIT_size);
255,260d238
< SeqNumMapIt store_list_it = storeList.find(issued_seq_num);
<
< if (store_list_it != storeList.end()) {
< storeList.erase(store_list_it);
< }
<
268c246
< assert(store_SSID < LFSTSize);
---
> assert(store_SSID < LFST_size);
279c257
< StoreSet::squash(InstSeqNum squashed_num, unsigned tid)
---
> StoreSet::squash(InstSeqNum squashed_num)
280a259,262
> // Not really sure how to do this well.
> // Generally this is small enough that it should be okay; short circuit
> // evaluation should take care of invalid entries.
>
284,292c266,268
< int idx;
< SeqNumMapIt store_list_it = storeList.begin();
<
< //@todo:Fix to only delete from correct thread
< while (!storeList.empty()) {
< idx = (*store_list_it).second;
<
< if ((*store_list_it).first <= squashed_num) {
< break;
---
> for (int i = 0; i < LFST_size; ++i) {
> if (validLFST[i] && LFST[i] < squashed_num) {
> validLFST[i] = false;
294,304d269
<
< bool younger = LFST[idx] > squashed_num;
<
< if (validLFST[idx] && younger) {
< DPRINTF(StoreSet, "Squashed [sn:%lli]\n", LFST[idx]);
< validLFST[idx] = false;
<
< storeList.erase(store_list_it++);
< } else if (!validLFST[idx] && younger) {
< storeList.erase(store_list_it++);
< }
311c276
< for (int i = 0; i < SSITSize; ++i) {
---
> for (int i = 0; i < SSIT_size; ++i) {
315c280
< for (int i = 0; i < LFSTSize; ++i) {
---
> for (int i = 0; i < LFST_size; ++i) {
318,319d282
<
< storeList.clear();
320a284
>