1 |
2 |
wfjm |
-- $Id: pdp11_decode.vhd 314 2010-07-09 17:38:41Z mueller $
|
2 |
|
|
--
|
3 |
|
|
-- Copyright 2006-2008 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
4 |
|
|
--
|
5 |
|
|
-- This program is free software; you may redistribute and/or modify it under
|
6 |
|
|
-- the terms of the GNU General Public License as published by the Free
|
7 |
|
|
-- Software Foundation, either version 2, or at your option any later version.
|
8 |
|
|
--
|
9 |
|
|
-- This program is distributed in the hope that it will be useful, but
|
10 |
|
|
-- WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
|
11 |
|
|
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
12 |
|
|
-- for complete details.
|
13 |
|
|
--
|
14 |
|
|
------------------------------------------------------------------------------
|
15 |
|
|
-- Module Name: pdp11_decode - syn
|
16 |
|
|
-- Description: pdp11: instruction decoder
|
17 |
|
|
--
|
18 |
|
|
-- Dependencies: -
|
19 |
|
|
-- Test bench: tb/tb_pdp11_core (implicit)
|
20 |
|
|
-- Target Devices: generic
|
21 |
|
|
-- Tool versions: xst 8.1, 8.2, 9.1, 9.2; ghdl 0.18-0.25
|
22 |
|
|
-- Revision History:
|
23 |
|
|
-- Date Rev Version Comment
|
24 |
|
|
-- 2008-11-30 174 1.0.4 BUGFIX: add updt_dstadsrc; set for MFP(I/D)
|
25 |
|
|
-- 2008-05-03 143 1.0.3 get fork_srcr,fork_dstr,fork_dsta assign out of if
|
26 |
|
|
-- 2008-04-27 139 1.0.2 BUGFIX: mtp now via do_fork_op; is_dsta logic mods
|
27 |
|
|
-- 2007-06-14 56 1.0.1 Use slvtypes.all
|
28 |
|
|
-- 2007-05-12 26 1.0 Initial version
|
29 |
|
|
------------------------------------------------------------------------------
|
30 |
|
|
|
31 |
|
|
library ieee;
|
32 |
|
|
use ieee.std_logic_1164.all;
|
33 |
|
|
use ieee.std_logic_arith.all;
|
34 |
|
|
|
35 |
|
|
use work.slvtypes.all;
|
36 |
|
|
use work.pdp11.all;
|
37 |
|
|
|
38 |
|
|
-- ----------------------------------------------------------------------------
|
39 |
|
|
|
40 |
|
|
entity pdp11_decode is -- instruction decoder
|
41 |
|
|
port (
|
42 |
|
|
IREG : in slv16; -- input instruction word
|
43 |
|
|
STAT : out decode_stat_type -- status output
|
44 |
|
|
);
|
45 |
|
|
end pdp11_decode;
|
46 |
|
|
|
47 |
|
|
architecture syn of pdp11_decode is
|
48 |
|
|
|
49 |
|
|
begin
|
50 |
|
|
|
51 |
|
|
proc_idecode: process (IREG)
|
52 |
|
|
|
53 |
|
|
alias OPCODE : slv4 is IREG(15 downto 12); -- basic opcode (upper 4 bits)
|
54 |
|
|
alias OPPRIM : slv3 is IREG(14 downto 12); -- basic opcode without B bit
|
55 |
|
|
alias OPBYTE : slbit is IREG(15); -- byte flag of basic opcode
|
56 |
|
|
alias OPEXT1 : slv3 is IREG(11 downto 9); -- extended opcode, part 1
|
57 |
|
|
alias OPEXT2 : slv3 is IREG(8 downto 6); -- extended opcode, part 2
|
58 |
|
|
alias OPEXT3 : slv3 is IREG(5 downto 3); -- extended opcode, part 3
|
59 |
|
|
alias OPEXT4 : slv3 is IREG(2 downto 0); -- extended opcode, part 4
|
60 |
|
|
|
61 |
|
|
alias SRCMODF : slv3 is IREG(11 downto 9); -- src register full mode
|
62 |
|
|
alias DSTMODF : slv3 is IREG(5 downto 3); -- dst register full mode
|
63 |
|
|
|
64 |
|
|
alias SRCMOD : slv2 is IREG(11 downto 10); -- src register mode high
|
65 |
|
|
alias SRCDEF : slbit is IREG(9); -- src register mode defered
|
66 |
|
|
alias SRCREG : slv3 is IREG(8 downto 6); -- src register number
|
67 |
|
|
alias DSTMOD : slv2 is IREG(5 downto 4); -- dst register mode high
|
68 |
|
|
alias DSTDEF : slbit is IREG(3); -- dst register mode defered
|
69 |
|
|
alias DSTREG : slv3 is IREG(2 downto 0); -- dst register number
|
70 |
|
|
|
71 |
|
|
variable nstat : decode_stat_type;
|
72 |
|
|
|
73 |
|
|
variable is_srcr : slbit := '0'; -- source is read
|
74 |
|
|
variable is_dstr : slbit := '0'; -- destination is read
|
75 |
|
|
variable is_dstm : slbit := '0'; -- destination is modified
|
76 |
|
|
variable is_dstw : slbit := '0'; -- destination is written
|
77 |
|
|
|
78 |
|
|
variable is_srcmode0 : slbit := '0'; -- source is register mode
|
79 |
|
|
variable is_dstmode0notpc : slbit := '0'; -- dest. is register mode, not PC
|
80 |
|
|
|
81 |
|
|
begin
|
82 |
|
|
|
83 |
|
|
is_srcr := '0';
|
84 |
|
|
is_dstr := '0';
|
85 |
|
|
is_dstm := '0';
|
86 |
|
|
is_dstw := '0';
|
87 |
|
|
|
88 |
|
|
is_srcmode0 := '0';
|
89 |
|
|
is_dstmode0notpc := '0';
|
90 |
|
|
|
91 |
|
|
nstat.is_dstmode0 := '0';
|
92 |
|
|
nstat.is_srcpc := '0';
|
93 |
|
|
nstat.is_srcpcmode1 := '0';
|
94 |
|
|
nstat.is_dstpc := '0';
|
95 |
|
|
nstat.is_dstw_reg := '0';
|
96 |
|
|
nstat.is_dstw_pc := '0';
|
97 |
|
|
nstat.is_rmwop := '0';
|
98 |
|
|
nstat.is_bytop := '0';
|
99 |
|
|
nstat.is_res := '1';
|
100 |
|
|
nstat.op_rtt := '0';
|
101 |
|
|
nstat.op_mov := '0';
|
102 |
|
|
nstat.trap_vec := "000";
|
103 |
|
|
nstat.force_srcsp := '0';
|
104 |
|
|
nstat.updt_dstadsrc := '0';
|
105 |
|
|
|
106 |
|
|
nstat.dbox_srcmod := c_dbox_mod_pass;
|
107 |
|
|
nstat.dbox_dstmod := c_dbox_mod_pass;
|
108 |
|
|
nstat.dbox_cimod := c_dbox_mod_pass;
|
109 |
|
|
nstat.dbox_cc1op := '0';
|
110 |
|
|
nstat.dbox_ccmode := IREG(8 downto 6); -- STATIC
|
111 |
|
|
nstat.lbox_func := (others=>'0');
|
112 |
|
|
nstat.mbox_func := (others=>'0');
|
113 |
|
|
nstat.res_sel := c_dpath_res_abox;
|
114 |
|
|
|
115 |
|
|
nstat.fork_op := (others=>'0');
|
116 |
|
|
nstat.fork_srcr := (others=>'0');
|
117 |
|
|
nstat.fork_dstr := (others=>'0');
|
118 |
|
|
nstat.fork_dsta := (others=>'0');
|
119 |
|
|
nstat.fork_opg := (others=>'0');
|
120 |
|
|
nstat.fork_opa := (others=>'0');
|
121 |
|
|
|
122 |
|
|
nstat.do_fork_op := '0';
|
123 |
|
|
nstat.do_fork_srcr := '0';
|
124 |
|
|
nstat.do_fork_dstr := '0';
|
125 |
|
|
nstat.do_fork_dsta := '0';
|
126 |
|
|
nstat.do_fork_opg := '0';
|
127 |
|
|
|
128 |
|
|
nstat.do_pref_dec := '0';
|
129 |
|
|
|
130 |
|
|
if SRCMODF = "000" then
|
131 |
|
|
is_srcmode0 := '1';
|
132 |
|
|
end if;
|
133 |
|
|
|
134 |
|
|
if DSTMODF = "000" then
|
135 |
|
|
nstat.is_dstmode0 := '1';
|
136 |
|
|
if DSTREG /= c_gpr_pc then
|
137 |
|
|
is_dstmode0notpc := '1';
|
138 |
|
|
end if;
|
139 |
|
|
end if;
|
140 |
|
|
|
141 |
|
|
if SRCREG = c_gpr_pc then
|
142 |
|
|
nstat.is_srcpc := '1';
|
143 |
|
|
if SRCMODF = "001" then
|
144 |
|
|
nstat.is_srcpcmode1 := '1';
|
145 |
|
|
end if;
|
146 |
|
|
end if;
|
147 |
|
|
|
148 |
|
|
if DSTREG = c_gpr_pc then
|
149 |
|
|
nstat.is_dstpc := '1';
|
150 |
|
|
end if;
|
151 |
|
|
|
152 |
|
|
if OPPRIM = "000" then
|
153 |
|
|
|
154 |
|
|
if OPBYTE='0' and OPEXT1="000" then
|
155 |
|
|
|
156 |
|
|
if OPEXT2="000" and OPEXT3="000" then -- HALT,...,RTT
|
157 |
|
|
nstat.is_res := '0';
|
158 |
|
|
case OPEXT4 is
|
159 |
|
|
|
160 |
|
|
when "000" => -- HALT
|
161 |
|
|
nstat.fork_op := c_fork_op_halt;
|
162 |
|
|
nstat.do_fork_op := '1';
|
163 |
|
|
|
164 |
|
|
when "001" => -- WAIT
|
165 |
|
|
nstat.fork_op := c_fork_op_wait;
|
166 |
|
|
nstat.do_fork_op := '1';
|
167 |
|
|
|
168 |
|
|
when "010" => -- RTI
|
169 |
|
|
nstat.force_srcsp := '1';
|
170 |
|
|
nstat.fork_op := c_fork_op_rtti;
|
171 |
|
|
nstat.do_fork_op := '1';
|
172 |
|
|
|
173 |
|
|
when "011" => -- BPT (trap to 14)
|
174 |
|
|
nstat.trap_vec := "011";
|
175 |
|
|
nstat.fork_op := c_fork_op_trap;
|
176 |
|
|
nstat.do_fork_op := '1';
|
177 |
|
|
|
178 |
|
|
when "100" => -- IOT (trap to 20)
|
179 |
|
|
nstat.trap_vec := "100";
|
180 |
|
|
nstat.fork_op := c_fork_op_trap;
|
181 |
|
|
nstat.do_fork_op := '1';
|
182 |
|
|
|
183 |
|
|
when "101" => -- RESET
|
184 |
|
|
nstat.fork_op := c_fork_op_reset;
|
185 |
|
|
nstat.do_fork_op := '1';
|
186 |
|
|
|
187 |
|
|
when "110" => -- RTT
|
188 |
|
|
nstat.op_rtt := '1';
|
189 |
|
|
nstat.force_srcsp := '1';
|
190 |
|
|
nstat.fork_op := c_fork_op_rtti;
|
191 |
|
|
nstat.do_fork_op := '1';
|
192 |
|
|
|
193 |
|
|
when others =>
|
194 |
|
|
nstat.is_res := '1';
|
195 |
|
|
|
196 |
|
|
end case;
|
197 |
|
|
end if;
|
198 |
|
|
|
199 |
|
|
if OPEXT2 = "001" then -- JMP
|
200 |
|
|
nstat.is_res := '0';
|
201 |
|
|
nstat.fork_opa := c_fork_opa_jmp;
|
202 |
|
|
nstat.do_fork_dsta := '1';
|
203 |
|
|
end if;
|
204 |
|
|
|
205 |
|
|
if OPEXT2 = "010" then
|
206 |
|
|
if OPEXT3 = "000" then -- RTS
|
207 |
|
|
nstat.is_res := '0';
|
208 |
|
|
nstat.force_srcsp := '1';
|
209 |
|
|
nstat.fork_op := c_fork_op_rts;
|
210 |
|
|
nstat.do_fork_op := '1';
|
211 |
|
|
end if;
|
212 |
|
|
if OPEXT3 = "011" then -- SPL
|
213 |
|
|
nstat.is_res := '0';
|
214 |
|
|
nstat.fork_op := c_fork_op_spl;
|
215 |
|
|
nstat.do_fork_op := '1';
|
216 |
|
|
end if;
|
217 |
|
|
end if;
|
218 |
|
|
|
219 |
|
|
if OPEXT2 = "010" then
|
220 |
|
|
if OPEXT3(2) = '1' then -- SEx/CLx
|
221 |
|
|
nstat.is_res := '0';
|
222 |
|
|
nstat.fork_op := c_fork_op_mcc;
|
223 |
|
|
nstat.do_fork_op := '1';
|
224 |
|
|
--!!!nstat.do_pref_dec := '1'; --??? ensure ireg_we ....
|
225 |
|
|
end if;
|
226 |
|
|
end if;
|
227 |
|
|
|
228 |
|
|
if OPEXT2 = "011" then -- SWAP
|
229 |
|
|
nstat.is_res := '0';
|
230 |
|
|
is_dstm := '1';
|
231 |
|
|
nstat.fork_opg := c_fork_opg_gen;
|
232 |
|
|
nstat.do_fork_opg := '1';
|
233 |
|
|
nstat.do_pref_dec := is_dstmode0notpc;
|
234 |
|
|
nstat.lbox_func := c_lbox_func_swap;
|
235 |
|
|
nstat.res_sel := c_dpath_res_lbox;
|
236 |
|
|
end if;
|
237 |
|
|
|
238 |
|
|
end if; -- OPBYTE='0' and OPEXT1="000"
|
239 |
|
|
|
240 |
|
|
if OPEXT1(2)='0' and -- BR class instructions
|
241 |
|
|
((OPBYTE='0' and OPEXT2(2)='1') or -- BR
|
242 |
|
|
(OPBYTE='0' and (OPEXT1(0)='1' or OPEXT1(1)='1')) or -- BNE,..,BLE
|
243 |
|
|
OPBYTE='1') then -- BPL,..,BCS
|
244 |
|
|
nstat.is_res := '0';
|
245 |
|
|
nstat.fork_op := c_fork_op_br;
|
246 |
|
|
nstat.do_fork_op := '1';
|
247 |
|
|
end if;
|
248 |
|
|
|
249 |
|
|
if OPBYTE='0' and OPEXT1="100" then -- JSR
|
250 |
|
|
nstat.is_res := '0';
|
251 |
|
|
nstat.fork_opa := c_fork_opa_jsr;
|
252 |
|
|
nstat.do_fork_dsta := '1';
|
253 |
|
|
end if;
|
254 |
|
|
|
255 |
|
|
if OPBYTE='1' and OPEXT1="100" then -- EMT, TRAP
|
256 |
|
|
nstat.is_res := '0';
|
257 |
|
|
if OPEXT2(2) = '0' then -- EMT (trap tp 30)
|
258 |
|
|
nstat.trap_vec := "110";
|
259 |
|
|
else -- TRAP (trap to 34)
|
260 |
|
|
nstat.trap_vec := "111";
|
261 |
|
|
end if;
|
262 |
|
|
nstat.fork_op := c_fork_op_trap;
|
263 |
|
|
nstat.do_fork_op := '1';
|
264 |
|
|
end if;
|
265 |
|
|
|
266 |
|
|
if OPEXT1 = "101" then -- CLR(B),...,TST(B)
|
267 |
|
|
nstat.is_res := '0';
|
268 |
|
|
nstat.res_sel := c_dpath_res_dbox;
|
269 |
|
|
if OPBYTE = '1' then
|
270 |
|
|
nstat.is_bytop := '1';
|
271 |
|
|
end if;
|
272 |
|
|
|
273 |
|
|
nstat.dbox_cc1op := '1';
|
274 |
|
|
|
275 |
|
|
case OPEXT2 is
|
276 |
|
|
when "000" => -- CLR: 0 + 0 + 0 (0)
|
277 |
|
|
is_dstw := '1';
|
278 |
|
|
nstat.dbox_srcmod := c_dbox_mod_zero;
|
279 |
|
|
nstat.dbox_dstmod := c_dbox_mod_zero;
|
280 |
|
|
nstat.dbox_cimod := c_dbox_mod_zero;
|
281 |
|
|
when "001" => -- COM: 0 + ~DST + 0 (~dst)
|
282 |
|
|
is_dstm := '1';
|
283 |
|
|
nstat.dbox_srcmod := c_dbox_mod_zero;
|
284 |
|
|
nstat.dbox_dstmod := c_dbox_mod_inv;
|
285 |
|
|
nstat.dbox_cimod := c_dbox_mod_zero;
|
286 |
|
|
when "010" => -- INC: 0 + DST + 1 (dst+1)
|
287 |
|
|
is_dstm := '1';
|
288 |
|
|
nstat.dbox_srcmod := c_dbox_mod_zero;
|
289 |
|
|
nstat.dbox_dstmod := c_dbox_mod_pass;
|
290 |
|
|
nstat.dbox_cimod := c_dbox_mod_one;
|
291 |
|
|
when "011" => -- DEC: ~0 + DST + 0 (dst-1)
|
292 |
|
|
is_dstm := '1';
|
293 |
|
|
nstat.dbox_srcmod := c_dbox_mod_one;
|
294 |
|
|
nstat.dbox_dstmod := c_dbox_mod_pass;
|
295 |
|
|
nstat.dbox_cimod := c_dbox_mod_zero;
|
296 |
|
|
when "100" => -- NEG: 0 + ~DST + 1 (-dst)
|
297 |
|
|
is_dstm := '1';
|
298 |
|
|
nstat.dbox_srcmod := c_dbox_mod_zero;
|
299 |
|
|
nstat.dbox_dstmod := c_dbox_mod_inv;
|
300 |
|
|
nstat.dbox_cimod := c_dbox_mod_one;
|
301 |
|
|
when "101" => -- ADC: 0 + DST + CI (dst+ci)
|
302 |
|
|
is_dstm := '1';
|
303 |
|
|
nstat.dbox_srcmod := c_dbox_mod_zero;
|
304 |
|
|
nstat.dbox_dstmod := c_dbox_mod_pass;
|
305 |
|
|
nstat.dbox_cimod := c_dbox_mod_pass;
|
306 |
|
|
when "110" => -- SBC: ~0 + DST + ~CI (dst-ci)
|
307 |
|
|
is_dstm := '1';
|
308 |
|
|
nstat.dbox_srcmod := c_dbox_mod_one;
|
309 |
|
|
nstat.dbox_dstmod := c_dbox_mod_pass;
|
310 |
|
|
nstat.dbox_cimod := c_dbox_mod_inv;
|
311 |
|
|
when "111" => -- TST: 0 + DST + 0 (dst)
|
312 |
|
|
is_dstr := '1';
|
313 |
|
|
nstat.dbox_srcmod := c_dbox_mod_zero;
|
314 |
|
|
nstat.dbox_dstmod := c_dbox_mod_pass;
|
315 |
|
|
nstat.dbox_cimod := c_dbox_mod_zero;
|
316 |
|
|
when others => null;
|
317 |
|
|
end case;
|
318 |
|
|
|
319 |
|
|
nstat.fork_opg := c_fork_opg_gen;
|
320 |
|
|
nstat.do_fork_opg := '1';
|
321 |
|
|
nstat.do_pref_dec := is_dstmode0notpc;
|
322 |
|
|
|
323 |
|
|
end if;
|
324 |
|
|
|
325 |
|
|
if OPEXT1 = "110" then
|
326 |
|
|
if OPEXT2(2) = '0' then -- ROR(B),...,ASL(B)
|
327 |
|
|
nstat.is_res := '0';
|
328 |
|
|
is_dstm := '1';
|
329 |
|
|
nstat.fork_opg := c_fork_opg_gen;
|
330 |
|
|
nstat.do_fork_opg := '1';
|
331 |
|
|
nstat.do_pref_dec := is_dstmode0notpc;
|
332 |
|
|
if OPBYTE = '1' then
|
333 |
|
|
nstat.is_bytop := '1';
|
334 |
|
|
end if;
|
335 |
|
|
nstat.res_sel := c_dpath_res_lbox;
|
336 |
|
|
case OPEXT2(1 downto 0) is
|
337 |
|
|
when "00" => -- ROR
|
338 |
|
|
nstat.lbox_func := c_lbox_func_ror;
|
339 |
|
|
when "01" => -- ROL
|
340 |
|
|
nstat.lbox_func := c_lbox_func_rol;
|
341 |
|
|
when "10" => -- ASR
|
342 |
|
|
nstat.lbox_func := c_lbox_func_asr;
|
343 |
|
|
when "11" => -- ASL
|
344 |
|
|
nstat.lbox_func := c_lbox_func_asl;
|
345 |
|
|
when others => null;
|
346 |
|
|
end case;
|
347 |
|
|
end if;
|
348 |
|
|
|
349 |
|
|
if OPBYTE='0' and OPEXT2="100" then -- MARK
|
350 |
|
|
nstat.is_res := '0';
|
351 |
|
|
nstat.fork_op := c_fork_op_mark;
|
352 |
|
|
nstat.do_fork_op := '1';
|
353 |
|
|
end if;
|
354 |
|
|
|
355 |
|
|
if OPEXT2 = "101" then -- MFP(I/D)
|
356 |
|
|
nstat.is_res := '0';
|
357 |
|
|
nstat.force_srcsp := '1';
|
358 |
|
|
if DSTREG = c_gpr_sp then -- is dst reg == sp ?
|
359 |
|
|
nstat.updt_dstadsrc := '1'; -- ensure DSRC update in dsta flow
|
360 |
|
|
end if;
|
361 |
|
|
nstat.res_sel := c_dpath_res_abox;
|
362 |
|
|
if nstat.is_dstmode0 = '1' then
|
363 |
|
|
nstat.fork_opa := c_fork_opa_mfp_reg;
|
364 |
|
|
else
|
365 |
|
|
nstat.fork_opa := c_fork_opa_mfp_mem;
|
366 |
|
|
end if;
|
367 |
|
|
nstat.do_fork_dsta := '1';
|
368 |
|
|
end if;
|
369 |
|
|
|
370 |
|
|
if OPEXT2 = "110" then -- MTP(I/D)
|
371 |
|
|
nstat.is_res := '0';
|
372 |
|
|
nstat.force_srcsp := '1';
|
373 |
|
|
nstat.res_sel := c_dpath_res_abox;
|
374 |
|
|
nstat.fork_opa := c_fork_opa_mtp;
|
375 |
|
|
nstat.fork_op := c_fork_op_mtp;
|
376 |
|
|
nstat.do_fork_op := '1';
|
377 |
|
|
end if;
|
378 |
|
|
|
379 |
|
|
if OPBYTE='0' and OPEXT2="111" then -- SXT
|
380 |
|
|
nstat.is_res := '0';
|
381 |
|
|
is_dstw := '1';
|
382 |
|
|
nstat.fork_opg := c_fork_opg_gen;
|
383 |
|
|
nstat.do_fork_opg := '1';
|
384 |
|
|
nstat.do_pref_dec := is_dstmode0notpc;
|
385 |
|
|
nstat.lbox_func := c_lbox_func_sxt;
|
386 |
|
|
nstat.res_sel := c_dpath_res_lbox;
|
387 |
|
|
end if;
|
388 |
|
|
end if;
|
389 |
|
|
|
390 |
|
|
end if; -- OPPRIM="000"
|
391 |
|
|
|
392 |
|
|
if OPPRIM/="000" and OPPRIM/="111" then
|
393 |
|
|
nstat.is_res := '0';
|
394 |
|
|
case OPPRIM is
|
395 |
|
|
when "001" => -- MOV
|
396 |
|
|
is_srcr := '1';
|
397 |
|
|
is_dstw := '1';
|
398 |
|
|
nstat.op_mov := '1';
|
399 |
|
|
nstat.lbox_func := c_lbox_func_mov;
|
400 |
|
|
nstat.res_sel := c_dpath_res_lbox;
|
401 |
|
|
nstat.is_bytop := OPBYTE;
|
402 |
|
|
when "010" => -- CMP
|
403 |
|
|
is_srcr := '1';
|
404 |
|
|
is_dstr := '1';
|
405 |
|
|
nstat.res_sel := c_dpath_res_dbox;
|
406 |
|
|
nstat.dbox_srcmod := c_dbox_mod_pass;
|
407 |
|
|
nstat.dbox_dstmod := c_dbox_mod_inv;
|
408 |
|
|
nstat.dbox_cimod := c_dbox_mod_one;
|
409 |
|
|
nstat.is_bytop := OPBYTE;
|
410 |
|
|
when "011" => -- BIT
|
411 |
|
|
is_srcr := '1';
|
412 |
|
|
is_dstr := '1';
|
413 |
|
|
nstat.lbox_func := c_lbox_func_bit;
|
414 |
|
|
nstat.res_sel := c_dpath_res_lbox;
|
415 |
|
|
nstat.is_bytop := OPBYTE;
|
416 |
|
|
when "100" => -- BIC
|
417 |
|
|
is_srcr := '1';
|
418 |
|
|
is_dstm := '1';
|
419 |
|
|
nstat.lbox_func := c_lbox_func_bic;
|
420 |
|
|
nstat.res_sel := c_dpath_res_lbox;
|
421 |
|
|
nstat.is_bytop := OPBYTE;
|
422 |
|
|
when "101" => -- BIS
|
423 |
|
|
is_srcr := '1';
|
424 |
|
|
is_dstm := '1';
|
425 |
|
|
nstat.lbox_func := c_lbox_func_bis;
|
426 |
|
|
nstat.res_sel := c_dpath_res_lbox;
|
427 |
|
|
nstat.is_bytop := OPBYTE;
|
428 |
|
|
when "110" =>
|
429 |
|
|
is_srcr := '1';
|
430 |
|
|
is_dstm := '1';
|
431 |
|
|
nstat.res_sel := c_dpath_res_dbox;
|
432 |
|
|
if OPBYTE = '0' then -- ADD
|
433 |
|
|
nstat.dbox_srcmod := c_dbox_mod_pass;
|
434 |
|
|
nstat.dbox_dstmod := c_dbox_mod_pass;
|
435 |
|
|
nstat.dbox_cimod := c_dbox_mod_zero;
|
436 |
|
|
else -- SUB
|
437 |
|
|
nstat.dbox_srcmod := c_dbox_mod_inv;
|
438 |
|
|
nstat.dbox_dstmod := c_dbox_mod_pass;
|
439 |
|
|
nstat.dbox_cimod := c_dbox_mod_one;
|
440 |
|
|
end if;
|
441 |
|
|
when others => null;
|
442 |
|
|
end case;
|
443 |
|
|
|
444 |
|
|
nstat.fork_opg := c_fork_opg_gen;
|
445 |
|
|
nstat.do_fork_opg := '1';
|
446 |
|
|
nstat.do_pref_dec := is_srcmode0 and is_dstmode0notpc;
|
447 |
|
|
|
448 |
|
|
end if;
|
449 |
|
|
|
450 |
|
|
if OPBYTE='0' and OPPRIM="111" then
|
451 |
|
|
case OPEXT1 is
|
452 |
|
|
when "000" => -- MUL
|
453 |
|
|
nstat.is_res := '0';
|
454 |
|
|
is_dstr := '1';
|
455 |
|
|
nstat.mbox_func := c_mbox_func_mul;
|
456 |
|
|
nstat.res_sel := c_dpath_res_mbox;
|
457 |
|
|
nstat.fork_opg := c_fork_opg_mul;
|
458 |
|
|
nstat.do_fork_opg := '1';
|
459 |
|
|
when "001" => -- DIV
|
460 |
|
|
nstat.is_res := '0';
|
461 |
|
|
is_dstr := '1';
|
462 |
|
|
nstat.mbox_func := c_mbox_func_div;
|
463 |
|
|
nstat.res_sel := c_dpath_res_mbox;
|
464 |
|
|
nstat.fork_opg := c_fork_opg_div;
|
465 |
|
|
nstat.do_fork_opg := '1';
|
466 |
|
|
when "010" => -- ASH
|
467 |
|
|
nstat.is_res := '0';
|
468 |
|
|
is_dstr := '1';
|
469 |
|
|
nstat.mbox_func := c_mbox_func_ash;
|
470 |
|
|
nstat.res_sel := c_dpath_res_mbox;
|
471 |
|
|
nstat.fork_opg := c_fork_opg_ash;
|
472 |
|
|
nstat.do_fork_opg := '1';
|
473 |
|
|
when "011" => -- ASHC
|
474 |
|
|
nstat.is_res := '0';
|
475 |
|
|
is_dstr := '1';
|
476 |
|
|
nstat.mbox_func := c_mbox_func_ashc;
|
477 |
|
|
nstat.res_sel := c_dpath_res_mbox;
|
478 |
|
|
nstat.fork_opg := c_fork_opg_ashc;
|
479 |
|
|
nstat.do_fork_opg := '1';
|
480 |
|
|
when "100" => -- XOR
|
481 |
|
|
nstat.is_res := '0';
|
482 |
|
|
is_dstm := '1';
|
483 |
|
|
nstat.lbox_func := c_lbox_func_xor;
|
484 |
|
|
nstat.res_sel := c_dpath_res_lbox;
|
485 |
|
|
nstat.fork_opg := c_fork_opg_gen;
|
486 |
|
|
nstat.do_fork_opg := '1';
|
487 |
|
|
nstat.do_pref_dec := is_dstmode0notpc;
|
488 |
|
|
when "111" => -- SOB: SRC + ~0 + 0 (src-1)
|
489 |
|
|
nstat.is_res := '0';
|
490 |
|
|
nstat.dbox_srcmod := c_dbox_mod_pass;
|
491 |
|
|
nstat.dbox_dstmod := c_dbox_mod_one;
|
492 |
|
|
nstat.dbox_cimod := c_dbox_mod_zero;
|
493 |
|
|
nstat.res_sel := c_dpath_res_dbox;
|
494 |
|
|
nstat.fork_op := c_fork_op_sob;
|
495 |
|
|
nstat.do_fork_op := '1';
|
496 |
|
|
when others => null;
|
497 |
|
|
end case;
|
498 |
|
|
|
499 |
|
|
end if;
|
500 |
|
|
|
501 |
|
|
if OPBYTE='1' and OPPRIM="111" then -- FPU
|
502 |
|
|
nstat.is_res := '1'; -- ??? FPU not yet handled
|
503 |
|
|
end if;
|
504 |
|
|
|
505 |
|
|
case SRCMOD is
|
506 |
|
|
when "00" => nstat.fork_srcr := c_fork_srcr_def;
|
507 |
|
|
when "01" => nstat.fork_srcr := c_fork_srcr_inc;
|
508 |
|
|
when "10" => nstat.fork_srcr := c_fork_srcr_dec;
|
509 |
|
|
when "11" => nstat.fork_srcr := c_fork_srcr_ind;
|
510 |
|
|
when others => null;
|
511 |
|
|
end case;
|
512 |
|
|
|
513 |
|
|
if is_srcr='1' and SRCMODF /="000" then
|
514 |
|
|
nstat.do_fork_srcr := '1';
|
515 |
|
|
end if;
|
516 |
|
|
|
517 |
|
|
case DSTMOD is
|
518 |
|
|
when "00" => nstat.fork_dstr := c_fork_dstr_def;
|
519 |
|
|
when "01" => nstat.fork_dstr := c_fork_dstr_inc;
|
520 |
|
|
when "10" => nstat.fork_dstr := c_fork_dstr_dec;
|
521 |
|
|
when "11" => nstat.fork_dstr := c_fork_dstr_ind;
|
522 |
|
|
when others => null;
|
523 |
|
|
end case;
|
524 |
|
|
|
525 |
|
|
if (is_dstr or is_dstm)='1' and nstat.is_dstmode0='0' then
|
526 |
|
|
nstat.do_fork_dstr := '1';
|
527 |
|
|
end if;
|
528 |
|
|
|
529 |
|
|
if is_dstw='1' and nstat.is_dstmode0='0' then
|
530 |
|
|
case DSTMOD is
|
531 |
|
|
when "00" => nstat.fork_opg := c_fork_opg_wdef;
|
532 |
|
|
when "01" => nstat.fork_opg := c_fork_opg_winc;
|
533 |
|
|
when "10" => nstat.fork_opg := c_fork_opg_wdec;
|
534 |
|
|
when "11" => nstat.fork_opg := c_fork_opg_wind;
|
535 |
|
|
when others => null;
|
536 |
|
|
end case;
|
537 |
|
|
end if;
|
538 |
|
|
|
539 |
|
|
if is_dstm='1' and nstat.is_dstmode0='0' then
|
540 |
|
|
nstat.is_rmwop := '1';
|
541 |
|
|
end if;
|
542 |
|
|
|
543 |
|
|
case DSTMOD is
|
544 |
|
|
when "00" => nstat.fork_dsta := c_fork_dsta_def;
|
545 |
|
|
when "01" => nstat.fork_dsta := c_fork_dsta_inc;
|
546 |
|
|
when "10" => nstat.fork_dsta := c_fork_dsta_dec;
|
547 |
|
|
when "11" => nstat.fork_dsta := c_fork_dsta_ind;
|
548 |
|
|
when others => null;
|
549 |
|
|
end case;
|
550 |
|
|
|
551 |
|
|
if (is_dstw or is_dstm)='1' and nstat.is_dstmode0='1' then
|
552 |
|
|
nstat.is_dstw_reg := '1';
|
553 |
|
|
if DSTREG = c_gpr_pc then
|
554 |
|
|
nstat.is_dstw_pc := '1'; --??? hack rename -> is_dstw_pc
|
555 |
|
|
end if;
|
556 |
|
|
end if;
|
557 |
|
|
|
558 |
|
|
STAT <= nstat;
|
559 |
|
|
|
560 |
|
|
end process proc_idecode;
|
561 |
|
|
|
562 |
|
|
end syn;
|