1 |
2 |
tobiflex |
------------------------------------------------------------------------------
|
2 |
|
|
------------------------------------------------------------------------------
|
3 |
|
|
-- --
|
4 |
8 |
tobiflex |
-- Copyright (c) 2009-2019 Tobias Gubener --
|
5 |
|
|
-- Patches by MikeJ, Till Harbaum, Rok Krajnk, ... --
|
6 |
2 |
tobiflex |
-- Subdesign fAMpIGA by TobiFlex --
|
7 |
|
|
-- --
|
8 |
|
|
-- This source file is free software: you can redistribute it and/or modify --
|
9 |
|
|
-- it under the terms of the GNU Lesser General Public License as published --
|
10 |
|
|
-- by the Free Software Foundation, either version 3 of the License, or --
|
11 |
|
|
-- (at your option) any later version. --
|
12 |
|
|
-- --
|
13 |
|
|
-- This source file is distributed in the hope that it will be useful, --
|
14 |
|
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of --
|
15 |
|
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --
|
16 |
|
|
-- GNU General Public License for more details. --
|
17 |
|
|
-- --
|
18 |
|
|
-- You should have received a copy of the GNU General Public License --
|
19 |
|
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>. --
|
20 |
|
|
-- --
|
21 |
|
|
------------------------------------------------------------------------------
|
22 |
|
|
------------------------------------------------------------------------------
|
23 |
|
|
library IEEE;
|
24 |
|
|
use IEEE.std_logic_1164.all;
|
25 |
|
|
|
26 |
|
|
package TG68K_Pack is
|
27 |
|
|
|
28 |
|
|
type micro_states is (idle, nop, ld_nn, st_nn, ld_dAn1, ld_AnXn1, ld_AnXn2, st_dAn1, ld_AnXnbd1, ld_AnXnbd2, ld_AnXnbd3,
|
29 |
|
|
ld_229_1, ld_229_2, ld_229_3, ld_229_4, st_229_1, st_229_2, st_229_3, st_229_4,
|
30 |
|
|
st_AnXn1, st_AnXn2, bra1, bsr1, bsr2, nopnop, dbcc1, movem1, movem2, movem3,
|
31 |
|
|
andi, pack1, pack2, pack3, op_AxAy, cmpm, link1, link2, unlink1, unlink2, int1, int2, int3, int4, rte1, rte2, rte3,
|
32 |
9 |
tobiflex |
rte4, rte5, rtd1, rtd2, trap00, trap0, trap1, trap2, trap3,
|
33 |
2 |
tobiflex |
trap4, trap5, trap6, movec1, movep1, movep2, movep3, movep4, movep5, rota1, bf1,
|
34 |
|
|
mul1, mul2, mul_end1, mul_end2, div1, div2, div3, div4, div_end1, div_end2);
|
35 |
|
|
|
36 |
8 |
tobiflex |
constant opcMOVE : integer := 0; --
|
37 |
|
|
constant opcMOVEQ : integer := 1; --
|
38 |
|
|
constant opcMOVESR : integer := 2; --
|
39 |
|
|
constant opcADD : integer := 3; --
|
40 |
|
|
constant opcADDQ : integer := 4; --
|
41 |
|
|
constant opcOR : integer := 5; --
|
42 |
|
|
constant opcAND : integer := 6; --
|
43 |
|
|
constant opcEOR : integer := 7; --
|
44 |
|
|
constant opcCMP : integer := 8; --
|
45 |
|
|
constant opcROT : integer := 9; --
|
46 |
|
|
constant opcCPMAW : integer := 10;
|
47 |
|
|
constant opcEXT : integer := 11; --
|
48 |
|
|
constant opcABCD : integer := 12; --
|
49 |
|
|
constant opcSBCD : integer := 13; --
|
50 |
|
|
constant opcBITS : integer := 14; --
|
51 |
|
|
constant opcSWAP : integer := 15; --
|
52 |
|
|
constant opcScc : integer := 16; --
|
53 |
|
|
constant andiSR : integer := 17; --
|
54 |
|
|
constant eoriSR : integer := 18; --
|
55 |
|
|
constant oriSR : integer := 19; --
|
56 |
|
|
constant opcMULU : integer := 20; --
|
57 |
|
|
constant opcDIVU : integer := 21; --
|
58 |
|
|
constant dispouter : integer := 22; --
|
59 |
|
|
constant rot_nop : integer := 23; --
|
60 |
|
|
constant ld_rot_cnt : integer := 24; --
|
61 |
|
|
constant writePC_add : integer := 25; --
|
62 |
|
|
constant ea_data_OP1 : integer := 26; --
|
63 |
|
|
constant ea_data_OP2 : integer := 27; --
|
64 |
|
|
constant use_XZFlag : integer := 28; --
|
65 |
|
|
constant get_bfoffset : integer := 29; --
|
66 |
|
|
constant save_memaddr : integer := 30; --
|
67 |
|
|
constant opcCHK : integer := 31; --
|
68 |
|
|
constant movec_rd : integer := 32; --
|
69 |
|
|
constant movec_wr : integer := 33; --
|
70 |
|
|
constant Regwrena : integer := 34; --
|
71 |
|
|
constant update_FC : integer := 35; --
|
72 |
|
|
constant linksp : integer := 36; --
|
73 |
|
|
constant movepl : integer := 37; --
|
74 |
|
|
constant update_ld : integer := 38; --
|
75 |
|
|
constant OP1addr : integer := 39; --
|
76 |
|
|
constant write_reg : integer := 40; --
|
77 |
|
|
constant changeMode : integer := 41; --
|
78 |
|
|
constant ea_build : integer := 42; --
|
79 |
|
|
constant trap_chk : integer := 43; --
|
80 |
|
|
constant store_ea_data : integer := 44; --
|
81 |
|
|
constant addrlong : integer := 45; --
|
82 |
|
|
constant postadd : integer := 46; --
|
83 |
|
|
constant presub : integer := 47; --
|
84 |
|
|
constant subidx : integer := 48; --
|
85 |
|
|
constant no_Flags : integer := 49; --
|
86 |
|
|
constant use_SP : integer := 50; --
|
87 |
|
|
constant to_CCR : integer := 51; --
|
88 |
|
|
constant to_SR : integer := 52; --
|
89 |
|
|
constant OP2out_one : integer := 53; --
|
90 |
|
|
constant OP1out_zero : integer := 54; --
|
91 |
|
|
constant mem_addsub : integer := 55; --
|
92 |
|
|
constant addsub : integer := 56; --
|
93 |
|
|
constant directPC : integer := 57; --
|
94 |
|
|
constant direct_delta : integer := 58; --
|
95 |
|
|
constant directSR : integer := 59; --
|
96 |
|
|
constant directCCR : integer := 60; --
|
97 |
|
|
constant exg : integer := 61; --
|
98 |
|
|
constant get_ea_now : integer := 62; --
|
99 |
|
|
constant ea_to_pc : integer := 63; --
|
100 |
|
|
constant hold_dwr : integer := 64; --
|
101 |
|
|
constant to_USP : integer := 65; --
|
102 |
|
|
constant from_USP : integer := 66; --
|
103 |
|
|
constant write_lowlong : integer := 67; --
|
104 |
|
|
constant write_reminder : integer := 68; --
|
105 |
|
|
constant movem_action : integer := 69; --
|
106 |
|
|
constant briefext : integer := 70; --
|
107 |
|
|
constant get_2ndOPC : integer := 71; --
|
108 |
|
|
constant mem_byte : integer := 72; --
|
109 |
|
|
constant longaktion : integer := 73; --
|
110 |
|
|
constant opcRESET : integer := 74; --
|
111 |
|
|
constant opcBF : integer := 75; --
|
112 |
|
|
constant opcBFwb : integer := 76; --
|
113 |
|
|
constant opcPACK : integer := 77; --
|
114 |
|
|
constant opcUNPACK : integer := 78; --
|
115 |
|
|
constant hold_ea_data : integer := 79; --
|
116 |
|
|
constant store_ea_packdata : integer := 80; --
|
117 |
|
|
constant exec_BS : integer := 81; --
|
118 |
9 |
tobiflex |
constant hold_OP2 : integer := 82; --
|
119 |
2 |
tobiflex |
|
120 |
10 |
tobiflex |
constant lastOpcBit : integer := 82;
|
121 |
2 |
tobiflex |
|
122 |
|
|
component TG68K_ALU
|
123 |
|
|
generic(
|
124 |
8 |
tobiflex |
MUL_Mode :integer; --0=>16Bit, 1=>32Bit, 2=>switchable with CPU(1), 3=>no MUL,
|
125 |
|
|
MUL_Hardware :integer; --0=>no, 1=>yes,
|
126 |
|
|
DIV_Mode :integer; --0=>16Bit, 1=>32Bit, 2=>switchable with CPU(1), 3=>no DIV,
|
127 |
|
|
BarrelShifter :integer --0=>no, 1=>yes, 2=>switchable with CPU(1)
|
128 |
2 |
tobiflex |
);
|
129 |
|
|
port(
|
130 |
8 |
tobiflex |
clk : in std_logic;
|
131 |
|
|
Reset : in std_logic;
|
132 |
|
|
clkena_lw : in std_logic:='1';
|
133 |
|
|
execOPC : in bit;
|
134 |
|
|
decodeOPC : in bit;
|
135 |
|
|
exe_condition : in std_logic;
|
136 |
|
|
exec_tas : in std_logic;
|
137 |
|
|
long_start : in bit;
|
138 |
|
|
non_aligned : in std_logic;
|
139 |
|
|
movem_presub : in bit;
|
140 |
|
|
set_stop : in bit;
|
141 |
|
|
Z_error : in bit;
|
142 |
|
|
rot_bits : in std_logic_vector(1 downto 0);
|
143 |
|
|
exec : in bit_vector(lastOpcBit downto 0);
|
144 |
|
|
OP1out : in std_logic_vector(31 downto 0);
|
145 |
|
|
OP2out : in std_logic_vector(31 downto 0);
|
146 |
|
|
reg_QA : in std_logic_vector(31 downto 0);
|
147 |
|
|
reg_QB : in std_logic_vector(31 downto 0);
|
148 |
|
|
opcode : in std_logic_vector(15 downto 0);
|
149 |
|
|
-- datatype : in std_logic_vector(1 downto 0);
|
150 |
|
|
exe_opcode : in std_logic_vector(15 downto 0);
|
151 |
|
|
exe_datatype : in std_logic_vector(1 downto 0);
|
152 |
|
|
sndOPC : in std_logic_vector(15 downto 0);
|
153 |
|
|
last_data_read : in std_logic_vector(15 downto 0);
|
154 |
|
|
data_read : in std_logic_vector(15 downto 0);
|
155 |
|
|
FlagsSR : in std_logic_vector(7 downto 0);
|
156 |
|
|
micro_state : in micro_states;
|
157 |
|
|
bf_ext_in : in std_logic_vector(7 downto 0);
|
158 |
|
|
bf_ext_out : out std_logic_vector(7 downto 0);
|
159 |
|
|
bf_shift : in std_logic_vector(5 downto 0);
|
160 |
|
|
bf_width : in std_logic_vector(5 downto 0);
|
161 |
|
|
bf_ffo_offset : in std_logic_vector(31 downto 0);
|
162 |
|
|
bf_loffset : in std_logic_vector(4 downto 0);
|
163 |
|
|
|
164 |
|
|
set_V_Flag : buffer bit;
|
165 |
|
|
Flags : buffer std_logic_vector(7 downto 0);
|
166 |
|
|
c_out : buffer std_logic_vector(2 downto 0);
|
167 |
|
|
addsub_q : buffer std_logic_vector(31 downto 0);
|
168 |
|
|
ALUout : out std_logic_vector(31 downto 0)
|
169 |
2 |
tobiflex |
);
|
170 |
|
|
end component;
|
171 |
|
|
|
172 |
|
|
end;
|