Line 39... |
Line 39... |
#include "abstract.h"
|
#include "abstract.h"
|
#include "trace.h"
|
#include "trace.h"
|
#include "execute.h"
|
#include "execute.h"
|
|
|
/* CVS revision number. */
|
/* CVS revision number. */
|
static const char rcsrev[] = "$Revision: 1.5 $";
|
static const char rcsrev[] = "$Revision: 1.6 $";
|
|
|
/* Continuos run versus single step tracing switch. */
|
/* Continuos run versus single step tracing switch. */
|
int cont_run;
|
int cont_run;
|
|
|
/* History of execution */
|
/* History of execution */
|
Line 51... |
Line 51... |
|
|
char *sim_commands [] = {
|
char *sim_commands [] = {
|
"q",
|
"q",
|
"t",
|
"t",
|
"help",
|
"help",
|
|
"de",
|
"dm",
|
"dm",
|
"run",
|
"run",
|
"pr",
|
"pr",
|
"pm",
|
"pm",
|
"pc",
|
"pc",
|
Line 98... |
Line 99... |
{
|
{
|
printf ("\n");
|
printf ("\n");
|
printf ("OpenRISC 1000 (OR16+OR32) Architectural Simulator, %s\n", rcsrev);
|
printf ("OpenRISC 1000 (OR16+OR32) Architectural Simulator, %s\n", rcsrev);
|
printf ("Copyright (C) 1999 Damjan Lampret, lampret@opencores.org\n");
|
printf ("Copyright (C) 1999 Damjan Lampret, lampret@opencores.org\n");
|
printf ("Copyright (C) 2000 Damjan Lampret, lampret@opencores.org\n");
|
printf ("Copyright (C) 2000 Damjan Lampret, lampret@opencores.org\n");
|
printf (" Jimmy Chen-Min Chen, jimmy87@sunplus.com.tw\n");
|
printf (" Jimmy Chen-Min Chen, jimmy@ee.nctu.edu.tw\n");
|
printf (" Johan Rydberg, johan.rydberg@insight.se\n");
|
printf (" Johan Rydberg, johan.rydberg@insight.se\n");
|
printf ("Visit http://www.opencores.org for more information about ");
|
printf ("Visit http://www.opencores.org for more information about ");
|
printf ("OpenRISC 1000 and\nother open source cores.\n\n");
|
printf ("OpenRISC 1000 and\nother open source cores.\n\n");
|
printf ("This software comes with ABSOLUTELY NO WARRANTY; for ");
|
printf ("This software comes with ABSOLUTELY NO WARRANTY; for ");
|
printf ("details see COPYING.\nThis is free software, and you ");
|
printf ("details see COPYING.\nThis is free software, and you ");
|
Line 117... |
Line 118... |
printf("r - display all registers\n");
|
printf("r - display all registers\n");
|
printf("t - execute next instruction\n");
|
printf("t - execute next instruction\n");
|
printf("run <cycles> [<hush>] - execute <cycles> instructions, no reg dump if hush\n");
|
printf("run <cycles> [<hush>] - execute <cycles> instructions, no reg dump if hush\n");
|
printf("pr <r> <value> - patch register <r> with <value>\n");
|
printf("pr <r> <value> - patch register <r> with <value>\n");
|
printf("dm <fromaddr> [<toaddr>] - display memory from <fromaddr> to <toaddr>\n");
|
printf("dm <fromaddr> [<toaddr>] - display memory from <fromaddr> to <toaddr>\n");
|
|
printf("de - debug insn memory\n");
|
printf("pm <addr> <value> - patch memory location <addr> with <value>\n");
|
printf("pm <addr> <value> - patch memory location <addr> with <value>\n");
|
printf("pc <value> - patch PC register with <value>\n");
|
printf("pc <value> - patch PC register with <value>\n");
|
printf("break <addr> - toggle breakpoint at address <addr>\n");
|
printf("break <addr> - toggle breakpoint at address <addr>\n");
|
printf("reset - simulator reset\n");
|
printf("reset - simulator reset\n");
|
printf("hist - execution history\n");
|
printf("hist - execution history\n");
|
Line 128... |
Line 130... |
printf("info - configuration info (caches etc.)\n");
|
printf("info - configuration info (caches etc.)\n");
|
printf("<cmd> > <filename> - redirect simulator stdout to <filename> (and not emulated printf)\n");
|
printf("<cmd> > <filename> - redirect simulator stdout to <filename> (and not emulated printf)\n");
|
printf("help - available commands (this list)\n");
|
printf("help - available commands (this list)\n");
|
}
|
}
|
|
|
|
void debugmem();
|
|
|
main(argc, argv)
|
main(argc, argv)
|
int argc;
|
int argc;
|
char *argv[];
|
char *argv[];
|
{
|
{
|
char *linestr;
|
char *linestr;
|
Line 261... |
Line 265... |
set_insnbrkpoint(strtoul(item2, NULL, 0));
|
set_insnbrkpoint(strtoul(item2, NULL, 0));
|
} else
|
} else
|
if (strcmp(item1, "r") == 0) { /* dump regs */
|
if (strcmp(item1, "r") == 0) { /* dump regs */
|
dumpreg();
|
dumpreg();
|
} else
|
} else
|
|
if (strcmp(item1, "de") == 0) { /* reset simulator */
|
|
debugmem();
|
|
} else
|
if (strcmp(item1, "reset") == 0) { /* reset simulator */
|
if (strcmp(item1, "reset") == 0) { /* reset simulator */
|
reset();
|
reset();
|
} else
|
} else
|
if (strcmp(item1, "hist") == 0) { /* dump history */
|
if (strcmp(item1, "hist") == 0) { /* dump history */
|
int i;
|
int i;
|
Line 450... |
Line 457... |
*++t = '\0';
|
*++t = '\0';
|
|
|
return s;
|
return s;
|
}
|
}
|
|
|
No newline at end of file
|
No newline at end of file
|
|
void debugmem() {
|
|
int i;
|
|
printf("starting to dump mem...\n");
|
|
for(i=0; i<500; i++) {
|
|
printf("i=%x :: ", i);
|
|
if(strlen(mem[i].label) != 0)
|
|
printf("label: %s |", mem[i].label);
|
|
printf("%s ", mem[i].insn);
|
|
if(strlen(mem[i].op1) != 0) printf("%s ", mem[i].op1);
|
|
if(strlen(mem[i].op2) != 0) printf("%s ", mem[i].op2);
|
|
if(strlen(mem[i].op3) != 0) printf("%s ", mem[i].op3);
|
|
if(strlen(mem[i].op4) != 0) printf("%s ", mem[i].op4);
|
|
printf("\n");
|
|
}
|
|
}
|
|
|
No newline at end of file
|
No newline at end of file
|