OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 180 to Rev 181
    Reverse comparison

Rev 180 → Rev 181

/trunk/or1ksim/toplevel.c
83,7 → 83,7
#endif /* no DEBUGMOD_OFF */
 
/* CVS revision number. */
const char rcsrev[] = "$Revision: 1.22 $";
const char rcsrev[] = "$Revision: 1.23 $";
 
/* Continuos run versus single step tracing switch. */
int cont_run;
105,6 → 105,7
"break",
"hist",
"stats",
"stall"
"info",
"r",
"dv",
171,8 → 172,10
ctrl_c(signum)
int signum;
{
cont_run = 1;
config.iprompt = 1;
extern int cpu_stalled; /* CZ from debug_interface */
cont_run = cpu_stalled ? 0 : 1;
config.iprompt = 1;
cpu_stalled = 0;
signal(SIGINT, ctrl_c);
}
 
208,6 → 211,7
printf("break <addr> - toggle breakpoint at address <addr>\n");
printf("reset - simulator reset\n");
printf("hist - execution history\n");
printf("stall - stalls the processor and gives control to the debugger\n");
printf("stats <num|clear> - execution statistics num or clear it.\n");
printf("info - configuration info (caches etc.)\n");
printf("dv <fromaddr> [<toaddr>] [<modname>] - dumps memory as verilog (use redirect)\n");
229,6 → 233,7
int hush;
unsigned long endaddr = 0xFFFFFFFF;
int first_prompt = 1;
int trace_fd = 0;
 
srand(getpid());
init_defconfig();
611,6 → 616,36
hush = 0;
cont_run = strtol(item2, NULL, 0);
} else
if(!strcmp(item1, "stall")) { /* Added by CZ 210801 */
extern int cpu_stalled; /* CZ from debug_interface */
cpu_stalled = 1;
config.iprompt = 0;
cont_run = -1;
hush = 1;
} else
if (!strcmp(item1, "trace")) { /* Added by CZ 210801 */
char item2[256];
strtoken(linestr, item2, 2);
if(trace_fd)
{
close(trace_fd);
trace_fd = 0;
}
if(strcmp(item2,"off")) /* if we're not being turned off */
{
if(item2[0])
trace_fd = open(item2,O_CREAT | O_NOCTTY |
O_TRUNC | O_WRONLY, 0644);
else
trace_fd = dup(1);
if(trace_fd < 0)
{
perror(item2[0]?item2:"stdout");
trace_fd = 0;
}
}
} else
if (strcmp(item1, "stats") == 0) { /* stats */
char item2[20];
int i = 0;
652,12 → 687,46
if (!testsprbits(SPR_PMR, SPR_PMR_DME | SPR_PMR_SME)) {
if(cycle_delay <= 0)
{
unsigned int addr;
if (cont_run > 0) cont_run--;
if(fetch()) {
cont_run = 0; /* memory breakpoint encountered */
break;
}
decode_execute(&iqueue[0]);
addr = iqueue[0].insn_addr;
/* If trace_fd is non zero, we want
to make sure that disassemble is called */
 
decode_execute(&iqueue[0],trace_fd);
if(trace_fd)
{
char sTemp[256];
char sTemp2[256];
unsigned long value;
extern char *disassembled;
extern unsigned long reg[];
 
/* The objects passed to the
trace command should not be
hardcoded like this...instead
what to dump should be passed
on the command line.
 
FIX THIS LATER...
*/
value = (mem[0x306bc].data << 24) +
(mem[0x306bd].data << 16) +
(mem[0x306be].data << 8)
+ mem[0x306bf].data;
 
sprintf(sTemp,"0x%06x: %s",addr,disassembled);
memset(sTemp2,' ',sizeof(sTemp2));
strncpy(sTemp2,sTemp,strlen(sTemp));
sprintf(&sTemp2[40],"<0x%08x,0x%08x> [0x%08x]\n",
reg[3],reg[4],value);
write(trace_fd,sTemp2,strlen(sTemp2));
}
update_pc();
analysis();
if (!hush)

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.