pseudo inst: Add rpns (read processor nanoseconds) instruction.

This instruction basically returns the number of nanoseconds that the CPU
has been running.
This commit is contained in:
Nathan Binkert 2008-11-10 11:51:18 -08:00
parent c25d966b06
commit eb5d9ba72b
6 changed files with 14 additions and 0 deletions

View file

@ -806,6 +806,9 @@ decode OPCODE default Unknown::unknown() {
0x04: quiesceTime({{ 0x04: quiesceTime({{
R0 = PseudoInst::quiesceTime(xc->tcBase()); R0 = PseudoInst::quiesceTime(xc->tcBase());
}}, IsNonSpeculative, IsUnverifiable); }}, IsNonSpeculative, IsUnverifiable);
0x07: rpns({{
R0 = PseudoInst::rpns(xc->tcBase());
}}, IsNonSpeculative, IsUnverifiable);
0x10: deprecated_ivlb({{ 0x10: deprecated_ivlb({{
warn_once("Obsolete M5 ivlb instruction encountered.\n"); warn_once("Obsolete M5 ivlb instruction encountered.\n");
}}); }});

View file

@ -125,6 +125,12 @@ quiesceTime(ThreadContext *tc)
return (tc->readLastActivate() - tc->readLastSuspend()) / Clock::Int::ns; return (tc->readLastActivate() - tc->readLastSuspend()) / Clock::Int::ns;
} }
uint64_t
rpns(ThreadContext *tc)
{
return curTick / Clock::Int::ns;
}
void void
m5exit(ThreadContext *tc, Tick delay) m5exit(ThreadContext *tc, Tick delay)
{ {

View file

@ -47,6 +47,7 @@ void quiesce(ThreadContext *tc);
void quiesceNs(ThreadContext *tc, uint64_t ns); void quiesceNs(ThreadContext *tc, uint64_t ns);
void quiesceCycles(ThreadContext *tc, uint64_t cycles); void quiesceCycles(ThreadContext *tc, uint64_t cycles);
uint64_t quiesceTime(ThreadContext *tc); uint64_t quiesceTime(ThreadContext *tc);
uint64_t rpns(ThreadContext *tc);
void m5exit(ThreadContext *tc, Tick delay); void m5exit(ThreadContext *tc, Tick delay);
void loadsymbol(ThreadContext *xc); void loadsymbol(ThreadContext *xc);
void resetstats(ThreadContext *tc, Tick delay, Tick period); void resetstats(ThreadContext *tc, Tick delay, Tick period);

View file

@ -39,6 +39,7 @@ void quiesce(void);
void quiesceNs(uint64_t ns); void quiesceNs(uint64_t ns);
void quiesceCycle(uint64_t cycles); void quiesceCycle(uint64_t cycles);
uint64_t quiesceTime(void); uint64_t quiesceTime(void);
uint64_t rpns();
void m5_exit(uint64_t ns_delay); void m5_exit(uint64_t ns_delay);
uint64_t m5_initparam(void); uint64_t m5_initparam(void);

View file

@ -59,6 +59,7 @@ func:
#define QUIESCENS(r1) INST(m5_op, r1, 0, quiescens_func) #define QUIESCENS(r1) INST(m5_op, r1, 0, quiescens_func)
#define QUIESCECYC(r1) INST(m5_op, r1, 0, quiescecycle_func) #define QUIESCECYC(r1) INST(m5_op, r1, 0, quiescecycle_func)
#define QUIESCETIME INST(m5_op, 0, 0, quiescetime_func) #define QUIESCETIME INST(m5_op, 0, 0, quiescetime_func)
#define RPNS INST(m5_op, 0, 0, rpns_func)
#define M5EXIT(reg) INST(m5_op, reg, 0, exit_func) #define M5EXIT(reg) INST(m5_op, reg, 0, exit_func)
#define INITPARAM(reg) INST(m5_op, reg, 0, initparam_func) #define INITPARAM(reg) INST(m5_op, reg, 0, initparam_func)
#define LOADSYMBOL(reg) INST(m5_op, reg, 0, loadsymbol_func) #define LOADSYMBOL(reg) INST(m5_op, reg, 0, loadsymbol_func)
@ -79,6 +80,7 @@ SIMPLE_OP(quiesce, QUIESCE)
SIMPLE_OP(quiesceNs, QUIESCENS(16)) SIMPLE_OP(quiesceNs, QUIESCENS(16))
SIMPLE_OP(quiesceCycle, QUIESCECYC(16)) SIMPLE_OP(quiesceCycle, QUIESCECYC(16))
SIMPLE_OP(quiesceTime, QUIESCETIME) SIMPLE_OP(quiesceTime, QUIESCETIME)
SIMPLE_OP(rpns, RPNS)
SIMPLE_OP(m5_exit, M5EXIT(16)) SIMPLE_OP(m5_exit, M5EXIT(16))
SIMPLE_OP(m5_initparam, INITPARAM(0)) SIMPLE_OP(m5_initparam, INITPARAM(0))
SIMPLE_OP(m5_loadsymbol, LOADSYMBOL(0)) SIMPLE_OP(m5_loadsymbol, LOADSYMBOL(0))

View file

@ -34,6 +34,7 @@
#define quiescens_func 0x02 #define quiescens_func 0x02
#define quiescecycle_func 0x03 #define quiescecycle_func 0x03
#define quiescetime_func 0x04 #define quiescetime_func 0x04
#define rpns_func 0x07
#define deprecated1_func 0x10 // obsolete ivlb #define deprecated1_func 0x10 // obsolete ivlb
#define deprecated2_func 0x11 // obsolete ivle #define deprecated2_func 0x11 // obsolete ivle
#define deprecated3_func 0x20 // deprecated exit function #define deprecated3_func 0x20 // deprecated exit function