3 static void write_header
PARAMS ((void));
4 static void write_opcodes
PARAMS ((void));
5 static void write_template
PARAMS ((void));
15 if ((argc
> 1) && (strcmp (argv
[1], "-h") == 0))
17 else if ((argc
> 1) && (strcmp (argv
[1], "-t") == 0))
28 struct v850_opcode
*opcode
;
30 for (opcode
= (struct v850_opcode
*)v850_opcodes
; opcode
->name
; opcode
++)
31 printf("void OP_%X PARAMS ((void));\t\t/* %s */\n",
32 opcode
->opcode
, opcode
->name
);
36 /* write_template creates a file all required functions, ready */
37 /* to be filled out */
42 struct v850_opcode
*opcode
;
45 printf ("#include \"v850_sim.h\"\n");
46 printf ("#include \"simops.h\"\n");
48 for (opcode
= (struct v850_opcode
*)v850_opcodes
; opcode
->name
; opcode
++)
50 printf("/* %s */\nvoid\nOP_%X ()\n{\n", opcode
->name
, opcode
->opcode
);
54 for (i
= 0; i
< 6; i
++)
56 int flags
= v850_operands
[opcode
->operands
[i
]].flags
;
58 if (flags
& (V850_OPERAND_REG
| V850_OPERAND_SRG
| V850_OPERAND_CC
))
64 printf ("printf(\" %s\\n\");\n", opcode
->name
);
67 printf ("printf(\" %s\\t%%x\\n\", OP[0]);\n", opcode
->name
);
70 printf ("printf(\" %s\\t%%x,%%x\\n\",OP[0],OP[1]);\n",
74 printf ("printf(\" %s\\t%%x,%%x,%%x\\n\",OP[0],OP[1],OP[2]);\n",
78 fprintf (stderr
,"Too many operands: %d\n", j
);
87 struct v850_opcode
*opcode
;
91 /* write out opcode table */
92 printf ("#include \"v850_sim.h\"\n");
93 printf ("#include \"simops.h\"\n\n");
94 printf ("struct simops Simops[] = {\n");
96 for (opcode
= (struct v850_opcode
*)v850_opcodes
; opcode
->name
; opcode
++)
98 printf (" { 0x%x,0x%x,OP_%X,",
99 opcode
->opcode
, opcode
->mask
, opcode
->opcode
);
101 Opcodes
[curop
++] = opcode
->opcode
;
105 for (i
= 0; i
< 6; i
++)
107 int flags
= v850_operands
[opcode
->operands
[i
]].flags
;
109 if (flags
& (V850_OPERAND_REG
| V850_OPERAND_SRG
| V850_OPERAND_CC
))
116 for (i
= 0; i
< 6; i
++)
118 int flags
= v850_operands
[opcode
->operands
[i
]].flags
;
119 int shift
= v850_operands
[opcode
->operands
[i
]].shift
;
121 if (flags
& (V850_OPERAND_REG
| V850_OPERAND_SRG
| V850_OPERAND_CC
))
125 printf ("%d,%d,%d", shift
,
126 v850_operands
[opcode
->operands
[i
]].bits
,flags
);
142 printf ("{ 0,0,NULL,0,{0,0,0,0,0,0}},\n};\n");
This page took 0.032862 seconds and 4 git commands to generate.