2002-06-02 Chris Demetriou <cgd@broadcom.com>
Ed Satterthwaite <ehs@broadcom.com> * mips.igen (mdmx): New (pseudo-)model. * mdmx.c, mdmx.igen: New files. * Makefile.in (SIM_OBJS): Add mdmx.o. * sim-main.h (MDMX_accumulator, MX_fmtsel, signed24, signed48): New typedefs. (ACC, MX_Add, MX_AddA, MX_AddL, MX_And, MX_C_EQ, MX_C_LT, MX_Comp) (MX_FMT_OB, MX_FMT_QH, MX_Max, MX_Min, MX_Msgn, MX_Mul, MX_MulA) (MX_MulL, MX_MulS, MX_MulSL, MX_Nor, MX_Or, MX_Pick, MX_RAC) (MX_RAC_H, MX_RAC_L, MX_RAC_M, MX_RNAS, MX_RNAU, MX_RND_AS) (MX_RND_AU, MX_RND_ES, MX_RND_EU, MX_RND_ZS, MX_RND_ZU, MX_RNES) (MX_RNEU, MX_RZS, MX_RZU, MX_SHFL, MX_ShiftLeftLogical) (MX_ShiftRightArith, MX_ShiftRightLogical, MX_Sub, MX_SubA, MX_SubL) (MX_VECT_ADD, MX_VECT_ADDA, MX_VECT_ADDL, MX_VECT_AND) (MX_VECT_MAX, MX_VECT_MIN, MX_VECT_MSGN, MX_VECT_MUL, MX_VECT_MULA) (MX_VECT_MULL, MX_VECT_MULS, MX_VECT_MULSL, MX_VECT_NOR) (MX_VECT_OR, MX_VECT_SLL, MX_VECT_SRA, MX_VECT_SRL, MX_VECT_SUB) (MX_VECT_SUBA, MX_VECT_SUBL, MX_VECT_XOR, MX_WACH, MX_WACL, MX_Xor) (SIM_ARGS, SIM_STATE, UnpredictableResult, fmt_mdmx, ob_fmtsel) (qh_fmtsel): New macros. (_sim_cpu): New member "acc". (mdmx_acc_op, mdmx_cc_op, mdmx_cpr_op, mdmx_pick_op, mdmx_rac_op) (mdmx_round_op, mdmx_shuffle, mdmx_wach, mdmx_wacl): New functions.
This commit is contained in:
parent
4a67a09883
commit
f4f1b9f102
@ -1,3 +1,29 @@
|
||||
2002-06-02 Chris Demetriou <cgd@broadcom.com>
|
||||
Ed Satterthwaite <ehs@broadcom.com>
|
||||
|
||||
* mips.igen (mdmx): New (pseudo-)model.
|
||||
* mdmx.c, mdmx.igen: New files.
|
||||
* Makefile.in (SIM_OBJS): Add mdmx.o.
|
||||
* sim-main.h (MDMX_accumulator, MX_fmtsel, signed24, signed48):
|
||||
New typedefs.
|
||||
(ACC, MX_Add, MX_AddA, MX_AddL, MX_And, MX_C_EQ, MX_C_LT, MX_Comp)
|
||||
(MX_FMT_OB, MX_FMT_QH, MX_Max, MX_Min, MX_Msgn, MX_Mul, MX_MulA)
|
||||
(MX_MulL, MX_MulS, MX_MulSL, MX_Nor, MX_Or, MX_Pick, MX_RAC)
|
||||
(MX_RAC_H, MX_RAC_L, MX_RAC_M, MX_RNAS, MX_RNAU, MX_RND_AS)
|
||||
(MX_RND_AU, MX_RND_ES, MX_RND_EU, MX_RND_ZS, MX_RND_ZU, MX_RNES)
|
||||
(MX_RNEU, MX_RZS, MX_RZU, MX_SHFL, MX_ShiftLeftLogical)
|
||||
(MX_ShiftRightArith, MX_ShiftRightLogical, MX_Sub, MX_SubA, MX_SubL)
|
||||
(MX_VECT_ADD, MX_VECT_ADDA, MX_VECT_ADDL, MX_VECT_AND)
|
||||
(MX_VECT_MAX, MX_VECT_MIN, MX_VECT_MSGN, MX_VECT_MUL, MX_VECT_MULA)
|
||||
(MX_VECT_MULL, MX_VECT_MULS, MX_VECT_MULSL, MX_VECT_NOR)
|
||||
(MX_VECT_OR, MX_VECT_SLL, MX_VECT_SRA, MX_VECT_SRL, MX_VECT_SUB)
|
||||
(MX_VECT_SUBA, MX_VECT_SUBL, MX_VECT_XOR, MX_WACH, MX_WACL, MX_Xor)
|
||||
(SIM_ARGS, SIM_STATE, UnpredictableResult, fmt_mdmx, ob_fmtsel)
|
||||
(qh_fmtsel): New macros.
|
||||
(_sim_cpu): New member "acc".
|
||||
(mdmx_acc_op, mdmx_cc_op, mdmx_cpr_op, mdmx_pick_op, mdmx_rac_op)
|
||||
(mdmx_round_op, mdmx_shuffle, mdmx_wach, mdmx_wacl): New functions.
|
||||
|
||||
2002-05-01 Chris Demetriou <cgd@broadcom.com>
|
||||
|
||||
* interp.c: Use 'deprecated' rather than 'depreciated.'
|
||||
|
@ -43,6 +43,7 @@ SIM_OBJS = \
|
||||
$(MIPS_EXTRA_OBJS) \
|
||||
cp1.o \
|
||||
interp.o \
|
||||
mdmx.o \
|
||||
sim-main.o \
|
||||
sim-hload.o \
|
||||
sim-engine.o \
|
||||
@ -71,6 +72,7 @@ SIM_RUN_OBJS = nrun.o
|
||||
interp.o: $(srcdir)/interp.c config.h sim-main.h itable.h
|
||||
cp1.o: $(srcdir)/cp1.c config.h sim-main.h
|
||||
|
||||
mdmx.o: $(srcdir)/mdmx.c $(srcdir)/sim-main.h
|
||||
|
||||
../igen/igen:
|
||||
cd ../igen && $(MAKE)
|
||||
|
1449
sim/mips/mdmx.c
Normal file
1449
sim/mips/mdmx.c
Normal file
File diff suppressed because it is too large
Load Diff
550
sim/mips/mdmx.igen
Normal file
550
sim/mips/mdmx.igen
Normal file
@ -0,0 +1,550 @@
|
||||
// -*- C -*-
|
||||
|
||||
// Simulator definition for the MIPS MDMX ASE.
|
||||
// Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
// Contributed by Broadcom Corporation (SiByte).
|
||||
//
|
||||
// This file is part of GDB, the GNU debugger.
|
||||
//
|
||||
// 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
|
||||
// the Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
// Reference: MIPS64 Architecture Volume IV-b:
|
||||
// The MDMX Application-Specific Extension
|
||||
|
||||
// Notes on "format selectors" (FMTSEL):
|
||||
//
|
||||
// A selector with final bit 0 indicates OB format.
|
||||
// A selector with final bits 01 indicates QH format.
|
||||
// A selector with final bits 11 has UNPREDICTABLE result per the spec.
|
||||
//
|
||||
// Similarly, for the single-bit fields which differentiate between
|
||||
// formats (FMTOP), 0 is OB format and 1 is QH format.
|
||||
|
||||
|
||||
// Helper:
|
||||
//
|
||||
// Check whether MDMX is usable, and if not signal an appropriate exception.
|
||||
//
|
||||
|
||||
:function:::void:check_mdmx:instruction_word insn
|
||||
*mdmx:
|
||||
{
|
||||
if (! COP_Usable (1))
|
||||
SignalExceptionCoProcessorUnusable (1);
|
||||
if ((SR & (status_MX|status_FR)) != (status_MX|status_FR))
|
||||
SignalExceptionMDMX ();
|
||||
check_u64 (SD_, insn);
|
||||
}
|
||||
|
||||
|
||||
// Helper:
|
||||
//
|
||||
// Check whether a given MDMX format selector indicates a valid and usable
|
||||
// format, and if not signal an appropriate exception.
|
||||
//
|
||||
|
||||
:function:::int:check_mdmx_fmtsel:instruction_word insn, int fmtsel
|
||||
*mdmx:
|
||||
{
|
||||
switch (fmtsel & 0x03)
|
||||
{
|
||||
case 0x00: /* ob */
|
||||
case 0x02:
|
||||
case 0x01: /* qh */
|
||||
return 1;
|
||||
case 0x03: /* UNPREDICTABLE */
|
||||
SignalException (ReservedInstruction, insn);
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// Helper:
|
||||
//
|
||||
// Check whether a given MDMX format bit indicates a valid and usable
|
||||
// format, and if not signal an appropriate exception.
|
||||
//
|
||||
|
||||
:function:::int:check_mdmx_fmtop:instruction_word insn, int fmtop
|
||||
*mdmx:
|
||||
{
|
||||
switch (fmtop & 0x01)
|
||||
{
|
||||
case 0x00: /* ob */
|
||||
case 0x01: /* qh */
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
:%s::::FMTSEL:int fmtsel
|
||||
*mdmx:
|
||||
{
|
||||
if ((fmtsel & 0x1) == 0)
|
||||
return "ob";
|
||||
else if ((fmtsel & 0x3) == 1)
|
||||
return "qh";
|
||||
else
|
||||
return "?";
|
||||
}
|
||||
|
||||
|
||||
:%s::::FMTOP:int fmtop
|
||||
*mdmx:
|
||||
{
|
||||
switch (fmtop)
|
||||
{
|
||||
case 0: return "ob";
|
||||
case 1: return "qh";
|
||||
default: return "?";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
:%s::::SHOP:int shop
|
||||
*mdmx:
|
||||
{
|
||||
if ((shop & 0x11) == 0x00)
|
||||
switch ((shop >> 1) & 0x07)
|
||||
{
|
||||
case 3: return "upsl.ob";
|
||||
case 4: return "pach.ob";
|
||||
case 6: return "mixh.ob";
|
||||
case 7: return "mixl.ob";
|
||||
default: return "?";
|
||||
}
|
||||
else if ((shop & 0x03) == 0x01)
|
||||
switch ((shop >> 2) & 0x07)
|
||||
{
|
||||
case 0: return "mixh.qh";
|
||||
case 1: return "mixl.qh";
|
||||
case 2: return "pach.qh";
|
||||
case 4: return "bfla.qh";
|
||||
case 6: return "repa.qh";
|
||||
case 7: return "repb.qh";
|
||||
default: return "?";
|
||||
}
|
||||
else
|
||||
return "?";
|
||||
}
|
||||
|
||||
|
||||
011110,5.FMTSEL,5.VT,5.VS,5.VD,001011:MDMX:64::ADD.fmt
|
||||
"add.%s<FMTSEL> v<VD>, v<VS>, v<VT>"
|
||||
*mdmx:
|
||||
{
|
||||
check_mdmx (SD_, instruction_0);
|
||||
if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
|
||||
StoreFPR(VD,fmt_mdmx,MX_Add(ValueFPR(VS,fmt_mdmx),VT,FMTSEL));
|
||||
}
|
||||
|
||||
|
||||
011110,5.FMTSEL,5.VT,5.VS,0,0000,110111:MDMX:64::ADDA.fmt
|
||||
"adda.%s<FMTSEL> v<VS>, v<VT>"
|
||||
*mdmx:
|
||||
{
|
||||
check_mdmx (SD_, instruction_0);
|
||||
if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
|
||||
MX_AddA(ValueFPR(VS,fmt_mdmx),VT,FMTSEL);
|
||||
}
|
||||
|
||||
|
||||
011110,5.FMTSEL,5.VT,5.VS,1,0000,110111:MDMX:64::ADDL.fmt
|
||||
"addl.%s<FMTSEL> v<VS>, v<VT>"
|
||||
*mdmx:
|
||||
{
|
||||
check_mdmx (SD_, instruction_0);
|
||||
if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
|
||||
MX_AddL(ValueFPR(VS,fmt_mdmx),VT,FMTSEL);
|
||||
}
|
||||
|
||||
|
||||
011110,00,3.IMM,5.VT,5.VS,5.VD,0110,1.FMTOP,0:MDMX:64::ALNI.fmt
|
||||
"alni.%s<FMTOP> v<VD>, v<VS>, v<VT>, <IMM>"
|
||||
*mdmx:
|
||||
{
|
||||
unsigned64 result;
|
||||
int s;
|
||||
check_mdmx (SD_, instruction_0);
|
||||
check_mdmx_fmtop (SD_, instruction_0, FMTOP);
|
||||
s = (IMM << 3);
|
||||
result = ValueFPR(VS,fmt_mdmx) << s;
|
||||
if (s != 0) // x86 gcc treats >> 64 as >> 0
|
||||
result |= ValueFPR(VT,fmt_mdmx) >> (64 - s);
|
||||
StoreFPR(VD,fmt_mdmx,result);
|
||||
}
|
||||
|
||||
|
||||
011110,5.RS,5.VT,5.VS,5.VD,0110,1.FMTOP,1:MDMX:64::ALNV.fmt
|
||||
"alnv.%s<FMTOP> v<VD>, v<VS>, v<VT>, r<RS>"
|
||||
*mdmx:
|
||||
{
|
||||
unsigned64 result;
|
||||
int s;
|
||||
check_mdmx (SD_, instruction_0);
|
||||
check_mdmx_fmtop (SD_, instruction_0, FMTOP);
|
||||
s = ((GPR[RS] & 0x7) << 3);
|
||||
result = ValueFPR(VS,fmt_mdmx) << s;
|
||||
if (s != 0) // x86 gcc treats >> 64 as >> 0
|
||||
result |= ValueFPR(VT,fmt_mdmx) >> (64 - s);
|
||||
StoreFPR(VD,fmt_mdmx,result);
|
||||
}
|
||||
|
||||
|
||||
011110,5.FMTSEL,5.VT,5.VS,5.VD,001100:MDMX:64::AND.fmt
|
||||
"and.%s<FMTSEL> v<VD>, v<VS>, v<VT>"
|
||||
*mdmx:
|
||||
{
|
||||
check_mdmx (SD_, instruction_0);
|
||||
if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
|
||||
StoreFPR(VD,fmt_mdmx,MX_And(ValueFPR(VS,fmt_mdmx),VT,FMTSEL));
|
||||
}
|
||||
|
||||
|
||||
011110,5.FMTSEL,5.VT,5.VS,00000,000001:MDMX:64::C.EQ.fmt
|
||||
"c.eq.%s<FMTSEL> v<VS>, v<VT>"
|
||||
*mdmx:
|
||||
{
|
||||
check_mdmx (SD_, instruction_0);
|
||||
if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
|
||||
MX_Comp(ValueFPR(VS,fmt_mdmx),MX_C_EQ,VT,FMTSEL);
|
||||
}
|
||||
|
||||
|
||||
011110,5.FMTSEL,5.VT,5.VS,00000,000101:MDMX:64::C.LE.fmt
|
||||
"c.le.%s<FMTSEL> v<VS>, v<VT>"
|
||||
*mdmx:
|
||||
{
|
||||
check_mdmx (SD_, instruction_0);
|
||||
if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
|
||||
MX_Comp(ValueFPR(VS,fmt_mdmx),MX_C_LT|MX_C_EQ,VT,FMTSEL);
|
||||
}
|
||||
|
||||
|
||||
011110,5.FMTSEL,5.VT,5.VS,00000,000100:MDMX:64::C.LT.fmt
|
||||
"c.lt.%s<FMTSEL> v<VS>, v<VT>"
|
||||
*mdmx:
|
||||
{
|
||||
check_mdmx (SD_, instruction_0);
|
||||
if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
|
||||
MX_Comp(ValueFPR(VS,fmt_mdmx),MX_C_LT,VT,FMTSEL);
|
||||
}
|
||||
|
||||
|
||||
011110,5.FMTSEL,5.VT,5.VS,5.VD,000111:MDMX:64::MAX.fmt
|
||||
"max.%s<FMTSEL> v<VD>, v<VS>, v<VT>"
|
||||
*mdmx:
|
||||
{
|
||||
check_mdmx (SD_, instruction_0);
|
||||
if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
|
||||
StoreFPR(VD,fmt_mdmx,MX_Max(ValueFPR(VS,fmt_mdmx),VT,FMTSEL));
|
||||
}
|
||||
|
||||
|
||||
011110,5.FMTSEL,5.VT,5.VS,5.VD,000110:MDMX:64::MIN.fmt
|
||||
"min.%s<FMTSEL> v<VD>, v<VS>, v<VT>"
|
||||
*mdmx:
|
||||
{
|
||||
check_mdmx (SD_, instruction_0);
|
||||
if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
|
||||
StoreFPR(VD,fmt_mdmx,MX_Min(ValueFPR(VS,fmt_mdmx),VT,FMTSEL));
|
||||
}
|
||||
|
||||
|
||||
011110,3.SEL,01,5.VT,5.VS,5.VD,000000:MDMX:64::MSGN.QH
|
||||
"msgn.qh v<VD>, v<VS>, v<VT>"
|
||||
*mdmx:
|
||||
{
|
||||
check_mdmx (SD_, instruction_0);
|
||||
StoreFPR(VD,fmt_mdmx,MX_Msgn(ValueFPR(VS,fmt_mdmx),VT,qh_fmtsel(SEL)));
|
||||
}
|
||||
|
||||
|
||||
011110,5.FMTSEL,5.VT,5.VS,5.VD,110000:MDMX:64::MUL.fmt
|
||||
"mul.%s<FMTSEL> v<VD>, v<VS>, v<VT>"
|
||||
*mdmx:
|
||||
{
|
||||
check_mdmx (SD_, instruction_0);
|
||||
if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
|
||||
StoreFPR(VD,fmt_mdmx,MX_Mul(ValueFPR(VS,fmt_mdmx),VT,FMTSEL));
|
||||
}
|
||||
|
||||
|
||||
011110,5.FMTSEL,5.VT,5.VS,0,0000,110011:MDMX:64::MULA.fmt
|
||||
"mula.%s<FMTSEL> v<VS>, v<VT>"
|
||||
*mdmx:
|
||||
{
|
||||
check_mdmx (SD_, instruction_0);
|
||||
if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
|
||||
MX_MulA(ValueFPR(VS,fmt_mdmx),VT,FMTSEL);
|
||||
}
|
||||
|
||||
|
||||
011110,5.FMTSEL,5.VT,5.VS,1,0000,110011:MDMX:64::MULL.fmt
|
||||
"mull.%s<FMTSEL> v<VS>, v<VT>"
|
||||
*mdmx:
|
||||
{
|
||||
check_mdmx (SD_, instruction_0);
|
||||
if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
|
||||
MX_MulL(ValueFPR(VS,fmt_mdmx),VT,FMTSEL);
|
||||
}
|
||||
|
||||
|
||||
011110,5.FMTSEL,5.VT,5.VS,0,0000,110010:MDMX:64::MULS.fmt
|
||||
"muls.%s<FMTSEL> v<VS>, v<VT>"
|
||||
*mdmx:
|
||||
{
|
||||
check_mdmx (SD_, instruction_0);
|
||||
if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
|
||||
MX_MulS(ValueFPR(VS,fmt_mdmx),VT,FMTSEL);
|
||||
}
|
||||
|
||||
|
||||
011110,5.FMTSEL,5.VT,5.VS,1,0000,110010:MDMX:64::MULSL.fmt
|
||||
"mulsl.%s<FMTSEL> v<VS>, v<VT>"
|
||||
*mdmx:
|
||||
{
|
||||
check_mdmx (SD_, instruction_0);
|
||||
if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
|
||||
MX_MulSL(ValueFPR(VS,fmt_mdmx),VT,FMTSEL);
|
||||
}
|
||||
|
||||
|
||||
011110,5.FMTSEL,5.VT,5.VS,5.VD,001111:MDMX:64::NOR.fmt
|
||||
"nor.%s<FMTSEL> v<VD>, v<VS>, v<VT>"
|
||||
*mdmx:
|
||||
{
|
||||
check_mdmx (SD_, instruction_0);
|
||||
if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
|
||||
StoreFPR(VD,fmt_mdmx,MX_Nor(ValueFPR(VS,fmt_mdmx),VT,FMTSEL));
|
||||
}
|
||||
|
||||
|
||||
011110,5.FMTSEL,5.VT,5.VS,5.VD,001110:MDMX:64::OR.fmt
|
||||
"or.%s<FMTSEL> v<VD>, v<VS>, v<VT>"
|
||||
*mdmx:
|
||||
{
|
||||
check_mdmx (SD_, instruction_0);
|
||||
if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
|
||||
StoreFPR(VD,fmt_mdmx,MX_Or(ValueFPR(VS,fmt_mdmx),VT,FMTSEL));
|
||||
}
|
||||
|
||||
|
||||
011110,5.FMTSEL,5.VT,5.VS,5.VD,000010:MDMX:64::PICKF.fmt
|
||||
"pickf.%s<FMTSEL> v<VD>, v<VS>, v<VT>"
|
||||
*mdmx:
|
||||
{
|
||||
check_mdmx (SD_, instruction_0);
|
||||
if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
|
||||
StoreFPR(VD,fmt_mdmx,MX_Pick(0,ValueFPR(VS,fmt_mdmx),VT,FMTSEL));
|
||||
}
|
||||
|
||||
|
||||
011110,5.FMTSEL,5.VT,5.VS,5.VD,000011:MDMX:64::PICKT.fmt
|
||||
"pickt.%s<FMTSEL> v<VD>, v<VS>, v<VT>"
|
||||
*mdmx:
|
||||
{
|
||||
check_mdmx (SD_, instruction_0);
|
||||
if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
|
||||
StoreFPR(VD,fmt_mdmx,MX_Pick(1,ValueFPR(VS,fmt_mdmx),VT,FMTSEL));
|
||||
}
|
||||
|
||||
|
||||
011110,1000,1.FMTOP,00000,00000,5.VD,111111:MDMX:64::RACH.fmt
|
||||
"rach.%s<FMTOP> v<VD>"
|
||||
*mdmx:
|
||||
{
|
||||
check_mdmx (SD_, instruction_0);
|
||||
check_mdmx_fmtop (SD_, instruction_0, FMTOP);
|
||||
StoreFPR(VD,fmt_mdmx,MX_RAC(MX_RAC_H,FMTOP));
|
||||
}
|
||||
|
||||
|
||||
011110,0000,1.FMTOP,00000,00000,5.VD,111111:MDMX:64::RACL.fmt
|
||||
"racl.%s<FMTOP> v<VD>"
|
||||
*mdmx:
|
||||
{
|
||||
check_mdmx (SD_, instruction_0);
|
||||
check_mdmx_fmtop (SD_, instruction_0, FMTOP);
|
||||
StoreFPR(VD,fmt_mdmx,MX_RAC(MX_RAC_L,FMTOP));
|
||||
}
|
||||
|
||||
|
||||
011110,0100,1.FMTOP,00000,00000,5.VD,111111:MDMX:64::RACM.fmt
|
||||
"racm.%s<FMTOP> v<VD>"
|
||||
*mdmx:
|
||||
{
|
||||
check_mdmx (SD_, instruction_0);
|
||||
check_mdmx_fmtop (SD_, instruction_0, FMTOP);
|
||||
StoreFPR(VD,fmt_mdmx,MX_RAC(MX_RAC_M,FMTOP));
|
||||
}
|
||||
|
||||
|
||||
011110,3.SEL,01,5.VT,00000,5.VD,100101:MDMX:64::RNAS.QH
|
||||
"rnas.qh v<VD>, v<VT>"
|
||||
*mdmx:
|
||||
{
|
||||
check_mdmx (SD_, instruction_0);
|
||||
StoreFPR(VD,fmt_mdmx,MX_RNAS(VT,qh_fmtsel(SEL)));
|
||||
}
|
||||
|
||||
|
||||
011110,5.FMTSEL,5.VT,00000,5.VD,100001:MDMX:64::RNAU.fmt
|
||||
"rnau.%s<FMTSEL> v<VD>, v<VT>"
|
||||
*mdmx:
|
||||
{
|
||||
check_mdmx (SD_, instruction_0);
|
||||
if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
|
||||
StoreFPR(VD,fmt_mdmx,MX_RNAU(VT,FMTSEL));
|
||||
}
|
||||
|
||||
|
||||
011110,3.SEL,01,5.VT,00000,5.VD,100110:MDMX:64::RNES.QH
|
||||
"rnes.qh v<VD>, v<VT>"
|
||||
*mdmx:
|
||||
{
|
||||
check_mdmx (SD_, instruction_0);
|
||||
StoreFPR(VD,fmt_mdmx,MX_RNES(VT,qh_fmtsel(SEL)));
|
||||
}
|
||||
|
||||
|
||||
011110,5.FMTSEL,5.VT,00000,5.VD,100010:MDMX:64::RNEU.fmt
|
||||
"rneu.%s<FMTSEL> v<VD>, v<VT>"
|
||||
*mdmx:
|
||||
{
|
||||
check_mdmx (SD_, instruction_0);
|
||||
if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
|
||||
StoreFPR(VD,fmt_mdmx,MX_RNEU(VT,FMTSEL));
|
||||
}
|
||||
|
||||
|
||||
011110,3.SEL,01,5.VT,00000,5.VD,100100:MDMX:64::RZS.QH
|
||||
"rzs.qh v<VD>, v<VT>"
|
||||
*mdmx:
|
||||
{
|
||||
check_mdmx (SD_, instruction_0);
|
||||
StoreFPR(VD,fmt_mdmx,MX_RZS(VT,qh_fmtsel(SEL)));
|
||||
}
|
||||
|
||||
|
||||
011110,5.FMTSEL,5.VT,00000,5.VD,100000:MDMX:64::RZU.fmt
|
||||
"rzu.%s<FMTSEL> v<VD>, v<VT>"
|
||||
*mdmx:
|
||||
{
|
||||
check_mdmx (SD_, instruction_0);
|
||||
if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
|
||||
StoreFPR(VD,fmt_mdmx,MX_RZU(VT,FMTSEL));
|
||||
}
|
||||
|
||||
|
||||
011110,5.SHOP,5.VT,5.VS,5.VD,011111:MDMX:64::SHFL.op.fmt
|
||||
"shfl.%s<SHOP> v<VD>, v<VS>, v<VT>"
|
||||
*mdmx:
|
||||
{
|
||||
check_mdmx (SD_, instruction_0);
|
||||
if (check_mdmx_fmtsel (SD_, instruction_0, SHOP))
|
||||
StoreFPR(VD,fmt_mdmx,MX_SHFL(SHOP,ValueFPR(VS,fmt_mdmx),ValueFPR(VT,fmt_mdmx)));
|
||||
}
|
||||
|
||||
|
||||
011110,5.FMTSEL,5.VT,5.VS,5.VD,010000:MDMX:64::SLL.fmt
|
||||
"sll.%s<FMTSEL> v<VD>, v<VS>, v<VT>"
|
||||
*mdmx:
|
||||
{
|
||||
check_mdmx (SD_, instruction_0);
|
||||
if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
|
||||
StoreFPR(VD,fmt_mdmx,MX_ShiftLeftLogical(ValueFPR(VS,fmt_mdmx),VT,FMTSEL));
|
||||
}
|
||||
|
||||
|
||||
011110,3.SEL,01,5.VT,5.VS,5.VD,010011:MDMX:64::SRA.QH
|
||||
"sra.qh v<VD>, v<VS>, v<VT>"
|
||||
*mdmx:
|
||||
{
|
||||
check_mdmx (SD_, instruction_0);
|
||||
StoreFPR(VD,fmt_mdmx,MX_ShiftRightArith(ValueFPR(VS,fmt_mdmx),VT,qh_fmtsel(SEL)));
|
||||
}
|
||||
|
||||
|
||||
011110,5.FMTSEL,5.VT,5.VS,5.VD,010010:MDMX:64::SRL.fmt
|
||||
"srl.%s<FMTSEL> v<VD>, v<VS>, v<VT>"
|
||||
*mdmx:
|
||||
{
|
||||
check_mdmx (SD_, instruction_0);
|
||||
if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
|
||||
StoreFPR(VD,fmt_mdmx,MX_ShiftRightLogical(ValueFPR(VS,fmt_mdmx),VT,FMTSEL));
|
||||
}
|
||||
|
||||
|
||||
011110,5.FMTSEL,5.VT,5.VS,5.VD,001010:MDMX:64::SUB.fmt
|
||||
"sub.%s<FMTSEL> v<VD>, v<VS>, v<VT>"
|
||||
*mdmx:
|
||||
{
|
||||
check_mdmx (SD_, instruction_0);
|
||||
if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
|
||||
StoreFPR(VD,fmt_mdmx,MX_Sub(ValueFPR(VS,fmt_mdmx),VT,FMTSEL));
|
||||
}
|
||||
|
||||
|
||||
011110,5.FMTSEL,5.VT,5.VS,0,0000,110110:MDMX:64::SUBA.fmt
|
||||
"suba.%s<FMTSEL> v<VS>, v<VT>"
|
||||
*mdmx:
|
||||
{
|
||||
check_mdmx (SD_, instruction_0);
|
||||
if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
|
||||
MX_SubA(ValueFPR(VS,fmt_mdmx),VT,FMTSEL);
|
||||
}
|
||||
|
||||
|
||||
011110,5.FMTSEL,5.VT,5.VS,1,0000,110110:MDMX:64::SUBL.fmt
|
||||
"subl.%s<FMTSEL> v<VS>, v<VT>"
|
||||
*mdmx:
|
||||
{
|
||||
check_mdmx (SD_, instruction_0);
|
||||
if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
|
||||
MX_SubL(ValueFPR(VS,fmt_mdmx),VT,FMTSEL);
|
||||
}
|
||||
|
||||
|
||||
011110,1000,1.FMTOP,00000,5.VS,00000,111110:MDMX:64::WACH.fmt
|
||||
"wach.%s<FMTOP> v<VS>"
|
||||
*mdmx:
|
||||
{
|
||||
check_mdmx (SD_, instruction_0);
|
||||
check_mdmx_fmtop (SD_, instruction_0, FMTOP);
|
||||
MX_WACH(FMTOP,ValueFPR(VS,fmt_mdmx));
|
||||
}
|
||||
|
||||
|
||||
011110,0000,1.FMTOP,5.VT,5.VS,00000,111110:MDMX:64::WACL.fmt
|
||||
"wacl.%s<FMTOP> v<VS>, v<VT>"
|
||||
*mdmx:
|
||||
{
|
||||
check_mdmx (SD_, instruction_0);
|
||||
check_mdmx_fmtop (SD_, instruction_0, FMTOP);
|
||||
MX_WACL(FMTOP,ValueFPR(VS,fmt_mdmx),ValueFPR(VT,fmt_mdmx));
|
||||
}
|
||||
|
||||
|
||||
011110,5.FMTSEL,5.VT,5.VS,5.VD,001101:MDMX:64::XOR.fmt
|
||||
"xor.%s<FMTSEL> v<VD>, v<VS>, v<VT>"
|
||||
*mdmx:
|
||||
{
|
||||
check_mdmx (SD_, instruction_0);
|
||||
if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
|
||||
StoreFPR(VD,fmt_mdmx,MX_Xor(ValueFPR(VS,fmt_mdmx),VT,FMTSEL));
|
||||
}
|
@ -61,7 +61,9 @@
|
||||
// MIPS Application Specific Extensions (ASEs)
|
||||
//
|
||||
// Instructions for the ASEs are in separate .igen files.
|
||||
// ASEs add instructions on to a base ISA.
|
||||
:model:::mips16:mips16: // m16.igen (and m16.dc)
|
||||
:model:::mdmx:mdmx: // mdmx.igen
|
||||
|
||||
|
||||
// Pseudo instructions known by IGEN
|
||||
@ -5054,6 +5056,7 @@
|
||||
|
||||
|
||||
:include:::m16.igen
|
||||
:include:::mdmx.igen
|
||||
:include:::tx.igen
|
||||
:include:::vr.igen
|
||||
|
||||
|
@ -296,6 +296,24 @@ enum float_operation
|
||||
};
|
||||
|
||||
|
||||
/* The internal representation of an MDMX accumulator.
|
||||
Note that 24 and 48 bit accumulator elements are represented in
|
||||
32 or 64 bits. Since the accumulators are 2's complement with
|
||||
overflow suppressed, high-order bits can be ignored in most contexts. */
|
||||
|
||||
typedef signed32 signed24;
|
||||
typedef signed64 signed48;
|
||||
|
||||
typedef union {
|
||||
signed24 ob[8];
|
||||
signed48 qh[4];
|
||||
} MDMX_accumulator;
|
||||
|
||||
|
||||
/* Conventional system arguments. */
|
||||
#define SIM_STATE sim_cpu *cpu, address_word cia
|
||||
#define SIM_ARGS CPU, cia
|
||||
|
||||
struct _sim_cpu {
|
||||
|
||||
|
||||
@ -439,6 +457,10 @@ struct _sim_cpu {
|
||||
|
||||
pending_write_queue pending;
|
||||
|
||||
/* The MDMX accumulator (used only for MDMX ASE). */
|
||||
MDMX_accumulator acc;
|
||||
#define ACC ((CPU)->acc)
|
||||
|
||||
/* LLBIT = Load-Linked bit. A bit of "virtual" state used by atomic
|
||||
read-write instructions. It is set when a linked load occurs. It
|
||||
is tested and cleared by the conditional store. It is cleared
|
||||
@ -707,6 +729,107 @@ decode_coproc (SD, CPU, cia, (instruction))
|
||||
int sim_monitor (SIM_DESC sd, sim_cpu *cpu, address_word cia, unsigned int arg);
|
||||
|
||||
|
||||
/* MDMX access. */
|
||||
|
||||
typedef unsigned int MX_fmtsel; /* MDMX format select field (5 bits). */
|
||||
#define ob_fmtsel(sel) (((sel)<<1)|0x0)
|
||||
#define qh_fmtsel(sel) (((sel)<<2)|0x1)
|
||||
|
||||
#define fmt_mdmx fmt_uninterpreted
|
||||
|
||||
#define MX_VECT_AND (0)
|
||||
#define MX_VECT_NOR (1)
|
||||
#define MX_VECT_OR (2)
|
||||
#define MX_VECT_XOR (3)
|
||||
#define MX_VECT_SLL (4)
|
||||
#define MX_VECT_SRL (5)
|
||||
|
||||
#define MX_VECT_ADD (6)
|
||||
#define MX_VECT_SUB (7)
|
||||
#define MX_VECT_MIN (8)
|
||||
#define MX_VECT_MAX (9)
|
||||
#define MX_VECT_MUL (10)
|
||||
#define MX_VECT_MSGN (11)
|
||||
#define MX_VECT_SRA (12)
|
||||
|
||||
unsigned64 mdmx_cpr_op (SIM_STATE, int op, unsigned64 op1, int vt, MX_fmtsel fmtsel);
|
||||
#define MX_Add(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_ADD, op1, vt, fmtsel)
|
||||
#define MX_And(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_AND, op1, vt, fmtsel)
|
||||
#define MX_Max(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_MAX, op1, vt, fmtsel)
|
||||
#define MX_Min(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_MIN, op1, vt, fmtsel)
|
||||
#define MX_Msgn(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_MSGN, op1, vt, fmtsel)
|
||||
#define MX_Mul(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_MUL, op1, vt, fmtsel)
|
||||
#define MX_Nor(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_NOR, op1, vt, fmtsel)
|
||||
#define MX_Or(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_OR, op1, vt, fmtsel)
|
||||
#define MX_ShiftLeftLogical(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_SLL, op1, vt, fmtsel)
|
||||
#define MX_ShiftRightArith(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_SRA, op1, vt, fmtsel)
|
||||
#define MX_ShiftRightLogical(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_SRL, op1, vt, fmtsel)
|
||||
#define MX_Sub(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_SUB, op1, vt, fmtsel)
|
||||
#define MX_Xor(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_XOR, op1, vt, fmtsel)
|
||||
|
||||
#define MX_C_EQ 0x1
|
||||
#define MX_C_LT 0x4
|
||||
|
||||
void mdmx_cc_op (SIM_STATE, int cond, unsigned64 op1, int vt, MX_fmtsel fmtsel);
|
||||
#define MX_Comp(op1,cond,vt,fmtsel) mdmx_cc_op(SIM_ARGS, cond, op1, vt, fmtsel)
|
||||
|
||||
unsigned64 mdmx_pick_op (SIM_STATE, int tf, unsigned64 op1, int vt, MX_fmtsel fmtsel);
|
||||
#define MX_Pick(tf,op1,vt,fmtsel) mdmx_pick_op(SIM_ARGS, tf, op1, vt, fmtsel)
|
||||
|
||||
#define MX_VECT_ADDA (0)
|
||||
#define MX_VECT_ADDL (1)
|
||||
#define MX_VECT_MULA (2)
|
||||
#define MX_VECT_MULL (3)
|
||||
#define MX_VECT_MULS (4)
|
||||
#define MX_VECT_MULSL (5)
|
||||
#define MX_VECT_SUBA (6)
|
||||
#define MX_VECT_SUBL (7)
|
||||
|
||||
void mdmx_acc_op (SIM_STATE, int op, unsigned64 op1, int vt, MX_fmtsel fmtsel);
|
||||
#define MX_AddA(op1,vt,fmtsel) mdmx_acc_op(SIM_ARGS, MX_VECT_ADDA, op1, vt, fmtsel)
|
||||
#define MX_AddL(op1,vt,fmtsel) mdmx_acc_op(SIM_ARGS, MX_VECT_ADDL, op1, vt, fmtsel)
|
||||
#define MX_MulA(op1,vt,fmtsel) mdmx_acc_op(SIM_ARGS, MX_VECT_MULA, op1, vt, fmtsel)
|
||||
#define MX_MulL(op1,vt,fmtsel) mdmx_acc_op(SIM_ARGS, MX_VECT_MULL, op1, vt, fmtsel)
|
||||
#define MX_MulS(op1,vt,fmtsel) mdmx_acc_op(SIM_ARGS, MX_VECT_MULS, op1, vt, fmtsel)
|
||||
#define MX_MulSL(op1,vt,fmtsel) mdmx_acc_op(SIM_ARGS, MX_VECT_MULSL, op1, vt, fmtsel)
|
||||
#define MX_SubA(op1,vt,fmtsel) mdmx_acc_op(SIM_ARGS, MX_VECT_SUBA, op1, vt, fmtsel)
|
||||
#define MX_SubL(op1,vt,fmtsel) mdmx_acc_op(SIM_ARGS, MX_VECT_SUBL, op1, vt, fmtsel)
|
||||
|
||||
#define MX_FMT_OB (0)
|
||||
#define MX_FMT_QH (1)
|
||||
|
||||
/* The following codes chosen to indicate the units of shift. */
|
||||
#define MX_RAC_L (0)
|
||||
#define MX_RAC_M (1)
|
||||
#define MX_RAC_H (2)
|
||||
|
||||
unsigned64 mdmx_rac_op (SIM_STATE, int, int);
|
||||
#define MX_RAC(op,fmt) mdmx_rac_op(SIM_ARGS, op, fmt)
|
||||
|
||||
void mdmx_wacl (SIM_STATE, int, unsigned64, unsigned64);
|
||||
#define MX_WACL(fmt,vs,vt) mdmx_wacl(SIM_ARGS, fmt, vs, vt)
|
||||
void mdmx_wach (SIM_STATE, int, unsigned64);
|
||||
#define MX_WACH(fmt,vs) mdmx_wach(SIM_ARGS, fmt, vs)
|
||||
|
||||
#define MX_RND_AS (0)
|
||||
#define MX_RND_AU (1)
|
||||
#define MX_RND_ES (2)
|
||||
#define MX_RND_EU (3)
|
||||
#define MX_RND_ZS (4)
|
||||
#define MX_RND_ZU (5)
|
||||
|
||||
unsigned64 mdmx_round_op (SIM_STATE, int, int, MX_fmtsel);
|
||||
#define MX_RNAS(vt,fmt) mdmx_round_op(SIM_ARGS, MX_RND_AS, vt, fmt)
|
||||
#define MX_RNAU(vt,fmt) mdmx_round_op(SIM_ARGS, MX_RND_AU, vt, fmt)
|
||||
#define MX_RNES(vt,fmt) mdmx_round_op(SIM_ARGS, MX_RND_ES, vt, fmt)
|
||||
#define MX_RNEU(vt,fmt) mdmx_round_op(SIM_ARGS, MX_RND_EU, vt, fmt)
|
||||
#define MX_RZS(vt,fmt) mdmx_round_op(SIM_ARGS, MX_RND_ZS, vt, fmt)
|
||||
#define MX_RZU(vt,fmt) mdmx_round_op(SIM_ARGS, MX_RND_ZU, vt, fmt)
|
||||
|
||||
unsigned64 mdmx_shuffle (SIM_STATE, int, unsigned64, unsigned64);
|
||||
#define MX_SHFL(shop,op1,op2) mdmx_shuffle(SIM_ARGS, shop, op1, op2)
|
||||
|
||||
|
||||
|
||||
/* Memory accesses */
|
||||
|
||||
@ -774,6 +897,7 @@ prefetch (SD, CPU, cia, CCA, pAddr, vAddr, DATA, hint)
|
||||
void unpredictable_action (sim_cpu *cpu, address_word cia);
|
||||
#define NotWordValue(val) not_word_value (SD_, (val))
|
||||
#define Unpredictable() unpredictable (SD_)
|
||||
#define UnpredictableResult() /* For now, do nothing. */
|
||||
|
||||
INLINE_SIM_MAIN (unsigned32) ifetch32 PARAMS ((SIM_DESC sd, sim_cpu *cpu, address_word cia, address_word vaddr));
|
||||
#define IMEM32(CIA) ifetch32 (SD, CPU, (CIA), (CIA))
|
||||
|
Loading…
Reference in New Issue
Block a user