// -*- C -*-
|
// -*- C -*-
|
//
|
//
|
// Simulator definition for the SmartMIPS extensions.
|
// Simulator definition for the SmartMIPS extensions.
|
// Copyright (C) 2005, 2010 Free Software Foundation, Inc.
|
// Copyright (C) 2005, 2010 Free Software Foundation, Inc.
|
// Contributed by Nigel Stephens (nigel@mips.com) and
|
// Contributed by Nigel Stephens (nigel@mips.com) and
|
// David Ung (davidu@mips.com) of MIPS Technologies.
|
// David Ung (davidu@mips.com) of MIPS Technologies.
|
//
|
//
|
// This file is part of GDB, the GNU debugger.
|
// This file is part of GDB, the GNU debugger.
|
//
|
//
|
// This program is free software; you can redistribute it and/or modify
|
// This program 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
|
// the Free Software Foundation; either version 3 of the License, or
|
// the Free Software Foundation; either version 3 of the License, or
|
// (at your option) any later version.
|
// (at your option) any later version.
|
//
|
//
|
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
//
|
//
|
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
// along with this program. If not, see .
|
// along with this program. If not, see .
|
|
|
011100,5.BASE,5.INDEX,5.RD,00010,001000:SPECIAL:32::LWXS
|
011100,5.BASE,5.INDEX,5.RD,00010,001000:SPECIAL:32::LWXS
|
"lwxs r, (r)"
|
"lwxs r, (r)"
|
*smartmips:
|
*smartmips:
|
{
|
{
|
GPR[RD] = EXTEND32 (do_load(SD_, AccessLength_WORD, GPR[BASE], GPR[INDEX]<<2));
|
GPR[RD] = EXTEND32 (do_load(SD_, AccessLength_WORD, GPR[BASE], GPR[INDEX]<<2));
|
}
|
}
|
|
|
011100,5.RS,5.RT,00000,10001,000001:SPECIAL:32::MADDP
|
011100,5.RS,5.RT,00000,10001,000001:SPECIAL:32::MADDP
|
"maddp r, r
|
"maddp r, r
|
*smartmips:
|
*smartmips:
|
{
|
{
|
unsigned64 res;
|
unsigned64 res;
|
unsigned64 rs, rt;
|
unsigned64 rs, rt;
|
int i;
|
int i;
|
|
|
check_mult_hilo (SD_, HIHISTORY, LOHISTORY);
|
check_mult_hilo (SD_, HIHISTORY, LOHISTORY);
|
TRACE_ALU_INPUT2 (GPR[RS], GPR[RT]);
|
TRACE_ALU_INPUT2 (GPR[RS], GPR[RT]);
|
|
|
res = 0;
|
res = 0;
|
rs = GPR[RS];
|
rs = GPR[RS];
|
rt = GPR[RT];
|
rt = GPR[RT];
|
for (i = 0; i < 32; i++)
|
for (i = 0; i < 32; i++)
|
{
|
{
|
if (rs & 1)
|
if (rs & 1)
|
res ^= rt;
|
res ^= rt;
|
rs >>= 1;
|
rs >>= 1;
|
rt <<= 1;
|
rt <<= 1;
|
}
|
}
|
LO ^= EXTEND32 (VL4_8 (res));
|
LO ^= EXTEND32 (VL4_8 (res));
|
HI ^= EXTEND32 (VH4_8 (res));
|
HI ^= EXTEND32 (VH4_8 (res));
|
TRACE_ALU_RESULT2 (HI, LO);
|
TRACE_ALU_RESULT2 (HI, LO);
|
}
|
}
|
|
|
|
|
000000,0000000000,5.RD,00001,010010:SPECIAL:32::MFLHXU
|
000000,0000000000,5.RD,00001,010010:SPECIAL:32::MFLHXU
|
"mflhxu r"
|
"mflhxu r"
|
*smartmips:
|
*smartmips:
|
{
|
{
|
check_mf_hilo (SD_, HIHISTORY, LOHISTORY);
|
check_mf_hilo (SD_, HIHISTORY, LOHISTORY);
|
TRACE_ALU_INPUT3 (ACX,HI,LO);
|
TRACE_ALU_INPUT3 (ACX,HI,LO);
|
GPR[RD] = LO;
|
GPR[RD] = LO;
|
LO = HI;
|
LO = HI;
|
HI = ACX;
|
HI = ACX;
|
ACX = 0;
|
ACX = 0;
|
TRACE_ALU_RESULT4 (ACX,HI,LO,GPR[RD]);
|
TRACE_ALU_RESULT4 (ACX,HI,LO,GPR[RD]);
|
}
|
}
|
|
|
000000,5.RS,000000000000001,010011:SPECIAL:32::MTLHX
|
000000,5.RS,000000000000001,010011:SPECIAL:32::MTLHX
|
"mtlhx r"
|
"mtlhx r"
|
*smartmips:
|
*smartmips:
|
{
|
{
|
check_mf_hilo (SD_, HIHISTORY, LOHISTORY);
|
check_mf_hilo (SD_, HIHISTORY, LOHISTORY);
|
TRACE_ALU_INPUT3 (HI,LO,GPR[RS]);
|
TRACE_ALU_INPUT3 (HI,LO,GPR[RS]);
|
ACX = HI;
|
ACX = HI;
|
HI = LO;
|
HI = LO;
|
LO = GPR[RS];
|
LO = GPR[RS];
|
TRACE_ALU_RESULT4 (ACX,HI,LO,GPR[RS]);
|
TRACE_ALU_RESULT4 (ACX,HI,LO,GPR[RS]);
|
}
|
}
|
|
|
000000,5.RS,5.RT,00000,10001,011001:SPECIAL:32::MULTP
|
000000,5.RS,5.RT,00000,10001,011001:SPECIAL:32::MULTP
|
"multp r, r
|
"multp r, r
|
*smartmips:
|
*smartmips:
|
{
|
{
|
unsigned64 res;
|
unsigned64 res;
|
unsigned64 rs, rt;
|
unsigned64 rs, rt;
|
int i;
|
int i;
|
check_mult_hilo (SD_, HIHISTORY, LOHISTORY);
|
check_mult_hilo (SD_, HIHISTORY, LOHISTORY);
|
TRACE_ALU_INPUT2 (GPR[RS], GPR[RT]);
|
TRACE_ALU_INPUT2 (GPR[RS], GPR[RT]);
|
|
|
res = 0;
|
res = 0;
|
rs = GPR[RS];
|
rs = GPR[RS];
|
rt = GPR[RT];
|
rt = GPR[RT];
|
for (i = 0; i < 32; i++)
|
for (i = 0; i < 32; i++)
|
{
|
{
|
if (rs & 1)
|
if (rs & 1)
|
res ^= rt;
|
res ^= rt;
|
rs >>= 1;
|
rs >>= 1;
|
rt <<= 1;
|
rt <<= 1;
|
}
|
}
|
LO = EXTEND32 (VL4_8 (res));
|
LO = EXTEND32 (VL4_8 (res));
|
HI = EXTEND32 (VH4_8 (res));
|
HI = EXTEND32 (VH4_8 (res));
|
ACX = 0;
|
ACX = 0;
|
TRACE_ALU_RESULT2 (HI, LO);
|
TRACE_ALU_RESULT2 (HI, LO);
|
}
|
}
|
|
|
011100,5.RS,5.RT,00000,10010,000001:SPECIAL:32::PPERM
|
011100,5.RS,5.RT,00000,10010,000001:SPECIAL:32::PPERM
|
"pperm r, r
|
"pperm r, r
|
*smartmips:
|
*smartmips:
|
{
|
{
|
int i;
|
int i;
|
ACX = (ACX << 6) | MSEXTRACTED(HI,26,31);
|
ACX = (ACX << 6) | MSEXTRACTED(HI,26,31);
|
HI = EXTEND32 ((HI << 6) | MSEXTRACTED(LO,26,31));
|
HI = EXTEND32 ((HI << 6) | MSEXTRACTED(LO,26,31));
|
LO = EXTEND32 (LO << 6);
|
LO = EXTEND32 (LO << 6);
|
for (i = 0; i < 6; i++) {
|
for (i = 0; i < 6; i++) {
|
int sbit = 5*i;
|
int sbit = 5*i;
|
int ebit = sbit + 4;
|
int ebit = sbit + 4;
|
int tbit = EXTRACTED(GPR[RT],sbit,ebit);
|
int tbit = EXTRACTED(GPR[RT],sbit,ebit);
|
LO |= MSEXTRACTED(GPR[RS],tbit,tbit) << i;
|
LO |= MSEXTRACTED(GPR[RS],tbit,tbit) << i;
|
}
|
}
|
}
|
}
|
|
|