-#include "d10v_sim.h"
-
-static void write_header PARAMS ((void));
-static void write_opcodes PARAMS ((void));
-static void write_template PARAMS ((void));
+#include "config.h"
+#include <stdio.h>
+#include <ctype.h>
+#include <limits.h>
+#include <string.h>
+#include "ansidecl.h"
+#include "opcode/d10v.h"
+
+static void write_header (void);
+static void write_opcodes (void);
+static void write_template (void);
int
-main (argc, argv)
- int argc;
- char *argv[];
+main (int argc, char *argv[])
{
if ((argc > 1) && (strcmp (argv[1],"-h") == 0))
write_header();
static void
-write_header ()
+write_header (void)
{
struct d10v_opcode *opcode;
for (opcode = (struct d10v_opcode *)d10v_opcodes; opcode->name; opcode++)
if (opcode->format != OPCODE_FAKE)
- printf("void OP_%X PARAMS ((void));\t\t/* %s */\n",opcode->opcode, opcode->name);
+ printf ("void OP_%lX (SIM_DESC, SIM_CPU *);\t\t/* %s */\n", opcode->opcode, opcode->name);
}
/* to be filled out */
static void
-write_template ()
+write_template (void)
{
struct d10v_opcode *opcode;
int i,j;
- printf ("#include \"d10v_sim.h\"\n");
+ printf ("#include \"sim-main.h\"\n");
printf ("#include \"simops.h\"\n");
for (opcode = (struct d10v_opcode *)d10v_opcodes; opcode->name; opcode++)
{
if (opcode->format != OPCODE_FAKE)
{
- printf("/* %s */\nvoid\nOP_%X ()\n{\n",opcode->name,opcode->opcode);
+ printf("/* %s */\nvoid\nOP_%lX ()\n{\n", opcode->name, opcode->opcode);
/* count operands */
j = 0;
long Opcodes[512];
static int curop=0;
+static void
check_opcodes( long op)
{
int i;
for (i=0;i<curop;i++)
if (Opcodes[i] == op)
- fprintf(stderr,"DUPLICATE OPCODES: %x\n",op);
+ fprintf(stderr,"DUPLICATE OPCODES: %lx\n", op);
}
-
static void
-write_opcodes ()
+write_opcodes (void)
{
struct d10v_opcode *opcode;
int i, j;
/* write out opcode table */
- printf ("#include \"d10v_sim.h\"\n");
+ printf ("#include \"sim-main.h\"\n");
printf ("#include \"simops.h\"\n\n");
printf ("struct simops Simops[] = {\n");
{
if (opcode->format != OPCODE_FAKE)
{
- printf (" { %ld,%d,%ld,%d,%d,%d,%d,OP_%X,", opcode->opcode,
+ printf (" { %ld,%d,%ld,%d,%d,%d,%d,OP_%lX,", opcode->opcode,
(opcode->format & LONG_OPCODE) ? 1 : 0, opcode->mask, opcode->format,
opcode->cycles, opcode->unit, opcode->exec_type, opcode->opcode);
if ((flags & OPERAND_REG) || (flags & OPERAND_NUM) || (flags & OPERAND_ADDR))
j++;
}
- printf ("%d,{",j);
+ printf ("%d,",j);
j = 0;
for (i=0;i<6;i++)
int shift = d10v_operands[opcode->operands[i]].shift;
if ((flags & OPERAND_REG) || (flags & OPERAND_NUM)|| (flags & OPERAND_ADDR))
{
- if (j)
+ if (j == 0)
+ printf ("{");
+ else
printf (", ");
if ((flags & OPERAND_REG) && (opcode->format == LONG_L))
shift += 15;
j = 1;
}
}
- printf ("}},\n");
+ if (j)
+ printf ("}");
+ printf ("},\n");
}
}
- printf ("{ 0,0,0,0,0,0,NULL,0,{ }},\n};\n");
+ printf ("{ 0,0,0,0,0,0,0,(void (*)())0,0,{0,0,0}},\n};\n");
}