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

Subversion Repositories or1k

[/] [or1k/] [tags/] [tn_m001/] [or1ksim/] [toplevel.c] - Diff between revs 28 and 30

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 28 Rev 30
Line 41... Line 41...
#include "execute.h"
#include "execute.h"
 
 
#include "coff.h"
#include "coff.h"
 
 
/* CVS revision number. */
/* CVS revision number. */
static const char rcsrev[] = "$Revision: 1.7 $";
static const char rcsrev[] = "$Revision: 1.8 $";
 
 
/* 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 86... Line 86...
  free(p);
  free(p);
#endif
#endif
  return;
  return;
}
}
 
 
 
/* Strip whitespace from the start and end of STRING.  Return a pointer
 
   into STRING. */
 
#ifndef whitespace
 
#define whitespace(a)   ((a) == '\t' ? 1 : ((a) == ' '? 1 : 0))
 
#endif
 
 
 
char *
 
stripwhite (string)
 
     char *string;
 
{
 
  register char *s, *t;
 
 
 
  for (s = string; whitespace (*s); s++)
 
    ;
 
 
 
  if (*s == 0)
 
    return (s);
 
 
 
  t = s + strlen (s) - 1;
 
  while (t > s && whitespace (*t))
 
    t--;
 
  *++t = '\0';
 
 
 
  return s;
 
}
 
 
void
void
ctrl_c(signum)
ctrl_c(signum)
     int signum;
     int signum;
{
{
        cont_run = 1;
        cont_run = 1;
Line 158... Line 184...
        version();
        version();
        init_defconfig();
        init_defconfig();
        signal(SIGINT, ctrl_c);
        signal(SIGINT, ctrl_c);
        initstats();
        initstats();
        loadcode(argv[1]);
        loadcode(argv[1]);
 
        uart_reset();
        reset();
        reset();
 
 
        while(1)
        while(1)
    {
    {
#ifdef HAVE_LIBREADLINE
#ifdef HAVE_LIBREADLINE
Line 271... Line 298...
                } else
                } else
                if (strcmp(item1, "de") == 0) {  /* reset simulator */
                if (strcmp(item1, "de") == 0) {  /* reset simulator */
                        debugmem();
                        debugmem();
                } else
                } else
                if (strcmp(item1, "reset") == 0) {       /* reset simulator */
                if (strcmp(item1, "reset") == 0) {       /* reset simulator */
 
                        uart_reset();
                        reset();
                        reset();
                } else
                } else
                if (strcmp(item1, "hist") == 0) {        /* dump history */
                if (strcmp(item1, "hist") == 0) {        /* dump history */
                        int i;
                        int i;
                        for(i = HISTEXEC_LEN; i; i--)
                        for(i = HISTEXEC_LEN; i; i--)
Line 308... Line 336...
                if (strcmp(item1, "info") == 0) { /* configuration info */
                if (strcmp(item1, "info") == 0) { /* configuration info */
                        bpb_info();
                        bpb_info();
                        btic_info();
                        btic_info();
                        ic_info();
                        ic_info();
                        dc_info();
                        dc_info();
 
                        uart_status();
 
                        sprs_status();
                } else {
                } else {
      printf("%s: Unknown command.\n", linestr);
      printf("%s: Unknown command.\n", linestr);
    }
    }
 
 
                while(cont_run) {
                while(cont_run) {
                        cont_run--;
                        cont_run--;
                        fetch();
                        fetch();
                        decode(&iqueue[0]);
                        decode(&iqueue[0]);
                        execute();
                        execute();
 
                        uart_clock();
                        if (!hush)
                        if (!hush)
                                dumpreg();
                                dumpreg();
                }
                }
 
 
                hush = 0;
                hush = 0;
Line 433... Line 464...
  return 0;
  return 0;
}
}
 
 
#endif
#endif
 
 
/* Strip whitespace from the start and end of STRING.  Return a pointer
 
   into STRING. */
 
#ifndef whitespace
 
#define whitespace(a)   ((a) == '\t' ? 1 : ((a) == ' '? 1 : 0))
 
#endif
 
 
 
char *
 
stripwhite (string)
 
     char *string;
 
{
 
  register char *s, *t;
 
 
 
  for (s = string; whitespace (*s); s++)
 
    ;
 
 
 
  if (*s == 0)
 
    return (s);
 
 
 
  t = s + strlen (s) - 1;
 
  while (t > s && whitespace (*t))
 
    t--;
 
  *++t = '\0';
 
 
 
  return s;
 
}
 
 
 
void debugmem() {
void debugmem() {
        int i;
        int i;
        printf("starting to dump mem...\n");
        printf("starting to dump mem...\n");
        for(i=0; i<500; i++) {
        for(i=0; i<500; i++) {
                printf("i=%x :: ", i);
                printf("i=%x :: ", i);
                if(strlen(mem[i].label) != 0)
                if (mem[i].label)
                        printf("label: %s |", mem[i].label->name);
                        printf("label: %s |", mem[i].label->name);
                printf("%s ", mem[i].insn->insn);
                printf("%s ", mem[i].insn->insn);
                if(strlen(mem[i].insn->op1) != 0) printf("%s ", mem[i].insn->op1);
                if(strlen(mem[i].insn->op1) != 0) printf("%s ", mem[i].insn->op1);
                if(strlen(mem[i].insn->op2) != 0) printf("%s ", mem[i].insn->op2);
                if(strlen(mem[i].insn->op2) != 0) printf("%s ", mem[i].insn->op2);
                if(strlen(mem[i].insn->op3) != 0) printf("%s ", mem[i].insn->op3);
                if(strlen(mem[i].insn->op3) != 0) printf("%s ", mem[i].insn->op3);

powered by: WebSVN 2.1.0

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