static void write_opcodes PARAMS ((void));
static void write_template PARAMS ((void));
+long Opcodes[512];
+static int curop=0;
+
int
main (argc, argv)
int argc;
char *argv[];
{
- if ((argc > 1) && (strcmp (argv[1],"-h") == 0))
+ if ((argc > 1) && (strcmp (argv[1], "-h") == 0))
write_header();
- else if ((argc > 1) && (strcmp (argv[1],"-t") == 0))
+ else if ((argc > 1) && (strcmp (argv[1], "-t") == 0))
write_template ();
else
write_opcodes();
struct v850_opcode *opcode;
for (opcode = (struct v850_opcode *)v850_opcodes; opcode->name; opcode++)
- printf("void OP_%X PARAMS ((void));\t\t/* %s */\n",opcode->opcode, opcode->name);
+ printf("void OP_%X PARAMS ((void));\t\t/* %s */\n",
+ opcode->opcode, opcode->name);
}
for (opcode = (struct v850_opcode *)v850_opcodes; opcode->name; opcode++)
{
- printf("/* %s */\nvoid\nOP_%X ()\n{\n",opcode->name,opcode->opcode);
+ printf("/* %s */\nvoid\nOP_%X ()\n{\n", opcode->name, opcode->opcode);
/* count operands */
j = 0;
switch (j)
{
case 0:
- printf ("printf(\" %s\\n\");\n",opcode->name);
+ printf ("printf(\" %s\\n\");\n", opcode->name);
break;
case 1:
- printf ("printf(\" %s\\t%%x\\n\",OP[0]);\n",opcode->name);
+ printf ("printf(\" %s\\t%%x\\n\", OP[0]);\n", opcode->name);
break;
case 2:
- printf ("printf(\" %s\\t%%x,%%x\\n\",OP[0],OP[1]);\n",opcode->name);
+ printf ("printf(\" %s\\t%%x,%%x\\n\",OP[0],OP[1]);\n",
+ opcode->name);
break;
case 3:
- printf ("printf(\" %s\\t%%x,%%x,%%x\\n\",OP[0],OP[1],OP[2]);\n",opcode->name);
+ printf ("printf(\" %s\\t%%x,%%x,%%x\\n\",OP[0],OP[1],OP[2]);\n",
+ opcode->name);
break;
default:
- fprintf (stderr,"Too many operands: %d\n",j);
+ fprintf (stderr,"Too many operands: %d\n", j);
}
printf ("}\n\n");
}
}
-
-long Opcodes[512];
-static int curop=0;
-
-check_opcodes( long op)
-{
- int i;
-
- for (i=0;i<curop;i++)
- if (Opcodes[i] == op)
- fprintf(stderr,"DUPLICATE OPCODES: %x\n",op);
-}
-
-
static void
write_opcodes ()
{
printf (" { %ld,%ld,OP_%X,",
opcode->opcode, opcode->mask, opcode->opcode);
- /* REMOVE ME */
- check_opcodes (opcode->opcode);
Opcodes[curop++] = opcode->opcode;
/* count operands */
{
if (j)
printf (", ");
-#if 0
- if ((flags & OPERAND_REG) && (opcode->format == LONG_L))
- shift += 15;
-#endif
- printf ("%d,%d,%d",shift,v850_operands[opcode->operands[i]].bits,flags);
+ printf ("%d,%d,%d", shift,
+ v850_operands[opcode->operands[i]].bits,flags);
j = 1;
}
}
void
OP_300 ()
{
- unsigned int op0, op1, op2;
+ unsigned int op2;
int result, temp;
temp = OP[1];
void
OP_400 ()
{
- unsigned int op0, op1, op2;
+ unsigned int op2;
int result, temp;
temp = OP[1];
void
OP_500 ()
{
- unsigned int op0, op1, op2;
+ unsigned int op2;
int result, temp;
temp = OP[1];
void
OP_380 ()
{
- unsigned int op0, op1, op2;
- int result, temp;
+ unsigned int op0, op1;
+ int temp;
op0 = State.regs[OP[0]];
temp = OP[1];
void
OP_480 ()
{
- unsigned int op0, op1, op2;
- int result, temp;
+ unsigned int op0, op1;
+ int temp;
op0 = State.regs[OP[0]];
temp = OP[1];
void
OP_501 ()
{
- unsigned int op0, op1, op2;
- int result, temp;
+ unsigned int op0, op1;
+ int temp;
op0 = State.regs[OP[0]];
temp = OP[1];
void
OP_700 ()
{
- unsigned int op0, op1, op2;
+ unsigned int op0, op2;
int result, temp;
op0 = State.regs[OP[0]];
void
OP_720 ()
{
- unsigned int op0, op1, op2;
+ unsigned int op0, op2;
int result, temp;
op0 = State.regs[OP[0]];
void
OP_10720 ()
{
- unsigned int op0, op1, op2;
+ unsigned int op0, op2;
int result, temp;
op0 = State.regs[OP[0]];
OP_740 ()
{
unsigned int op0, op1, op2;
- int result, temp;
+ int temp;
op0 = State.regs[OP[0]];
op1 = State.regs[OP[1]];
OP_760 ()
{
unsigned int op0, op1, op2;
- int result, temp;
+ int temp;
op0 = State.regs[OP[0]];
op1 = State.regs[OP[1]];
OP_10760 ()
{
unsigned int op0, op1, op2;
- int result, temp;
+ int temp;
op0 = State.regs[OP[0]];
op1 = State.regs[OP[1]];
OP_580 ()
{
unsigned int op0, psw;
- int temp;
op0 = ((signed)OP[0] << 23) >> 23;
psw = State.sregs[5];
OP_581 ()
{
unsigned int op0, psw;
- int temp;
op0 = ((signed)OP[0] << 23) >> 23;
psw = State.sregs[5];
OP_582 ()
{
unsigned int op0, psw;
- int temp;
op0 = ((signed)OP[0] << 23) >> 23;
psw = State.sregs[5];
OP_583 ()
{
unsigned int op0, psw;
- int temp;
op0 = ((signed)OP[0] << 23) >> 23;
psw = State.sregs[5];
OP_584 ()
{
unsigned int op0, psw;
- int temp;
op0 = ((signed)OP[0] << 23) >> 23;
psw = State.sregs[5];
OP_585 ()
{
unsigned int op0;
- int temp;
op0 = ((signed)OP[0] << 23) >> 23;
State.pc += op0;
OP_586 ()
{
unsigned int op0, psw;
- int temp;
op0 = ((signed)OP[0] << 23) >> 23;
psw = State.sregs[5];
OP_587 ()
{
unsigned int op0, psw;
- int temp;
op0 = ((signed)OP[0] << 23) >> 23;
psw = State.sregs[5];
OP_588 ()
{
unsigned int op0, psw;
- int temp;
op0 = ((signed)OP[0] << 23) >> 23;
psw = State.sregs[5];
OP_589 ()
{
unsigned int op0, psw;
- int temp;
op0 = ((signed)OP[0] << 23) >> 23;
psw = State.sregs[5];
OP_58A ()
{
unsigned int op0, psw;
- int temp;
op0 = ((signed)OP[0] << 23) >> 23;
psw = State.sregs[5];
OP_58B ()
{
unsigned int op0, psw;
- int temp;
op0 = ((signed)OP[0] << 23) >> 23;
psw = State.sregs[5];
OP_58C ()
{
unsigned int op0, psw;
- int temp;
op0 = ((signed)OP[0] << 23) >> 23;
psw = State.sregs[5];
OP_58D ()
{
unsigned int op0, psw;
- int temp;
op0 = ((signed)OP[0] << 23) >> 23;
psw = State.sregs[5];
OP_58E ()
{
unsigned int op0, psw;
- int temp;
op0 = ((signed)OP[0] << 23) >> 23;
psw = State.sregs[5];
OP_58F ()
{
unsigned int op0, psw;
- int temp;
op0 = ((signed)OP[0] << 23) >> 23;
psw = State.sregs[5];
void
OP_40 ()
{
- unsigned int op0, op1, result, z, s, cy, ov;
+ unsigned int op0, op1, result, ov, s, z;
int temp;
/* Compute the result. */
ov = 0;
}
else
- ov = 1;
+ {
+ result = 0x0;
+ ov = 1;
+ }
/* Compute the condition codes. */
z = (result == 0);
{
/* Hack alert. We turn off a bit in op0 since we really only
wanted 4 bits. */
- unsigned int op0, psw, result;
+ unsigned int op0, psw, result = 0;
op0 = OP[0] & 0xf;
psw = State.sregs[5];
void
OP_160 ()
{
- unsigned int op0, op1, result, z, s, cy, ov;
+ unsigned int op0, op1, result, z, s;
/* Compute the result. */
op0 = State.regs[OP[0]];
void
OP_2A0 ()
{
- unsigned int op0, op1, result, z, s, cy, ov;
+ unsigned int op0, op1, result, z, s, cy;
op0 = OP[0] & 0x1f;
op1 = State.regs[OP[1]];
State.regs[OP[1]] = result;
State.sregs[5] &= ~(PSW_Z | PSW_S | PSW_OV | PSW_CY);
State.sregs[5] |= ((z ? PSW_Z : 0) | (s ? PSW_S : 0)
- | (cy ? PSW_CY : 0) | (ov ? PSW_OV : 0));
+ | (cy ? PSW_CY : 0));
}
/* sar reg1, reg2 */
void
OP_A007E0 ()
{
- unsigned int op0, op1, result, z, s, cy, ov;
+ unsigned int op0, op1, result, z, s, cy;
op0 = State.regs[OP[0]] & 0x1f;
op1 = State.regs[OP[1]];
void
OP_2C0 ()
{
- unsigned int op0, op1, result, z, s, cy, ov;
+ unsigned int op0, op1, result, z, s, cy;
op0 = OP[0] & 0x1f;
op1 = State.regs[OP[1]];
void
OP_C007E0 ()
{
- unsigned int op0, op1, result, z, s, cy, ov;
+ unsigned int op0, op1, result, z, s, cy;
op0 = State.regs[OP[0]] & 0x1f;
op1 = State.regs[OP[1]];
void
OP_280 ()
{
- unsigned int op0, op1, result, z, s, cy, ov;
+ unsigned int op0, op1, result, z, s, cy;
op0 = OP[0] & 0x1f;
op1 = State.regs[OP[1]];
void
OP_8007E0 ()
{
- unsigned int op0, op1, result, z, s, cy, ov;
+ unsigned int op0, op1, result, z, s, cy;
op0 = State.regs[OP[0]] & 0x1f;
op1 = State.regs[OP[1]];
void
OP_100 ()
{
- unsigned int op0, op1, result, z, s, cy, ov;
+ unsigned int op0, op1, result, z, s;
/* Compute the result. */
op0 = State.regs[OP[0]];
void
OP_680 ()
{
- unsigned int op0, op1, result, z, s, cy, ov;
+ unsigned int op0, op1, result, z, s;
op0 = OP[0] & 0xffff;
op1 = State.regs[OP[1]];
void
OP_140 ()
{
- unsigned int op0, op1, result, z, s, cy, ov;
+ unsigned int op0, op1, result, z, s;
/* Compute the result. */
op0 = State.regs[OP[0]];
void
OP_6C0 ()
{
- unsigned int op0, op1, result, z, s, cy, ov;
+ unsigned int op0, op1, result, z;
op0 = OP[0] & 0xffff;
op1 = State.regs[OP[1]];
void
OP_120 ()
{
- unsigned int op0, op1, result, z, s, cy, ov;
+ unsigned int op0, op1, result, z, s;
/* Compute the result. */
op0 = State.regs[OP[0]];
void
OP_6A0 ()
{
- unsigned int op0, op1, result, z, s, cy, ov;
+ unsigned int op0, op1, result, z, s;
op0 = OP[0] & 0xffff;
op1 = State.regs[OP[1]];
void
OP_20 ()
{
- unsigned int op0, result, z, s, cy, ov;
+ unsigned int op0, result, z, s;
/* Compute the result. */
op0 = State.regs[OP[0]];
OP_7C0 ()
{
unsigned int op0, op1, op2;
- int result, temp;
+ int temp;
op0 = State.regs[OP[0]];
op1 = OP[1] & 0x7;
OP_47C0 ()
{
unsigned int op0, op1, op2;
- int result, temp;
+ int temp;
op0 = State.regs[OP[0]];
op1 = OP[1] & 0x7;
OP_87C0 ()
{
unsigned int op0, op1, op2;
- int result, temp;
+ int temp;
op0 = State.regs[OP[0]];
op1 = OP[1] & 0x7;
OP_C7C0 ()
{
unsigned int op0, op1, op2;
- int result, temp;
+ int temp;
op0 = State.regs[OP[0]];
op1 = OP[1] & 0x7;