mirror of
https://github.com/vortexgpgpu/vortex.git
synced 2025-04-23 21:39:10 -04:00
fixed simulator snoop handling
This commit is contained in:
parent
6882d88a62
commit
507622f1a1
2 changed files with 21 additions and 14 deletions
|
@ -201,7 +201,7 @@
|
|||
`define L2DRAM_TAG_WIDTH (`L2_ENABLE ? `L2DRAM_ADDR_WIDTH : (`L2DRAM_ADDR_WIDTH+`CLOG2(`NUM_CORES*2)))
|
||||
|
||||
// Snoop request tag bits
|
||||
`define L2SNP_TAG_WIDTH ((`NUM_CLUSTERS > 1) ? `LOG2UP(`L3SNRQ_SIZE) : 1)
|
||||
`define L2SNP_TAG_WIDTH ((`NUM_CLUSTERS > 1) ? `LOG2UP(`L3SNRQ_SIZE) : `L3SNP_TAG_WIDTH)
|
||||
|
||||
// Number of Word requests per cycle {1, 2, 4, 8, ...}
|
||||
`define L2NUM_REQUESTS (2*`NUM_CORES)
|
||||
|
@ -221,7 +221,7 @@
|
|||
`define L3DRAM_TAG_WIDTH ((`NUM_CLUSTERS > 1) ? `L3DRAM_ADDR_WIDTH : `L2DRAM_TAG_WIDTH)
|
||||
|
||||
// Snoop request tag bits
|
||||
`define L3SNP_TAG_WIDTH 1
|
||||
`define L3SNP_TAG_WIDTH 16
|
||||
|
||||
// Number of Word requests per cycle {1, 2, 4, 8, ...}
|
||||
`define L3NUM_REQUESTS `NUM_CLUSTERS
|
||||
|
|
|
@ -181,27 +181,34 @@ void Simulator::flush_caches(uint32_t mem_addr, uint32_t size) {
|
|||
// align address to LLC block boundaries
|
||||
auto aligned_addr_start = mem_addr / GLOBAL_BLOCK_SIZE;
|
||||
auto aligned_addr_end = (mem_addr + size + GLOBAL_BLOCK_SIZE - 1) / GLOBAL_BLOCK_SIZE;
|
||||
int outstanding_snp_reqs = 0;
|
||||
|
||||
|
||||
// submit snoop requests for the needed blocks
|
||||
vortex_->snp_req_addr = aligned_addr_start;
|
||||
vortex_->snp_req_tag = 0;
|
||||
vortex_->snp_req_valid = 1;
|
||||
vortex_->snp_rsp_ready = 1;
|
||||
|
||||
int pending_snp_reqs = 1;
|
||||
|
||||
for (;;) {
|
||||
this->step();
|
||||
if (vortex_->snp_rsp_valid) {
|
||||
assert(outstanding_snp_reqs > 0);
|
||||
--outstanding_snp_reqs;
|
||||
this->step();
|
||||
if (vortex_->snp_rsp_valid) {
|
||||
assert(pending_snp_reqs > 0);
|
||||
--pending_snp_reqs;
|
||||
//std::cout << timestamp << ": [sim] snp rsp: tag=" << vortex_->snp_rsp_tag << " pending=" << pending_snp_reqs << std::endl;
|
||||
}
|
||||
if (vortex_->snp_req_valid && vortex_->snp_req_ready) {
|
||||
++outstanding_snp_reqs;
|
||||
vortex_->snp_req_addr += 1;
|
||||
if (vortex_->snp_req_addr >= aligned_addr_end) {
|
||||
if (vortex_->snp_req_valid && vortex_->snp_req_ready) {
|
||||
if (vortex_->snp_req_addr < aligned_addr_end) {
|
||||
vortex_->snp_req_addr += 1;
|
||||
vortex_->snp_req_tag += 1;
|
||||
++pending_snp_reqs;
|
||||
//std::cout << timestamp << ": [sim] snp req: addr=" << vortex_->snp_req_addr << " tag=" << vortex_->snp_req_tag << " remain=" << (aligned_addr_end - vortex_->snp_req_addr) << std::endl;
|
||||
} else {
|
||||
vortex_->snp_req_valid = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!vortex_->snp_req_valid
|
||||
&& 0 == outstanding_snp_reqs) {
|
||||
&& 0 == pending_snp_reqs) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue