summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFangjia Shen <[email protected]>2023-06-17 19:03:31 -0400
committerGitHub <[email protected]>2023-06-17 19:03:31 -0400
commit301be9e59c6c934f4e194cf6c95dd0c60b3894cc (patch)
treef1c25eaf864c908b5e79694d0fa9e4a62ffe3481 /src
parent66ae8815dd1a9cd5fcc0e08332ebca323c356863 (diff)
137 drop sector cache flexibility (#57)
Addresses accel-sim issue 137. For sector cache, the sector size must be 32B (hard-coded and not configurable) and cache line size must be set to 128B; a runtime parameter check will terminate simulation if the cache line size is not 128B.
Diffstat (limited to 'src')
-rw-r--r--src/gpgpu-sim/gpu-cache.h22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/gpgpu-sim/gpu-cache.h b/src/gpgpu-sim/gpu-cache.h
index 4bbf7e2..aa693b5 100644
--- a/src/gpgpu-sim/gpu-cache.h
+++ b/src/gpgpu-sim/gpu-cache.h
@@ -563,10 +563,12 @@ class cache_config {
char ct, rp, wp, ap, mshr_type, wap, sif;
int ntok =
- sscanf(config, "%c:%u:%u:%u,%c:%c:%c:%c:%c,%c:%u:%u,%u:%u,%u", &ct,
- &m_nset, &m_line_sz, &m_assoc, &rp, &wp, &ap, &wap, &sif,
- &mshr_type, &m_mshr_entries, &m_mshr_max_merge,
- &m_miss_queue_size, &m_result_fifo_entries, &m_data_port_width);
+ sscanf(config, "%c:%u:%u:%u,%c:%c:%c:%c:%c,%c:%u:%u,%u:%u,%u",
+ &ct, &m_nset, &m_line_sz, &m_assoc,
+ &rp, &wp, &ap, &wap, &sif,
+ &mshr_type, &m_mshr_entries, &m_mshr_max_merge,
+ &m_miss_queue_size, &m_result_fifo_entries,
+ &m_data_port_width);
if (ntok < 12) {
if (!strcmp(config, "none")) {
@@ -721,9 +723,17 @@ class cache_config {
"Invalid cache configuration: FETCH_ON_WRITE and LAZY_FETCH_ON_READ "
"cannot work properly with ON_FILL policy. Cache must be ON_MISS. ");
}
+
if (m_cache_type == SECTOR) {
- assert(m_line_sz / SECTOR_SIZE == SECTOR_CHUNCK_SIZE &&
- m_line_sz % SECTOR_SIZE == 0);
+ bool cond =
+ m_line_sz / SECTOR_SIZE == SECTOR_CHUNCK_SIZE &&
+ m_line_sz % SECTOR_SIZE == 0;
+ if(!cond){
+ std::cerr<<"error: For sector cache, the simulator uses hard-coded "
+ "SECTOR_SIZE and SECTOR_CHUNCK_SIZE. The line size "
+ "must be product of both values.\n";
+ assert(0);
+ }
}
// default: port to data array width and granularity = line size