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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [or1ksim/] [cpu/] [or32/] [generate.c] - Diff between revs 240 and 429

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

Rev 240 Rev 429
Line 350... Line 350...
  return 0;
  return 0;
 
 
}
}
 
 
/* Generates .c file footer */
/* Generates .c file footer */
static int generate_footer (FILE *fo)
static int
 
generate_footer (FILE *fo)
{
{
  fprintf (fo, "}\n");
  fprintf (fo, "}\n");
  return 0;
  return 0;
}
}
 
 
/* Decodes all instructions and generates code for that.  This function
/* Decodes all instructions and generates code for that.  This function
   is similar to or1ksim_insn_decode, except it decodes all instructions.
   is similar to or1ksim_insn_decode, except it decodes all instructions.
 
 
   JPB: Added code to generate an illegal instruction exception for invalid
   JPB: Added code to generate an illegal instruction exception for invalid
   instructions. */
   instructions. */
static int generate_body (FILE *fo, unsigned long *a, unsigned long cur_mask, int level)
static int
 
generate_body (FILE *fo, unsigned long *a, unsigned long cur_mask, int level)
{
{
  unsigned long shift = *a;
  unsigned long shift = *a;
  unsigned long mask;
  unsigned long mask;
  int i;
  int i;
  int prev_inv = 0;
  int prev_inv = 0;
Line 380... Line 382...
        shift_fprintf (level, fo, "case 0x%x:\n", i);
        shift_fprintf (level, fo, "case 0x%x:\n", i);
        prev_inv = 1;
        prev_inv = 1;
      } else {
      } else {
        if(prev_inv) {
        if(prev_inv) {
          shift_fprintf (++level, fo, "/* Invalid instruction(s) */\n");
          shift_fprintf (++level, fo, "/* Invalid instruction(s) */\n");
 
          shift_fprintf (level, fo,
 
                         "except_handle (EXCEPT_ILLEGAL, cpu_state.pc);\n");
          shift_fprintf (level--, fo, "break;\n");
          shift_fprintf (level--, fo, "break;\n");
        }
        }
        shift_fprintf (level, fo, "case 0x%x:\n", i);
        shift_fprintf (level, fo, "case 0x%x:\n", i);
        generate_body (fo, or1ksim_automata + *a, cur_mask | (mask << shift), ++level);
        generate_body (fo, or1ksim_automata + *a, cur_mask | (mask << shift), ++level);
        shift_fprintf (level--, fo, "break;\n");
        shift_fprintf (level--, fo, "break;\n");

powered by: WebSVN 2.1.0

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