Read a register value at run time

7 views
Skip to first unread message

Chen

unread,
Feb 9, 2012, 9:08:22 PM2/9/12
to gpuocelot
Hi all,

I would like to read the value of each instruction's destination
operand at run time, but I didn't figure out how to do it in
InstructionTraceGenerator. Could anyone give me a hint? Thanks in
advance.

Thanks,
Chen

Mark Gebhart

unread,
Feb 10, 2012, 12:16:51 PM2/10/12
to gpuo...@googlegroups.com, zch...@gmail.com
Hi Chen,

I wrote this helper function to get a register value from one of my
trace analysis modules:

ir::PTXU64 TraceAnalysis::getRegisterValue(unsigned int tid,
ir::PTXOperand::RegisterType reg) {
executive::EmulatedKernel::RegisterFile rf =
_kernel->getCurrentRegisterFile();
return rf [tid * _kernel->registerCount() + reg];
}

Here _kernel is defined in the initialize function the same as in
MemoryChecker.cpp

_kernel = static_cast< const executive::EmulatedKernel* >( &kernel );

Then you should be able to get a register value using a call along the lines of:

getRegisterValue( tid, instruction->d.reg)

Hope this helps,
Mark

> --
> You received this message because you are subscribed to the Google Groups "gpuocelot" group.
> To post to this group, send email to gpuo...@googlegroups.com.
> To unsubscribe from this group, send email to gpuocelot+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/gpuocelot?hl=en.
>

Zhongliang Chen

unread,
Feb 12, 2012, 10:13:21 AM2/12/12
to Mark Gebhart, gpuo...@googlegroups.com
Hi Mark,

Thank you for your help!

Chen

Reply all
Reply to author
Forward
0 new messages