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

Subversion Repositories openrisc

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

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

Rev 220 Rev 226
Line 285... Line 285...
    shift_fprintf (level, fo, "cpu_state.reg[0] = 0; /* Repair in case we changed it */\n");
    shift_fprintf (level, fo, "cpu_state.reg[0] = 0; /* Repair in case we changed it */\n");
  shift_fprintf (--level, fo, "}\n");
  shift_fprintf (--level, fo, "}\n");
  return 0;
  return 0;
}
}
 
 
 
 
/* Generates .c file header */
/* Generates .c file header */
static int generate_header (FILE *fo)
static int generate_header (FILE *fo)
{
{
  fprintf (fo, "/* execgen.c -- Automatically generated decoder\n");
  fprintf (fo, "/* execgen.c -- Automatically generated decoder\n");
  fprintf (fo, "\n");
  fprintf (fo, "\n");
Line 316... Line 317...
  fprintf (fo, "   with Doxygen. */\n");
  fprintf (fo, "   with Doxygen. */\n");
  fprintf (fo, "\n");
  fprintf (fo, "\n");
 
 
  fprintf (fo, "/* This file was automatically generated by generate (see\n");
  fprintf (fo, "/* This file was automatically generated by generate (see\n");
  fprintf (fo, "   cpu/or32/generate.c) */\n\n");
  fprintf (fo, "   cpu/or32/generate.c) */\n\n");
  fprintf (fo, "#include <math.h>\n\n");
 
  fprintf (fo, "#include <stdint.h>\n\n");
 
 
  return 0;
 
}
 
 
 
/* Generates .c file decode function hedaer */
 
static int generate_decode_function_header (FILE *fo)
 
{
  fprintf (fo, "typedef union {\n\tfloat fval;\n\tuint32_t hval;\n} FLOAT;\n\n");
  fprintf (fo, "typedef union {\n\tfloat fval;\n\tuint32_t hval;\n} FLOAT;\n\n");
  fprintf (fo, "static void decode_execute (struct iqueue_entry *current)\n{\n");
  fprintf (fo, "static void decode_execute (struct iqueue_entry *current)\n{\n");
  fprintf (fo, "  uint32_t insn = current->insn;\n");
  fprintf (fo, "  uint32_t insn = current->insn;\n");
  out_lines = 5;
  out_lines +=3;
  return 0;
  return 0;
}
}
 
 
 
// List of strings which will be printed on a line after "#include "
 
char *include_strings[] = { "<math.h>",
 
                            "<stdint.h>",
 
                            "\"execute-fp.h\"",
 
                            ""}; // Last one must be empty
 
 
 
 
 
/* Generates .c file includes */
 
static int generate_includes (FILE *fo)
 
{
 
  int i;
 
  for (i=0;(strcmp(include_strings[i], "")!=0);i++)
 
    fprintf (fo, "#include %s\n\n", include_strings[i]);
 
  out_lines +=i;
 
  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;
Line 421... Line 446...
  if (generate_header (fo)) {
  if (generate_header (fo)) {
    fprintf (stderr, "generate_header\n");
    fprintf (stderr, "generate_header\n");
    return 1;
    return 1;
  }
  }
 
 
 
  if (generate_includes (fo)) {
 
    fprintf (stderr, "generate_includes\n");
 
    return 1;
 
  }
 
 
 
  if (generate_decode_function_header (fo)) {
 
    fprintf (stderr, "generate_decode_function_header\n");
 
    return 1;
 
  }
 
 
  if (generate_body (fo, automata, 0, 1)) {
  if (generate_body (fo, automata, 0, 1)) {
    fprintf (stderr, "generate_body\n");
    fprintf (stderr, "generate_body\n");
    return 1;
    return 1;
  }
  }
 
 

powered by: WebSVN 2.1.0

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