added tmu stats debug menu

This commit is contained in:
Anthony Pesch 2017-11-15 08:35:51 -05:00
parent 2297386e0c
commit 796b7a2dca
7 changed files with 68 additions and 10 deletions

View File

@ -317,7 +317,7 @@ void holly_reg_write(struct holly *hl, uint32_t addr, uint32_t data,
uint32_t offset = addr >> 2;
reg_write_cb write = holly_cb[offset].write;
if (hl->log_reg_access) {
if (hl->log_regs) {
LOG_INFO("holly_reg_write addr=0x%08x data=0x%x", addr, data & mask);
}
@ -340,7 +340,7 @@ uint32_t holly_reg_read(struct holly *hl, uint32_t addr, uint32_t mask) {
data = hl->reg[offset];
}
if (hl->log_reg_access) {
if (hl->log_regs) {
LOG_INFO("holly_reg_read addr=0x%08x data=0x%x", addr, data);
}
@ -351,8 +351,8 @@ uint32_t holly_reg_read(struct holly *hl, uint32_t addr, uint32_t mask) {
void holly_debug_menu(struct holly *hl) {
if (igBeginMainMenuBar()) {
if (igBeginMenu("HOLLY", 1)) {
if (igMenuItem("log reg access", NULL, hl->log_reg_access, 1)) {
hl->log_reg_access = !hl->log_reg_access;
if (igMenuItem("log reg access", NULL, hl->log_regs, 1)) {
hl->log_regs = !hl->log_regs;
}
if (igMenuItem("raise all HOLLY_INT_NRM", NULL, 0, 1)) {

View File

@ -29,7 +29,7 @@ struct holly {
struct holly_g2_dma dma[HOLLY_G2_NUM_CHAN];
/* debug */
int log_reg_access;
int log_regs;
};
extern struct reg_cb holly_cb[NUM_HOLLY_REGS];

View File

@ -296,8 +296,12 @@ void sh4_debug_menu(struct sh4 *sh4) {
}
}
if (igMenuItem("log reg access", NULL, sh4->log_reg_access, 1)) {
sh4->log_reg_access = !sh4->log_reg_access;
if (igMenuItem("log reg access", NULL, sh4->log_regs, 1)) {
sh4->log_regs = !sh4->log_regs;
}
if (igMenuItem("tmu stats", NULL, sh4->tmu_stats, 1)) {
sh4->tmu_stats = !sh4->tmu_stats;
}
igEndMenu();
@ -305,6 +309,10 @@ void sh4_debug_menu(struct sh4 *sh4) {
igEndMainMenuBar();
}
if (sh4->tmu_stats) {
sh4_tmu_debug_menu(sh4);
}
}
#endif

View File

@ -9,6 +9,7 @@
#include "guest/sh4/sh4_mem.h"
#include "guest/sh4/sh4_mmu.h"
#include "guest/sh4/sh4_scif.h"
#include "guest/sh4/sh4_tmu.h"
#include "guest/sh4/sh4_types.h"
#include "jit/frontend/sh4/sh4_guest.h"
#include "jit/jit.h"
@ -43,7 +44,8 @@ struct sh4 {
struct jit_backend *backend;
/* dbg */
int log_reg_access;
int log_regs;
int tmu_stats;
struct list breakpoints;
/* intc */

View File

@ -17,7 +17,7 @@ static uint32_t sh4_reg_read(struct sh4 *sh4, uint32_t addr, uint32_t mask) {
data = sh4->reg[offset];
}
if (sh4->log_reg_access) {
if (sh4->log_regs) {
LOG_INFO("sh4_reg_read addr=0x%08x data=0x%x", addr, data);
}
@ -29,7 +29,7 @@ static void sh4_reg_write(struct sh4 *sh4, uint32_t addr, uint32_t data,
uint32_t offset = SH4_REG_OFFSET(addr);
reg_write_cb write = sh4_cb[offset].write;
if (sh4->log_reg_access) {
if (sh4->log_regs) {
LOG_INFO("sh4_reg_write addr=0x%08x data=0x%x", addr, data & mask);
}

View File

@ -1,5 +1,7 @@
#include "guest/sh4/sh4_tmu.h"
#include "guest/scheduler.h"
#include "guest/sh4/sh4.h"
#include "imgui.h"
static const int64_t PERIPHERAL_CLOCK_FREQ = SH4_CLOCK_FREQ >> 2;
static const int PERIPHERAL_SCALE[] = {2, 4, 6, 8, 10, 0, 0, 0};
@ -133,6 +135,44 @@ static void sh4_tmu_update_tcnt(struct sh4 *sh4, uint32_t n) {
}
}
#ifdef HAVE_IMGUI
void sh4_tmu_debug_menu(struct sh4 *sh4) {
if (igBegin("tmu stats", NULL, 0)) {
igColumns(6, NULL, 0);
igText("#");
igNextColumn();
igText("started");
igNextColumn();
igText("count");
igNextColumn();
igText("control");
igNextColumn();
igText("reset count");
igNextColumn();
igText("underflowed");
igNextColumn();
for (int i = 0; i < 3; i++) {
igText("%d", i);
igNextColumn();
igText(TSTR(i) ? "yes" : "no");
igNextColumn();
igText("0x%08x", sh4_tmu_tcnt(sh4, i));
igNextColumn();
igText("0x%08x", TCR(i));
igNextColumn();
igText("0x%08x", TCOR(i));
igNextColumn();
igText("0x%x", TUNI(i));
igNextColumn();
}
igEnd();
}
}
#endif
REG_W32(sh4_cb, TSTR) {
struct sh4 *sh4 = dc->sh4;
*sh4->TSTR = value;

8
src/guest/sh4/sh4_tmu.h Normal file
View File

@ -0,0 +1,8 @@
#ifndef SH4_TMU_H
#define SH4_TMU_H
struct sh4;
void sh4_tmu_debug_menu(struct sh4 *sh4);
#endif