summaryrefslogtreecommitdiff
path: root/src/cuda-sim
diff options
context:
space:
mode:
authorTor Aamodt <[email protected]>2010-11-28 09:35:25 -0800
committerTor Aamodt <[email protected]>2010-11-28 09:35:25 -0800
commit23d096dd1f1d4f0387087ffff0605fbf349556d2 (patch)
tree18e39a86e83bc445ec37eb9485c2a5ace7c82074 /src/cuda-sim
parenta937a4b354b60999a011970d054cd6c478be130d (diff)
adding 1st level data cache
[git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 8153]
Diffstat (limited to 'src/cuda-sim')
-rw-r--r--src/cuda-sim/cuda-sim.cc18
-rw-r--r--src/cuda-sim/ptx.l3
-rw-r--r--src/cuda-sim/ptx.y9
3 files changed, 30 insertions, 0 deletions
diff --git a/src/cuda-sim/cuda-sim.cc b/src/cuda-sim/cuda-sim.cc
index b1893a0..34bfe82 100644
--- a/src/cuda-sim/cuda-sim.cc
+++ b/src/cuda-sim/cuda-sim.cc
@@ -566,6 +566,24 @@ void ptx_instruction::pre_decode()
break;
}
+ switch( m_cache_option ) {
+ case CA_OPTION: cache_op = CACHE_ALL; break;
+ case CG_OPTION: cache_op = CACHE_GLOBAL; break;
+ case CS_OPTION: cache_op = CACHE_STREAMING; break;
+ case LU_OPTION: cache_op = CACHE_LAST_USE; break;
+ case CV_OPTION: cache_op = CACHE_VOLATILE; break;
+ case WB_OPTION: cache_op = CACHE_WRITE_BACK; break;
+ case WT_OPTION: cache_op = CACHE_WRITE_THROUGH; break;
+ default:
+ if( m_opcode == LD_OP )
+ cache_op = CACHE_ALL;
+ else if( m_opcode == ST_OP )
+ cache_op = CACHE_WRITE_BACK;
+ else if( m_opcode == ATOM_OP )
+ cache_op = CACHE_GLOBAL;
+ break;
+ }
+
set_opcode_and_latency();
// Get register operands
diff --git a/src/cuda-sim/ptx.l b/src/cuda-sim/ptx.l
index 1b87c7d..d54530d 100644
--- a/src/cuda-sim/ptx.l
+++ b/src/cuda-sim/ptx.l
@@ -340,6 +340,9 @@ breakaddr TC; ptx_lval.int_value = BREAKADDR_OP; return OPCODE;
\.lu TC; return LU_OPTION;
\.cv TC; return CV_OPTION;
+\.wb TC; return WB_OPTION;
+\.wt TC; return WT_OPTION;
+
\.and TC; return ATOMIC_AND;
\.or TC; return ATOMIC_OR;
\.xor TC; return ATOMIC_XOR;
diff --git a/src/cuda-sim/ptx.y b/src/cuda-sim/ptx.y
index 833e082..5142f4d 100644
--- a/src/cuda-sim/ptx.y
+++ b/src/cuda-sim/ptx.y
@@ -215,6 +215,8 @@
%token CS_OPTION;
%token LU_OPTION;
%token CV_OPTION;
+%token WB_OPTION;
+%token WT_OPTION;
%type <int_value> function_decl_header
%type <ptr_value> function_decl
@@ -435,6 +437,13 @@ option: type_spec
| atomic_operation_spec ;
| TO_OPTION { add_option(TO_OPTION); }
| HALF_OPTION { add_option(HALF_OPTION); }
+ | CA_OPTION { add_option(CA_OPTION); }
+ | CG_OPTION { add_option(CG_OPTION); }
+ | CS_OPTION { add_option(CS_OPTION); }
+ | LU_OPTION { add_option(LU_OPTION); }
+ | CV_OPTION { add_option(CV_OPTION); }
+ | WB_OPTION { add_option(WB_OPTION); }
+ | WT_OPTION { add_option(WT_OPTION); }
;
atomic_operation_spec: ATOMIC_AND { add_option(ATOMIC_AND); }