1996-08-29 09:06:42 +08:00
|
|
|
|
#include <signal.h>
|
|
|
|
|
#include "v850_sim.h"
|
|
|
|
|
#include "simops.h"
|
1996-09-10 10:51:07 +08:00
|
|
|
|
#include "sys/syscall.h"
|
1996-09-13 00:06:02 +08:00
|
|
|
|
#include "bfd.h"
|
1996-10-25 01:39:30 +08:00
|
|
|
|
#include <errno.h>
|
1996-08-29 09:06:42 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
enum op_types {
|
|
|
|
|
OP_UNKNOWN,
|
|
|
|
|
OP_NONE,
|
|
|
|
|
OP_TRAP,
|
|
|
|
|
OP_REG,
|
|
|
|
|
OP_REG_REG,
|
|
|
|
|
OP_REG_REG_CMP,
|
|
|
|
|
OP_REG_REG_MOVE,
|
|
|
|
|
OP_IMM_REG,
|
|
|
|
|
OP_IMM_REG_CMP,
|
|
|
|
|
OP_IMM_REG_MOVE,
|
|
|
|
|
OP_COND_BR,
|
|
|
|
|
OP_LOAD16,
|
|
|
|
|
OP_STORE16,
|
|
|
|
|
OP_LOAD32,
|
|
|
|
|
OP_STORE32,
|
|
|
|
|
OP_JUMP,
|
|
|
|
|
OP_IMM_REG_REG,
|
|
|
|
|
OP_UIMM_REG_REG,
|
|
|
|
|
OP_BIT,
|
|
|
|
|
OP_EX1,
|
|
|
|
|
OP_EX2,
|
|
|
|
|
OP_LDSR,
|
|
|
|
|
OP_STSR
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
|
static void trace_input PARAMS ((char *name, enum op_types type, int size));
|
|
|
|
|
static void trace_output PARAMS ((enum op_types result));
|
1996-09-13 00:06:02 +08:00
|
|
|
|
static int init_text_p = 0;
|
|
|
|
|
static asection *text;
|
|
|
|
|
static bfd_vma text_start;
|
|
|
|
|
static bfd_vma text_end;
|
1996-09-28 07:41:12 +08:00
|
|
|
|
extern bfd *exec_bfd;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
|
|
|
|
|
#ifndef SIZE_INSTRUCTION
|
|
|
|
|
#define SIZE_INSTRUCTION 6
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifndef SIZE_OPERANDS
|
|
|
|
|
#define SIZE_OPERANDS 16
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifndef SIZE_VALUES
|
|
|
|
|
#define SIZE_VALUES 11
|
|
|
|
|
#endif
|
|
|
|
|
|
1996-09-13 00:06:02 +08:00
|
|
|
|
#ifndef SIZE_LOCATION
|
|
|
|
|
#define SIZE_LOCATION 40
|
|
|
|
|
#endif
|
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
static void
|
|
|
|
|
trace_input (name, type, size)
|
|
|
|
|
char *name;
|
|
|
|
|
enum op_types type;
|
|
|
|
|
int size;
|
|
|
|
|
{
|
1996-09-13 00:06:02 +08:00
|
|
|
|
char buf[1024];
|
|
|
|
|
char *p;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
uint32 values[3];
|
|
|
|
|
int num_values, i;
|
|
|
|
|
char *cond;
|
1996-09-13 00:06:02 +08:00
|
|
|
|
asection *s;
|
|
|
|
|
const char *filename;
|
|
|
|
|
const char *functionname;
|
|
|
|
|
unsigned int linenumber;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
|
|
|
|
|
if ((v850_debug & DEBUG_TRACE) == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
1996-09-13 00:06:02 +08:00
|
|
|
|
buf[0] = '\0';
|
|
|
|
|
if (!init_text_p)
|
|
|
|
|
{
|
|
|
|
|
init_text_p = 1;
|
1996-09-28 07:41:12 +08:00
|
|
|
|
for (s = exec_bfd->sections; s; s = s->next)
|
|
|
|
|
if (strcmp (bfd_get_section_name (exec_bfd, s), ".text") == 0)
|
1996-09-13 00:06:02 +08:00
|
|
|
|
{
|
|
|
|
|
text = s;
|
1996-09-28 07:41:12 +08:00
|
|
|
|
text_start = bfd_get_section_vma (exec_bfd, s);
|
|
|
|
|
text_end = text_start + bfd_section_size (exec_bfd, s);
|
1996-09-13 00:06:02 +08:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (text && PC >= text_start && PC < text_end)
|
|
|
|
|
{
|
|
|
|
|
filename = (const char *)0;
|
|
|
|
|
functionname = (const char *)0;
|
|
|
|
|
linenumber = 0;
|
1996-09-28 07:41:12 +08:00
|
|
|
|
if (bfd_find_nearest_line (exec_bfd, text, (struct symbol_cache_entry **)0, PC - text_start,
|
1996-09-13 00:06:02 +08:00
|
|
|
|
&filename, &functionname, &linenumber))
|
|
|
|
|
{
|
|
|
|
|
p = buf;
|
|
|
|
|
if (linenumber)
|
|
|
|
|
{
|
|
|
|
|
sprintf (p, "Line %5d ", linenumber);
|
|
|
|
|
p += strlen (p);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (functionname)
|
|
|
|
|
{
|
|
|
|
|
sprintf (p, "Func %s ", functionname);
|
|
|
|
|
p += strlen (p);
|
|
|
|
|
}
|
|
|
|
|
else if (filename)
|
|
|
|
|
{
|
|
|
|
|
char *q = (char *) strrchr (filename, '/');
|
|
|
|
|
sprintf (p, "File %s ", (q) ? q+1 : filename);
|
|
|
|
|
p += strlen (p);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (*p == ' ')
|
|
|
|
|
*p = '\0';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
(*v850_callback->printf_filtered) (v850_callback, "0x%.8x: %-*.*s %-*s",
|
1996-09-12 04:54:21 +08:00
|
|
|
|
(unsigned)PC,
|
1996-09-13 00:06:02 +08:00
|
|
|
|
SIZE_LOCATION, SIZE_LOCATION, buf,
|
1996-09-12 04:54:21 +08:00
|
|
|
|
SIZE_INSTRUCTION, name);
|
|
|
|
|
|
|
|
|
|
switch (type)
|
|
|
|
|
{
|
|
|
|
|
default:
|
|
|
|
|
case OP_UNKNOWN:
|
|
|
|
|
case OP_NONE:
|
|
|
|
|
strcpy (buf, "unknown");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_TRAP:
|
|
|
|
|
sprintf (buf, "%d", OP[0]);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_REG:
|
|
|
|
|
sprintf (buf, "r%d", OP[0]);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_REG_REG:
|
|
|
|
|
case OP_REG_REG_CMP:
|
|
|
|
|
case OP_REG_REG_MOVE:
|
|
|
|
|
sprintf (buf, "r%d,r%d", OP[0], OP[1]);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_IMM_REG:
|
|
|
|
|
case OP_IMM_REG_CMP:
|
|
|
|
|
case OP_IMM_REG_MOVE:
|
1996-10-25 01:39:30 +08:00
|
|
|
|
sprintf (buf, "%d,r%d", OP[0], OP[1]);
|
1996-09-12 04:54:21 +08:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_COND_BR:
|
|
|
|
|
sprintf (buf, "%d", SEXT9 (OP[0]));
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_LOAD16:
|
1996-10-25 02:28:43 +08:00
|
|
|
|
sprintf (buf, "%d[r30],r%d", OP[1] * size, OP[0]);
|
1996-09-12 04:54:21 +08:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_STORE16:
|
1996-10-25 02:28:43 +08:00
|
|
|
|
sprintf (buf, "r%d,%d[r30]", OP[0], OP[1] * size);
|
1996-09-12 04:54:21 +08:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_LOAD32:
|
1996-10-25 01:39:30 +08:00
|
|
|
|
sprintf (buf, "%d[r%d],r%d", SEXT16 (OP[2]) & ~0x1, OP[0], OP[1]);
|
1996-09-12 04:54:21 +08:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_STORE32:
|
1996-10-25 01:39:30 +08:00
|
|
|
|
sprintf (buf, "r%d,%d[r%d]", OP[1], SEXT16 (OP[2] & ~0x1), OP[0]);
|
1996-09-12 04:54:21 +08:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_JUMP:
|
|
|
|
|
sprintf (buf, "%d,r%d", SEXT22 (OP[0]), OP[1]);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_IMM_REG_REG:
|
|
|
|
|
sprintf (buf, "%d,r%d,r%d", SEXT16 (OP[0]), OP[1], OP[2]);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_UIMM_REG_REG:
|
|
|
|
|
sprintf (buf, "%d,r%d,r%d", OP[0] & 0xffff, OP[1], OP[2]);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_BIT:
|
|
|
|
|
sprintf (buf, "%d,%d[r%d]", OP[1] & 0x7, SEXT16 (OP[2]), OP[0]);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_EX1:
|
|
|
|
|
switch (OP[0] & 0xf)
|
|
|
|
|
{
|
|
|
|
|
default: cond = "?"; break;
|
|
|
|
|
case 0x0: cond = "v"; break;
|
|
|
|
|
case 0x1: cond = "c"; break;
|
|
|
|
|
case 0x2: cond = "z"; break;
|
|
|
|
|
case 0x3: cond = "nh"; break;
|
|
|
|
|
case 0x4: cond = "s"; break;
|
|
|
|
|
case 0x5: cond = "t"; break;
|
|
|
|
|
case 0x6: cond = "lt"; break;
|
|
|
|
|
case 0x7: cond = "le"; break;
|
|
|
|
|
case 0x8: cond = "nv"; break;
|
|
|
|
|
case 0x9: cond = "nc"; break;
|
|
|
|
|
case 0xa: cond = "nz"; break;
|
|
|
|
|
case 0xb: cond = "h"; break;
|
|
|
|
|
case 0xc: cond = "ns"; break;
|
|
|
|
|
case 0xd: cond = "sa"; break;
|
|
|
|
|
case 0xe: cond = "ge"; break;
|
|
|
|
|
case 0xf: cond = "gt"; break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sprintf (buf, "%s,r%d", cond, OP[1]);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_EX2:
|
|
|
|
|
strcpy (buf, "EX2");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_LDSR:
|
|
|
|
|
case OP_STSR:
|
|
|
|
|
sprintf (buf, "r%d,s%d", OP[0], OP[1]);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((v850_debug & DEBUG_VALUES) == 0)
|
|
|
|
|
{
|
|
|
|
|
(*v850_callback->printf_filtered) (v850_callback, "%s\n", buf);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
(*v850_callback->printf_filtered) (v850_callback, "%-*s", SIZE_OPERANDS, buf);
|
|
|
|
|
switch (type)
|
|
|
|
|
{
|
|
|
|
|
default:
|
|
|
|
|
case OP_UNKNOWN:
|
|
|
|
|
case OP_NONE:
|
|
|
|
|
case OP_TRAP:
|
|
|
|
|
num_values = 0;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_REG:
|
|
|
|
|
case OP_REG_REG_MOVE:
|
|
|
|
|
values[0] = State.regs[OP[0]];
|
|
|
|
|
num_values = 1;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_REG_REG:
|
|
|
|
|
case OP_REG_REG_CMP:
|
|
|
|
|
values[0] = State.regs[OP[1]];
|
|
|
|
|
values[1] = State.regs[OP[0]];
|
|
|
|
|
num_values = 2;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_IMM_REG:
|
|
|
|
|
case OP_IMM_REG_CMP:
|
|
|
|
|
values[0] = SEXT5 (OP[0]);
|
|
|
|
|
values[1] = OP[1];
|
|
|
|
|
num_values = 2;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_IMM_REG_MOVE:
|
|
|
|
|
values[0] = SEXT5 (OP[0]);
|
|
|
|
|
num_values = 1;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_COND_BR:
|
|
|
|
|
values[0] = State.pc;
|
|
|
|
|
values[1] = SEXT9 (OP[0]);
|
|
|
|
|
values[2] = State.sregs[5];
|
|
|
|
|
num_values = 3;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_LOAD16:
|
1996-10-25 02:28:43 +08:00
|
|
|
|
values[0] = OP[1] * size;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
values[1] = State.regs[30];
|
|
|
|
|
num_values = 2;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_STORE16:
|
|
|
|
|
values[0] = State.regs[OP[0]];
|
1996-10-25 02:28:43 +08:00
|
|
|
|
values[1] = OP[1] * size;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
values[2] = State.regs[30];
|
|
|
|
|
num_values = 3;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_LOAD32:
|
|
|
|
|
values[0] = SEXT16 (OP[2]);
|
|
|
|
|
values[1] = State.regs[OP[0]];
|
|
|
|
|
num_values = 2;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_STORE32:
|
|
|
|
|
values[0] = State.regs[OP[1]];
|
|
|
|
|
values[1] = SEXT16 (OP[2]);
|
|
|
|
|
values[2] = State.regs[OP[0]];
|
|
|
|
|
num_values = 3;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_JUMP:
|
|
|
|
|
values[0] = SEXT22 (OP[0]);
|
|
|
|
|
values[1] = State.pc;
|
|
|
|
|
num_values = 2;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_IMM_REG_REG:
|
|
|
|
|
values[0] = SEXT16 (OP[0]) << size;
|
|
|
|
|
values[1] = State.regs[OP[1]];
|
|
|
|
|
num_values = 2;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_UIMM_REG_REG:
|
|
|
|
|
values[0] = (OP[0] & 0xffff) << size;
|
|
|
|
|
values[1] = State.regs[OP[1]];
|
|
|
|
|
num_values = 2;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_BIT:
|
|
|
|
|
num_values = 0;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_EX1:
|
|
|
|
|
values[0] = State.sregs[5];
|
|
|
|
|
num_values = 1;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_EX2:
|
|
|
|
|
num_values = 0;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_LDSR:
|
|
|
|
|
values[0] = State.regs[OP[0]];
|
|
|
|
|
num_values = 1;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_STSR:
|
|
|
|
|
values[0] = State.sregs[OP[1]];
|
|
|
|
|
num_values = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < num_values; i++)
|
|
|
|
|
(*v850_callback->printf_filtered) (v850_callback, "%*s0x%.8lx", SIZE_VALUES - 10, "", values[i]);
|
|
|
|
|
|
|
|
|
|
while (i++ < 3)
|
|
|
|
|
(*v850_callback->printf_filtered) (v850_callback, "%*s", SIZE_VALUES, "");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
trace_output (result)
|
|
|
|
|
enum op_types result;
|
|
|
|
|
{
|
|
|
|
|
if ((v850_debug & (DEBUG_TRACE | DEBUG_VALUES)) == (DEBUG_TRACE | DEBUG_VALUES))
|
|
|
|
|
{
|
|
|
|
|
switch (result)
|
|
|
|
|
{
|
|
|
|
|
default:
|
|
|
|
|
case OP_UNKNOWN:
|
|
|
|
|
case OP_NONE:
|
|
|
|
|
case OP_TRAP:
|
|
|
|
|
case OP_REG:
|
|
|
|
|
case OP_REG_REG_CMP:
|
|
|
|
|
case OP_IMM_REG_CMP:
|
|
|
|
|
case OP_COND_BR:
|
|
|
|
|
case OP_STORE16:
|
|
|
|
|
case OP_STORE32:
|
|
|
|
|
case OP_BIT:
|
|
|
|
|
case OP_EX2:
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_LOAD16:
|
|
|
|
|
case OP_STSR:
|
|
|
|
|
(*v850_callback->printf_filtered) (v850_callback, " :: 0x%.8lx",
|
|
|
|
|
(unsigned long)State.regs[OP[0]]);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_REG_REG:
|
|
|
|
|
case OP_REG_REG_MOVE:
|
|
|
|
|
case OP_IMM_REG:
|
|
|
|
|
case OP_IMM_REG_MOVE:
|
|
|
|
|
case OP_LOAD32:
|
|
|
|
|
case OP_EX1:
|
|
|
|
|
(*v850_callback->printf_filtered) (v850_callback, " :: 0x%.8lx",
|
|
|
|
|
(unsigned long)State.regs[OP[1]]);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_IMM_REG_REG:
|
|
|
|
|
case OP_UIMM_REG_REG:
|
|
|
|
|
(*v850_callback->printf_filtered) (v850_callback, " :: 0x%.8lx",
|
|
|
|
|
(unsigned long)State.regs[OP[2]]);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_JUMP:
|
|
|
|
|
if (OP[1] != 0)
|
|
|
|
|
(*v850_callback->printf_filtered) (v850_callback, " :: 0x%.8lx",
|
|
|
|
|
(unsigned long)State.regs[OP[1]]);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_LDSR:
|
|
|
|
|
(*v850_callback->printf_filtered) (v850_callback, " :: 0x%.8lx",
|
|
|
|
|
(unsigned long)State.sregs[OP[1]]);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
(*v850_callback->printf_filtered) (v850_callback, "\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#else
|
1996-09-28 07:41:12 +08:00
|
|
|
|
#define trace_input(NAME, IN1, IN2)
|
1996-09-12 04:54:21 +08:00
|
|
|
|
#define trace_output(RESULT)
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
/* sld.b */
|
1996-08-29 09:06:42 +08:00
|
|
|
|
void
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
OP_300 ()
|
1996-08-29 09:06:42 +08:00
|
|
|
|
{
|
1996-09-04 02:31:48 +08:00
|
|
|
|
unsigned int op2;
|
1996-08-30 13:49:07 +08:00
|
|
|
|
int result, temp;
|
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("sld.b", OP_LOAD16, 1);
|
1996-08-30 13:49:07 +08:00
|
|
|
|
temp = OP[1];
|
1996-10-25 02:28:43 +08:00
|
|
|
|
temp &= 0x7f;
|
1996-08-30 13:49:07 +08:00
|
|
|
|
op2 = temp;
|
1996-10-25 01:39:30 +08:00
|
|
|
|
result = load_mem (State.regs[30] + op2, 1);
|
1996-09-12 04:54:21 +08:00
|
|
|
|
State.regs[OP[0]] = SEXT8 (result);
|
|
|
|
|
trace_output (OP_LOAD16);
|
1996-08-29 09:06:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
/* sld.h */
|
1996-08-29 09:06:42 +08:00
|
|
|
|
void
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
OP_400 ()
|
|
|
|
|
{
|
1996-09-04 02:31:48 +08:00
|
|
|
|
unsigned int op2;
|
1996-08-30 13:49:07 +08:00
|
|
|
|
int result, temp;
|
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("sld.h", OP_LOAD16, 2);
|
1996-08-30 13:49:07 +08:00
|
|
|
|
temp = OP[1];
|
1996-10-25 02:28:43 +08:00
|
|
|
|
temp &= 0x7f;
|
1996-08-30 13:49:07 +08:00
|
|
|
|
op2 = temp << 1;
|
1996-10-25 01:39:30 +08:00
|
|
|
|
result = load_mem (State.regs[30] + op2, 2);
|
1996-09-12 04:54:21 +08:00
|
|
|
|
State.regs[OP[0]] = SEXT16 (result);
|
|
|
|
|
trace_output (OP_LOAD16);
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* sld.w */
|
|
|
|
|
void
|
|
|
|
|
OP_500 ()
|
1996-08-29 09:06:42 +08:00
|
|
|
|
{
|
1996-09-04 02:31:48 +08:00
|
|
|
|
unsigned int op2;
|
1996-08-30 13:49:07 +08:00
|
|
|
|
int result, temp;
|
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("sld.w", OP_LOAD16, 4);
|
1996-08-30 13:49:07 +08:00
|
|
|
|
temp = OP[1];
|
1996-10-25 05:19:22 +08:00
|
|
|
|
temp &= 0x7e;
|
1996-10-25 04:49:06 +08:00
|
|
|
|
op2 = temp << 1;
|
1996-10-25 01:39:30 +08:00
|
|
|
|
result = load_mem (State.regs[30] + op2, 4);
|
1996-08-30 13:49:07 +08:00
|
|
|
|
State.regs[OP[0]] = result;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_LOAD16);
|
1996-08-29 09:06:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
/* sst.b */
|
|
|
|
|
void
|
|
|
|
|
OP_380 ()
|
|
|
|
|
{
|
1996-09-04 02:31:48 +08:00
|
|
|
|
unsigned int op0, op1;
|
|
|
|
|
int temp;
|
1996-08-30 13:49:07 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("sst.b", OP_STORE16, 1);
|
1996-08-30 13:49:07 +08:00
|
|
|
|
op0 = State.regs[OP[0]];
|
|
|
|
|
temp = OP[1];
|
1996-10-25 02:28:43 +08:00
|
|
|
|
temp &= 0x7f;
|
1996-08-30 13:49:07 +08:00
|
|
|
|
op1 = temp;
|
1996-10-25 01:39:30 +08:00
|
|
|
|
store_mem (State.regs[30] + op1, 1, op0);
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_STORE16);
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* sst.h */
|
|
|
|
|
void
|
|
|
|
|
OP_480 ()
|
|
|
|
|
{
|
1996-09-04 02:31:48 +08:00
|
|
|
|
unsigned int op0, op1;
|
|
|
|
|
int temp;
|
1996-08-30 13:49:07 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("sst.h", OP_STORE16, 2);
|
1996-08-30 13:49:07 +08:00
|
|
|
|
op0 = State.regs[OP[0]];
|
|
|
|
|
temp = OP[1];
|
1996-10-25 02:28:43 +08:00
|
|
|
|
temp &= 0x7f;
|
1996-08-30 13:49:07 +08:00
|
|
|
|
op1 = temp << 1;
|
1996-10-25 01:39:30 +08:00
|
|
|
|
store_mem (State.regs[30] + op1, 2, op0);
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_STORE16);
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* sst.w */
|
|
|
|
|
void
|
|
|
|
|
OP_501 ()
|
|
|
|
|
{
|
1996-09-04 02:31:48 +08:00
|
|
|
|
unsigned int op0, op1;
|
|
|
|
|
int temp;
|
1996-08-30 13:49:07 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("sst.w", OP_STORE16, 4);
|
1996-08-30 13:49:07 +08:00
|
|
|
|
op0 = State.regs[OP[0]];
|
|
|
|
|
temp = OP[1];
|
1996-10-25 05:19:22 +08:00
|
|
|
|
temp &= 0x7e;
|
1996-10-25 04:49:06 +08:00
|
|
|
|
op1 = temp << 1;
|
1996-10-25 01:39:30 +08:00
|
|
|
|
store_mem (State.regs[30] + op1, 4, op0);
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_STORE16);
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ld.b */
|
|
|
|
|
void
|
|
|
|
|
OP_700 ()
|
|
|
|
|
{
|
1996-09-04 02:31:48 +08:00
|
|
|
|
unsigned int op0, op2;
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
int result, temp;
|
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("ld.b", OP_LOAD32, 1);
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
op0 = State.regs[OP[0]];
|
1996-09-12 04:54:21 +08:00
|
|
|
|
temp = SEXT16 (OP[2]);
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
op2 = temp;
|
1996-10-25 01:39:30 +08:00
|
|
|
|
result = load_mem (op0 + op2, 1);
|
1996-09-12 04:54:21 +08:00
|
|
|
|
State.regs[OP[1]] = SEXT8 (result);
|
|
|
|
|
trace_output (OP_LOAD32);
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ld.h */
|
|
|
|
|
void
|
|
|
|
|
OP_720 ()
|
|
|
|
|
{
|
1996-09-04 02:31:48 +08:00
|
|
|
|
unsigned int op0, op2;
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
int result, temp;
|
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("ld.h", OP_LOAD32, 2);
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
op0 = State.regs[OP[0]];
|
1996-09-12 04:54:21 +08:00
|
|
|
|
temp = SEXT16 (OP[2]);
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
temp &= ~0x1;
|
|
|
|
|
op2 = temp;
|
1996-10-25 01:39:30 +08:00
|
|
|
|
result = load_mem (op0 + op2, 2);
|
1996-09-12 04:54:21 +08:00
|
|
|
|
State.regs[OP[1]] = SEXT16 (result);
|
|
|
|
|
trace_output (OP_LOAD32);
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ld.w */
|
|
|
|
|
void
|
|
|
|
|
OP_10720 ()
|
|
|
|
|
{
|
1996-09-04 02:31:48 +08:00
|
|
|
|
unsigned int op0, op2;
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
int result, temp;
|
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("ld.w", OP_LOAD32, 4);
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
op0 = State.regs[OP[0]];
|
1996-09-12 04:54:21 +08:00
|
|
|
|
temp = SEXT16 (OP[2]);
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
temp &= ~0x1;
|
|
|
|
|
op2 = temp;
|
1996-10-25 01:39:30 +08:00
|
|
|
|
result = load_mem (op0 + op2, 4);
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
State.regs[OP[1]] = result;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_LOAD32);
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* st.b */
|
|
|
|
|
void
|
|
|
|
|
OP_740 ()
|
|
|
|
|
{
|
|
|
|
|
unsigned int op0, op1, op2;
|
1996-09-04 02:31:48 +08:00
|
|
|
|
int temp;
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("st.b", OP_STORE32, 1);
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
op0 = State.regs[OP[0]];
|
|
|
|
|
op1 = State.regs[OP[1]];
|
1996-09-12 04:54:21 +08:00
|
|
|
|
temp = SEXT16 (OP[2]);
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
op2 = temp;
|
1996-10-25 01:39:30 +08:00
|
|
|
|
store_mem (op0 + op2, 1, op1);
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_STORE32);
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* st.h */
|
1996-08-29 09:06:42 +08:00
|
|
|
|
void
|
|
|
|
|
OP_760 ()
|
|
|
|
|
{
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
unsigned int op0, op1, op2;
|
1996-09-04 02:31:48 +08:00
|
|
|
|
int temp;
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("st.h", OP_STORE32, 2);
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
op0 = State.regs[OP[0]];
|
|
|
|
|
op1 = State.regs[OP[1]];
|
1996-09-12 04:54:21 +08:00
|
|
|
|
temp = SEXT16 (OP[2] & ~0x1);
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
op2 = temp;
|
1996-10-25 01:39:30 +08:00
|
|
|
|
store_mem (op0 + op2, 2, op1);
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_STORE32);
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* st.w */
|
|
|
|
|
void
|
|
|
|
|
OP_10760 ()
|
|
|
|
|
{
|
|
|
|
|
unsigned int op0, op1, op2;
|
1996-09-04 02:31:48 +08:00
|
|
|
|
int temp;
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("st.w", OP_STORE32, 4);
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
op0 = State.regs[OP[0]];
|
|
|
|
|
op1 = State.regs[OP[1]];
|
1996-09-12 04:54:21 +08:00
|
|
|
|
temp = SEXT16 (OP[2] & ~0x1);
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
op2 = temp;
|
1996-10-25 01:39:30 +08:00
|
|
|
|
store_mem (op0 + op2, 4, op1);
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_STORE32);
|
1996-08-29 09:06:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
1996-08-30 11:48:13 +08:00
|
|
|
|
/* bv disp9 */
|
1996-08-29 09:06:42 +08:00
|
|
|
|
void
|
|
|
|
|
OP_580 ()
|
|
|
|
|
{
|
1996-09-12 04:54:21 +08:00
|
|
|
|
unsigned int psw;
|
|
|
|
|
int op0;
|
1996-08-29 09:06:42 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("bv", OP_COND_BR, 0);
|
|
|
|
|
op0 = SEXT9 (OP[0]);
|
1996-08-30 13:09:08 +08:00
|
|
|
|
psw = State.sregs[5];
|
1996-08-30 11:48:13 +08:00
|
|
|
|
|
|
|
|
|
if ((psw & PSW_OV) != 0)
|
|
|
|
|
State.pc += op0;
|
|
|
|
|
else
|
|
|
|
|
State.pc += 2;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_COND_BR);
|
1996-08-29 09:06:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
1996-08-30 11:48:13 +08:00
|
|
|
|
/* bl disp9 */
|
1996-08-29 09:06:42 +08:00
|
|
|
|
void
|
|
|
|
|
OP_581 ()
|
|
|
|
|
{
|
1996-09-12 04:54:21 +08:00
|
|
|
|
unsigned int psw;
|
|
|
|
|
int op0;
|
1996-08-30 11:48:13 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("bl", OP_COND_BR, 0);
|
|
|
|
|
op0 = SEXT9 (OP[0]);
|
1996-08-30 13:09:08 +08:00
|
|
|
|
psw = State.sregs[5];
|
1996-08-30 11:48:13 +08:00
|
|
|
|
|
|
|
|
|
if ((psw & PSW_CY) != 0)
|
|
|
|
|
State.pc += op0;
|
|
|
|
|
else
|
|
|
|
|
State.pc += 2;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_COND_BR);
|
1996-08-29 09:06:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
1996-08-30 11:48:13 +08:00
|
|
|
|
/* be disp9 */
|
1996-08-29 09:06:42 +08:00
|
|
|
|
void
|
|
|
|
|
OP_582 ()
|
|
|
|
|
{
|
1996-09-12 04:54:21 +08:00
|
|
|
|
unsigned int psw;
|
|
|
|
|
int op0;
|
1996-08-30 11:48:13 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("be", OP_COND_BR, 0);
|
|
|
|
|
op0 = SEXT9 (OP[0]);
|
1996-08-30 13:09:08 +08:00
|
|
|
|
psw = State.sregs[5];
|
1996-08-30 11:48:13 +08:00
|
|
|
|
|
|
|
|
|
if ((psw & PSW_Z) != 0)
|
|
|
|
|
State.pc += op0;
|
|
|
|
|
else
|
|
|
|
|
State.pc += 2;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_COND_BR);
|
1996-08-29 09:06:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
1996-08-30 11:48:13 +08:00
|
|
|
|
/* bnh disp 9*/
|
1996-08-29 09:06:42 +08:00
|
|
|
|
void
|
|
|
|
|
OP_583 ()
|
|
|
|
|
{
|
1996-09-12 04:54:21 +08:00
|
|
|
|
unsigned int psw;
|
|
|
|
|
int op0;
|
1996-08-30 11:48:13 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("bnh", OP_COND_BR, 0);
|
|
|
|
|
op0 = SEXT9 (OP[0]);
|
1996-08-30 13:09:08 +08:00
|
|
|
|
psw = State.sregs[5];
|
1996-08-30 11:48:13 +08:00
|
|
|
|
|
|
|
|
|
if ((((psw & PSW_CY) != 0) | ((psw & PSW_Z) != 0)) != 0)
|
|
|
|
|
State.pc += op0;
|
|
|
|
|
else
|
|
|
|
|
State.pc += 2;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_COND_BR);
|
1996-08-29 09:06:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
1996-08-30 11:48:13 +08:00
|
|
|
|
/* bn disp9 */
|
1996-08-29 09:06:42 +08:00
|
|
|
|
void
|
|
|
|
|
OP_584 ()
|
|
|
|
|
{
|
1996-09-12 04:54:21 +08:00
|
|
|
|
unsigned int psw;
|
|
|
|
|
int op0;
|
1996-08-30 11:48:13 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("bn", OP_COND_BR, 0);
|
|
|
|
|
op0 = SEXT9 (OP[0]);
|
1996-08-30 13:09:08 +08:00
|
|
|
|
psw = State.sregs[5];
|
1996-08-30 11:48:13 +08:00
|
|
|
|
|
|
|
|
|
if ((psw & PSW_S) != 0)
|
|
|
|
|
State.pc += op0;
|
|
|
|
|
else
|
|
|
|
|
State.pc += 2;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_COND_BR);
|
1996-08-29 09:06:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
1996-08-30 11:48:13 +08:00
|
|
|
|
/* br disp9 */
|
1996-08-29 09:06:42 +08:00
|
|
|
|
void
|
|
|
|
|
OP_585 ()
|
|
|
|
|
{
|
1996-09-12 04:54:21 +08:00
|
|
|
|
unsigned int psw;
|
|
|
|
|
int op0;
|
1996-08-30 11:48:13 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("br", OP_COND_BR, 0);
|
|
|
|
|
op0 = SEXT9 (OP[0]);
|
1996-08-30 11:48:13 +08:00
|
|
|
|
State.pc += op0;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_COND_BR);
|
1996-08-29 09:06:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
1996-08-30 11:48:13 +08:00
|
|
|
|
/* blt disp9 */
|
1996-08-29 09:06:42 +08:00
|
|
|
|
void
|
|
|
|
|
OP_586 ()
|
|
|
|
|
{
|
1996-09-12 04:54:21 +08:00
|
|
|
|
unsigned int psw;
|
|
|
|
|
int op0;
|
1996-08-30 11:48:13 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("blt", OP_COND_BR, 0);
|
|
|
|
|
op0 = SEXT9 (OP[0]);
|
1996-08-30 13:09:08 +08:00
|
|
|
|
psw = State.sregs[5];
|
1996-08-30 11:48:13 +08:00
|
|
|
|
|
|
|
|
|
if ((((psw & PSW_S) != 0) ^ ((psw & PSW_OV) != 0)) != 0)
|
|
|
|
|
State.pc += op0;
|
|
|
|
|
else
|
|
|
|
|
State.pc += 2;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_COND_BR);
|
1996-08-29 09:06:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
1996-08-30 11:48:13 +08:00
|
|
|
|
/* ble disp9 */
|
1996-08-29 09:06:42 +08:00
|
|
|
|
void
|
|
|
|
|
OP_587 ()
|
|
|
|
|
{
|
1996-09-12 04:54:21 +08:00
|
|
|
|
unsigned int psw;
|
|
|
|
|
int op0;
|
1996-08-30 11:48:13 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("ble", OP_COND_BR, 0);
|
|
|
|
|
op0 = SEXT9 (OP[0]);
|
1996-08-30 13:09:08 +08:00
|
|
|
|
psw = State.sregs[5];
|
1996-08-30 11:48:13 +08:00
|
|
|
|
|
|
|
|
|
if ((((psw & PSW_Z) != 0)
|
|
|
|
|
|| (((psw & PSW_S) != 0) ^ ((psw & PSW_OV) != 0))) != 0)
|
|
|
|
|
State.pc += op0;
|
|
|
|
|
else
|
|
|
|
|
State.pc += 2;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_COND_BR);
|
1996-08-29 09:06:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
1996-08-30 11:48:13 +08:00
|
|
|
|
/* bnv disp9 */
|
1996-08-29 09:06:42 +08:00
|
|
|
|
void
|
|
|
|
|
OP_588 ()
|
|
|
|
|
{
|
1996-09-12 04:54:21 +08:00
|
|
|
|
unsigned int psw;
|
|
|
|
|
int op0;
|
1996-08-30 11:48:13 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("bnv", OP_COND_BR, 0);
|
|
|
|
|
op0 = SEXT9 (OP[0]);
|
1996-08-30 13:09:08 +08:00
|
|
|
|
psw = State.sregs[5];
|
1996-08-30 11:48:13 +08:00
|
|
|
|
|
|
|
|
|
if ((psw & PSW_OV) == 0)
|
|
|
|
|
State.pc += op0;
|
|
|
|
|
else
|
|
|
|
|
State.pc += 2;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_COND_BR);
|
1996-08-29 09:06:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
1996-08-30 11:48:13 +08:00
|
|
|
|
/* bnl disp9 */
|
1996-08-29 09:06:42 +08:00
|
|
|
|
void
|
|
|
|
|
OP_589 ()
|
|
|
|
|
{
|
1996-09-12 04:54:21 +08:00
|
|
|
|
unsigned int psw;
|
|
|
|
|
int op0;
|
1996-08-30 11:48:13 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("bnl", OP_COND_BR, 0);
|
|
|
|
|
op0 = SEXT9 (OP[0]);
|
1996-08-30 13:09:08 +08:00
|
|
|
|
psw = State.sregs[5];
|
1996-08-30 11:48:13 +08:00
|
|
|
|
|
|
|
|
|
if ((psw & PSW_CY) == 0)
|
|
|
|
|
State.pc += op0;
|
|
|
|
|
else
|
|
|
|
|
State.pc += 2;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_COND_BR);
|
1996-08-29 09:06:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
1996-08-30 11:48:13 +08:00
|
|
|
|
/* bne disp9 */
|
1996-08-29 09:06:42 +08:00
|
|
|
|
void
|
|
|
|
|
OP_58A ()
|
|
|
|
|
{
|
1996-09-12 04:54:21 +08:00
|
|
|
|
unsigned int psw;
|
|
|
|
|
int op0;
|
1996-08-30 11:48:13 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("bne", OP_COND_BR, 0);
|
|
|
|
|
op0 = SEXT9 (OP[0]);
|
1996-08-30 13:09:08 +08:00
|
|
|
|
psw = State.sregs[5];
|
1996-08-30 11:48:13 +08:00
|
|
|
|
|
|
|
|
|
if ((psw & PSW_Z) == 0)
|
|
|
|
|
State.pc += op0;
|
|
|
|
|
else
|
|
|
|
|
State.pc += 2;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_COND_BR);
|
1996-08-29 09:06:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
1996-08-30 11:48:13 +08:00
|
|
|
|
/* bh disp9 */
|
1996-08-29 09:06:42 +08:00
|
|
|
|
void
|
|
|
|
|
OP_58B ()
|
|
|
|
|
{
|
1996-09-12 04:54:21 +08:00
|
|
|
|
unsigned int psw;
|
|
|
|
|
int op0;
|
1996-08-29 09:06:42 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("bh", OP_COND_BR, 0);
|
|
|
|
|
op0 = SEXT9 (OP[0]);
|
1996-08-30 13:09:08 +08:00
|
|
|
|
psw = State.sregs[5];
|
1996-08-30 11:48:13 +08:00
|
|
|
|
|
|
|
|
|
if ((((psw & PSW_CY) != 0) | ((psw & PSW_Z) != 0)) == 0)
|
|
|
|
|
State.pc += op0;
|
|
|
|
|
else
|
|
|
|
|
State.pc += 2;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_COND_BR);
|
1996-08-29 09:06:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
1996-08-30 11:48:13 +08:00
|
|
|
|
/* bp disp9 */
|
1996-08-29 09:06:42 +08:00
|
|
|
|
void
|
1996-08-30 11:48:13 +08:00
|
|
|
|
OP_58C ()
|
1996-08-29 09:06:42 +08:00
|
|
|
|
{
|
1996-09-12 04:54:21 +08:00
|
|
|
|
unsigned int psw;
|
|
|
|
|
int op0;
|
1996-08-29 09:06:42 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("bp", OP_COND_BR, 0);
|
|
|
|
|
op0 = SEXT9 (OP[0]);
|
1996-08-30 13:09:08 +08:00
|
|
|
|
psw = State.sregs[5];
|
1996-08-30 11:48:13 +08:00
|
|
|
|
|
|
|
|
|
if ((psw & PSW_S) == 0)
|
|
|
|
|
State.pc += op0;
|
|
|
|
|
else
|
|
|
|
|
State.pc += 2;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_COND_BR);
|
1996-08-29 09:06:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
1996-08-30 11:48:13 +08:00
|
|
|
|
/* bsa disp9 */
|
1996-08-29 09:06:42 +08:00
|
|
|
|
void
|
|
|
|
|
OP_58D ()
|
|
|
|
|
{
|
1996-09-12 04:54:21 +08:00
|
|
|
|
unsigned int psw;
|
|
|
|
|
int op0;
|
1996-08-30 11:48:13 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("bsa", OP_COND_BR, 0);
|
|
|
|
|
op0 = SEXT9 (OP[0]);
|
1996-08-30 13:09:08 +08:00
|
|
|
|
psw = State.sregs[5];
|
1996-08-30 11:48:13 +08:00
|
|
|
|
|
|
|
|
|
if ((psw & PSW_SAT) != 0)
|
|
|
|
|
State.pc += op0;
|
|
|
|
|
else
|
|
|
|
|
State.pc += 2;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_COND_BR);
|
1996-08-29 09:06:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
1996-08-30 11:48:13 +08:00
|
|
|
|
/* bge disp9 */
|
1996-08-29 09:06:42 +08:00
|
|
|
|
void
|
|
|
|
|
OP_58E ()
|
|
|
|
|
{
|
1996-09-12 04:54:21 +08:00
|
|
|
|
unsigned int psw;
|
|
|
|
|
int op0;
|
1996-08-30 11:48:13 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("bge", OP_COND_BR, 0);
|
|
|
|
|
op0 = SEXT9 (OP[0]);
|
1996-08-30 13:09:08 +08:00
|
|
|
|
psw = State.sregs[5];
|
1996-08-30 11:48:13 +08:00
|
|
|
|
|
|
|
|
|
if ((((psw & PSW_S) != 0) ^ ((psw & PSW_OV) != 0)) == 0)
|
|
|
|
|
State.pc += op0;
|
|
|
|
|
else
|
|
|
|
|
State.pc += 2;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_COND_BR);
|
1996-08-29 09:06:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
1996-08-30 11:48:13 +08:00
|
|
|
|
/* bgt disp9 */
|
1996-08-29 09:06:42 +08:00
|
|
|
|
void
|
|
|
|
|
OP_58F ()
|
|
|
|
|
{
|
1996-09-12 04:54:21 +08:00
|
|
|
|
unsigned int psw;
|
|
|
|
|
int op0;
|
1996-08-30 11:48:13 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("bgt", OP_COND_BR, 0);
|
|
|
|
|
op0 = SEXT9 (OP[0]);
|
1996-08-30 13:09:08 +08:00
|
|
|
|
psw = State.sregs[5];
|
1996-08-30 11:48:13 +08:00
|
|
|
|
|
|
|
|
|
if ((((psw & PSW_Z) != 0)
|
|
|
|
|
|| (((psw & PSW_S) != 0) ^ ((psw & PSW_OV) != 0))) == 0)
|
|
|
|
|
State.pc += op0;
|
|
|
|
|
else
|
|
|
|
|
State.pc += 2;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_COND_BR);
|
1996-08-29 09:06:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
1996-08-30 12:27:48 +08:00
|
|
|
|
/* jmp [reg1] */
|
1996-08-29 09:06:42 +08:00
|
|
|
|
void
|
1996-08-30 12:27:48 +08:00
|
|
|
|
OP_60 ()
|
1996-08-29 09:06:42 +08:00
|
|
|
|
{
|
1996-08-30 12:27:48 +08:00
|
|
|
|
/* interp.c will bump this by +2, so correct for it here. */
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("jmp", OP_REG, 0);
|
1996-08-30 12:27:48 +08:00
|
|
|
|
State.pc = State.regs[OP[0]] - 2;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_REG);
|
1996-08-29 09:06:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
1996-08-30 12:27:48 +08:00
|
|
|
|
/* jarl disp22, reg */
|
|
|
|
|
void
|
|
|
|
|
OP_780 ()
|
|
|
|
|
{
|
|
|
|
|
unsigned int op0, opc;
|
|
|
|
|
int temp;
|
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("jarl", OP_JUMP, 0);
|
|
|
|
|
temp = SEXT22 (OP[0]);
|
1996-08-30 12:27:48 +08:00
|
|
|
|
op0 = temp;
|
|
|
|
|
opc = State.pc;
|
|
|
|
|
|
|
|
|
|
State.pc += temp;
|
|
|
|
|
|
|
|
|
|
/* Gross. jarl X,r0 is really jr and doesn't save its result. */
|
|
|
|
|
if (OP[1] != 0)
|
|
|
|
|
State.regs[OP[1]] = opc + 4;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_JUMP);
|
1996-08-30 12:27:48 +08:00
|
|
|
|
}
|
1996-08-29 09:06:42 +08:00
|
|
|
|
|
1996-08-30 07:39:23 +08:00
|
|
|
|
/* add reg, reg */
|
1996-08-29 09:06:42 +08:00
|
|
|
|
void
|
1996-08-30 03:53:37 +08:00
|
|
|
|
OP_1C0 ()
|
1996-08-29 09:06:42 +08:00
|
|
|
|
{
|
1996-08-30 07:39:23 +08:00
|
|
|
|
unsigned int op0, op1, result, z, s, cy, ov;
|
1996-08-29 09:06:42 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("add", OP_REG_REG, 0);
|
1996-08-30 07:39:23 +08:00
|
|
|
|
/* Compute the result. */
|
|
|
|
|
op0 = State.regs[OP[0]];
|
|
|
|
|
op1 = State.regs[OP[1]];
|
|
|
|
|
result = op0 + op1;
|
1996-08-30 03:53:37 +08:00
|
|
|
|
|
1996-08-30 07:39:23 +08:00
|
|
|
|
/* Compute the condition codes. */
|
|
|
|
|
z = (result == 0);
|
|
|
|
|
s = (result & 0x80000000);
|
|
|
|
|
cy = (result < op0 || result < op1);
|
|
|
|
|
ov = ((op0 & 0x80000000) == (op1 & 0x80000000)
|
|
|
|
|
&& (op0 & 0x80000000) != (result & 0x80000000));
|
|
|
|
|
|
|
|
|
|
/* Store the result and condition codes. */
|
|
|
|
|
State.regs[OP[1]] = result;
|
1996-08-30 13:09:08 +08:00
|
|
|
|
State.sregs[5] &= ~(PSW_Z | PSW_S | PSW_CY | PSW_OV);
|
|
|
|
|
State.sregs[5] |= ((z ? PSW_Z : 0) | (s ? PSW_S : 0)
|
|
|
|
|
| (cy ? PSW_CY : 0) | (ov ? PSW_OV : 0));
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_REG_REG);
|
1996-08-30 07:39:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* add sign_extend(imm5), reg */
|
1996-08-29 09:06:42 +08:00
|
|
|
|
void
|
1996-08-30 03:53:37 +08:00
|
|
|
|
OP_240 ()
|
1996-08-29 09:06:42 +08:00
|
|
|
|
{
|
1996-08-30 07:39:23 +08:00
|
|
|
|
unsigned int op0, op1, result, z, s, cy, ov;
|
|
|
|
|
int temp;
|
1996-08-30 03:53:37 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("add", OP_IMM_REG, 0);
|
|
|
|
|
|
1996-08-30 07:39:23 +08:00
|
|
|
|
/* Compute the result. */
|
1996-09-12 04:54:21 +08:00
|
|
|
|
temp = SEXT5 (OP[0]);
|
1996-08-30 07:39:23 +08:00
|
|
|
|
op0 = temp;
|
|
|
|
|
op1 = State.regs[OP[1]];
|
|
|
|
|
result = op0 + op1;
|
|
|
|
|
|
|
|
|
|
/* Compute the condition codes. */
|
|
|
|
|
z = (result == 0);
|
|
|
|
|
s = (result & 0x80000000);
|
|
|
|
|
cy = (result < op0 || result < op1);
|
|
|
|
|
ov = ((op0 & 0x80000000) == (op1 & 0x80000000)
|
|
|
|
|
&& (op0 & 0x80000000) != (result & 0x80000000));
|
1996-08-29 09:06:42 +08:00
|
|
|
|
|
1996-08-30 07:39:23 +08:00
|
|
|
|
/* Store the result and condition codes. */
|
|
|
|
|
State.regs[OP[1]] = result;
|
1996-08-30 13:09:08 +08:00
|
|
|
|
State.sregs[5] &= ~(PSW_Z | PSW_S | PSW_CY | PSW_OV);
|
|
|
|
|
State.sregs[5] |= ((z ? PSW_Z : 0) | (s ? PSW_S : 0)
|
1996-08-30 07:39:23 +08:00
|
|
|
|
| (cy ? PSW_CY : 0) | (ov ? PSW_OV : 0));
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_IMM_REG);
|
1996-08-30 07:39:23 +08:00
|
|
|
|
}
|
1996-08-30 03:53:37 +08:00
|
|
|
|
|
1996-08-30 07:39:23 +08:00
|
|
|
|
/* addi sign_extend(imm16), reg, reg */
|
1996-08-29 09:06:42 +08:00
|
|
|
|
void
|
1996-08-30 03:53:37 +08:00
|
|
|
|
OP_600 ()
|
1996-08-29 09:06:42 +08:00
|
|
|
|
{
|
1996-08-30 07:39:23 +08:00
|
|
|
|
unsigned int op0, op1, result, z, s, cy, ov;
|
|
|
|
|
int temp;
|
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("addi", OP_IMM_REG_REG, 0);
|
|
|
|
|
|
1996-08-30 07:39:23 +08:00
|
|
|
|
/* Compute the result. */
|
1996-09-12 04:54:21 +08:00
|
|
|
|
temp = SEXT16 (OP[0]);
|
1996-08-30 07:39:23 +08:00
|
|
|
|
op0 = temp;
|
|
|
|
|
op1 = State.regs[OP[1]];
|
|
|
|
|
result = op0 + op1;
|
|
|
|
|
|
|
|
|
|
/* Compute the condition codes. */
|
|
|
|
|
z = (result == 0);
|
|
|
|
|
s = (result & 0x80000000);
|
|
|
|
|
cy = (result < op0 || result < op1);
|
|
|
|
|
ov = ((op0 & 0x80000000) == (op1 & 0x80000000)
|
|
|
|
|
&& (op0 & 0x80000000) != (result & 0x80000000));
|
|
|
|
|
|
|
|
|
|
/* Store the result and condition codes. */
|
|
|
|
|
State.regs[OP[2]] = result;
|
1996-08-30 13:09:08 +08:00
|
|
|
|
State.sregs[5] &= ~(PSW_Z | PSW_S | PSW_CY | PSW_OV);
|
|
|
|
|
State.sregs[5] |= ((z ? PSW_Z : 0) | (s ? PSW_S : 0)
|
1996-08-30 07:39:23 +08:00
|
|
|
|
| (cy ? PSW_CY : 0) | (ov ? PSW_OV : 0));
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_IMM_REG_REG);
|
1996-08-29 09:06:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
1996-08-30 11:07:24 +08:00
|
|
|
|
/* sub reg1, reg2 */
|
1996-08-29 09:06:42 +08:00
|
|
|
|
void
|
1996-08-30 03:53:37 +08:00
|
|
|
|
OP_1A0 ()
|
1996-08-29 09:06:42 +08:00
|
|
|
|
{
|
1996-08-30 11:07:24 +08:00
|
|
|
|
unsigned int op0, op1, result, z, s, cy, ov;
|
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("sub", OP_REG_REG, 0);
|
1996-08-30 11:07:24 +08:00
|
|
|
|
/* Compute the result. */
|
|
|
|
|
op0 = State.regs[OP[0]];
|
|
|
|
|
op1 = State.regs[OP[1]];
|
|
|
|
|
result = op1 - op0;
|
1996-08-29 09:06:42 +08:00
|
|
|
|
|
1996-08-30 11:07:24 +08:00
|
|
|
|
/* Compute the condition codes. */
|
|
|
|
|
z = (result == 0);
|
|
|
|
|
s = (result & 0x80000000);
|
1996-09-04 00:25:51 +08:00
|
|
|
|
cy = (op1 < op0);
|
1996-08-30 11:07:24 +08:00
|
|
|
|
ov = ((op1 & 0x80000000) != (op0 & 0x80000000)
|
|
|
|
|
&& (op1 & 0x80000000) != (result & 0x80000000));
|
1996-08-30 03:53:37 +08:00
|
|
|
|
|
1996-08-30 11:07:24 +08:00
|
|
|
|
/* Store the result and condition codes. */
|
|
|
|
|
State.regs[OP[1]] = result;
|
1996-08-30 13:09:08 +08:00
|
|
|
|
State.sregs[5] &= ~(PSW_Z | PSW_S | PSW_CY | PSW_OV);
|
|
|
|
|
State.sregs[5] |= ((z ? PSW_Z : 0) | (s ? PSW_S : 0)
|
1996-08-30 11:07:24 +08:00
|
|
|
|
| (cy ? PSW_CY : 0) | (ov ? PSW_OV : 0));
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_REG_REG);
|
1996-08-30 11:07:24 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* subr reg1, reg2 */
|
1996-08-29 09:06:42 +08:00
|
|
|
|
void
|
1996-08-30 03:53:37 +08:00
|
|
|
|
OP_180 ()
|
1996-08-29 09:06:42 +08:00
|
|
|
|
{
|
1996-08-30 11:07:24 +08:00
|
|
|
|
unsigned int op0, op1, result, z, s, cy, ov;
|
1996-08-29 09:06:42 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("subr", OP_REG_REG, 0);
|
1996-08-30 11:07:24 +08:00
|
|
|
|
/* Compute the result. */
|
|
|
|
|
op0 = State.regs[OP[0]];
|
|
|
|
|
op1 = State.regs[OP[1]];
|
|
|
|
|
result = op0 - op1;
|
1996-08-30 04:08:37 +08:00
|
|
|
|
|
1996-08-30 11:07:24 +08:00
|
|
|
|
/* Compute the condition codes. */
|
|
|
|
|
z = (result == 0);
|
|
|
|
|
s = (result & 0x80000000);
|
1996-09-04 00:25:51 +08:00
|
|
|
|
cy = (op0 < op1);
|
1996-08-30 11:07:24 +08:00
|
|
|
|
ov = ((op0 & 0x80000000) != (op1 & 0x80000000)
|
|
|
|
|
&& (op0 & 0x80000000) != (result & 0x80000000));
|
|
|
|
|
|
|
|
|
|
/* Store the result and condition codes. */
|
|
|
|
|
State.regs[OP[1]] = result;
|
1996-08-30 13:09:08 +08:00
|
|
|
|
State.sregs[5] &= ~(PSW_Z | PSW_S | PSW_CY | PSW_OV);
|
|
|
|
|
State.sregs[5] |= ((z ? PSW_Z : 0) | (s ? PSW_S : 0)
|
1996-08-30 11:07:24 +08:00
|
|
|
|
| (cy ? PSW_CY : 0) | (ov ? PSW_OV : 0));
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_REG_REG);
|
1996-08-30 11:07:24 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* mulh reg1, reg2 */
|
1996-08-29 09:06:42 +08:00
|
|
|
|
void
|
1996-08-30 04:08:37 +08:00
|
|
|
|
OP_E0 ()
|
1996-08-29 09:06:42 +08:00
|
|
|
|
{
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("mulh", OP_REG_REG, 0);
|
1996-08-30 04:08:37 +08:00
|
|
|
|
State.regs[OP[1]] = ((State.regs[OP[1]] & 0xffff)
|
1996-08-30 06:05:15 +08:00
|
|
|
|
* (State.regs[OP[0]] & 0xffff));
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_REG_REG);
|
1996-08-29 09:06:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
1996-08-30 04:08:37 +08:00
|
|
|
|
/* mulh sign_extend(imm5), reg2
|
|
|
|
|
|
|
|
|
|
Condition codes */
|
1996-08-29 09:06:42 +08:00
|
|
|
|
void
|
1996-08-30 04:08:37 +08:00
|
|
|
|
OP_2E0 ()
|
1996-08-29 09:06:42 +08:00
|
|
|
|
{
|
1996-09-12 04:54:21 +08:00
|
|
|
|
int value = SEXT5 (OP[0]);
|
1996-08-30 04:08:37 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("mulh", OP_IMM_REG, 0);
|
1996-08-30 04:08:37 +08:00
|
|
|
|
State.regs[OP[1]] = (State.regs[OP[1]] & 0xffff) * value;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_IMM_REG);
|
1996-08-29 09:06:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
1996-08-30 11:07:24 +08:00
|
|
|
|
/* mulhi imm16, reg1, reg2 */
|
1996-08-29 09:06:42 +08:00
|
|
|
|
void
|
1996-08-30 04:08:37 +08:00
|
|
|
|
OP_6E0 ()
|
|
|
|
|
{
|
1996-09-12 04:54:21 +08:00
|
|
|
|
int value = OP[0] & 0xffff;
|
1996-08-30 04:08:37 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("mulhi", OP_IMM_REG_REG, 0);
|
1996-08-30 06:05:15 +08:00
|
|
|
|
State.regs[OP[2]] = (State.regs[OP[1]] & 0xffff) * value;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_IMM_REG_REG);
|
1996-08-30 04:08:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
1996-08-30 11:07:24 +08:00
|
|
|
|
/* divh reg1, reg2 */
|
1996-08-30 04:08:37 +08:00
|
|
|
|
void
|
|
|
|
|
OP_40 ()
|
1996-08-29 09:06:42 +08:00
|
|
|
|
{
|
1996-09-04 02:31:48 +08:00
|
|
|
|
unsigned int op0, op1, result, ov, s, z;
|
1996-08-30 11:07:24 +08:00
|
|
|
|
int temp;
|
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("divh", OP_REG_REG, 0);
|
|
|
|
|
|
1996-08-30 11:07:24 +08:00
|
|
|
|
/* Compute the result. */
|
1996-09-12 04:54:21 +08:00
|
|
|
|
temp = SEXT16 (State.regs[OP[0]]);
|
1996-08-30 11:07:24 +08:00
|
|
|
|
op0 = temp;
|
|
|
|
|
op1 = State.regs[OP[1]];
|
|
|
|
|
|
|
|
|
|
if (op0 == 0xffffffff && op1 == 0x80000000)
|
|
|
|
|
{
|
|
|
|
|
result = 0x80000000;
|
|
|
|
|
ov = 1;
|
|
|
|
|
}
|
|
|
|
|
else if (op0 != 0)
|
|
|
|
|
{
|
|
|
|
|
result = op1 / op0;
|
|
|
|
|
ov = 0;
|
|
|
|
|
}
|
|
|
|
|
else
|
1996-09-04 02:31:48 +08:00
|
|
|
|
{
|
|
|
|
|
result = 0x0;
|
|
|
|
|
ov = 1;
|
|
|
|
|
}
|
1996-08-30 11:07:24 +08:00
|
|
|
|
|
|
|
|
|
/* Compute the condition codes. */
|
|
|
|
|
z = (result == 0);
|
|
|
|
|
s = (result & 0x80000000);
|
|
|
|
|
|
|
|
|
|
/* Store the result and condition codes. */
|
|
|
|
|
State.regs[OP[1]] = result;
|
1996-08-30 13:09:08 +08:00
|
|
|
|
State.sregs[5] &= ~(PSW_Z | PSW_S | PSW_OV);
|
|
|
|
|
State.sregs[5] |= ((z ? PSW_Z : 0) | (s ? PSW_S : 0)
|
1996-08-30 11:07:24 +08:00
|
|
|
|
| (ov ? PSW_OV : 0));
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_REG_REG);
|
1996-08-29 09:06:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
1996-08-30 12:11:32 +08:00
|
|
|
|
/* cmp reg, reg */
|
|
|
|
|
void
|
|
|
|
|
OP_1E0 ()
|
|
|
|
|
{
|
|
|
|
|
unsigned int op0, op1, result, z, s, cy, ov;
|
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("cmp", OP_REG_REG_CMP, 0);
|
1996-08-30 12:11:32 +08:00
|
|
|
|
/* Compute the result. */
|
|
|
|
|
op0 = State.regs[OP[0]];
|
|
|
|
|
op1 = State.regs[OP[1]];
|
|
|
|
|
result = op1 - op0;
|
|
|
|
|
|
|
|
|
|
/* Compute the condition codes. */
|
|
|
|
|
z = (result == 0);
|
|
|
|
|
s = (result & 0x80000000);
|
1996-09-04 00:25:51 +08:00
|
|
|
|
cy = (op1 < op0);
|
1996-08-30 12:11:32 +08:00
|
|
|
|
ov = ((op1 & 0x80000000) != (op0 & 0x80000000)
|
|
|
|
|
&& (op1 & 0x80000000) != (result & 0x80000000));
|
|
|
|
|
|
|
|
|
|
/* Set condition codes. */
|
1996-08-30 13:09:08 +08:00
|
|
|
|
State.sregs[5] &= ~(PSW_Z | PSW_S | PSW_CY | PSW_OV);
|
|
|
|
|
State.sregs[5] |= ((z ? PSW_Z : 0) | (s ? PSW_S : 0)
|
1996-08-30 12:11:32 +08:00
|
|
|
|
| (cy ? PSW_CY : 0) | (ov ? PSW_OV : 0));
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_REG_REG_CMP);
|
1996-08-30 12:11:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* cmp sign_extend(imm5), reg */
|
|
|
|
|
void
|
|
|
|
|
OP_260 ()
|
|
|
|
|
{
|
|
|
|
|
unsigned int op0, op1, result, z, s, cy, ov;
|
|
|
|
|
int temp;
|
|
|
|
|
|
|
|
|
|
/* Compute the result. */
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("cmp", OP_IMM_REG_CMP, 0);
|
|
|
|
|
temp = SEXT5 (OP[0]);
|
1996-08-30 12:11:32 +08:00
|
|
|
|
op0 = temp;
|
|
|
|
|
op1 = State.regs[OP[1]];
|
|
|
|
|
result = op1 - op0;
|
|
|
|
|
|
|
|
|
|
/* Compute the condition codes. */
|
|
|
|
|
z = (result == 0);
|
|
|
|
|
s = (result & 0x80000000);
|
1996-09-04 00:25:51 +08:00
|
|
|
|
cy = (op1 < op0);
|
1996-08-30 12:11:32 +08:00
|
|
|
|
ov = ((op1 & 0x80000000) != (op0 & 0x80000000)
|
|
|
|
|
&& (op1 & 0x80000000) != (result & 0x80000000));
|
|
|
|
|
|
|
|
|
|
/* Set condition codes. */
|
1996-08-30 13:09:08 +08:00
|
|
|
|
State.sregs[5] &= ~(PSW_Z | PSW_S | PSW_CY | PSW_OV);
|
|
|
|
|
State.sregs[5] |= ((z ? PSW_Z : 0) | (s ? PSW_S : 0)
|
1996-08-30 12:11:32 +08:00
|
|
|
|
| (cy ? PSW_CY : 0) | (ov ? PSW_OV : 0));
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_IMM_REG_CMP);
|
1996-08-30 12:11:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* setf cccc,reg2 */
|
|
|
|
|
void
|
|
|
|
|
OP_7E0 ()
|
|
|
|
|
{
|
|
|
|
|
/* Hack alert. We turn off a bit in op0 since we really only
|
|
|
|
|
wanted 4 bits. */
|
1996-09-04 02:31:48 +08:00
|
|
|
|
unsigned int op0, psw, result = 0;
|
1996-08-30 12:11:32 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("setf", OP_EX1, 0);
|
1996-08-30 12:11:32 +08:00
|
|
|
|
op0 = OP[0] & 0xf;
|
1996-08-30 13:09:08 +08:00
|
|
|
|
psw = State.sregs[5];
|
1996-08-30 12:11:32 +08:00
|
|
|
|
|
|
|
|
|
switch (op0)
|
|
|
|
|
{
|
|
|
|
|
case 0x0:
|
|
|
|
|
result = ((psw & PSW_OV) != 0);
|
|
|
|
|
break;
|
|
|
|
|
case 0x1:
|
|
|
|
|
result = ((psw & PSW_CY) != 0);
|
|
|
|
|
break;
|
|
|
|
|
case 0x2:
|
|
|
|
|
result = ((psw & PSW_Z) != 0);
|
|
|
|
|
break;
|
|
|
|
|
case 0x3:
|
|
|
|
|
result = ((((psw & PSW_CY) != 0) | ((psw & PSW_Z) != 0)) != 0);
|
|
|
|
|
break;
|
|
|
|
|
case 0x4:
|
|
|
|
|
result = ((psw & PSW_S) != 0);
|
|
|
|
|
break;
|
|
|
|
|
case 0x5:
|
|
|
|
|
result = 1;
|
|
|
|
|
break;
|
|
|
|
|
case 0x6:
|
|
|
|
|
result = ((((psw & PSW_S) != 0) ^ ((psw & PSW_OV) != 0)) != 0);
|
|
|
|
|
break;
|
|
|
|
|
case 0x7:
|
|
|
|
|
result = (((((psw & PSW_S) != 0) ^ ((psw & PSW_OV) != 0))
|
|
|
|
|
|| ((psw & PSW_Z) != 0)) != 0);
|
|
|
|
|
break;
|
|
|
|
|
case 0x8:
|
|
|
|
|
result = ((psw & PSW_OV) == 0);
|
|
|
|
|
break;
|
|
|
|
|
case 0x9:
|
|
|
|
|
result = ((psw & PSW_CY) == 0);
|
|
|
|
|
break;
|
|
|
|
|
case 0xa:
|
|
|
|
|
result = ((psw & PSW_Z) == 0);
|
|
|
|
|
break;
|
|
|
|
|
case 0xb:
|
|
|
|
|
result = ((((psw & PSW_CY) != 0) | ((psw & PSW_Z) != 0)) == 0);
|
|
|
|
|
break;
|
|
|
|
|
case 0xc:
|
|
|
|
|
result = ((psw & PSW_S) == 0);
|
|
|
|
|
break;
|
|
|
|
|
case 0xd:
|
|
|
|
|
result = ((psw & PSW_SAT) != 0);
|
|
|
|
|
break;
|
|
|
|
|
case 0xe:
|
|
|
|
|
result = ((((psw & PSW_S) != 0) ^ ((psw & PSW_OV) != 0)) == 0);
|
|
|
|
|
break;
|
|
|
|
|
case 0xf:
|
|
|
|
|
result = (((((psw & PSW_S) != 0) ^ ((psw & PSW_OV) != 0))
|
|
|
|
|
|| ((psw & PSW_Z) != 0)) == 0);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
State.regs[OP[1]] = result;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_EX1);
|
1996-08-30 12:11:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
1996-08-30 12:59:02 +08:00
|
|
|
|
/* satadd reg,reg */
|
|
|
|
|
void
|
|
|
|
|
OP_C0 ()
|
|
|
|
|
{
|
|
|
|
|
unsigned int op0, op1, result, z, s, cy, ov, sat;
|
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("satadd", OP_REG_REG, 0);
|
1996-08-30 12:59:02 +08:00
|
|
|
|
/* Compute the result. */
|
|
|
|
|
op0 = State.regs[OP[0]];
|
|
|
|
|
op1 = State.regs[OP[1]];
|
|
|
|
|
result = op0 + op1;
|
|
|
|
|
|
|
|
|
|
/* Compute the condition codes. */
|
|
|
|
|
z = (result == 0);
|
|
|
|
|
s = (result & 0x80000000);
|
|
|
|
|
cy = (result < op0 || result < op1);
|
|
|
|
|
ov = ((op0 & 0x80000000) == (op1 & 0x80000000)
|
|
|
|
|
&& (op0 & 0x80000000) != (result & 0x80000000));
|
|
|
|
|
sat = ov;
|
|
|
|
|
|
|
|
|
|
/* Store the result and condition codes. */
|
|
|
|
|
State.regs[OP[1]] = result;
|
1996-08-30 13:09:08 +08:00
|
|
|
|
State.sregs[5] &= ~(PSW_Z | PSW_S | PSW_CY | PSW_OV);
|
|
|
|
|
State.sregs[5] |= ((z ? PSW_Z : 0) | (s ? PSW_S : 0)
|
1996-08-30 12:59:02 +08:00
|
|
|
|
| (cy ? PSW_CY : 0) | (ov ? PSW_OV : 0)
|
|
|
|
|
| (sat ? PSW_SAT : 0));
|
|
|
|
|
|
|
|
|
|
/* Handle saturated results. */
|
1996-08-31 00:41:39 +08:00
|
|
|
|
if (sat && s)
|
1996-08-30 12:59:02 +08:00
|
|
|
|
State.regs[OP[1]] = 0x80000000;
|
|
|
|
|
else if (sat)
|
|
|
|
|
State.regs[OP[1]] = 0x7fffffff;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_REG_REG);
|
1996-08-30 12:59:02 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* satadd sign_extend(imm5), reg */
|
|
|
|
|
void
|
|
|
|
|
OP_220 ()
|
|
|
|
|
{
|
|
|
|
|
unsigned int op0, op1, result, z, s, cy, ov, sat;
|
|
|
|
|
|
|
|
|
|
int temp;
|
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("satadd", OP_IMM_REG, 0);
|
|
|
|
|
|
1996-08-30 12:59:02 +08:00
|
|
|
|
/* Compute the result. */
|
1996-09-12 04:54:21 +08:00
|
|
|
|
temp = SEXT5 (OP[0]);
|
1996-08-30 12:59:02 +08:00
|
|
|
|
op0 = temp;
|
|
|
|
|
op1 = State.regs[OP[1]];
|
|
|
|
|
result = op0 + op1;
|
|
|
|
|
|
|
|
|
|
/* Compute the condition codes. */
|
|
|
|
|
z = (result == 0);
|
|
|
|
|
s = (result & 0x80000000);
|
|
|
|
|
cy = (result < op0 || result < op1);
|
|
|
|
|
ov = ((op0 & 0x80000000) == (op1 & 0x80000000)
|
|
|
|
|
&& (op0 & 0x80000000) != (result & 0x80000000));
|
|
|
|
|
sat = ov;
|
|
|
|
|
|
|
|
|
|
/* Store the result and condition codes. */
|
|
|
|
|
State.regs[OP[1]] = result;
|
1996-08-30 13:09:08 +08:00
|
|
|
|
State.sregs[5] &= ~(PSW_Z | PSW_S | PSW_CY | PSW_OV);
|
|
|
|
|
State.sregs[5] |= ((z ? PSW_Z : 0) | (s ? PSW_S : 0)
|
1996-08-30 12:59:02 +08:00
|
|
|
|
| (cy ? PSW_CY : 0) | (ov ? PSW_OV : 0)
|
|
|
|
|
| (sat ? PSW_SAT : 0));
|
|
|
|
|
|
|
|
|
|
/* Handle saturated results. */
|
1996-08-31 00:41:39 +08:00
|
|
|
|
if (sat && s)
|
1996-08-30 12:59:02 +08:00
|
|
|
|
State.regs[OP[1]] = 0x80000000;
|
|
|
|
|
else if (sat)
|
|
|
|
|
State.regs[OP[1]] = 0x7fffffff;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_IMM_REG);
|
1996-08-30 12:59:02 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* satsub reg1, reg2 */
|
|
|
|
|
void
|
|
|
|
|
OP_A0 ()
|
|
|
|
|
{
|
|
|
|
|
unsigned int op0, op1, result, z, s, cy, ov, sat;
|
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("satsub", OP_REG_REG, 0);
|
|
|
|
|
|
1996-08-30 12:59:02 +08:00
|
|
|
|
/* Compute the result. */
|
|
|
|
|
op0 = State.regs[OP[0]];
|
|
|
|
|
op1 = State.regs[OP[1]];
|
|
|
|
|
result = op1 - op0;
|
|
|
|
|
|
|
|
|
|
/* Compute the condition codes. */
|
|
|
|
|
z = (result == 0);
|
|
|
|
|
s = (result & 0x80000000);
|
1996-09-04 00:25:51 +08:00
|
|
|
|
cy = (op1 < op0);
|
1996-08-30 12:59:02 +08:00
|
|
|
|
ov = ((op1 & 0x80000000) != (op0 & 0x80000000)
|
|
|
|
|
&& (op1 & 0x80000000) != (result & 0x80000000));
|
|
|
|
|
sat = ov;
|
|
|
|
|
|
|
|
|
|
/* Store the result and condition codes. */
|
|
|
|
|
State.regs[OP[1]] = result;
|
1996-08-30 13:09:08 +08:00
|
|
|
|
State.sregs[5] &= ~(PSW_Z | PSW_S | PSW_CY | PSW_OV);
|
|
|
|
|
State.sregs[5] |= ((z ? PSW_Z : 0) | (s ? PSW_S : 0)
|
1996-08-30 12:59:02 +08:00
|
|
|
|
| (cy ? PSW_CY : 0) | (ov ? PSW_OV : 0)
|
|
|
|
|
| (sat ? PSW_SAT : 0));
|
|
|
|
|
|
|
|
|
|
/* Handle saturated results. */
|
1996-08-31 00:41:39 +08:00
|
|
|
|
if (sat && s)
|
1996-08-30 12:59:02 +08:00
|
|
|
|
State.regs[OP[1]] = 0x80000000;
|
|
|
|
|
else if (sat)
|
|
|
|
|
State.regs[OP[1]] = 0x7fffffff;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_REG_REG);
|
1996-08-30 12:59:02 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* satsubi sign_extend(imm16), reg */
|
|
|
|
|
void
|
|
|
|
|
OP_660 ()
|
|
|
|
|
{
|
|
|
|
|
unsigned int op0, op1, result, z, s, cy, ov, sat;
|
|
|
|
|
int temp;
|
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("satsubi", OP_IMM_REG, 0);
|
|
|
|
|
|
1996-08-30 12:59:02 +08:00
|
|
|
|
/* Compute the result. */
|
1996-09-12 04:54:21 +08:00
|
|
|
|
temp = SEXT16 (OP[0]);
|
1996-08-30 12:59:02 +08:00
|
|
|
|
op0 = temp;
|
|
|
|
|
op1 = State.regs[OP[1]];
|
|
|
|
|
result = op1 - op0;
|
|
|
|
|
|
|
|
|
|
/* Compute the condition codes. */
|
|
|
|
|
z = (result == 0);
|
|
|
|
|
s = (result & 0x80000000);
|
1996-09-04 00:25:51 +08:00
|
|
|
|
cy = (op1 < op0);
|
1996-08-30 12:59:02 +08:00
|
|
|
|
ov = ((op1 & 0x80000000) != (op0 & 0x80000000)
|
|
|
|
|
&& (op1 & 0x80000000) != (result & 0x80000000));
|
|
|
|
|
sat = ov;
|
|
|
|
|
|
|
|
|
|
/* Store the result and condition codes. */
|
|
|
|
|
State.regs[OP[1]] = result;
|
1996-08-30 13:09:08 +08:00
|
|
|
|
State.sregs[5] &= ~(PSW_Z | PSW_S | PSW_CY | PSW_OV);
|
|
|
|
|
State.sregs[5] |= ((z ? PSW_Z : 0) | (s ? PSW_S : 0)
|
1996-08-30 12:59:02 +08:00
|
|
|
|
| (cy ? PSW_CY : 0) | (ov ? PSW_OV : 0)
|
|
|
|
|
| (sat ? PSW_SAT : 0));
|
|
|
|
|
|
|
|
|
|
/* Handle saturated results. */
|
1996-08-31 00:41:39 +08:00
|
|
|
|
if (sat && s)
|
1996-08-30 12:59:02 +08:00
|
|
|
|
State.regs[OP[1]] = 0x80000000;
|
|
|
|
|
else if (sat)
|
|
|
|
|
State.regs[OP[1]] = 0x7fffffff;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_IMM_REG);
|
1996-08-30 12:59:02 +08:00
|
|
|
|
}
|
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
/* satsubr reg,reg */
|
1996-08-30 12:59:02 +08:00
|
|
|
|
void
|
|
|
|
|
OP_80 ()
|
|
|
|
|
{
|
|
|
|
|
unsigned int op0, op1, result, z, s, cy, ov, sat;
|
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("satsubr", OP_REG_REG, 0);
|
|
|
|
|
|
1996-08-30 12:59:02 +08:00
|
|
|
|
/* Compute the result. */
|
|
|
|
|
op0 = State.regs[OP[0]];
|
|
|
|
|
op1 = State.regs[OP[1]];
|
|
|
|
|
result = op0 - op1;
|
|
|
|
|
|
|
|
|
|
/* Compute the condition codes. */
|
|
|
|
|
z = (result == 0);
|
|
|
|
|
s = (result & 0x80000000);
|
1996-09-04 00:25:51 +08:00
|
|
|
|
cy = (result < op0);
|
1996-08-30 12:59:02 +08:00
|
|
|
|
ov = ((op1 & 0x80000000) != (op0 & 0x80000000)
|
|
|
|
|
&& (op1 & 0x80000000) != (result & 0x80000000));
|
|
|
|
|
sat = ov;
|
|
|
|
|
|
|
|
|
|
/* Store the result and condition codes. */
|
|
|
|
|
State.regs[OP[1]] = result;
|
1996-08-30 13:09:08 +08:00
|
|
|
|
State.sregs[5] &= ~(PSW_Z | PSW_S | PSW_CY | PSW_OV);
|
|
|
|
|
State.sregs[5] |= ((z ? PSW_Z : 0) | (s ? PSW_S : 0)
|
1996-08-30 12:59:02 +08:00
|
|
|
|
| (cy ? PSW_CY : 0) | (ov ? PSW_OV : 0)
|
|
|
|
|
| (sat ? PSW_SAT : 0));
|
|
|
|
|
|
|
|
|
|
/* Handle saturated results. */
|
1996-08-31 00:41:39 +08:00
|
|
|
|
if (sat && s)
|
1996-08-30 12:59:02 +08:00
|
|
|
|
State.regs[OP[1]] = 0x80000000;
|
|
|
|
|
else if (sat)
|
|
|
|
|
State.regs[OP[1]] = 0x7fffffff;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_REG_REG);
|
1996-08-30 12:59:02 +08:00
|
|
|
|
}
|
|
|
|
|
|
1996-08-30 12:11:32 +08:00
|
|
|
|
/* tst reg,reg */
|
|
|
|
|
void
|
|
|
|
|
OP_160 ()
|
|
|
|
|
{
|
1996-09-04 02:31:48 +08:00
|
|
|
|
unsigned int op0, op1, result, z, s;
|
1996-08-30 12:11:32 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("tst", OP_REG_REG_CMP, 0);
|
|
|
|
|
|
1996-08-30 12:11:32 +08:00
|
|
|
|
/* Compute the result. */
|
|
|
|
|
op0 = State.regs[OP[0]];
|
|
|
|
|
op1 = State.regs[OP[1]];
|
|
|
|
|
result = op0 & op1;
|
|
|
|
|
|
|
|
|
|
/* Compute the condition codes. */
|
|
|
|
|
z = (result == 0);
|
|
|
|
|
s = (result & 0x80000000);
|
|
|
|
|
|
|
|
|
|
/* Store the condition codes. */
|
1996-08-30 13:09:08 +08:00
|
|
|
|
State.sregs[5] &= ~(PSW_Z | PSW_S | PSW_OV);
|
|
|
|
|
State.sregs[5] |= ((z ? PSW_Z : 0) | (s ? PSW_S : 0));
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_REG_REG_CMP);
|
1996-08-30 12:11:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
1996-08-30 03:53:37 +08:00
|
|
|
|
/* mov reg, reg */
|
1996-08-29 09:06:42 +08:00
|
|
|
|
void
|
|
|
|
|
OP_0 ()
|
|
|
|
|
{
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("mov", OP_REG_REG_MOVE, 0);
|
1996-08-30 03:53:37 +08:00
|
|
|
|
State.regs[OP[1]] = State.regs[OP[0]];
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_REG_REG_MOVE);
|
1996-08-29 09:06:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
1996-08-30 03:53:37 +08:00
|
|
|
|
/* mov sign_extend(imm5), reg */
|
1996-08-29 09:06:42 +08:00
|
|
|
|
void
|
1996-08-30 03:53:37 +08:00
|
|
|
|
OP_200 ()
|
1996-08-29 09:06:42 +08:00
|
|
|
|
{
|
1996-09-12 04:54:21 +08:00
|
|
|
|
int value = SEXT5 (OP[0]);
|
1996-08-30 03:53:37 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("mov", OP_IMM_REG_MOVE, 0);
|
1996-08-30 03:53:37 +08:00
|
|
|
|
State.regs[OP[1]] = value;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_IMM_REG_MOVE);
|
1996-08-29 09:06:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
1996-08-30 03:53:37 +08:00
|
|
|
|
/* movea sign_extend(imm16), reg, reg */
|
|
|
|
|
|
1996-08-29 09:06:42 +08:00
|
|
|
|
void
|
1996-08-30 03:53:37 +08:00
|
|
|
|
OP_620 ()
|
1996-08-29 09:06:42 +08:00
|
|
|
|
{
|
1996-09-12 04:54:21 +08:00
|
|
|
|
int value = SEXT16 (OP[0]);
|
1996-08-30 03:53:37 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("movea", OP_IMM_REG_REG, 0);
|
1996-08-30 03:53:37 +08:00
|
|
|
|
State.regs[OP[2]] = State.regs[OP[1]] + value;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_IMM_REG_REG);
|
1996-08-29 09:06:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
1996-08-30 03:53:37 +08:00
|
|
|
|
/* movhi imm16, reg, reg */
|
1996-08-29 09:06:42 +08:00
|
|
|
|
void
|
1996-08-30 03:53:37 +08:00
|
|
|
|
OP_640 ()
|
1996-08-29 09:06:42 +08:00
|
|
|
|
{
|
1996-09-12 04:54:21 +08:00
|
|
|
|
uint32 value = (OP[0] & 0xffff) << 16;
|
1996-08-30 03:53:37 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("movhi", OP_UIMM_REG_REG, 16);
|
1996-08-30 03:53:37 +08:00
|
|
|
|
State.regs[OP[2]] = State.regs[OP[1]] + value;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_UIMM_REG_REG);
|
1996-08-29 09:06:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
1996-08-30 11:23:36 +08:00
|
|
|
|
/* sar zero_extend(imm5),reg1 */
|
1996-08-29 09:06:42 +08:00
|
|
|
|
void
|
1996-08-30 06:29:41 +08:00
|
|
|
|
OP_2A0 ()
|
1996-08-29 09:06:42 +08:00
|
|
|
|
{
|
1996-09-04 02:31:48 +08:00
|
|
|
|
unsigned int op0, op1, result, z, s, cy;
|
1996-08-30 06:29:41 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("sar", OP_IMM_REG, 0);
|
1996-08-30 11:23:36 +08:00
|
|
|
|
op0 = OP[0] & 0x1f;
|
|
|
|
|
op1 = State.regs[OP[1]];
|
|
|
|
|
result = (signed)op1 >> op0;
|
1996-08-30 06:29:41 +08:00
|
|
|
|
|
1996-08-30 11:23:36 +08:00
|
|
|
|
/* Compute the condition codes. */
|
|
|
|
|
z = (result == 0);
|
|
|
|
|
s = (result & 0x80000000);
|
|
|
|
|
cy = (op1 & (1 << (op0 - 1)));
|
1996-08-29 09:06:42 +08:00
|
|
|
|
|
1996-08-30 11:23:36 +08:00
|
|
|
|
/* Store the result and condition codes. */
|
|
|
|
|
State.regs[OP[1]] = result;
|
1996-08-30 13:09:08 +08:00
|
|
|
|
State.sregs[5] &= ~(PSW_Z | PSW_S | PSW_OV | PSW_CY);
|
|
|
|
|
State.sregs[5] |= ((z ? PSW_Z : 0) | (s ? PSW_S : 0)
|
1996-09-04 02:31:48 +08:00
|
|
|
|
| (cy ? PSW_CY : 0));
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_IMM_REG);
|
1996-08-30 11:23:36 +08:00
|
|
|
|
}
|
1996-08-30 06:29:41 +08:00
|
|
|
|
|
1996-08-30 11:23:36 +08:00
|
|
|
|
/* sar reg1, reg2 */
|
1996-08-29 09:06:42 +08:00
|
|
|
|
void
|
1996-08-30 06:29:41 +08:00
|
|
|
|
OP_A007E0 ()
|
1996-08-29 09:06:42 +08:00
|
|
|
|
{
|
1996-09-04 02:31:48 +08:00
|
|
|
|
unsigned int op0, op1, result, z, s, cy;
|
1996-08-30 06:29:41 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("sar", OP_REG_REG, 0);
|
1996-08-30 11:23:36 +08:00
|
|
|
|
op0 = State.regs[OP[0]] & 0x1f;
|
|
|
|
|
op1 = State.regs[OP[1]];
|
|
|
|
|
result = (signed)op1 >> op0;
|
1996-08-30 06:29:41 +08:00
|
|
|
|
|
1996-08-30 11:23:36 +08:00
|
|
|
|
/* Compute the condition codes. */
|
|
|
|
|
z = (result == 0);
|
|
|
|
|
s = (result & 0x80000000);
|
|
|
|
|
cy = (op1 & (1 << (op0 - 1)));
|
1996-08-29 09:06:42 +08:00
|
|
|
|
|
1996-08-30 11:23:36 +08:00
|
|
|
|
/* Store the result and condition codes. */
|
|
|
|
|
State.regs[OP[1]] = result;
|
1996-08-30 13:09:08 +08:00
|
|
|
|
State.sregs[5] &= ~(PSW_Z | PSW_S | PSW_OV | PSW_CY);
|
|
|
|
|
State.sregs[5] |= ((z ? PSW_Z : 0) | (s ? PSW_S : 0)
|
1996-08-30 11:23:36 +08:00
|
|
|
|
| (cy ? PSW_CY : 0));
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_REG_REG);
|
1996-08-30 11:23:36 +08:00
|
|
|
|
}
|
1996-08-30 06:29:41 +08:00
|
|
|
|
|
1996-08-30 11:23:36 +08:00
|
|
|
|
/* shl zero_extend(imm5),reg1 */
|
1996-08-29 09:06:42 +08:00
|
|
|
|
void
|
|
|
|
|
OP_2C0 ()
|
1996-08-30 06:29:41 +08:00
|
|
|
|
{
|
1996-09-04 02:31:48 +08:00
|
|
|
|
unsigned int op0, op1, result, z, s, cy;
|
1996-08-30 11:23:36 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("shl", OP_IMM_REG, 0);
|
1996-08-30 11:23:36 +08:00
|
|
|
|
op0 = OP[0] & 0x1f;
|
|
|
|
|
op1 = State.regs[OP[1]];
|
|
|
|
|
result = op1 << op0;
|
|
|
|
|
|
|
|
|
|
/* Compute the condition codes. */
|
|
|
|
|
z = (result == 0);
|
|
|
|
|
s = (result & 0x80000000);
|
|
|
|
|
cy = (op1 & (1 << (32 - op0)));
|
1996-08-30 06:29:41 +08:00
|
|
|
|
|
1996-08-30 11:23:36 +08:00
|
|
|
|
/* Store the result and condition codes. */
|
|
|
|
|
State.regs[OP[1]] = result;
|
1996-08-30 13:09:08 +08:00
|
|
|
|
State.sregs[5] &= ~(PSW_Z | PSW_S | PSW_OV | PSW_CY);
|
|
|
|
|
State.sregs[5] |= ((z ? PSW_Z : 0) | (s ? PSW_S : 0)
|
1996-08-30 11:23:36 +08:00
|
|
|
|
| (cy ? PSW_CY : 0));
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_IMM_REG);
|
1996-08-30 11:23:36 +08:00
|
|
|
|
}
|
1996-08-30 06:29:41 +08:00
|
|
|
|
|
1996-08-30 11:23:36 +08:00
|
|
|
|
/* shl reg1, reg2 */
|
1996-08-30 06:29:41 +08:00
|
|
|
|
void
|
|
|
|
|
OP_C007E0 ()
|
|
|
|
|
{
|
1996-09-04 02:31:48 +08:00
|
|
|
|
unsigned int op0, op1, result, z, s, cy;
|
1996-08-30 06:29:41 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("shl", OP_REG_REG, 0);
|
1996-08-30 11:23:36 +08:00
|
|
|
|
op0 = State.regs[OP[0]] & 0x1f;
|
|
|
|
|
op1 = State.regs[OP[1]];
|
|
|
|
|
result = op1 << op0;
|
|
|
|
|
|
|
|
|
|
/* Compute the condition codes. */
|
|
|
|
|
z = (result == 0);
|
|
|
|
|
s = (result & 0x80000000);
|
|
|
|
|
cy = (op1 & (1 << (32 - op0)));
|
|
|
|
|
|
|
|
|
|
/* Store the result and condition codes. */
|
|
|
|
|
State.regs[OP[1]] = result;
|
1996-08-30 13:09:08 +08:00
|
|
|
|
State.sregs[5] &= ~(PSW_Z | PSW_S | PSW_OV | PSW_CY);
|
|
|
|
|
State.sregs[5] |= ((z ? PSW_Z : 0) | (s ? PSW_S : 0)
|
1996-08-30 11:23:36 +08:00
|
|
|
|
| (cy ? PSW_CY : 0));
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_REG_REG);
|
1996-08-30 11:23:36 +08:00
|
|
|
|
}
|
1996-08-30 06:29:41 +08:00
|
|
|
|
|
1996-08-30 11:23:36 +08:00
|
|
|
|
/* shr zero_extend(imm5),reg1 */
|
1996-08-30 06:29:41 +08:00
|
|
|
|
void
|
|
|
|
|
OP_280 ()
|
|
|
|
|
{
|
1996-09-04 02:31:48 +08:00
|
|
|
|
unsigned int op0, op1, result, z, s, cy;
|
1996-08-30 06:29:41 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("shr", OP_IMM_REG, 0);
|
1996-08-30 11:23:36 +08:00
|
|
|
|
op0 = OP[0] & 0x1f;
|
|
|
|
|
op1 = State.regs[OP[1]];
|
|
|
|
|
result = op1 >> op0;
|
1996-08-30 06:29:41 +08:00
|
|
|
|
|
1996-08-30 11:23:36 +08:00
|
|
|
|
/* Compute the condition codes. */
|
|
|
|
|
z = (result == 0);
|
|
|
|
|
s = (result & 0x80000000);
|
|
|
|
|
cy = (op1 & (1 << (op0 - 1)));
|
|
|
|
|
|
|
|
|
|
/* Store the result and condition codes. */
|
|
|
|
|
State.regs[OP[1]] = result;
|
1996-08-30 13:09:08 +08:00
|
|
|
|
State.sregs[5] &= ~(PSW_Z | PSW_S | PSW_OV | PSW_CY);
|
|
|
|
|
State.sregs[5] |= ((z ? PSW_Z : 0) | (s ? PSW_S : 0)
|
1996-08-30 11:23:36 +08:00
|
|
|
|
| (cy ? PSW_CY : 0));
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_IMM_REG);
|
1996-08-30 11:23:36 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* shr reg1, reg2 */
|
1996-08-30 06:29:41 +08:00
|
|
|
|
void
|
|
|
|
|
OP_8007E0 ()
|
|
|
|
|
{
|
1996-09-04 02:31:48 +08:00
|
|
|
|
unsigned int op0, op1, result, z, s, cy;
|
1996-08-30 11:23:36 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("shr", OP_REG_REG, 0);
|
1996-08-30 11:23:36 +08:00
|
|
|
|
op0 = State.regs[OP[0]] & 0x1f;
|
|
|
|
|
op1 = State.regs[OP[1]];
|
|
|
|
|
result = op1 >> op0;
|
|
|
|
|
|
|
|
|
|
/* Compute the condition codes. */
|
|
|
|
|
z = (result == 0);
|
|
|
|
|
s = (result & 0x80000000);
|
|
|
|
|
cy = (op1 & (1 << (op0 - 1)));
|
|
|
|
|
|
|
|
|
|
/* Store the result and condition codes. */
|
|
|
|
|
State.regs[OP[1]] = result;
|
1996-08-30 13:09:08 +08:00
|
|
|
|
State.sregs[5] &= ~(PSW_Z | PSW_S | PSW_OV | PSW_CY);
|
|
|
|
|
State.sregs[5] |= ((z ? PSW_Z : 0) | (s ? PSW_S : 0)
|
1996-08-30 11:23:36 +08:00
|
|
|
|
| (cy ? PSW_CY : 0));
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_REG_REG);
|
1996-08-30 06:29:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
1996-08-30 07:39:23 +08:00
|
|
|
|
/* or reg, reg */
|
1996-08-30 03:53:37 +08:00
|
|
|
|
void
|
|
|
|
|
OP_100 ()
|
|
|
|
|
{
|
1996-09-04 02:31:48 +08:00
|
|
|
|
unsigned int op0, op1, result, z, s;
|
1996-08-30 03:53:37 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("or", OP_REG_REG, 0);
|
|
|
|
|
|
1996-08-30 07:39:23 +08:00
|
|
|
|
/* Compute the result. */
|
|
|
|
|
op0 = State.regs[OP[0]];
|
|
|
|
|
op1 = State.regs[OP[1]];
|
|
|
|
|
result = op0 | op1;
|
1996-08-30 03:53:37 +08:00
|
|
|
|
|
1996-08-30 07:39:23 +08:00
|
|
|
|
/* Compute the condition codes. */
|
|
|
|
|
z = (result == 0);
|
|
|
|
|
s = (result & 0x80000000);
|
|
|
|
|
|
|
|
|
|
/* Store the result and condition codes. */
|
|
|
|
|
State.regs[OP[1]] = result;
|
1996-08-30 13:09:08 +08:00
|
|
|
|
State.sregs[5] &= ~(PSW_Z | PSW_S | PSW_OV);
|
|
|
|
|
State.sregs[5] |= ((z ? PSW_Z : 0) | (s ? PSW_S : 0));
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_REG_REG);
|
1996-08-30 07:39:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ori zero_extend(imm16), reg, reg */
|
1996-08-30 03:53:37 +08:00
|
|
|
|
void
|
|
|
|
|
OP_680 ()
|
|
|
|
|
{
|
1996-09-04 02:31:48 +08:00
|
|
|
|
unsigned int op0, op1, result, z, s;
|
1996-08-30 03:53:37 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("ori", OP_UIMM_REG_REG, 0);
|
1996-08-30 07:39:23 +08:00
|
|
|
|
op0 = OP[0] & 0xffff;
|
|
|
|
|
op1 = State.regs[OP[1]];
|
|
|
|
|
result = op0 | op1;
|
1996-08-30 03:53:37 +08:00
|
|
|
|
|
1996-08-30 07:39:23 +08:00
|
|
|
|
/* Compute the condition codes. */
|
|
|
|
|
z = (result == 0);
|
|
|
|
|
s = (result & 0x80000000);
|
1996-08-30 03:53:37 +08:00
|
|
|
|
|
1996-08-30 07:39:23 +08:00
|
|
|
|
/* Store the result and condition codes. */
|
|
|
|
|
State.regs[OP[2]] = result;
|
1996-08-30 13:09:08 +08:00
|
|
|
|
State.sregs[5] &= ~(PSW_Z | PSW_S | PSW_OV);
|
|
|
|
|
State.sregs[5] |= ((z ? PSW_Z : 0) | (s ? PSW_S : 0));
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_UIMM_REG_REG);
|
1996-08-30 07:39:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* and reg, reg */
|
1996-08-29 09:06:42 +08:00
|
|
|
|
void
|
|
|
|
|
OP_140 ()
|
|
|
|
|
{
|
1996-09-04 02:31:48 +08:00
|
|
|
|
unsigned int op0, op1, result, z, s;
|
1996-08-29 09:06:42 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("and", OP_REG_REG, 0);
|
|
|
|
|
|
1996-08-30 07:39:23 +08:00
|
|
|
|
/* Compute the result. */
|
|
|
|
|
op0 = State.regs[OP[0]];
|
|
|
|
|
op1 = State.regs[OP[1]];
|
|
|
|
|
result = op0 & op1;
|
1996-08-30 03:53:37 +08:00
|
|
|
|
|
1996-08-30 07:39:23 +08:00
|
|
|
|
/* Compute the condition codes. */
|
|
|
|
|
z = (result == 0);
|
|
|
|
|
s = (result & 0x80000000);
|
|
|
|
|
|
|
|
|
|
/* Store the result and condition codes. */
|
|
|
|
|
State.regs[OP[1]] = result;
|
1996-08-30 13:09:08 +08:00
|
|
|
|
State.sregs[5] &= ~(PSW_Z | PSW_S | PSW_OV);
|
|
|
|
|
State.sregs[5] |= ((z ? PSW_Z : 0) | (s ? PSW_S : 0));
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_REG_REG);
|
1996-08-30 07:39:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* andi zero_extend(imm16), reg, reg */
|
1996-08-29 09:06:42 +08:00
|
|
|
|
void
|
1996-08-30 03:53:37 +08:00
|
|
|
|
OP_6C0 ()
|
|
|
|
|
{
|
1996-09-04 02:31:48 +08:00
|
|
|
|
unsigned int op0, op1, result, z;
|
1996-08-30 03:53:37 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("andi", OP_UIMM_REG_REG, 0);
|
1996-08-30 07:39:23 +08:00
|
|
|
|
op0 = OP[0] & 0xffff;
|
|
|
|
|
op1 = State.regs[OP[1]];
|
|
|
|
|
result = op0 & op1;
|
1996-08-30 03:53:37 +08:00
|
|
|
|
|
1996-08-30 07:39:23 +08:00
|
|
|
|
/* Compute the condition codes. */
|
|
|
|
|
z = (result == 0);
|
1996-08-30 03:53:37 +08:00
|
|
|
|
|
1996-08-30 07:39:23 +08:00
|
|
|
|
/* Store the result and condition codes. */
|
|
|
|
|
State.regs[OP[2]] = result;
|
1996-08-30 13:09:08 +08:00
|
|
|
|
State.sregs[5] &= ~(PSW_Z | PSW_S | PSW_OV);
|
|
|
|
|
State.sregs[5] |= (z ? PSW_Z : 0);
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_UIMM_REG_REG);
|
1996-08-30 07:39:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* xor reg, reg */
|
1996-08-30 03:53:37 +08:00
|
|
|
|
void
|
|
|
|
|
OP_120 ()
|
1996-08-29 09:06:42 +08:00
|
|
|
|
{
|
1996-09-04 02:31:48 +08:00
|
|
|
|
unsigned int op0, op1, result, z, s;
|
1996-08-30 03:53:37 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("xor", OP_REG_REG, 0);
|
|
|
|
|
|
1996-08-30 07:39:23 +08:00
|
|
|
|
/* Compute the result. */
|
|
|
|
|
op0 = State.regs[OP[0]];
|
|
|
|
|
op1 = State.regs[OP[1]];
|
|
|
|
|
result = op0 ^ op1;
|
1996-08-30 03:53:37 +08:00
|
|
|
|
|
1996-08-30 07:39:23 +08:00
|
|
|
|
/* Compute the condition codes. */
|
|
|
|
|
z = (result == 0);
|
|
|
|
|
s = (result & 0x80000000);
|
|
|
|
|
|
|
|
|
|
/* Store the result and condition codes. */
|
|
|
|
|
State.regs[OP[1]] = result;
|
1996-08-30 13:09:08 +08:00
|
|
|
|
State.sregs[5] &= ~(PSW_Z | PSW_S | PSW_OV);
|
|
|
|
|
State.sregs[5] |= ((z ? PSW_Z : 0) | (s ? PSW_S : 0));
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_REG_REG);
|
1996-08-30 07:39:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* xori zero_extend(imm16), reg, reg */
|
1996-08-30 03:53:37 +08:00
|
|
|
|
void
|
|
|
|
|
OP_6A0 ()
|
|
|
|
|
{
|
1996-09-04 02:31:48 +08:00
|
|
|
|
unsigned int op0, op1, result, z, s;
|
1996-08-30 07:39:23 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("xori", OP_UIMM_REG_REG, 0);
|
1996-08-30 07:39:23 +08:00
|
|
|
|
op0 = OP[0] & 0xffff;
|
|
|
|
|
op1 = State.regs[OP[1]];
|
|
|
|
|
result = op0 ^ op1;
|
|
|
|
|
|
|
|
|
|
/* Compute the condition codes. */
|
|
|
|
|
z = (result == 0);
|
|
|
|
|
s = (result & 0x80000000);
|
|
|
|
|
|
|
|
|
|
/* Store the result and condition codes. */
|
|
|
|
|
State.regs[OP[2]] = result;
|
1996-08-30 13:09:08 +08:00
|
|
|
|
State.sregs[5] &= ~(PSW_Z | PSW_S | PSW_OV);
|
|
|
|
|
State.sregs[5] |= ((z ? PSW_Z : 0) | (s ? PSW_S : 0));
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_UIMM_REG_REG);
|
1996-08-30 07:39:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* not reg1, reg2 */
|
|
|
|
|
void
|
|
|
|
|
OP_20 ()
|
|
|
|
|
{
|
1996-09-04 02:31:48 +08:00
|
|
|
|
unsigned int op0, result, z, s;
|
1996-08-30 07:39:23 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("not", OP_REG_REG_MOVE, 0);
|
1996-08-30 07:39:23 +08:00
|
|
|
|
/* Compute the result. */
|
|
|
|
|
op0 = State.regs[OP[0]];
|
|
|
|
|
result = ~op0;
|
|
|
|
|
|
|
|
|
|
/* Compute the condition codes. */
|
|
|
|
|
z = (result == 0);
|
|
|
|
|
s = (result & 0x80000000);
|
1996-08-30 03:53:37 +08:00
|
|
|
|
|
1996-08-30 07:39:23 +08:00
|
|
|
|
/* Store the result and condition codes. */
|
|
|
|
|
State.regs[OP[1]] = result;
|
1996-08-30 13:09:08 +08:00
|
|
|
|
State.sregs[5] &= ~(PSW_Z | PSW_S | PSW_OV);
|
|
|
|
|
State.sregs[5] |= ((z ? PSW_Z : 0) | (s ? PSW_S : 0));
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_REG_REG_MOVE);
|
1996-08-29 09:06:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
/* set1 */
|
1996-08-30 03:53:37 +08:00
|
|
|
|
void
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
OP_7C0 ()
|
1996-08-30 03:53:37 +08:00
|
|
|
|
{
|
1996-08-31 00:35:10 +08:00
|
|
|
|
unsigned int op0, op1, op2;
|
1996-09-04 02:31:48 +08:00
|
|
|
|
int temp;
|
1996-08-31 00:35:10 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("set1", OP_BIT, 0);
|
1996-08-31 00:35:10 +08:00
|
|
|
|
op0 = State.regs[OP[0]];
|
|
|
|
|
op1 = OP[1] & 0x7;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
temp = SEXT16 (OP[2]);
|
1996-08-31 00:35:10 +08:00
|
|
|
|
op2 = temp;
|
1996-10-25 01:39:30 +08:00
|
|
|
|
temp = load_mem (op0 + op2, 1);
|
1996-08-31 00:35:10 +08:00
|
|
|
|
State.sregs[5] &= ~PSW_Z;
|
|
|
|
|
if ((temp & (1 << op1)) == 0)
|
|
|
|
|
State.sregs[5] |= PSW_Z;
|
1996-08-31 05:55:26 +08:00
|
|
|
|
temp |= (1 << op1);
|
1996-10-25 01:39:30 +08:00
|
|
|
|
store_mem (op0 + op2, 1, temp);
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_BIT);
|
1996-08-30 03:53:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
/* not1 */
|
1996-08-30 03:53:37 +08:00
|
|
|
|
void
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
OP_47C0 ()
|
1996-08-30 03:53:37 +08:00
|
|
|
|
{
|
1996-08-31 00:35:10 +08:00
|
|
|
|
unsigned int op0, op1, op2;
|
1996-09-04 02:31:48 +08:00
|
|
|
|
int temp;
|
1996-08-31 00:35:10 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("not1", OP_BIT, 0);
|
1996-08-31 00:35:10 +08:00
|
|
|
|
op0 = State.regs[OP[0]];
|
|
|
|
|
op1 = OP[1] & 0x7;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
temp = SEXT16 (OP[2]);
|
1996-08-31 00:35:10 +08:00
|
|
|
|
op2 = temp;
|
1996-10-25 01:39:30 +08:00
|
|
|
|
temp = load_mem (op0 + op2, 1);
|
1996-08-31 00:35:10 +08:00
|
|
|
|
State.sregs[5] &= ~PSW_Z;
|
|
|
|
|
if ((temp & (1 << op1)) == 0)
|
|
|
|
|
State.sregs[5] |= PSW_Z;
|
1996-08-31 05:55:26 +08:00
|
|
|
|
temp ^= (1 << op1);
|
1996-10-25 01:39:30 +08:00
|
|
|
|
store_mem (op0 + op2, 1, temp);
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_BIT);
|
1996-08-30 03:53:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
/* clr1 */
|
1996-08-30 03:53:37 +08:00
|
|
|
|
void
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
OP_87C0 ()
|
|
|
|
|
{
|
1996-08-31 00:35:10 +08:00
|
|
|
|
unsigned int op0, op1, op2;
|
1996-09-04 02:31:48 +08:00
|
|
|
|
int temp;
|
1996-08-31 00:35:10 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("clr1", OP_BIT, 0);
|
1996-08-31 00:35:10 +08:00
|
|
|
|
op0 = State.regs[OP[0]];
|
|
|
|
|
op1 = OP[1] & 0x7;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
temp = SEXT16 (OP[2]);
|
1996-08-31 00:35:10 +08:00
|
|
|
|
op2 = temp;
|
1996-10-25 01:39:30 +08:00
|
|
|
|
temp = load_mem (op0 + op2, 1);
|
1996-08-31 00:35:10 +08:00
|
|
|
|
State.sregs[5] &= ~PSW_Z;
|
|
|
|
|
if ((temp & (1 << op1)) == 0)
|
|
|
|
|
State.sregs[5] |= PSW_Z;
|
|
|
|
|
temp &= ~(1 << op1);
|
1996-10-25 01:39:30 +08:00
|
|
|
|
store_mem (op0 + op2, 1, temp);
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_BIT);
|
* v850_sim.h: The V850 doesn't have split I&D spaces. Change
accordingly. Remove many unused definitions.
* interp.c: The V850 doesn't have split I&D spaces. Change
accordingly.
(get_longlong, get_longword, get_word): Deleted.
(write_longlong, write_longword, write_word): Deleted.
(get_operands): Deleted.
(get_byte, get_half, get_word): New functions.
(put_byte, put_half, put_word): New functions.
* simops.c: Remove unused functions. Rough cut at
"ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns.
1996-08-30 13:41:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* tst1 */
|
|
|
|
|
void
|
|
|
|
|
OP_C7C0 ()
|
1996-08-30 03:53:37 +08:00
|
|
|
|
{
|
1996-08-31 00:35:10 +08:00
|
|
|
|
unsigned int op0, op1, op2;
|
1996-09-04 02:31:48 +08:00
|
|
|
|
int temp;
|
1996-08-31 00:35:10 +08:00
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("tst1", OP_BIT, 0);
|
1996-08-31 00:35:10 +08:00
|
|
|
|
op0 = State.regs[OP[0]];
|
|
|
|
|
op1 = OP[1] & 0x7;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
temp = SEXT16 (OP[2]);
|
1996-08-31 00:35:10 +08:00
|
|
|
|
op2 = temp;
|
1996-10-25 01:39:30 +08:00
|
|
|
|
temp = load_mem (op0 + op2, 1);
|
1996-08-31 00:35:10 +08:00
|
|
|
|
State.sregs[5] &= ~PSW_Z;
|
|
|
|
|
if ((temp & (1 << op1)) == 0)
|
|
|
|
|
State.sregs[5] |= PSW_Z;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_BIT);
|
1996-08-30 03:53:37 +08:00
|
|
|
|
}
|
1996-08-30 04:08:37 +08:00
|
|
|
|
|
1996-09-28 09:38:45 +08:00
|
|
|
|
/* breakpoint */
|
|
|
|
|
void
|
|
|
|
|
OP_FFFF ()
|
|
|
|
|
{
|
|
|
|
|
State.exception = SIGTRAP;
|
|
|
|
|
PC -= 4;
|
|
|
|
|
}
|
|
|
|
|
|
1996-08-30 12:11:32 +08:00
|
|
|
|
/* di */
|
1996-08-30 04:08:37 +08:00
|
|
|
|
void
|
|
|
|
|
OP_16007E0 ()
|
|
|
|
|
{
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("di", OP_NONE, 0);
|
1996-08-30 13:09:08 +08:00
|
|
|
|
State.sregs[5] |= PSW_ID;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_NONE);
|
1996-08-30 04:08:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
1996-08-30 12:11:32 +08:00
|
|
|
|
/* ei */
|
1996-08-30 04:08:37 +08:00
|
|
|
|
void
|
|
|
|
|
OP_16087E0 ()
|
|
|
|
|
{
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("ei", OP_NONE, 0);
|
1996-08-30 13:09:08 +08:00
|
|
|
|
State.sregs[5] &= ~PSW_ID;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_NONE);
|
1996-08-30 04:08:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* halt, not supported */
|
|
|
|
|
void
|
|
|
|
|
OP_12007E0 ()
|
|
|
|
|
{
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("halt", OP_NONE, 0);
|
1996-09-04 00:25:51 +08:00
|
|
|
|
State.exception = SIGQUIT;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_NONE);
|
1996-08-30 04:08:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* reti, not supported */
|
|
|
|
|
void
|
|
|
|
|
OP_14007E0 ()
|
|
|
|
|
{
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("reti", OP_NONE, 0);
|
|
|
|
|
trace_output (OP_NONE);
|
1996-10-25 01:39:30 +08:00
|
|
|
|
|
|
|
|
|
if ((State.sregs[5] & (PSW_NP | PSW_EP)) == PSW_NP)
|
|
|
|
|
{ /* Only NP is on */
|
|
|
|
|
PC = State.sregs[2] - 4; /* FEPC */
|
|
|
|
|
State.sregs[5] = State.sregs[3]; /* FEPSW */
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
PC = State.sregs[0] - 4; /* EIPC */
|
|
|
|
|
State.sregs[5] = State.sregs[1]; /* EIPSW */
|
|
|
|
|
}
|
1996-08-30 04:08:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* trap, not supportd */
|
|
|
|
|
void
|
|
|
|
|
OP_10007E0 ()
|
|
|
|
|
{
|
1996-09-04 00:25:51 +08:00
|
|
|
|
extern int errno;
|
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("trap", OP_TRAP, 0);
|
|
|
|
|
trace_output (OP_TRAP);
|
|
|
|
|
|
1996-10-25 01:39:30 +08:00
|
|
|
|
/* Trap 31 is used for simulating OS I/O functions */
|
1996-09-04 00:25:51 +08:00
|
|
|
|
|
1996-10-25 01:39:30 +08:00
|
|
|
|
if (OP[0] == 31)
|
1996-09-04 00:25:51 +08:00
|
|
|
|
{
|
|
|
|
|
int save_errno = errno;
|
|
|
|
|
errno = 0;
|
|
|
|
|
|
|
|
|
|
/* Registers passed to trap 0 */
|
|
|
|
|
|
|
|
|
|
#define FUNC State.regs[6] /* function number, return value */
|
|
|
|
|
#define PARM1 State.regs[7] /* optional parm 1 */
|
|
|
|
|
#define PARM2 State.regs[8] /* optional parm 2 */
|
|
|
|
|
#define PARM3 State.regs[9] /* optional parm 3 */
|
|
|
|
|
|
|
|
|
|
/* Registers set by trap 0 */
|
|
|
|
|
|
|
|
|
|
#define RETVAL State.regs[10] /* return value */
|
|
|
|
|
#define RETERR State.regs[11] /* return error code */
|
|
|
|
|
|
|
|
|
|
/* Turn a pointer in a register into a pointer into real memory. */
|
|
|
|
|
|
1996-10-25 01:39:30 +08:00
|
|
|
|
#define MEMPTR(x) (map (x))
|
1996-09-04 00:25:51 +08:00
|
|
|
|
|
|
|
|
|
switch (FUNC)
|
|
|
|
|
{
|
|
|
|
|
#if !defined(__GO32__) && !defined(_WIN32)
|
|
|
|
|
case SYS_fork:
|
|
|
|
|
RETVAL = fork ();
|
|
|
|
|
break;
|
|
|
|
|
case SYS_execve:
|
|
|
|
|
RETVAL = execve (MEMPTR (PARM1), (char **) MEMPTR (PARM2),
|
|
|
|
|
(char **)MEMPTR (PARM3));
|
|
|
|
|
break;
|
|
|
|
|
case SYS_execv:
|
|
|
|
|
RETVAL = execve (MEMPTR (PARM1), (char **) MEMPTR (PARM2), NULL);
|
|
|
|
|
break;
|
1996-09-10 10:51:07 +08:00
|
|
|
|
#if 0
|
1996-09-04 00:25:51 +08:00
|
|
|
|
case SYS_pipe:
|
|
|
|
|
{
|
|
|
|
|
reg_t buf;
|
|
|
|
|
int host_fd[2];
|
|
|
|
|
|
|
|
|
|
buf = PARM1;
|
|
|
|
|
RETVAL = pipe (host_fd);
|
|
|
|
|
SW (buf, host_fd[0]);
|
|
|
|
|
buf += sizeof(uint16);
|
|
|
|
|
SW (buf, host_fd[1]);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case SYS_wait:
|
|
|
|
|
{
|
|
|
|
|
int status;
|
|
|
|
|
|
|
|
|
|
RETVAL = wait (&status);
|
|
|
|
|
SW (PARM1, status);
|
|
|
|
|
}
|
|
|
|
|
break;
|
1996-09-10 10:51:07 +08:00
|
|
|
|
#endif
|
1996-09-04 00:25:51 +08:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
case SYS_read:
|
|
|
|
|
RETVAL = v850_callback->read (v850_callback, PARM1, MEMPTR (PARM2),
|
|
|
|
|
PARM3);
|
|
|
|
|
break;
|
|
|
|
|
case SYS_write:
|
|
|
|
|
if (PARM1 == 1)
|
|
|
|
|
RETVAL = (int)v850_callback->write_stdout (v850_callback,
|
|
|
|
|
MEMPTR (PARM2), PARM3);
|
|
|
|
|
else
|
|
|
|
|
RETVAL = (int)v850_callback->write (v850_callback, PARM1,
|
|
|
|
|
MEMPTR (PARM2), PARM3);
|
|
|
|
|
break;
|
|
|
|
|
case SYS_lseek:
|
|
|
|
|
RETVAL = v850_callback->lseek (v850_callback, PARM1, PARM2, PARM3);
|
|
|
|
|
break;
|
|
|
|
|
case SYS_close:
|
|
|
|
|
RETVAL = v850_callback->close (v850_callback, PARM1);
|
|
|
|
|
break;
|
|
|
|
|
case SYS_open:
|
|
|
|
|
RETVAL = v850_callback->open (v850_callback, MEMPTR (PARM1), PARM2);
|
|
|
|
|
break;
|
|
|
|
|
case SYS_exit:
|
|
|
|
|
/* EXIT - caller can look in PARM1 to work out the
|
|
|
|
|
reason */
|
|
|
|
|
if (PARM1 == 0xdead || PARM1 == 0x1)
|
|
|
|
|
State.exception = SIGABRT;
|
|
|
|
|
else
|
|
|
|
|
State.exception = SIGQUIT;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
case SYS_stat: /* added at hmsi */
|
|
|
|
|
/* stat system call */
|
|
|
|
|
{
|
|
|
|
|
struct stat host_stat;
|
|
|
|
|
reg_t buf;
|
|
|
|
|
|
|
|
|
|
RETVAL = stat (MEMPTR (PARM1), &host_stat);
|
|
|
|
|
|
|
|
|
|
buf = PARM2;
|
|
|
|
|
|
|
|
|
|
/* The hard-coded offsets and sizes were determined by using
|
|
|
|
|
* the D10V compiler on a test program that used struct stat.
|
|
|
|
|
*/
|
|
|
|
|
SW (buf, host_stat.st_dev);
|
|
|
|
|
SW (buf+2, host_stat.st_ino);
|
|
|
|
|
SW (buf+4, host_stat.st_mode);
|
|
|
|
|
SW (buf+6, host_stat.st_nlink);
|
|
|
|
|
SW (buf+8, host_stat.st_uid);
|
|
|
|
|
SW (buf+10, host_stat.st_gid);
|
|
|
|
|
SW (buf+12, host_stat.st_rdev);
|
|
|
|
|
SLW (buf+16, host_stat.st_size);
|
|
|
|
|
SLW (buf+20, host_stat.st_atime);
|
|
|
|
|
SLW (buf+28, host_stat.st_mtime);
|
|
|
|
|
SLW (buf+36, host_stat.st_ctime);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case SYS_chown:
|
|
|
|
|
RETVAL = chown (MEMPTR (PARM1), PARM2, PARM3);
|
|
|
|
|
break;
|
1996-10-25 01:39:30 +08:00
|
|
|
|
#endif
|
1996-09-04 00:25:51 +08:00
|
|
|
|
case SYS_chmod:
|
|
|
|
|
RETVAL = chmod (MEMPTR (PARM1), PARM2);
|
|
|
|
|
break;
|
|
|
|
|
case SYS_utime:
|
|
|
|
|
/* Cast the second argument to void *, to avoid type mismatch
|
|
|
|
|
if a prototype is present. */
|
|
|
|
|
RETVAL = utime (MEMPTR (PARM1), (void *) MEMPTR (PARM2));
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
abort ();
|
|
|
|
|
}
|
|
|
|
|
RETERR = errno;
|
|
|
|
|
errno = save_errno;
|
|
|
|
|
}
|
1996-10-25 01:39:30 +08:00
|
|
|
|
else
|
|
|
|
|
{ /* Trap 0 -> 30 */
|
|
|
|
|
State.sregs[0] = PC + 4; /* EIPC */
|
|
|
|
|
State.sregs[1] = State.sregs[5]; /* EIPSW */
|
|
|
|
|
State.sregs[4] &= 0xffff0000; /* Mask out EICC */
|
|
|
|
|
State.sregs[4] |= 0x40 + OP[0]; /* EICC */
|
|
|
|
|
State.sregs[5] |= PSW_EP | PSW_ID; /* Now doing exception processing */
|
|
|
|
|
PC = ((OP[0] < 0x10) ? 0x40 : 0x50) - 4;
|
1996-09-04 00:25:51 +08:00
|
|
|
|
}
|
1996-08-30 04:08:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
1996-08-30 13:09:08 +08:00
|
|
|
|
/* ldsr, reg,reg */
|
1996-08-30 04:08:37 +08:00
|
|
|
|
void
|
|
|
|
|
OP_2007E0 ()
|
|
|
|
|
{
|
1996-08-30 13:09:08 +08:00
|
|
|
|
unsigned int op0;
|
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("ldsr", OP_LDSR, 0);
|
1996-08-30 13:09:08 +08:00
|
|
|
|
op0 = State.regs[OP[0]];
|
|
|
|
|
State.sregs[OP[1]] = op0;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_LDSR);
|
1996-08-30 04:08:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* stsr, not supported */
|
|
|
|
|
void
|
|
|
|
|
OP_4007E0 ()
|
|
|
|
|
{
|
1996-08-30 13:09:08 +08:00
|
|
|
|
unsigned int op0;
|
|
|
|
|
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_input ("stsr", OP_STSR, 0);
|
1996-08-30 13:09:08 +08:00
|
|
|
|
op0 = State.sregs[OP[1]];
|
|
|
|
|
State.regs[OP[0]] = op0;
|
1996-09-12 04:54:21 +08:00
|
|
|
|
trace_output (OP_STSR);
|
1996-08-30 04:08:37 +08:00
|
|
|
|
}
|