From 23d096dd1f1d4f0387087ffff0605fbf349556d2 Mon Sep 17 00:00:00 2001 From: Tor Aamodt Date: Sun, 28 Nov 2010 09:35:25 -0800 Subject: adding 1st level data cache [git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 8153] --- src/cuda-sim/cuda-sim.cc | 18 ++++++++++++++++++ src/cuda-sim/ptx.l | 3 +++ src/cuda-sim/ptx.y | 9 +++++++++ 3 files changed, 30 insertions(+) (limited to 'src/cuda-sim') 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 function_decl_header %type 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); } -- cgit v1.3