OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [or1ksim/] [cuc/] [load.c] - Diff between revs 19 and 230

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 19 Rev 230
Line 187... Line 187...
/* Disassemble one instruction from insn index and generate parameters */
/* Disassemble one instruction from insn index and generate parameters */
const char *build_insn (unsigned long data, cuc_insn *insn)
const char *build_insn (unsigned long data, cuc_insn *insn)
{
{
  const char *name;
  const char *name;
  char *s;
  char *s;
  int index = insn_decode (data);
  int index = or1ksim_insn_decode (data);
  struct or32_opcode const *opcode;
  struct or32_opcode const *opcode;
  int i, argc = 0;
  int i, argc = 0;
 
 
  insn->insn = data;
  insn->insn = data;
  insn->index = -1;
  insn->index = -1;
  insn->type = 0;
  insn->type = 0;
  name = insn_name (index);
  name = or1ksim_insn_name (index);
  insn->index = index;
  insn->index = index;
  disassemble_index (data, index);
  or1ksim_disassemble_index (data, index);
  strcpy (insn->disasm, disassembled);
  strcpy (insn->disasm, or1ksim_disassembled);
  insn->dep = NULL;
  insn->dep = NULL;
  for (i = 0; i < MAX_OPERANDS; i++) insn->opt[i] = OPT_NONE;
  for (i = 0; i < MAX_OPERANDS; i++) insn->opt[i] = OPT_NONE;
 
 
  if (index < 0) {
  if (index < 0) {
    fprintf (stderr, "Invalid opcode 0x%08lx!\n", data);
    fprintf (stderr, "Invalid opcode 0x%08lx!\n", data);
    exit (1);
    exit (1);
  }
  }
  opcode = &or32_opcodes[index];
  opcode = &or1ksim_or32_opcodes[index];
 
 
  for (s = opcode->args; *s != '\0'; ++s) {
  for (s = opcode->args; *s != '\0'; ++s) {
    switch (*s) {
    switch (*s) {
    case '\0': return name;
    case '\0': return name;
    case 'r':
    case 'r':
      insn->opt[argc] = OPT_REGISTER | (argc ? 0 : OPT_DEST);
      insn->opt[argc] = OPT_REGISTER | (argc ? 0 : OPT_DEST);
      insn->op[argc++] = or32_extract(*++s, opcode->encoding, data);
      insn->op[argc++] = or1ksim_or32_extract(*++s, opcode->encoding, data);
      break;
      break;
 
 
    default:
    default:
      if (strchr (opcode->encoding, *s)) {
      if (strchr (opcode->encoding, *s)) {
        unsigned long imm = or32_extract (*s, opcode->encoding, data);
        unsigned long imm = or1ksim_or32_extract (*s, opcode->encoding, data);
        imm = extend_imm(imm, *s);
        imm = or1ksim_extend_imm(imm, *s);
        insn->opt[argc] = OPT_CONST;
        insn->opt[argc] = OPT_CONST;
        insn->op[argc++] = imm;
        insn->op[argc++] = imm;
      }
      }
    }
    }
  }
  }
Line 434... Line 434...
    /* build params */
    /* build params */
    name = build_insn (data, &insn[i]);
    name = build_insn (data, &insn[i]);
    if (func_return) func_return++;
    if (func_return) func_return++;
    //PRINTF ("%s\n", name);
    //PRINTF ("%s\n", name);
 
 
    if (or32_opcodes[insn[i].index].flags & OR32_IF_DELAY) {
    if (or1ksim_or32_opcodes[insn[i].index].flags & OR32_IF_DELAY) {
      int f;
      int f;
      if (strcmp (name, "l.bnf") == 0) f = 1;
      if (strcmp (name, "l.bnf") == 0) f = 1;
      else if (strcmp (name, "l.bf") == 0) f = 0;
      else if (strcmp (name, "l.bf") == 0) f = 0;
      else if (strcmp (name, "l.j") == 0) {
      else if (strcmp (name, "l.j") == 0) {
        f = -1;
        f = -1;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.