* configure.ac (mipsisa32r2*-*-*, mipsisa32*-*-*): Add smartmips to
[deliverable/binutils-gdb.git] / sim / mips / smartmips.igen
1 // -*- C -*-
2 //
3 // Simulator definition for the SmartMIPS extensions.
4 // Copyright (C) 2005 Free Software Foundation, Inc.
5 // Contributed by Nigel Stephens (nigel@mips.com) and
6 // David Ung (davidu@mips.com) of MIPS Technologies.
7 //
8 // This file is part of GDB, the GNU debugger.
9 //
10 // This program is free software; you can redistribute it and/or modify
11 // it under the terms of the GNU General Public License as published by
12 // the Free Software Foundation; either version 2, or (at your option)
13 // any later version.
14 //
15 // This program is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License along
21 // with this program; if not, write to the Free Software Foundation, Inc.,
22 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23
24 011100,5.BASE,5.INDEX,5.RD,00010,001000:SPECIAL:32::LWXS
25 "lwxs r<RD>, <INDEX>(r<BASE>)"
26 *smartmips:
27 {
28 GPR[RD] = EXTEND32 (do_load(SD_, AccessLength_WORD, GPR[BASE], GPR[INDEX]<<2));
29 }
30
31 011100,5.RS,5.RT,00000,10001,000001:SPECIAL:32::MADDP
32 "maddp r<RS>, r<RT>"
33 *smartmips:
34 {
35 unsigned64 res;
36 unsigned64 rs, rt;
37 int i;
38
39 check_mult_hilo (SD_, HIHISTORY, LOHISTORY);
40 TRACE_ALU_INPUT2 (GPR[RS], GPR[RT]);
41
42 res = 0;
43 rs = GPR[RS];
44 rt = GPR[RT];
45 for (i = 0; i < 32; i++)
46 {
47 if (rs & 1)
48 res ^= rt;
49 rs >>= 1;
50 rt <<= 1;
51 }
52 LO ^= EXTEND32 (VL4_8 (res));
53 HI ^= EXTEND32 (VH4_8 (res));
54 TRACE_ALU_RESULT2 (HI, LO);
55 }
56
57
58 000000,0000000000,5.RD,00001,010010:SPECIAL:32::MFLHXU
59 "mflhxu r<RD>"
60 *smartmips:
61 {
62 check_mf_hilo (SD_, HIHISTORY, LOHISTORY);
63 TRACE_ALU_INPUT3 (ACX,HI,LO);
64 GPR[RD] = LO;
65 LO = HI;
66 HI = ACX;
67 ACX = 0;
68 TRACE_ALU_RESULT4 (ACX,HI,LO,GPR[RD]);
69 }
70
71 000000,5.RS,000000000000001,010011:SPECIAL:32::MTLHX
72 "mtlhx r<RS>"
73 *smartmips:
74 {
75 check_mf_hilo (SD_, HIHISTORY, LOHISTORY);
76 TRACE_ALU_INPUT3 (HI,LO,GPR[RS]);
77 ACX = HI;
78 HI = LO;
79 LO = GPR[RS];
80 TRACE_ALU_RESULT4 (ACX,HI,LO,GPR[RS]);
81 }
82
83 000000,5.RS,5.RT,00000,10001,011001:SPECIAL:32::MULTP
84 "multp r<RS>, r<RT>"
85 *smartmips:
86 {
87 unsigned64 res;
88 unsigned64 rs, rt;
89 int i;
90 check_mult_hilo (SD_, HIHISTORY, LOHISTORY);
91 TRACE_ALU_INPUT2 (GPR[RS], GPR[RT]);
92
93 res = 0;
94 rs = GPR[RS];
95 rt = GPR[RT];
96 for (i = 0; i < 32; i++)
97 {
98 if (rs & 1)
99 res ^= rt;
100 rs >>= 1;
101 rt <<= 1;
102 }
103 LO = EXTEND32 (VL4_8 (res));
104 HI = EXTEND32 (VH4_8 (res));
105 ACX = 0;
106 TRACE_ALU_RESULT2 (HI, LO);
107 }
108
109 011100,5.RS,5.RT,00000,10010,000001:SPECIAL:32::PPERM
110 "pperm r<RS>, r<RT>"
111 *smartmips:
112 {
113 int i;
114 ACX = (ACX << 6) | MSEXTRACTED(HI,26,31);
115 HI = EXTEND32 ((HI << 6) | MSEXTRACTED(LO,26,31));
116 LO = EXTEND32 (LO << 6);
117 for (i = 0; i < 6; i++) {
118 int sbit = 5*i;
119 int ebit = sbit + 4;
120 int tbit = EXTRACTED(GPR[RT],sbit,ebit);
121 LO |= MSEXTRACTED(GPR[RS],tbit,tbit) << i;
122 }
123 }
This page took 0.034914 seconds and 5 git commands to generate.