From 355b9bcbc870fb79a5d682748f2475432c5cb6a5 Mon Sep 17 00:00:00 2001 From: Tim Rogers Date: Thu, 21 Feb 2013 23:56:39 -0800 Subject: Fixing a bug exposed by the fix for bug 42. The "_" "null" register potentially generated by ptx and intentionally generated by ptxplus was being initialized without a type. This caused the parser to think it was not a register. Fix is to allow the parser to think of it as register, but ensure the arch-sim does not by adding a flag indicating that it is special. [git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 15305] --- src/cuda-sim/cuda-sim.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/cuda-sim/cuda-sim.cc') diff --git a/src/cuda-sim/cuda-sim.cc b/src/cuda-sim/cuda-sim.cc index 1dbff50..cba5262 100644 --- a/src/cuda-sim/cuda-sim.cc +++ b/src/cuda-sim/cuda-sim.cc @@ -844,7 +844,8 @@ void ptx_instruction::pre_decode() for ( ; opr != op_iter_end(); opr++, n++ ) { //process operands const operand_info &o = *opr; if ( has_dst && n==0 ) { - if ( o.is_reg() ) { + // Do not set the null register "_" as an architectural register + if ( o.is_reg() && !o.is_non_arch_reg() ) { out[0] = o.reg_num(); arch_reg.dst[0] = o.arch_reg_num(); } else if ( o.is_vector() ) { @@ -858,7 +859,7 @@ void ptx_instruction::pre_decode() arch_reg.dst[i] = o.arch_reg_num(i); } } else { - if ( o.is_reg() ) { + if ( o.is_reg() && !o.is_non_arch_reg() ) { int reg_num = o.reg_num(); arch_reg.src[m] = o.arch_reg_num(); switch ( m ) { @@ -898,6 +899,8 @@ void ptx_instruction::pre_decode() const operand_info &o = *op; if(o.is_memory_operand()) { + // We do not support the null register as a memory operand + assert( !o.is_non_arch_reg() ); // Check PTXPlus-type operand // memory operand with addressing (ex. s[0x4] or g[$r1]) -- cgit v1.3