This commit is contained in:
parent
b02004f62e
commit
36a338af99
|
|
@ -5,10 +5,10 @@ WARN = -Wall
|
||||||
CFLAGS = $(OPT) $(WARN) $(INC) $(LIB)
|
CFLAGS = $(OPT) $(WARN) $(INC) $(LIB)
|
||||||
|
|
||||||
# List all your .cc files here (source files, excluding header files)
|
# List all your .cc files here (source files, excluding header files)
|
||||||
SIM_SRC = main.cc world.cc
|
SIM_SRC = main.cc cache.cc
|
||||||
|
|
||||||
# List corresponding compiled object files here (.o files)
|
# List corresponding compiled object files here (.o files)
|
||||||
SIM_OBJ = main.o world.o
|
SIM_OBJ = main.o cache.o
|
||||||
|
|
||||||
#################################
|
#################################
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,21 +13,21 @@ Cache::Cache(char *argv[])
|
||||||
}
|
}
|
||||||
if (this->size < 0)
|
if (this->size < 0)
|
||||||
{
|
{
|
||||||
throw "Para blockSize Err.";
|
throw "Para Size Err.";
|
||||||
}
|
}
|
||||||
if (this->Assoc < 1)
|
if (this->assoc < 1)
|
||||||
{
|
{
|
||||||
throw "Para blockSize Err.";
|
throw "Para assoc Err.";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->replicementPolicy != LRU && this->replicementPolicy != LFU)
|
if (this->replicementPolicy != LRU && this->replicementPolicy != LFU)
|
||||||
{
|
{
|
||||||
throw "Para blockSize Err.";
|
throw "Para replicementPolicy Err.";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->writePolicy != WBWA && this->writePolicy != WTNA)
|
if (this->writePolicy != WBWA && this->writePolicy != WTNA)
|
||||||
{
|
{
|
||||||
throw "Para blockSize Err.";
|
throw "Para writePolicy Err.";
|
||||||
}
|
}
|
||||||
|
|
||||||
this->offset = log2_floor(this->blockSize);
|
this->offset = log2_floor(this->blockSize);
|
||||||
|
|
@ -39,7 +39,7 @@ Cache::Cache(char *argv[])
|
||||||
|
|
||||||
this->L1.resize(this->getMaxIndex());
|
this->L1.resize(this->getMaxIndex());
|
||||||
for (auto &s : L1 )
|
for (auto &s : L1 )
|
||||||
s.block.resize(this->GetAssoc());
|
s.block.resize(this->getAssoc());
|
||||||
}
|
}
|
||||||
|
|
||||||
Cache::~Cache()
|
Cache::~Cache()
|
||||||
|
|
@ -49,7 +49,7 @@ Cache::~Cache()
|
||||||
uint32_t Cache::getMaxIndex(){
|
uint32_t Cache::getMaxIndex(){
|
||||||
return (1<<this->index);
|
return (1<<this->index);
|
||||||
}
|
}
|
||||||
uint32_t Cache::GetAssoc() {
|
uint32_t Cache::getAssoc() {
|
||||||
return this->assoc;
|
return this->assoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue