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

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_33/] [insight/] [opcodes/] [or32.c] - Diff between revs 344 and 355

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

Rev 344 Rev 355
Line 590... Line 590...
  type = 0;
  type = 0;
  /* In case we don't have any parameters, we add dummy read from r0.  */
  /* In case we don't have any parameters, we add dummy read from r0.  */
  if (!(*args)) {
  if (!(*args)) {
    cur->type = OPTYPE_REG | OPTYPE_OP | OPTYPE_LAST;
    cur->type = OPTYPE_REG | OPTYPE_OP | OPTYPE_LAST;
    cur->data = 0;
    cur->data = 0;
    debug(8, "#%08X %08X\n", cur->type, cur->data);
    debug(9, "#%08X %08X\n", cur->type, cur->data);
    cur++;
    cur++;
    return cur;
    return cur;
  }
  }
 
 
  while (*args != '\0')
  while (*args != '\0')
Line 606... Line 606...
        }
        }
      else if (isalpha (*args))
      else if (isalpha (*args))
        {
        {
          unsigned long arg;
          unsigned long arg;
          arg = insn_extract(*args, opcode->encoding);
          arg = insn_extract(*args, opcode->encoding);
          debug(3, "%s : %08X ------\n", opcode->name, arg);
          debug(9, "%s : %08X ------\n", opcode->name, arg);
          if (letter_signed (*args))
          if (letter_signed (*args))
            {
            {
              type |= OPTYPE_SIG;
              type |= OPTYPE_SIG;
              type |= ((num_ones (arg) - 1) << OPTYPE_SBIT_SHR) & OPTYPE_SBIT;
              type |= ((num_ones (arg) - 1) << OPTYPE_SBIT_SHR) & OPTYPE_SBIT;
            }
            }
Line 631... Line 631...
                  tmp >>= 1;
                  tmp >>= 1;
                }
                }
              cur->type = type | shr;
              cur->type = type | shr;
              cur->data = mask;
              cur->data = mask;
              arg &= ~(((1 << mask) - 1) << shr);
              arg &= ~(((1 << mask) - 1) << shr);
              debug(3, "|%08X %08X\n", cur->type, cur->data);
              debug(6, "|%08X %08X\n", cur->type, cur->data);
              cur++;
              cur++;
            }
            }
          args++;
          args++;
        }
        }
      else if (*args == '(')
      else if (*args == '(')
        {
        {
          /* Next param is displacement.  Later we will treat them as one operand.  */
          /* Next param is displacement.  Later we will treat them as one operand.  */
          cur--;
          cur--;
          cur->type = type | cur->type | OPTYPE_DIS | OPTYPE_OP;
          cur->type = type | cur->type | OPTYPE_DIS | OPTYPE_OP;
          debug(3, ">%08X %08X\n", cur->type, cur->data);
          debug(9, ">%08X %08X\n", cur->type, cur->data);
          cur++;
          cur++;
          type = 0;
          type = 0;
          i++;
          i++;
          args++;
          args++;
        }
        }
      else if (*args == OPERAND_DELIM)
      else if (*args == OPERAND_DELIM)
        {
        {
          cur--;
          cur--;
          cur->type = type | cur->type | OPTYPE_OP;
          cur->type = type | cur->type | OPTYPE_OP;
          debug(3, ">%08X %08X\n", cur->type, cur->data);
          debug(9, ">%08X %08X\n", cur->type, cur->data);
          cur++;
          cur++;
          type = 0;
          type = 0;
          i++;
          i++;
          args++;
          args++;
        }
        }
      else if (*args == '0')
      else if (*args == '0')
        {
        {
          cur->type = type;
          cur->type = type;
          cur->data = 0;
          cur->data = 0;
          debug(3, ">%08X %08X\n", cur->type, cur->data);
          debug(9, ">%08X %08X\n", cur->type, cur->data);
          cur++;
          cur++;
          type = 0;
          type = 0;
          i++;
          i++;
          args++;
          args++;
        }
        }
Line 677... Line 677...
          exit (1);
          exit (1);
        }
        }
    }
    }
  cur--;
  cur--;
  cur->type = type | cur->type | OPTYPE_OP | OPTYPE_LAST;
  cur->type = type | cur->type | OPTYPE_OP | OPTYPE_LAST;
  debug(3, "#%08X %08X\n", cur->type, cur->data);
  debug(9, "#%08X %08X\n", cur->type, cur->data);
  cur++;
  cur++;
  return cur;
  return cur;
}
}
 
 
/* Constructs new automata based on or32_opcodes array.  */
/* Constructs new automata based on or32_opcodes array.  */
Line 752... Line 752...
  unsigned long *a = automata;
  unsigned long *a = automata;
  int i;
  int i;
  while (!(*a & LEAF_FLAG))
  while (!(*a & LEAF_FLAG))
    {
    {
      unsigned int first = *a;
      unsigned int first = *a;
      debug(8, "%i ", a - automata);
      debug(9, "%i ", a - automata);
      a++;
      a++;
      i = (insn >> first) & *a;
      i = (insn >> first) & *a;
      a++;
      a++;
      if (!*(a + i))
      if (!*(a + i))
        { /* Invalid instruction found?  */
        { /* Invalid instruction found?  */
          debug(8, "XXX\n", i);
          debug(9, "XXX\n", i);
          return -1;
          return -1;
        }
        }
      a = automata + *(a + i);
      a = automata + *(a + i);
    }
    }
  i = *a & ~LEAF_FLAG;
  i = *a & ~LEAF_FLAG;
  debug(8, "%i\n", i);
  debug(9, "%i\n", i);
  /* Final check - do we have direct match?
  /* Final check - do we have direct match?
     (based on or32_opcodes this should be the only possibility,
     (based on or32_opcodes this should be the only possibility,
     but in case of invalid/missing instruction we must perform a check)  */
     but in case of invalid/missing instruction we must perform a check)  */
  if ((ti[i].insn_mask & insn) == ti[i].insn)
  if ((ti[i].insn_mask & insn) == ti[i].insn)
    return i;
    return i;

powered by: WebSVN 2.1.0

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