Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor tag::probe to increase readability #38

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 6 additions & 17 deletions src/gpgpu-sim/gpu-cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -267,26 +267,16 @@ enum cache_request_status tag_array::probe(new_addr_type addr, unsigned &idx,
unsigned index = set_index * m_config.m_assoc + way;
cache_block_t *line = m_lines[index];
if (line->m_tag == tag) {
if (line->get_status(mask) == RESERVED) {
idx = index;
auto status = line->get_status(mask);
idx = index;
if (status == RESERVED) {
return HIT_RESERVED;
} else if (line->get_status(mask) == VALID) {
idx = index;
} else if (status == VALID || (status == MODIFIED && line->is_readable(mask))) {
return HIT;
} else if (line->get_status(mask) == MODIFIED) {
if (line->is_readable(mask)) {
idx = index;
return HIT;
} else {
idx = index;
return SECTOR_MISS;
}

} else if (line->is_valid_line() && line->get_status(mask) == INVALID) {
idx = index;
} else if ((line->is_valid_line() && status == INVALID) || status == MODIFIED) {
return SECTOR_MISS;
} else {
assert(line->get_status(mask) == INVALID);
assert(status == INVALID);
}
}
if (!line->is_reserved_line()) {
Expand Down Expand Up @@ -331,7 +321,6 @@ enum cache_request_status tag_array::probe(new_addr_type addr, unsigned &idx,
if (i->second != mf->get_inst().get_uid()) return SECTOR_MISS;
}
}

return MISS;
}

Expand Down