diff options
| author | Tor Aamodt <[email protected]> | 2010-07-17 08:42:20 -0800 |
|---|---|---|
| committer | Tor Aamodt <[email protected]> | 2010-07-17 08:42:20 -0800 |
| commit | ca7e2e58e7fd932d67c6d28477a5c15ed3b156b0 (patch) | |
| tree | 1a66586b291019476ec06715d259560818baf923 /src/cuda-sim/instructions.cc | |
| parent | b6661da800739b0fca9e01ba6d5afaca4f286d84 (diff) | |
- add support for cvta and isspacep instructions (currently assuming
a fixed address mapping between shared,local to generic that depends
upon hardware thread context used... might be interesting to explore
tradeoffs at some point)
- remove util.h... we don't need TRUE, FALSE anymore now that
everything is C++
- remove some dead code from shader_decode
[git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 6867]
Diffstat (limited to 'src/cuda-sim/instructions.cc')
| -rw-r--r-- | src/cuda-sim/instructions.cc | 64 |
1 files changed, 62 insertions, 2 deletions
diff --git a/src/cuda-sim/instructions.cc b/src/cuda-sim/instructions.cc index 7cdf0de..ffbcd8f 100644 --- a/src/cuda-sim/instructions.cc +++ b/src/cuda-sim/instructions.cc @@ -1326,7 +1326,41 @@ void cvt_impl( const ptx_instruction *pI, ptx_thread_info *thread ) thread->set_operand_value(dst,data); } -void cvta_impl( const ptx_instruction *pI, ptx_thread_info *thread ) { inst_not_implemented(pI); } +void cvta_impl( const ptx_instruction *pI, ptx_thread_info *thread ) +{ + ptx_reg_t data; + + const operand_info &dst = pI->dst(); + const operand_info &src1 = pI->src1(); + unsigned space = pI->get_space(); + bool to_non_generic = pI->is_to(); + + ptx_reg_t from_addr = thread->get_operand_value(src1); + addr_t from_addr_hw = (addr_t)from_addr.u64; + addr_t to_addr_hw = 0; + unsigned smid = thread->get_hw_sid(); + unsigned hwtid = thread->get_hw_tid(); + + if( to_non_generic ) { + switch( space ) { + case SHARED_DIRECTIVE: to_addr_hw = generic_to_shared( smid, from_addr_hw ); break; + case LOCAL_DIRECTIVE: to_addr_hw = generic_to_local( smid, hwtid, from_addr_hw ); break; + case GLOBAL_DIRECTIVE: to_addr_hw = from_addr_hw; break; + default: abort(); + } + } else { + switch( space ) { + case SHARED_DIRECTIVE: to_addr_hw = shared_to_generic( smid, from_addr_hw ); break; + case LOCAL_DIRECTIVE: to_addr_hw = local_to_generic( smid, hwtid, from_addr_hw ); break; + case GLOBAL_DIRECTIVE: to_addr_hw = from_addr_hw; break; + default: abort(); + } + } + + ptx_reg_t to_addr; + to_addr.u64 = to_addr_hw; + thread->set_operand_value(dst,to_addr); +} void div_impl( const ptx_instruction *pI, ptx_thread_info *thread ) { @@ -1402,7 +1436,33 @@ void fma_impl( const ptx_instruction *pI, ptx_thread_info *thread ) mad_def(pI,thread); } -void isspacep_impl( const ptx_instruction *pI, ptx_thread_info *thread ) { inst_not_implemented(pI); } +void isspacep_impl( const ptx_instruction *pI, ptx_thread_info *thread ) +{ + ptx_reg_t a; + bool t=false; + + const operand_info &dst = pI->dst(); + const operand_info &src1 = pI->src1(); + unsigned space = pI->get_space(); + + a = thread->get_operand_value(src1); + addr_t addr = (addr_t)a.u64; + unsigned smid = thread->get_hw_sid(); + unsigned hwtid = thread->get_hw_tid(); + + switch( space ) { + case SHARED_DIRECTIVE: t = isspace_shared( smid, addr ); + case LOCAL_DIRECTIVE: t = isspace_local( smid, hwtid, addr ); + case GLOBAL_DIRECTIVE: t = isspace_global( addr ); + default: abort(); + } + + ptx_reg_t p; + p.pred = t?1:0; + + thread->set_operand_value(dst,p); +} + void ld_impl( const ptx_instruction *pI, ptx_thread_info *thread ) { |
