2c2
< * Copyright (c) 2004-2005 The Regents of The University of Michigan
---
> * Copyright (c) 2004-2006 The Regents of The University of Michigan
33c33
< : SSIT_size(_SSIT_size), LFST_size(_LFST_size)
---
> : SSITSize(_SSIT_size), LFSTSize(_LFST_size)
37c37
< SSIT_size, LFST_size);
---
> SSITSize, LFSTSize);
39c39
< SSIT = new SSID[SSIT_size];
---
> SSIT.resize(SSITSize);
41c41
< validSSIT.resize(SSIT_size);
---
> validSSIT.resize(SSITSize);
43c43
< for (int i = 0; i < SSIT_size; ++i)
---
> for (int i = 0; i < SSITSize; ++i)
46c46
< LFST = new InstSeqNum[LFST_size];
---
> LFST.resize(LFSTSize);
48c48
< validLFST.resize(LFST_size);
---
> validLFST.resize(LFSTSize);
50c50,53
< SSCounters = new int[LFST_size];
---
> for (int i = 0; i < LFSTSize; ++i) {
> validLFST[i] = false;
> LFST[i] = 0;
> }
52,53c55,85
< 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) {
55c87
< SSCounters[i] = 0;
---
> LFST[i] = 0;
58c90
< index_mask = SSIT_size - 1;
---
> indexMask = SSITSize - 1;
60c92
< offset_bits = 2;
---
> offsetBits = 2;
62a95
>
69c102
< assert(load_index < SSIT_size && store_index < SSIT_size);
---
> assert(load_index < SSITSize && store_index < SSITSize);
86c119
< assert(new_set < LFST_size);
---
> assert(new_set < LFSTSize);
88,90d120
< SSCounters[new_set]++;
<
<
101c131
< assert(load_SSID < LFST_size);
---
> assert(load_SSID < LFSTSize);
103,104d132
< SSCounters[load_SSID]++;
<
115,117d142
< // Because we are having a load point to an already existing set,
< // the size of the store set is not incremented.
<
125c150
< assert(load_SSID < LFST_size && store_SSID < LFST_size);
---
> assert(load_SSID < LFSTSize && store_SSID < LFSTSize);
127,132c152,153
< 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) {
135,138c156
< SSCounters[load_SSID]++;
< SSCounters[store_SSID]--;
<
< DPRINTF(StoreSet, "StoreSet: Load had bigger store set: %i; "
---
> DPRINTF(StoreSet, "StoreSet: Load had smaller store set: %i; "
144,147c162
< SSCounters[store_SSID]++;
< SSCounters[load_SSID]--;
<
< DPRINTF(StoreSet, "StoreSet: Store had bigger store set: %i; "
---
> DPRINTF(StoreSet, "StoreSet: Store had smaller store set: %i; "
162c177,178
< StoreSet::insertStore(Addr store_PC, InstSeqNum store_seq_num)
---
> StoreSet::insertStore(Addr store_PC, InstSeqNum store_seq_num,
> unsigned tid)
168c184
< assert(index < SSIT_size);
---
> assert(index < SSITSize);
176c192
< assert(store_SSID < LFST_size);
---
> assert(store_SSID < LFSTSize);
182a199,200
> storeList[store_seq_num] = store_SSID;
>
195c213
< assert(index < SSIT_size);
---
> assert(index < SSITSize);
206c224
< assert(inst_SSID < LFST_size);
---
> assert(inst_SSID < LFSTSize);
235c253
< assert(index < SSIT_size);
---
> assert(index < SSITSize);
236a255,260
> SeqNumMapIt store_list_it = storeList.find(issued_seq_num);
>
> if (store_list_it != storeList.end()) {
> storeList.erase(store_list_it);
> }
>
244c268
< assert(store_SSID < LFST_size);
---
> assert(store_SSID < LFSTSize);
255c279
< StoreSet::squash(InstSeqNum squashed_num)
---
> StoreSet::squash(InstSeqNum squashed_num, unsigned tid)
257,260d280
< // 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.
<
264,266c284,292
< 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;
267a294,304
>
> 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++);
> }
274c311
< for (int i = 0; i < SSIT_size; ++i) {
---
> for (int i = 0; i < SSITSize; ++i) {
278c315
< for (int i = 0; i < LFST_size; ++i) {
---
> for (int i = 0; i < LFSTSize; ++i) {
281d317
< }
282a319,320
> storeList.clear();
> }