/* Simulation code for the CR16 processor.
- Copyright (C) 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2008-2018 Free Software Foundation, Inc.
Contributed by M Ranga Swami Reddy <MR.Swami.Reddy@nsc.com>
This file is part of GDB, the GNU debugger.
#include <stdio.h>
#include <ctype.h>
#include <limits.h>
+#include <string.h>
#include "ansidecl.h"
#include "opcode/cr16.h"
-static void write_header PARAMS ((void));
-static void write_opcodes PARAMS ((void));
-static void write_template PARAMS ((void));
+static void write_header (void);
+static void write_opcodes (void);
+static void write_template (void);
int
main (int argc, char *argv[])
static void
-write_header ()
+write_header (void)
{
int i = 0;
/* Loop over instruction table until a full match is found. */
for ( ; i < NUMOPCODES; i++)
- {
- printf("void OP_%X_%X PARAMS ((void));\t\t/* %s */\n",cr16_instruction[i].match, (32 - cr16_instruction[i].match_bits), cr16_instruction[i].mnemonic);
- }
+ printf("void OP_%lX_%X (SIM_DESC, SIM_CPU *);\t\t/* %s */\n",
+ cr16_instruction[i].match, (32 - cr16_instruction[i].match_bits),
+ cr16_instruction[i].mnemonic);
}
ready to be filled out. */
static void
-write_template ()
+write_template (void)
{
int i = 0,j, k, flags;
- printf ("#include \"cr16_sim.h\"\n");
+ printf ("#include \"sim-main.h\"\n");
printf ("#include \"simops.h\"\n\n");
for ( ; i < NUMOPCODES; i++)
{
if (cr16_instruction[i].size != 0)
{
- printf("/* %s */\nvoid\nOP_%X_%X ()\n{\n",cr16_instruction[i].mnemonic,cr16_instruction[i].match,(32 - cr16_instruction[i].match_bits));
+ printf ("/* %s */\nvoid\nOP_%lX_%X (SIM_DESC sd, SIM_CPU *cpu)\n{\n",
+ cr16_instruction[i].mnemonic, cr16_instruction[i].match,
+ (32 - cr16_instruction[i].match_bits));
/* count operands. */
j = 0;
long Opcodes[512];
static int curop=0;
+#if 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);
}
-
+#endif
static void
-write_opcodes ()
+write_opcodes (void)
{
int i = 0, j = 0, k;
/* write out opcode table. */
- printf ("#include \"cr16_sim.h\"\n");
+ printf ("#include \"sim-main.h\"\n");
printf ("#include \"simops.h\"\n\n");
printf ("struct simops Simops[] = {\n");
{
if (cr16_instruction[i].size != 0)
{
- printf (" { \"%s\", %ld, %d, %d, %d, \"OP_%X_%X\", OP_%X_%X, ",
+ printf (" { \"%s\", %u, %d, %ld, %u, \"OP_%lX_%X\", OP_%lX_%X, ",
cr16_instruction[i].mnemonic, cr16_instruction[i].size,
cr16_instruction[i].match_bits, cr16_instruction[i].match,
cr16_instruction[i].flags, ((BIN(cr16_instruction[i].match, cr16_instruction[i].match_bits))>>(cr16_instruction[i].match_bits)),
printf ("},\n");
}
}
- printf (" { \"NULL\",1,8,0,0,\"OP_0_20\",OP_0_20,0,{0,0,0}},\n};\n");
+ printf (" { \"NULL\",1,8,0,0,\"OP_0_20\",OP_0_20,0,{{0,0},{0,0},{0,0},{0,0}}},\n};\n");
}