1 |
24 |
fpga_is_fu |
LIBRARY ieee;
|
2 |
|
|
USE ieee.std_logic_1164.all;
|
3 |
|
|
USE ieee.std_logic_arith.all;
|
4 |
|
|
|
5 |
|
|
entity r65c02_tc is
|
6 |
|
|
port(
|
7 |
|
|
clk_clk_i : in std_logic;
|
8 |
|
|
d_i : in std_logic_vector (7 downto 0);
|
9 |
|
|
irq_n_i : in std_logic;
|
10 |
|
|
nmi_n_i : in std_logic;
|
11 |
|
|
rdy_i : in std_logic;
|
12 |
|
|
rst_rst_n_i : in std_logic;
|
13 |
|
|
so_n_i : in std_logic;
|
14 |
|
|
a_o : out std_logic_vector (15 downto 0);
|
15 |
|
|
d_o : out std_logic_vector (7 downto 0);
|
16 |
|
|
rd_o : out std_logic;
|
17 |
|
|
sync_o : out std_logic;
|
18 |
|
|
wr_n_o : out std_logic;
|
19 |
|
|
wr_o : out std_logic
|
20 |
|
|
);
|
21 |
|
|
|
22 |
|
|
-- Declarations
|
23 |
|
|
|
24 |
|
|
end r65c02_tc ;
|
25 |
|
|
-- (C) 2008 - 2021 Jens Gutschmidt
|
26 |
|
|
-- (email: opencores@vivare-services.com)
|
27 |
|
|
--
|
28 |
|
|
-- Versions:
|
29 |
|
|
-- Revision 2.00 2021/01/22 13:27:00 jens
|
30 |
|
|
-- Production Release
|
31 |
|
|
--
|
32 |
|
|
-- Revision 2.00RC_C 2021/01/11 17:23:00 jens
|
33 |
|
|
-- - Performance improvements (PC)
|
34 |
|
|
-- Revision 2.00RC_B 2021/01/05 23:36:00 jens
|
35 |
|
|
-- - Bug Fixes RDY (='0')
|
36 |
|
|
-- - Performance improvements
|
37 |
|
|
-- Revision 2.00RC_A 2020/12/31 17:24:00 jens
|
38 |
|
|
-- - Bug Fix RDY (='0') forces A, X, Y and flags
|
39 |
|
|
-- to be cumulated at specific states on several
|
40 |
|
|
-- instructions.
|
41 |
|
|
-- Revision 2.00RC 2018/10/14 11:50:00 jens
|
42 |
|
|
-- - Performance improvements
|
43 |
|
|
-- Revision 1.52 2018/09/10 12:14:00 jens
|
44 |
|
|
-- - RESET generates SYNC now, 1 dead cycle delayed
|
45 |
|
|
-- Revision 1.52 RC 2018/09/09 03:00:00 jens
|
46 |
|
|
-- - ADC / SBC flags and A like R65C02 now
|
47 |
|
|
-- Revision 1.52 BETA 2018/09/05 19:35:00 jens
|
48 |
|
|
-- - BBRx/BBSx internal cycles like real 65C02 now
|
49 |
|
|
-- - Bug Fix ADC and SBC in decimal mode (all op codes -
|
50 |
|
|
-- 1 cycle is missing
|
51 |
|
|
-- - Bug Fix ADC and SBC in decimal mode (all op codes -
|
52 |
|
|
-- "Overflow" flag was computed wrong)
|
53 |
|
|
-- Revision 1.52 BETA 2018/09/02 18:49:00 jens
|
54 |
|
|
-- - Interrupt NMI and IRQ processing via FETCH stage now
|
55 |
|
|
-- Revision 1.52 BETA 2018/08/30 15:39:00 jens
|
56 |
|
|
-- - Interrupt priority order is now: BRQ - NMI - IRQ
|
57 |
|
|
-- - Performance improvements on-going (Mealy -> Moore)
|
58 |
|
|
-- Revision 1.52 BETA 2018/08/23 20:27:00 jens
|
59 |
|
|
-- - Bug Fixes All Branch Instructions
|
60 |
|
|
-- (BCC, BCS, BEQ, BNE, BPL, BMI, BVC, BVS, BRA)
|
61 |
|
|
-- 3 cycles now if branch forward occur and the branch
|
62 |
|
|
-- instruction lies on a xxFEh location.
|
63 |
|
|
-- (BBR, BBS) 6 cycles now if branch forward occur and the
|
64 |
|
|
-- branch instruction lies on a xxFDh location.
|
65 |
|
|
-- - Bug Fix Hardware Interrupts NMI & IRQ - 7 cycles & "SYNC" now
|
66 |
|
|
-- - Bug Fix Now all cycles are delayable (WR and internal)
|
67 |
|
|
--
|
68 |
|
|
-- Revision 1.51 RC 2014/04/19 14:44:00 jens
|
69 |
|
|
-- (never submitted to opencores)
|
70 |
|
|
-- - Bug Fix JMP ABS - produced a 6502 like JMP (IND) PCH.
|
71 |
|
|
-- When the ABS address data bytes cross the page
|
72 |
|
|
-- boundary (e.g. $02FE JMP hhll reads hh from
|
73 |
|
|
-- $02FF and ll from $0200, instead $02FF and $0300)
|
74 |
|
|
--
|
75 |
|
|
-- Revision 1.5 RC 2013/08/01 11:00:00 jens
|
76 |
|
|
-- - Change Block name to lower case
|
77 |
|
|
-- - Bug Fix CMP (IND) - wrongly decoded as function AND
|
78 |
|
|
-- - Bug Fix BRK should clear decimal flag in P Reg
|
79 |
|
|
-- - Bug Fix JMP (ABS,X) - Low Address outputted twice - no High Address
|
80 |
|
|
-- - Bug Fix Unknown Ops - Used always 1b2c NOP ($EA) - new NOPs created
|
81 |
|
|
-- - Bug Fix DECIMAL ADC and SBC (all op codes - "C" flag was computed wrong)
|
82 |
|
|
-- - Bug Fix INC/DEC ABS,X - N/Z flag wrongly computed
|
83 |
|
|
-- - Bug Fix RTI - should increment stack pointer
|
84 |
|
|
-- - Bug Fix "E" & "B" flags (Bits 5 & 4) - should be always "1" in P Reg. Change "RES", "RTI", "IRQ" & "NMI" substates.
|
85 |
|
|
-- - Bug Fix ADC and SBC (all sub codes - "Overflow" flag was computed wrong)
|
86 |
|
|
-- - Bug Fix RMB, SMB Bug - Bit position decoded wrong
|
87 |
|
|
--
|
88 |
|
|
-- Revision 1.4 2013/07/21 11:11:00 jens
|
89 |
|
|
-- - Changing the title block and internal revision history
|
90 |
|
|
-- - Bug Fix STA [(IND)] op$92 ($92 was missed in the connection list at state FETCH)
|
91 |
|
|
--
|
92 |
|
|
-- Revision 1.3 2009/01/04 10:20:50 eda
|
93 |
|
|
-- Changes for cosmetic issues only
|
94 |
|
|
--
|
95 |
|
|
-- Revision 1.2 2009/01/04 09:23:12 eda
|
96 |
|
|
-- - Delete unused nets and blocks (same as R6502_TC)
|
97 |
|
|
-- - Rename blocks
|
98 |
|
|
-- - Re-arrage FSM symbols in block FSM_Execution_Unit
|
99 |
|
|
--
|
100 |
|
|
-- Revision 1.1 2009/01/03 16:36:48 eda
|
101 |
|
|
-- -- no description --
|
102 |
|
|
--
|
103 |
|
|
--
|
104 |
|
|
--
|
105 |
|
|
-- r65c02_tc.r65c02_tc.struct
|
106 |
|
|
--
|
107 |
|
|
-- Date: 22.01.2021
|
108 |
|
|
-- Time: 13:28:45
|
109 |
|
|
-- By: VIVARE GmbH, Switzerland
|
110 |
|
|
--
|
111 |
|
|
-- COPYRIGHT (C) 2008 - 2021 by Jens Gutschmidt
|
112 |
|
|
--
|
113 |
|
|
-- This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
|
114 |
|
|
--
|
115 |
|
|
-- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
116 |
|
|
--
|
117 |
|
|
-- You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
118 |
|
|
--
|
119 |
|
|
--
|
120 |
|
|
LIBRARY ieee;
|
121 |
|
|
USE ieee.std_logic_1164.all;
|
122 |
|
|
USE ieee.std_logic_arith.all;
|
123 |
|
|
|
124 |
|
|
library r65c02_tc;
|
125 |
|
|
|
126 |
|
|
architecture struct of r65c02_tc is
|
127 |
|
|
|
128 |
|
|
-- Architecture declarations
|
129 |
|
|
|
130 |
|
|
-- Internal signal declarations
|
131 |
|
|
|
132 |
|
|
|
133 |
|
|
-- Component Declarations
|
134 |
|
|
component core
|
135 |
|
|
port (
|
136 |
|
|
clk_clk_i : in std_logic ;
|
137 |
|
|
d_i : in std_logic_vector (7 downto 0);
|
138 |
|
|
irq_n_i : in std_logic ;
|
139 |
|
|
nmi_n_i : in std_logic ;
|
140 |
|
|
rdy_i : in std_logic ;
|
141 |
|
|
rst_rst_n_i : in std_logic ;
|
142 |
|
|
so_n_i : in std_logic ;
|
143 |
|
|
a_o : out std_logic_vector (15 downto 0);
|
144 |
|
|
d_o : out std_logic_vector (7 downto 0);
|
145 |
|
|
rd_o : out std_logic ;
|
146 |
|
|
sync_o : out std_logic ;
|
147 |
|
|
wr_n_o : out std_logic ;
|
148 |
|
|
wr_o : out std_logic
|
149 |
|
|
);
|
150 |
|
|
end component;
|
151 |
|
|
|
152 |
|
|
-- Optional embedded configurations
|
153 |
|
|
-- pragma synthesis_off
|
154 |
|
|
for all : core use entity r65c02_tc.core;
|
155 |
|
|
-- pragma synthesis_on
|
156 |
|
|
|
157 |
|
|
|
158 |
|
|
begin
|
159 |
|
|
|
160 |
|
|
-- Instance port mappings.
|
161 |
|
|
U_0 : core
|
162 |
|
|
port map (
|
163 |
|
|
clk_clk_i => clk_clk_i,
|
164 |
|
|
d_i => d_i,
|
165 |
|
|
irq_n_i => irq_n_i,
|
166 |
|
|
nmi_n_i => nmi_n_i,
|
167 |
|
|
rdy_i => rdy_i,
|
168 |
|
|
rst_rst_n_i => rst_rst_n_i,
|
169 |
|
|
so_n_i => so_n_i,
|
170 |
|
|
a_o => a_o,
|
171 |
|
|
d_o => d_o,
|
172 |
|
|
rd_o => rd_o,
|
173 |
|
|
sync_o => sync_o,
|
174 |
|
|
wr_n_o => wr_n_o,
|
175 |
|
|
wr_o => wr_o
|
176 |
|
|
);
|
177 |
|
|
|
178 |
|
|
end struct;
|