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

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [gnu/] [binutils/] [opcodes/] [v850-opc.c] - Diff between revs 18 and 166

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

Rev 18 Rev 166
Line 1... Line 1...
/* Assemble V850 instructions.
/* Assemble V850 instructions.
   Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2005, 2007, 2010
   Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2005, 2007, 2010,
   Free Software Foundation, Inc.
   2012 Free Software Foundation, Inc.
 
 
   This file is part of the GNU opcodes library.
   This file is part of the GNU opcodes library.
 
 
   This library is free software; you can redistribute it and/or modify
   This library is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   it under the terms of the GNU General Public License as published by
Line 257... Line 257...
}
}
 
 
static unsigned long
static unsigned long
extract_v8 (unsigned long insn, int * invalid)
extract_v8 (unsigned long insn, int * invalid)
{
{
  unsigned long ret = (insn & 0x1f) | ((insn & 0x38000000) >> (27-5));
  unsigned long ret = (insn & 0x1f) | ((insn >> (27-5)) & 0xe0);
 
 
  if (invalid != 0)
  if (invalid != 0)
    *invalid = 0;
    *invalid = 0;
  return ret;
  return ret;
}
}
Line 283... Line 283...
}
}
 
 
static unsigned long
static unsigned long
extract_d9 (unsigned long insn, int * invalid)
extract_d9 (unsigned long insn, int * invalid)
{
{
  unsigned long ret = ((insn & 0xf800) >> 7) | ((insn & 0x0070) >> 3);
  signed long ret = ((insn >> 7) & 0x1f0) | ((insn >> 3) & 0x0e);
 
 
  if ((insn & 0x8000) != 0)
  ret = (ret ^ 0x100) - 0x100;
    ret -= 0x0200;
 
 
 
  if (invalid != 0)
  if (invalid != 0)
    *invalid = 0;
    *invalid = 0;
  return ret;
  return ret;
}
}
Line 339... Line 338...
}
}
 
 
static unsigned long
static unsigned long
extract_d16_15 (unsigned long insn, int * invalid)
extract_d16_15 (unsigned long insn, int * invalid)
{
{
  signed long ret = (insn & 0xfffe0000);
  signed long ret = (insn >> 16) & 0xfffe;
  ret >>= 16;
 
 
  ret = (ret ^ 0x8000) - 0x8000;
 
 
  if (invalid != 0)
  if (invalid != 0)
    *invalid = 0;
    *invalid = 0;
  return ret;
  return ret;
}
}
Line 359... Line 359...
}
}
 
 
static unsigned long
static unsigned long
extract_d16_16 (unsigned long insn, int * invalid)
extract_d16_16 (unsigned long insn, int * invalid)
{
{
  signed long ret = insn & 0xfffe0000;
  signed long ret = ((insn >> 16) & 0xfffe) | ((insn >> 5) & 1);
  ret >>= 16;
 
  ret |= ((insn & 0x20) >> 5);
  ret = (ret ^ 0x8000) - 0x8000;
 
 
  if (invalid != 0)
  if (invalid != 0)
    *invalid = 0;
    *invalid = 0;
  return ret;
  return ret;
}
}
Line 380... Line 380...
}
}
 
 
static unsigned long
static unsigned long
extract_d17_16 (unsigned long insn, int * invalid)
extract_d17_16 (unsigned long insn, int * invalid)
{
{
  signed long ret = (insn >> 16) & 0xfffe;
  signed long ret = ((insn >> 16) & 0xfffe) | ((insn << (16 - 4)) & 0x10000);
  ret |= (insn << (16 - 4)) & 0x10000;
 
  ret = (ret << ((sizeof ret)*8 - 17)) >> ((sizeof ret)*8 - 17);
  ret = (ret ^ 0x10000) - 0x10000;
 
 
  if (invalid != 0)
  if (invalid != 0)
    *invalid = 0;
    *invalid = 0;
  return (unsigned long)ret;
  return (unsigned long)ret;
}
}
Line 408... Line 408...
}
}
 
 
static unsigned long
static unsigned long
extract_d22 (unsigned long insn, int * invalid)
extract_d22 (unsigned long insn, int * invalid)
{
{
  signed long ret = ((insn & 0xfffe0000) >> 16) | ((insn & 0x3f) << 16);
  signed long ret = ((insn >> 16) & 0xfffe) | ((insn << 16) & 0x3f0000);
 
 
  ret = (ret << ((sizeof ret)*8 - 22)) >> ((sizeof ret)*8 - 22);
  ret = (ret ^ 0x200000) - 0x200000;
 
 
  if (invalid != 0)
  if (invalid != 0)
    *invalid = 0;
    *invalid = 0;
  return (unsigned long) ret;
  return (unsigned long) ret;
}
}
Line 429... Line 429...
}
}
 
 
static unsigned long
static unsigned long
extract_d23 (unsigned long insn, int * invalid)
extract_d23 (unsigned long insn, int * invalid)
{
{
  signed long ret = ((insn >> 4) & 0x7f) | ((insn >> (16-7)) & 0x7fffff80);
  signed long ret = ((insn >> 4) & 0x7f) | ((insn >> (16-7)) & 0x7fff80);
 
 
  ret = ((ret << ((sizeof ret)*8 - 23)) >> ((sizeof ret)*8 - 23));
  ret = (ret ^ 0x400000) - 0x400000;
 
 
  if (invalid != 0)
  if (invalid != 0)
    *invalid = 0;
    *invalid = 0;
  return (unsigned long) ret;
  return (unsigned long) ret;
}
}
Line 450... Line 450...
}
}
 
 
static unsigned long
static unsigned long
extract_i9 (unsigned long insn, int * invalid)
extract_i9 (unsigned long insn, int * invalid)
{
{
  signed long ret = insn & 0x003c0000;
  signed long ret = ((insn >> 13) & 0x1e0) | (insn & 0x1f);
 
 
  ret <<= 10;
  ret = (ret ^ 0x100) - 0x100;
  ret >>= 23;
 
  ret |= (insn & 0x1f);
 
 
 
  if (invalid != 0)
  if (invalid != 0)
    *invalid = 0;
    *invalid = 0;
  return ret;
  return ret;
}
}
Line 475... Line 473...
}
}
 
 
static unsigned long
static unsigned long
extract_u9 (unsigned long insn, int * invalid)
extract_u9 (unsigned long insn, int * invalid)
{
{
  unsigned long ret = insn & 0x003c0000;
  unsigned long ret = ((insn >> 13) & 0x1e0) | (insn & 0x1f);
 
 
  ret >>= 13;
 
 
 
  ret |= (insn & 0x1f);
 
 
 
  if (invalid != 0)
  if (invalid != 0)
    *invalid = 0;
    *invalid = 0;
  return ret;
  return ret;
}
}
Line 494... Line 488...
  unsigned long value = (unsigned long) v;
  unsigned long value = (unsigned long) v;
 
 
  if (value != 3)
  if (value != 3)
    * errmsg = _("invalid register for stack adjustment");
    * errmsg = _("invalid register for stack adjustment");
 
 
  return insn & (~ 0x180000);
  return insn & ~0x180000;
}
}
 
 
static unsigned long
static unsigned long
extract_spe (unsigned long insn ATTRIBUTE_UNUSED, int * invalid)
extract_spe (unsigned long insn ATTRIBUTE_UNUSED, int * invalid)
{
{
Line 522... Line 516...
}
}
 
 
static unsigned long
static unsigned long
extract_r4 (unsigned long insn, int * invalid)
extract_r4 (unsigned long insn, int * invalid)
{
{
  unsigned long ret;
  unsigned long ret = ((insn >> (23-4)) & 0x10) | ((insn >> 17) & 0x0f);
  ret = (insn >> 17) & 0xf;
 
  ret |= (insn >> (23-4)) & 0x10;
 
 
 
  if (invalid != 0)
  if (invalid != 0)
    *invalid = 0;
    *invalid = 0;
  return ret;
  return ret;
}
}

powered by: WebSVN 2.1.0

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