Browse Source

[sim,xcc] add rdcycle/rdtime/rdinstret

cs250
Andrew Waterman 15 years ago
parent
commit
c42bce582a
  1. 2
      riscv/insns/rdcycle.h
  2. 2
      riscv/insns/rdinstret.h
  3. 2
      riscv/insns/rdtime.h
  4. 4
      riscv/processor.cc
  5. 2
      riscv/processor.h

2
riscv/insns/rdcycle.h

@ -1 +1 @@
throw trap_illegal_instruction;
RD = cycle;

2
riscv/insns/rdinstret.h

@ -1 +1 @@
throw trap_illegal_instruction;
RD = cycle;

2
riscv/insns/rdtime.h

@ -1 +1 @@
throw trap_illegal_instruction;
RD = cycle;

4
riscv/processor.cc

@ -28,11 +28,10 @@ processor_t::processor_t(sim_t* _sim, char* _mem, size_t _memsz)
fromhost = 0;
count = 0;
compare = 0;
cycle = 0;
set_sr(SR_S | SR_SX); // SX ignored if 64b mode not supported
set_fsr(0);
memset(counters,0,sizeof(counters));
// vector stuff
vecbanks = 0xff;
vecbanks_count = 8;
@ -175,6 +174,7 @@ void processor_t::step(size_t n, bool noisy)
if(count++ == compare)
cause |= 1 << (TIMER_IRQ+CAUSE_IP_SHIFT);
cycle++;
}
return;
}

2
riscv/processor.h

@ -51,7 +51,7 @@ private:
mmu_t mmu;
// counters
reg_t counters[32];
reg_t cycle;
// functions
void set_sr(uint32_t val);

Loading…
Cancel
Save