Line 18... |
Line 18... |
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|
|
/*
|
/*
|
* $Log: not supported by cvs2svn $
|
* $Log: not supported by cvs2svn $
|
|
* Revision 1.37 2005/01/11 15:41:58 andreje
|
|
* l.ff1 instruction added
|
|
*
|
* Revision 1.36 2004/07/22 20:17:23 phoenix
|
* Revision 1.36 2004/07/22 20:17:23 phoenix
|
* removed includes
|
* removed includes
|
*
|
*
|
* Revision 1.35 2004/07/19 23:07:37 phoenix
|
* Revision 1.35 2004/07/19 23:07:37 phoenix
|
* Gyorgy Jeney: extensive cleanup
|
* Gyorgy Jeney: extensive cleanup
|
Line 80... |
Line 83... |
Recommendation: irrelevant instruction bits should be set with a value of
|
Recommendation: irrelevant instruction bits should be set with a value of
|
bits in same positions of instruction preceding current instruction in the
|
bits in same positions of instruction preceding current instruction in the
|
code (when assembling).
|
code (when assembling).
|
*/
|
*/
|
|
|
#if defined HAS_EXECUTION && SIMPLE_EXECUTION
|
#ifdef HAS_EXECUTION
|
|
# if SIMPLE_EXECUTION
|
#define EFN &l_none
|
#define EFN &l_none
|
#define EF(func) &(func)
|
#define EF(func) &(func)
|
#define EFI &l_invalid
|
#define EFI &l_invalid
|
#else /* HAS_EXECUTION */
|
# else /* SIMPLE_EXECUTION */
|
|
|
#ifndef HAS_EXECUTION
|
|
#define EFN &l_none
|
|
#define EF(func) EFN
|
|
#define EFI EFN
|
|
#else /* !HAS_EXECUTION */
|
|
#define EFN "l_none"
|
#define EFN "l_none"
|
#define EFI "l_invalid"
|
#define EFI "l_invalid"
|
#ifdef __GNUC__
|
#ifdef __GNUC__
|
#define EF(func) #func
|
#define EF(func) #func
|
#else
|
#else
|
#define EF(func) "func"
|
#define EF(func) "func"
|
#endif
|
#endif
|
#endif /* !HAS_EXECUTION */
|
# endif /* SIMPLE_EXECUTION */
|
|
#else /* HAS_EXECUTION */
|
|
# define EFN &l_none
|
|
# define EF(func) EFN
|
|
# define EFI EFN
|
#endif /* HAS_EXECUTION */
|
#endif /* HAS_EXECUTION */
|
|
|
CONST struct or32_opcode or32_opcodes[] =
|
CONST struct or32_opcode or32_opcodes[] =
|
{
|
{
|
|
|
Line 287... |
Line 288... |
{ "lf.sfge.d", "rA,rB", "11 0x2 ----- AAAAA BBBB B--- 0x1 0xB", EFI, 0 },
|
{ "lf.sfge.d", "rA,rB", "11 0x2 ----- AAAAA BBBB B--- 0x1 0xB", EFI, 0 },
|
{ "lf.sflt.d", "rA,rB", "11 0x2 ----- AAAAA BBBB B--- 0x1 0xC", EFI, 0 },
|
{ "lf.sflt.d", "rA,rB", "11 0x2 ----- AAAAA BBBB B--- 0x1 0xC", EFI, 0 },
|
{ "lf.sfle.d", "rA,rB", "11 0x2 ----- AAAAA BBBB B--- 0x1 0xD", EFI, 0 },
|
{ "lf.sfle.d", "rA,rB", "11 0x2 ----- AAAAA BBBB B--- 0x1 0xD", EFI, 0 },
|
{ "lf.cust1.d", "rA,rB", "11 0x2 ----- AAAAA BBBB B--- 0xE ----", EFI, 0 },
|
{ "lf.cust1.d", "rA,rB", "11 0x2 ----- AAAAA BBBB B--- 0xE ----", EFI, 0 },
|
|
|
{ "l.sd", "I(rA),rB", "11 0x4 IIIII AAAAA BBBB BIII IIII IIII", EFI, 0 },
|
{ "l.sd", "I(rD),rB", "11 0x4 IIIII DDDDD BBBB BIII IIII IIII", EFI, 0 },
|
{ "l.sw", "I(rA),rB", "11 0x5 IIIII AAAAA BBBB BIII IIII IIII", EF(l_sw), 0 },
|
{ "l.sw", "I(rD),rB", "11 0x5 IIIII DDDDD BBBB BIII IIII IIII", EF(l_sw), 0 },
|
{ "l.sb", "I(rA),rB", "11 0x6 IIIII AAAAA BBBB BIII IIII IIII", EF(l_sb), 0 },
|
{ "l.sb", "I(rD),rB", "11 0x6 IIIII DDDDD BBBB BIII IIII IIII", EF(l_sb), 0 },
|
{ "l.sh", "I(rA),rB", "11 0x7 IIIII AAAAA BBBB BIII IIII IIII", EF(l_sh), 0 },
|
{ "l.sh", "I(rD),rB", "11 0x7 IIIII DDDDD BBBB BIII IIII IIII", EF(l_sh), 0 },
|
|
|
{ "l.add", "rD,rA,rB", "11 0x8 DDDDD AAAAA BBBB B-00 ---- 0x0", EF(l_add), OR32_W_FLAG },
|
{ "l.add", "rD,rA,rB", "11 0x8 DDDDD AAAAA BBBB B-00 ---- 0x0", EF(l_add), OR32_W_FLAG },
|
{ "l.addc", "rD,rA,rB", "11 0x8 DDDDD AAAAA BBBB B-00 ---- 0x1", EF(l_addc), OR32_W_FLAG },
|
{ "l.addc", "rD,rA,rB", "11 0x8 DDDDD AAAAA BBBB B-00 ---- 0x1", EF(l_addc), OR32_W_FLAG },
|
{ "l.sub", "rD,rA,rB", "11 0x8 DDDDD AAAAA BBBB B-00 ---- 0x2", EF(l_sub), 0 },
|
{ "l.sub", "rD,rA,rB", "11 0x8 DDDDD AAAAA BBBB B-00 ---- 0x2", EF(l_sub), 0 },
|
{ "l.and", "rD,rA,rB", "11 0x8 DDDDD AAAAA BBBB B-00 ---- 0x3", EF(l_and), OR32_W_FLAG },
|
{ "l.and", "rD,rA,rB", "11 0x8 DDDDD AAAAA BBBB B-00 ---- 0x3", EF(l_and), OR32_W_FLAG },
|
Line 364... |
Line 365... |
#undef EF
|
#undef EF
|
|
|
/* **INDENT-ON** */
|
/* **INDENT-ON** */
|
|
|
/* Define dummy, if debug is not defined. */
|
/* Define dummy, if debug is not defined. */
|
#if !defined HAS_DEBUG
|
#ifndef HAS_DEBUG
|
void debug(int level, const char *format, ...)
|
#define debug(l, fmt...) ;
|
{
|
|
/* Just to get rid of warnings. */
|
|
format = level = 0;
|
|
}
|
|
#endif
|
#endif
|
|
|
CONST int num_opcodes = ((sizeof(or32_opcodes)) / (sizeof(struct or32_opcode))) - 1;
|
CONST int num_opcodes = ((sizeof(or32_opcodes)) / (sizeof(struct or32_opcode))) - 1;
|
|
|
/* Calculates instruction length in bytes. Always 4 for OR32. */
|
/* Calculates instruction length in bytes. Always 4 for OR32. */
|
Line 458... |
Line 455... |
{
|
{
|
}
|
}
|
|
|
/*** Finite automata for instruction decoding building code ***/
|
/*** Finite automata for instruction decoding building code ***/
|
|
|
/* Find simbols in encoding. */
|
/* Find symbols in encoding. */
|
unsigned long
|
unsigned long
|
insn_extract(param_ch, enc_initial)
|
insn_extract(param_ch, enc_initial)
|
char param_ch;
|
char param_ch;
|
char *enc_initial;
|
char *enc_initial;
|
{
|
{
|
Line 506... |
Line 503... |
|
|
unsigned long *automata;
|
unsigned long *automata;
|
int nuncovered;
|
int nuncovered;
|
int curpass = 0;
|
int curpass = 0;
|
|
|
/* MM: Struct that hold runtime build information about instructions. */
|
/* MM: Struct that holds runtime build information about instructions. */
|
struct temp_insn_struct
|
struct temp_insn_struct
|
{
|
{
|
unsigned long insn;
|
unsigned long insn;
|
unsigned long insn_mask;
|
unsigned long insn_mask;
|
int in_pass;
|
int in_pass;
|
Line 653... |
Line 650... |
{
|
{
|
if (*args == 'r')
|
if (*args == 'r')
|
{
|
{
|
args++;
|
args++;
|
type |= OPTYPE_REG;
|
type |= OPTYPE_REG;
|
|
if(args[1] == 'D')
|
|
type |= OPTYPE_DST;
|
}
|
}
|
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);
|