X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=sim%2Fd10v%2Fgencode.c;h=9f8a41c93694f1376c006fd6668be572d1d039c0;hb=a350efd4fb368a35ada608f6bc26ccd3bed0ae6b;hp=71e92e8e746bb742fda8b2f029f2ec3cf9af0ab1;hpb=fa803dc60f0bf01297674c41d001798e18ade4dc;p=deliverable%2Fbinutils-gdb.git diff --git a/sim/d10v/gencode.c b/sim/d10v/gencode.c index 71e92e8e74..9f8a41c936 100644 --- a/sim/d10v/gencode.c +++ b/sim/d10v/gencode.c @@ -1,13 +1,17 @@ -#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 +#include +#include +#include +#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(); @@ -20,13 +24,13 @@ main (argc, argv) 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); } @@ -34,19 +38,19 @@ write_header () /* 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; @@ -82,24 +86,24 @@ write_template () long Opcodes[512]; static int curop=0; +static void check_opcodes( long op) { int i; for (i=0;iformat != 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); @@ -122,7 +126,7 @@ write_opcodes () 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++) @@ -131,7 +135,9 @@ write_opcodes () 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; @@ -139,8 +145,10 @@ write_opcodes () 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"); }