1 |
7 |
jesus |
--
|
2 |
|
|
-- 65xx compatible microprocessor core
|
3 |
|
|
--
|
4 |
|
|
-- Version : 0246
|
5 |
|
|
--
|
6 |
|
|
-- Copyright (c) 2002 Daniel Wallner (jesus@opencores.org)
|
7 |
|
|
--
|
8 |
|
|
-- All rights reserved
|
9 |
|
|
--
|
10 |
|
|
-- Redistribution and use in source and synthezised forms, with or without
|
11 |
|
|
-- modification, are permitted provided that the following conditions are met:
|
12 |
|
|
--
|
13 |
|
|
-- Redistributions of source code must retain the above copyright notice,
|
14 |
|
|
-- this list of conditions and the following disclaimer.
|
15 |
|
|
--
|
16 |
|
|
-- Redistributions in synthesized form must reproduce the above copyright
|
17 |
|
|
-- notice, this list of conditions and the following disclaimer in the
|
18 |
|
|
-- documentation and/or other materials provided with the distribution.
|
19 |
|
|
--
|
20 |
|
|
-- Neither the name of the author nor the names of other contributors may
|
21 |
|
|
-- be used to endorse or promote products derived from this software without
|
22 |
|
|
-- specific prior written permission.
|
23 |
|
|
--
|
24 |
|
|
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
25 |
|
|
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
26 |
|
|
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
27 |
|
|
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
|
28 |
|
|
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
29 |
|
|
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
30 |
|
|
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
31 |
|
|
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
32 |
|
|
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
33 |
|
|
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
34 |
|
|
-- POSSIBILITY OF SUCH DAMAGE.
|
35 |
|
|
--
|
36 |
|
|
-- Please report bugs to the author, but before you do so, please
|
37 |
|
|
-- make sure that this is not a derivative work and that
|
38 |
|
|
-- you have the latest version of this file.
|
39 |
|
|
--
|
40 |
|
|
-- The latest version of this file can be found at:
|
41 |
|
|
-- http://www.opencores.org/cvsweb.shtml/t65/
|
42 |
|
|
--
|
43 |
|
|
-- Limitations :
|
44 |
|
|
--
|
45 |
|
|
-- File history :
|
46 |
|
|
--
|
47 |
|
|
|
48 |
|
|
library IEEE;
|
49 |
|
|
use IEEE.std_logic_1164.all;
|
50 |
|
|
|
51 |
|
|
package T65_Pack is
|
52 |
|
|
|
53 |
|
|
constant Flag_C : integer := 0;
|
54 |
|
|
constant Flag_Z : integer := 1;
|
55 |
|
|
constant Flag_I : integer := 2;
|
56 |
|
|
constant Flag_D : integer := 3;
|
57 |
|
|
constant Flag_B : integer := 4;
|
58 |
|
|
constant Flag_1 : integer := 5;
|
59 |
|
|
constant Flag_V : integer := 6;
|
60 |
|
|
constant Flag_N : integer := 7;
|
61 |
|
|
|
62 |
|
|
component T65
|
63 |
|
|
port(
|
64 |
|
|
Mode : in std_logic_vector(1 downto 0); -- "00" => 6502, "01" => 65C02, "10" => 65816
|
65 |
|
|
Res_n : in std_logic;
|
66 |
|
|
Clk : in std_logic;
|
67 |
|
|
Rdy : in std_logic;
|
68 |
|
|
Abort_n : in std_logic;
|
69 |
|
|
IRQ_n : in std_logic;
|
70 |
|
|
NMI_n : in std_logic;
|
71 |
|
|
SO_n : in std_logic;
|
72 |
|
|
R_W_n : out std_logic;
|
73 |
|
|
Sync : out std_logic;
|
74 |
|
|
EF : out std_logic;
|
75 |
|
|
MF : out std_logic;
|
76 |
|
|
XF : out std_logic;
|
77 |
|
|
ML_n : out std_logic;
|
78 |
|
|
VP_n : out std_logic;
|
79 |
|
|
VDA : out std_logic;
|
80 |
|
|
VPA : out std_logic;
|
81 |
|
|
A : out std_logic_vector(23 downto 0);
|
82 |
|
|
DI : in std_logic_vector(7 downto 0);
|
83 |
|
|
DO : out std_logic_vector(7 downto 0)
|
84 |
|
|
);
|
85 |
|
|
end component;
|
86 |
|
|
|
87 |
|
|
component T65_MCode
|
88 |
|
|
port(
|
89 |
|
|
Mode : in std_logic_vector(1 downto 0); -- "00" => 6502, "01" => 65C02, "10" => 65816
|
90 |
|
|
IR : in std_logic_vector(7 downto 0);
|
91 |
|
|
MCycle : in std_logic_vector(2 downto 0);
|
92 |
|
|
P : in std_logic_vector(7 downto 0);
|
93 |
|
|
LCycle : out std_logic_vector(2 downto 0);
|
94 |
|
|
ALU_Op : out std_logic_vector(3 downto 0);
|
95 |
|
|
Set_BusA_To : out std_logic_vector(2 downto 0); -- DI,A,X,Y,S,P
|
96 |
|
|
Set_Addr_To : out std_logic_vector(1 downto 0); -- PC Adder,S,AD,BA
|
97 |
|
|
Write_Data : out std_logic_vector(2 downto 0); -- DL,A,X,Y,S,P,PCL,PCH
|
98 |
|
|
Jump : out std_logic_vector(1 downto 0); -- PC,++,DIDL,Rel
|
99 |
|
|
BAAdd : out std_logic_vector(1 downto 0); -- None,DB Inc,BA Add,BA Adj
|
100 |
|
|
BreakAtNA : out std_logic;
|
101 |
|
|
ADAdd : out std_logic;
|
102 |
|
|
PCAdd : out std_logic;
|
103 |
|
|
Inc_S : out std_logic;
|
104 |
|
|
Dec_S : out std_logic;
|
105 |
|
|
LDA : out std_logic;
|
106 |
|
|
LDP : out std_logic;
|
107 |
|
|
LDX : out std_logic;
|
108 |
|
|
LDY : out std_logic;
|
109 |
|
|
LDS : out std_logic;
|
110 |
|
|
LDDI : out std_logic;
|
111 |
|
|
LDALU : out std_logic;
|
112 |
|
|
LDAD : out std_logic;
|
113 |
|
|
LDBAL : out std_logic;
|
114 |
|
|
LDBAH : out std_logic;
|
115 |
|
|
SaveP : out std_logic;
|
116 |
|
|
Write : out std_logic
|
117 |
|
|
);
|
118 |
|
|
end component;
|
119 |
|
|
|
120 |
|
|
component T65_ALU
|
121 |
|
|
port(
|
122 |
|
|
Mode : in std_logic_vector(1 downto 0); -- "00" => 6502, "01" => 65C02, "10" => 65C816
|
123 |
|
|
Op : in std_logic_vector(3 downto 0);
|
124 |
|
|
BusA : in std_logic_vector(7 downto 0);
|
125 |
|
|
BusB : in std_logic_vector(7 downto 0);
|
126 |
|
|
P_In : in std_logic_vector(7 downto 0);
|
127 |
|
|
P_Out : out std_logic_vector(7 downto 0);
|
128 |
|
|
Q : out std_logic_vector(7 downto 0)
|
129 |
|
|
);
|
130 |
|
|
end component;
|
131 |
|
|
|
132 |
|
|
end;
|