dev merge

This commit is contained in:
Blaise Tine
2020-09-09 17:09:18 -04:00
3 changed files with 43 additions and 14 deletions

View File

@@ -58,7 +58,7 @@ void CacheSim::reset() {
} }
void CacheSim::step() { void CacheSim::step() {
std::cout << timestamp << ": [sim] step()" << std::endl; //std::cout << timestamp << ": [sim] step()" << std::endl;
//toggle clock //toggle clock
cache_->clk = 0; cache_->clk = 0;
this->eval(); this->eval();
@@ -95,6 +95,7 @@ void CacheSim::run(){
if(!cache_->core_req_valid && !cache_->core_rsp_valid){ if(!cache_->core_req_valid && !cache_->core_rsp_valid){
valid--; valid--;
} }
this->display_hit_miss();
} }
} }
@@ -261,7 +262,7 @@ void CacheSim::get_core_rsp(unsigned int (&rsp)[4]){
} }
void CacheSim::get_core_req(){ void CacheSim::get_core_req(){
std::cout << cache_->genblk5_BRA_0_KET_->bank->is_fill_in_pipe<< std::endl; //std::cout << cache_->genblk5_BRA_0_KET_->bank->is_fill_in_pipe<< std::endl;
char check = cache_->core_req_valid; char check = cache_->core_req_valid;
std::cout << std::hex << "core_req_valid: " << check << std::endl; std::cout << std::hex << "core_req_valid: " << check << std::endl;
std::cout << std::hex << "core_req_data[0]: " << cache_->core_req_data[0] << std::endl; std::cout << std::hex << "core_req_data[0]: " << cache_->core_req_data[0] << std::endl;
@@ -287,3 +288,7 @@ void CacheSim::get_dram_rsp(){
std::cout << std::hex << "dram_rsp_ready: " << cache_->dram_rsp_ready << std::endl; std::cout << std::hex << "dram_rsp_ready: " << cache_->dram_rsp_ready << std::endl;
} }
void CacheSim::display_hit_miss(){
std::cout << std::hex << "Misses: " << cache_->misses << std::endl;
}

View File

@@ -62,6 +62,7 @@ public:
bool get_core_req_ready(); bool get_core_req_ready();
bool get_core_rsp_ready(); bool get_core_rsp_ready();
void get_dram_rsp(); void get_dram_rsp();
void display_hit_miss();
private: private:

View File

@@ -81,7 +81,9 @@ int HIT_1(CacheSim *sim){
} }
int MISS_1(CacheSim *sim){ int MISS_1(CacheSim *sim){
unsigned int addr[4] = {0x12222222, 0xabbbbbbb, 0xcddddddd, 0xe4444444}; unsigned int addr1[4] = {0x12222222, 0xabbbbbbb, 0xcddddddd, 0xe4444444};
unsigned int addr2[4] = {0x12244444, 0xabb0bbbb, 0xcddd0ddd, 0xe0444444};
unsigned int addr3[4] = {0x12888888, 0xa0bbbbbb, 0xcddddd0d, 0xe4444440};
unsigned int data[4] = {0xffffffff, 0x11111111, 0x22222222, 0x33333333}; unsigned int data[4] = {0xffffffff, 0x11111111, 0x22222222, 0x33333333};
unsigned int rsp[4] = {0,0,0,0}; unsigned int rsp[4] = {0,0,0,0};
char responded = 0; char responded = 0;
@@ -90,25 +92,46 @@ int MISS_1(CacheSim *sim){
write->valid = 0xf; write->valid = 0xf;
write->rw = 0xf; write->rw = 0xf;
write->byteen = 0xffff; write->byteen = 0xffff;
write->addr = addr; write->addr = addr1;
write->data = data; write->data = data;
write->tag = 0xff; write->tag = 0xff;
//read req //read req
core_req_t* read = new core_req_t; core_req_t* read1 = new core_req_t;
read->valid = 0xf; read1->valid = 0xf;
read->rw = 0; read1->rw = 0;
read->byteen = 0xffff; read1->byteen = 0xffff;
read->addr = addr; read1->addr = addr1;
read->data = addr; read1->data = data;
read->tag = 0xff; read1->tag = 0xff;
//read req
core_req_t* read2 = new core_req_t;
read2->valid = 0xf;
read2->rw = 0;
read2->byteen = 0xffff;
read2->addr = addr2;
read2->data = data;
read2->tag = 0xff;
//read req
core_req_t* read3 = new core_req_t;
read3->valid = 0xf;
read3->rw = 0;
read3->byteen = 0xffff;
read3->addr = addr3;
read3->data = data;
read3->tag = 0xff;
// reset the device // reset the device
sim->reset(); sim->reset();
//queue reqs //queue reqs
sim->send_req(write); //sim->send_req(write);
sim->send_req(read); sim->send_req(read1);
sim->send_req(read2);
sim->send_req(read3);
sim->run(); sim->run();
@@ -201,7 +224,7 @@ int main(int argc, char **argv)
RAM ram; RAM ram;
CacheSim cachesim; CacheSim cachesim;
cachesim.attach_ram(&ram); cachesim.attach_ram(&ram);
int check = HIT_1(&cachesim); int check = REQ_RSP(&cachesim);
if(check){ if(check){
std::cout << "PASSED" << std::endl; std::cout << "PASSED" << std::endl;
} else { } else {