2c2
< * Copyright (c) 2004-2005 The Regents of The University of Michigan
---
> * Copyright (c) 2004-2006 The Regents of The University of Michigan
35c35
< : SSIT_size(_SSIT_size), LFST_size(_LFST_size)
---
> : SSITSize(_SSIT_size), LFSTSize(_LFST_size)
39c39
< SSIT_size, LFST_size);
---
> SSITSize, LFSTSize);
41c41
< SSIT = new SSID[SSIT_size];
---
> SSIT.resize(SSITSize);
43c43
< validSSIT.resize(SSIT_size);
---
> validSSIT.resize(SSITSize);
45c45
< for (int i = 0; i < SSIT_size; ++i)
---
> for (int i = 0; i < SSITSize; ++i)
48c48
< LFST = new InstSeqNum[LFST_size];
---
> LFST.resize(LFSTSize);
50c50
< validLFST.resize(LFST_size);
---
> validLFST.resize(LFSTSize);
52c52,55
< SSCounters = new int[LFST_size];
---
> for (int i = 0; i < LFSTSize; ++i) {
> validLFST[i] = false;
> LFST[i] = 0;
> }
54,55c57,87
< for (int i = 0; i < LFST_size; ++i)
< {
---
> 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) {
57c89
< SSCounters[i] = 0;
---
> LFST[i] = 0;
60c92
< index_mask = SSIT_size - 1;
---
> indexMask = SSITSize - 1;
62c94
< offset_bits = 2;
---
> offsetBits = 2;
64a97
>
71c104
< assert(load_index < SSIT_size && store_index < SSIT_size);
---
> assert(load_index < SSITSize && store_index < SSITSize);
88c121
< assert(new_set < LFST_size);
---
> assert(new_set < LFSTSize);
90,92d122
< SSCounters[new_set]++;
<
<
103c133
< assert(load_SSID < LFST_size);
---
> assert(load_SSID < LFSTSize);
105,106d134
< SSCounters[load_SSID]++;
<
117,119d144
< // Because we are having a load point to an already existing set,
< // the size of the store set is not incremented.
<
127c152
< assert(load_SSID < LFST_size && store_SSID < LFST_size);
---
> assert(load_SSID < LFSTSize && store_SSID < LFSTSize);
129,134c154,155
< 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) {
---
> // The store set with the lower number wins
> if (store_SSID > load_SSID) {
137,140c158
< SSCounters[load_SSID]++;
< SSCounters[store_SSID]--;
<
< DPRINTF(StoreSet, "StoreSet: Load had bigger store set: %i; "
---
> DPRINTF(StoreSet, "StoreSet: Load had smaller store set: %i; "
146,149c164
< SSCounters[store_SSID]++;
< SSCounters[load_SSID]--;
<
< DPRINTF(StoreSet, "StoreSet: Store had bigger store set: %i; "
---
> DPRINTF(StoreSet, "StoreSet: Store had smaller store set: %i; "
164c179,180
< StoreSet::insertStore(Addr store_PC, InstSeqNum store_seq_num)
---
> StoreSet::insertStore(Addr store_PC, InstSeqNum store_seq_num,
> unsigned tid)
170c186
< assert(index < SSIT_size);
---
> assert(index < SSITSize);
178c194
< assert(store_SSID < LFST_size);
---
> assert(store_SSID < LFSTSize);
184a201,202
> storeList[store_seq_num] = store_SSID;
>
197c215
< assert(index < SSIT_size);
---
> assert(index < SSITSize);
208c226
< assert(inst_SSID < LFST_size);
---
> assert(inst_SSID < LFSTSize);
237c255
< assert(index < SSIT_size);
---
> assert(index < SSITSize);
238a257,262
> SeqNumMapIt store_list_it = storeList.find(issued_seq_num);
>
> if (store_list_it != storeList.end()) {
> storeList.erase(store_list_it);
> }
>
246c270
< assert(store_SSID < LFST_size);
---
> assert(store_SSID < LFSTSize);
257c281
< StoreSet::squash(InstSeqNum squashed_num)
---
> StoreSet::squash(InstSeqNum squashed_num, unsigned tid)
259,262d282
< // 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.
<
266,268c286,294
< for (int i = 0; i < LFST_size; ++i) {
< if (validLFST[i] && LFST[i] < squashed_num) {
< validLFST[i] = false;
---
> 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;
269a296,306
>
> 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++);
> }
276c313
< for (int i = 0; i < SSIT_size; ++i) {
---
> for (int i = 0; i < SSITSize; ++i) {
280c317
< for (int i = 0; i < LFST_size; ++i) {
---
> for (int i = 0; i < LFSTSize; ++i) {
283d319
< }
284a321,322
> storeList.clear();
> }