1 |
2 |
dimamali |
------------------------------------------------------------------------------
|
2 |
|
|
-- This file is a part of the GRLIB VHDL IP LIBRARY
|
3 |
|
|
-- Copyright (C) 2003, Gaisler Research
|
4 |
|
|
--
|
5 |
|
|
-- This program is free software; you can redistribute it and/or modify
|
6 |
|
|
-- it under the terms of the GNU General Public License as published by
|
7 |
|
|
-- the Free Software Foundation; either version 2 of the License, or
|
8 |
|
|
-- (at your option) any later version.
|
9 |
|
|
--
|
10 |
|
|
-- This program is distributed in the hope that it will be useful,
|
11 |
|
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
|
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
|
|
-- GNU General Public License for more details.
|
14 |
|
|
--
|
15 |
|
|
-- You should have received a copy of the GNU General Public License
|
16 |
|
|
-- along with this program; if not, write to the Free Software
|
17 |
|
|
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
18 |
|
|
-----------------------------------------------------------------------------
|
19 |
|
|
-- package: opcodes
|
20 |
|
|
-- File: opcodes.vhd
|
21 |
|
|
-- Author: Jiri Gaisler
|
22 |
|
|
-- Description: Instruction definitions according to the SPARC V8 manual.
|
23 |
|
|
------------------------------------------------------------------------------
|
24 |
|
|
|
25 |
|
|
library ieee;
|
26 |
|
|
use ieee.std_logic_1164.all;
|
27 |
|
|
|
28 |
|
|
package sparc is
|
29 |
|
|
|
30 |
|
|
-- op decoding (inst(31 downto 30))
|
31 |
|
|
|
32 |
|
|
subtype op_type is std_logic_vector(1 downto 0);
|
33 |
|
|
|
34 |
|
|
constant FMT2 : op_type := "00";
|
35 |
|
|
constant CALL : op_type := "01";
|
36 |
|
|
constant FMT3 : op_type := "10";
|
37 |
|
|
constant LDST : op_type := "11";
|
38 |
|
|
|
39 |
|
|
-- op2 decoding (inst(24 downto 22))
|
40 |
|
|
|
41 |
|
|
subtype op2_type is std_logic_vector(2 downto 0);
|
42 |
|
|
|
43 |
|
|
constant UNIMP : op2_type := "000";
|
44 |
|
|
constant BICC : op2_type := "010";
|
45 |
|
|
constant SETHI : op2_type := "100";
|
46 |
|
|
constant FBFCC : op2_type := "110";
|
47 |
|
|
constant CBCCC : op2_type := "111";
|
48 |
|
|
|
49 |
|
|
-- op3 decoding (inst(24 downto 19))
|
50 |
|
|
|
51 |
|
|
subtype op3_type is std_logic_vector(5 downto 0);
|
52 |
|
|
|
53 |
|
|
constant IADD : op3_type := "000000";
|
54 |
|
|
constant IAND : op3_type := "000001";
|
55 |
|
|
constant IOR : op3_type := "000010";
|
56 |
|
|
constant IXOR : op3_type := "000011";
|
57 |
|
|
constant ISUB : op3_type := "000100";
|
58 |
|
|
constant ANDN : op3_type := "000101";
|
59 |
|
|
constant ORN : op3_type := "000110";
|
60 |
|
|
constant IXNOR : op3_type := "000111";
|
61 |
|
|
constant ADDX : op3_type := "001000";
|
62 |
|
|
constant UMUL : op3_type := "001010";
|
63 |
|
|
constant SMUL : op3_type := "001011";
|
64 |
|
|
constant SUBX : op3_type := "001100";
|
65 |
|
|
constant UDIV : op3_type := "001110";
|
66 |
|
|
constant SDIV : op3_type := "001111";
|
67 |
|
|
constant ADDCC : op3_type := "010000";
|
68 |
|
|
constant ANDCC : op3_type := "010001";
|
69 |
|
|
constant ORCC : op3_type := "010010";
|
70 |
|
|
constant XORCC : op3_type := "010011";
|
71 |
|
|
constant SUBCC : op3_type := "010100";
|
72 |
|
|
constant ANDNCC : op3_type := "010101";
|
73 |
|
|
constant ORNCC : op3_type := "010110";
|
74 |
|
|
constant XNORCC : op3_type := "010111";
|
75 |
|
|
constant ADDXCC : op3_type := "011000";
|
76 |
|
|
constant UMULCC : op3_type := "011010";
|
77 |
|
|
constant SMULCC : op3_type := "011011";
|
78 |
|
|
constant SUBXCC : op3_type := "011100";
|
79 |
|
|
constant UDIVCC : op3_type := "011110";
|
80 |
|
|
constant SDIVCC : op3_type := "011111";
|
81 |
|
|
constant TADDCC : op3_type := "100000";
|
82 |
|
|
constant TSUBCC : op3_type := "100001";
|
83 |
|
|
constant TADDCCTV : op3_type := "100010";
|
84 |
|
|
constant TSUBCCTV : op3_type := "100011";
|
85 |
|
|
constant MULSCC : op3_type := "100100";
|
86 |
|
|
constant ISLL : op3_type := "100101";
|
87 |
|
|
constant ISRL : op3_type := "100110";
|
88 |
|
|
constant ISRA : op3_type := "100111";
|
89 |
|
|
constant RDY : op3_type := "101000";
|
90 |
|
|
constant RDPSR : op3_type := "101001";
|
91 |
|
|
constant RDWIM : op3_type := "101010";
|
92 |
|
|
constant RDTBR : op3_type := "101011";
|
93 |
|
|
constant WRY : op3_type := "110000";
|
94 |
|
|
constant WRPSR : op3_type := "110001";
|
95 |
|
|
constant WRWIM : op3_type := "110010";
|
96 |
|
|
constant WRTBR : op3_type := "110011";
|
97 |
|
|
constant FPOP1 : op3_type := "110100";
|
98 |
|
|
constant FPOP2 : op3_type := "110101";
|
99 |
|
|
constant CPOP1 : op3_type := "110110";
|
100 |
|
|
constant CPOP2 : op3_type := "110111";
|
101 |
|
|
constant JMPL : op3_type := "111000";
|
102 |
|
|
constant TICC : op3_type := "111010";
|
103 |
|
|
constant FLUSH : op3_type := "111011";
|
104 |
|
|
constant RETT : op3_type := "111001";
|
105 |
|
|
constant SAVE : op3_type := "111100";
|
106 |
|
|
constant RESTORE : op3_type := "111101";
|
107 |
|
|
constant UMAC : op3_type := "111110";
|
108 |
|
|
constant SMAC : op3_type := "111111";
|
109 |
|
|
|
110 |
|
|
constant LD : op3_type := "000000";
|
111 |
|
|
constant LDUB : op3_type := "000001";
|
112 |
|
|
constant LDUH : op3_type := "000010";
|
113 |
|
|
constant LDD : op3_type := "000011";
|
114 |
|
|
constant LDSB : op3_type := "001001";
|
115 |
|
|
constant LDSH : op3_type := "001010";
|
116 |
|
|
constant LDSTUB : op3_type := "001101";
|
117 |
|
|
constant SWAP : op3_type := "001111";
|
118 |
|
|
constant LDA : op3_type := "010000";
|
119 |
|
|
constant LDUBA : op3_type := "010001";
|
120 |
|
|
constant LDUHA : op3_type := "010010";
|
121 |
|
|
constant LDDA : op3_type := "010011";
|
122 |
|
|
constant LDSBA : op3_type := "011001";
|
123 |
|
|
constant LDSHA : op3_type := "011010";
|
124 |
|
|
constant LDSTUBA : op3_type := "011101";
|
125 |
|
|
constant SWAPA : op3_type := "011111";
|
126 |
|
|
constant LDF : op3_type := "100000";
|
127 |
|
|
constant LDFSR : op3_type := "100001";
|
128 |
|
|
constant LDDF : op3_type := "100011";
|
129 |
|
|
constant LDC : op3_type := "110000";
|
130 |
|
|
constant LDCSR : op3_type := "110001";
|
131 |
|
|
constant LDDC : op3_type := "110011";
|
132 |
|
|
constant ST : op3_type := "000100";
|
133 |
|
|
constant STB : op3_type := "000101";
|
134 |
|
|
constant STH : op3_type := "000110";
|
135 |
|
|
constant ISTD : op3_type := "000111";
|
136 |
|
|
constant STA : op3_type := "010100";
|
137 |
|
|
constant STBA : op3_type := "010101";
|
138 |
|
|
constant STHA : op3_type := "010110";
|
139 |
|
|
constant STDA : op3_type := "010111";
|
140 |
|
|
constant STF : op3_type := "100100";
|
141 |
|
|
constant STFSR : op3_type := "100101";
|
142 |
|
|
constant STDFQ : op3_type := "100110";
|
143 |
|
|
constant STDF : op3_type := "100111";
|
144 |
|
|
constant STC : op3_type := "110100";
|
145 |
|
|
constant STCSR : op3_type := "110101";
|
146 |
|
|
constant STDCQ : op3_type := "110110";
|
147 |
|
|
constant STDC : op3_type := "110111";
|
148 |
|
|
|
149 |
|
|
-- bicc decoding (inst(27 downto 25))
|
150 |
|
|
|
151 |
|
|
constant BA : std_logic_vector(3 downto 0) := "1000";
|
152 |
|
|
|
153 |
|
|
-- fpop1 decoding
|
154 |
|
|
|
155 |
|
|
subtype fpop_type is std_logic_vector(8 downto 0);
|
156 |
|
|
|
157 |
|
|
constant FITOS : fpop_type := "011000100";
|
158 |
|
|
constant FITOD : fpop_type := "011001000";
|
159 |
|
|
constant FSTOI : fpop_type := "011010001";
|
160 |
|
|
constant FDTOI : fpop_type := "011010010";
|
161 |
|
|
constant FSTOD : fpop_type := "011001001";
|
162 |
|
|
constant FDTOS : fpop_type := "011000110";
|
163 |
|
|
constant FMOVS : fpop_type := "000000001";
|
164 |
|
|
constant FNEGS : fpop_type := "000000101";
|
165 |
|
|
constant FABSS : fpop_type := "000001001";
|
166 |
|
|
constant FSQRTS : fpop_type := "000101001";
|
167 |
|
|
constant FSQRTD : fpop_type := "000101010";
|
168 |
|
|
constant FADDS : fpop_type := "001000001";
|
169 |
|
|
constant FADDD : fpop_type := "001000010";
|
170 |
|
|
constant FSUBS : fpop_type := "001000101";
|
171 |
|
|
constant FSUBD : fpop_type := "001000110";
|
172 |
|
|
constant FMULS : fpop_type := "001001001";
|
173 |
|
|
constant FMULD : fpop_type := "001001010";
|
174 |
|
|
constant FSMULD : fpop_type := "001101001";
|
175 |
|
|
constant FDIVS : fpop_type := "001001101";
|
176 |
|
|
constant FDIVD : fpop_type := "001001110";
|
177 |
|
|
|
178 |
|
|
-- fpop2 decoding
|
179 |
|
|
|
180 |
|
|
constant FCMPS : fpop_type := "001010001";
|
181 |
|
|
constant FCMPD : fpop_type := "001010010";
|
182 |
|
|
constant FCMPES : fpop_type := "001010101";
|
183 |
|
|
constant FCMPED : fpop_type := "001010110";
|
184 |
|
|
|
185 |
|
|
-- trap type decoding
|
186 |
|
|
|
187 |
|
|
subtype trap_type is std_logic_vector(5 downto 0);
|
188 |
|
|
|
189 |
|
|
constant TT_IAEX : trap_type := "000001";
|
190 |
|
|
constant TT_IINST : trap_type := "000010";
|
191 |
|
|
constant TT_PRIV : trap_type := "000011";
|
192 |
|
|
constant TT_FPDIS : trap_type := "000100";
|
193 |
|
|
constant TT_WINOF : trap_type := "000101";
|
194 |
|
|
constant TT_WINUF : trap_type := "000110";
|
195 |
|
|
constant TT_UNALA : trap_type := "000111";
|
196 |
|
|
constant TT_FPEXC : trap_type := "001000";
|
197 |
|
|
constant TT_DAEX : trap_type := "001001";
|
198 |
|
|
constant TT_TAG : trap_type := "001010";
|
199 |
|
|
constant TT_WATCH : trap_type := "001011";
|
200 |
|
|
|
201 |
|
|
constant TT_DSU : trap_type := "010000";
|
202 |
|
|
constant TT_PWD : trap_type := "010001";
|
203 |
|
|
|
204 |
|
|
constant TT_RFERR : trap_type := "100000";
|
205 |
|
|
constant TT_IAERR : trap_type := "100001";
|
206 |
|
|
constant TT_CPDIS : trap_type := "100100";
|
207 |
|
|
constant TT_CPEXC : trap_type := "101000";
|
208 |
|
|
constant TT_DIV : trap_type := "101010";
|
209 |
|
|
constant TT_DSEX : trap_type := "101011";
|
210 |
|
|
constant TT_TICC : trap_type := "111111";
|
211 |
|
|
|
212 |
|
|
-- Alternate address space identifiers (only 5 lsb bist are used)
|
213 |
|
|
|
214 |
|
|
subtype asi_type is std_logic_vector(4 downto 0);
|
215 |
|
|
|
216 |
|
|
constant ASI_SYSR : asi_type := "00010"; -- 0x02
|
217 |
|
|
constant ASI_UINST : asi_type := "01000"; -- 0x08
|
218 |
|
|
constant ASI_SINST : asi_type := "01001"; -- 0x09
|
219 |
|
|
constant ASI_UDATA : asi_type := "01010"; -- 0x0A
|
220 |
|
|
constant ASI_SDATA : asi_type := "01011"; -- 0x0B
|
221 |
|
|
constant ASI_ITAG : asi_type := "01100"; -- 0x0C
|
222 |
|
|
constant ASI_IDATA : asi_type := "01101"; -- 0x0D
|
223 |
|
|
constant ASI_DTAG : asi_type := "01110"; -- 0x0E
|
224 |
|
|
constant ASI_DDATA : asi_type := "01111"; -- 0x0F
|
225 |
|
|
constant ASI_IFLUSH : asi_type := "10000"; -- 0x10
|
226 |
|
|
constant ASI_DFLUSH : asi_type := "10001"; -- 0x11
|
227 |
|
|
|
228 |
|
|
constant ASI_FLUSH_PAGE : std_logic_vector(4 downto 0) := "10000"; -- 0x10 i/dcache flush page
|
229 |
|
|
constant ASI_FLUSH_CTX : std_logic_vector(4 downto 0) := "10011"; -- 0x13 i/dcache flush ctx
|
230 |
|
|
|
231 |
|
|
constant ASI_DCTX : std_logic_vector(4 downto 0) := "10100"; -- 0x14 dcache ctx
|
232 |
|
|
constant ASI_ICTX : std_logic_vector(4 downto 0) := "10101"; -- 0x15 icache ctx
|
233 |
|
|
|
234 |
|
|
constant ASI_MMUFLUSHPROBE : std_logic_vector(4 downto 0) := "11000"; -- 0x18 i/dtlb flush/(probe)
|
235 |
|
|
constant ASI_MMUREGS : std_logic_vector(4 downto 0) := "11001"; -- 0x19 mmu regs access
|
236 |
|
|
constant ASI_MMU_BP : std_logic_vector(4 downto 0) := "11100"; -- 0x1c mmu Bypass
|
237 |
|
|
constant ASI_MMU_DIAG : std_logic_vector(4 downto 0) := "11101"; -- 0x1d mmu diagnostic
|
238 |
|
|
--constant ASI_MMU_DSU : std_logic_vector(4 downto 0) := "11111"; -- 0x1f mmu diagnostic
|
239 |
|
|
|
240 |
|
|
constant ASI_MMUSNOOP_DTAG : std_logic_vector(4 downto 0) := "11110"; -- 0x1e mmusnoop physical dtag
|
241 |
|
|
|
242 |
|
|
-- ftt decoding
|
243 |
|
|
|
244 |
|
|
subtype ftt_type is std_logic_vector(2 downto 0);
|
245 |
|
|
|
246 |
|
|
constant FPIEEE_ERR : ftt_type := "001";
|
247 |
|
|
constant FPSEQ_ERR : ftt_type := "100";
|
248 |
|
|
constant FPHW_ERR : ftt_type := "101";
|
249 |
|
|
|
250 |
|
|
end;
|
251 |
|
|
|
252 |
|
|
|
253 |
|
|
|