1 |
2 |
MichaelA |
M65C02 Microprocessor Core
|
2 |
|
|
=======================
|
3 |
|
|
|
4 |
|
|
Copyright (C) 2012-2013, Michael A. Morris .
|
5 |
|
|
All Rights Reserved.
|
6 |
|
|
|
7 |
|
|
Released under LGPL.
|
8 |
|
|
|
9 |
|
|
News
|
10 |
|
|
----
|
11 |
|
|
|
12 |
|
|
Recently completed tests have verified the M65C02 soft-
|
13 |
|
|
processor to operate as designed at a frequency of 73.728 MHz in an XC3S50A-
|
14 |
|
|
4VQG100I FPGA. See below for a more complete description of Release 2.7.2.
|
15 |
|
|
with which this milestone was achieved.
|
16 |
|
|
|
17 |
|
|
General Description
|
18 |
|
|
-------------------
|
19 |
|
|
|
20 |
|
|
This project provides a microprogrammed synthesizable IP core compatible with
|
21 |
|
|
the WDC and Rockwell 65C02 microprocessors.
|
22 |
|
|
|
23 |
|
|
It is provided as a core. Several external components are required to form a
|
24 |
|
|
functioning processor: (1) memory, (2) interrupt controller, and (3) I/O
|
25 |
|
|
interface buffers. The Verilog testbench provided demonstrates a simple
|
26 |
|
|
configuration for a functioning processor implemented with the M65C02 core:
|
27 |
|
|
M65C02_Core. The M65C02 core supports the full instruction set of the W65C02.
|
28 |
|
|
|
29 |
|
|
The core accepts an interrupt signal from an external interrupt controller.
|
30 |
|
|
The core provides the interrupt mask bit to the external interrupt controller,
|
31 |
|
|
and expects the controller to handle the detection of the NMI edge, the
|
32 |
|
|
prioritization of the interrupt sources, and to provide the interrupt and
|
33 |
|
|
exception vectors. The core also provides an indication of whether the BRK
|
34 |
|
|
instruction is being executed. With this additional information, the external
|
35 |
|
|
interrupt controller is expected to provide the same vector for the BRK
|
36 |
|
|
exception as the vector for the IRQ interrupt request, or another suitable
|
37 |
|
|
vector. This approach to interrupt handling can be used to support a vectored
|
38 |
|
|
interrupt structure with more interrupt sources than the original processor
|
39 |
|
|
implementation supported: NMI, RST, and IRQ.
|
40 |
|
|
|
41 |
|
|
With Release 2.x, the core now provides a microcycle length controller as an
|
42 |
|
|
integral component of the M65C02 Microprogram Controller (MPC). The M65C02
|
43 |
|
|
core microprogram can now inform the external memory controller, on a cycle by
|
44 |
|
|
cycle basis, of the memory cycle type. Logic external to the core can use this
|
45 |
|
|
output to map the memory cycle to whatever memory is appropriate, and to drive
|
46 |
|
|
the microcycle length inputs of the core to extend each microcycle if
|
47 |
|
|
necessary. Thus, the Release 2.x core no longer assumes that the external
|
48 |
|
|
memory is implemented as an asynchronous memory device, and as a result, the
|
49 |
|
|
core no longer expects that the memory will accept an address and return the
|
50 |
|
|
read data at that address in the same cycle. With the built-in microcycle
|
51 |
|
|
length controller, single cycle LUT-based zero page memory, 2 cycle internal
|
52 |
|
|
block RAM memory, and 4 cycle external memory can easily be supported. A Wait
|
53 |
|
|
input can also be used to extend, i.e. add wait states, to the 4 cycle
|
54 |
|
|
microcycles, so a wide variety of memories can be easily supported; the only
|
55 |
|
|
limitation being the memory types supported by the user-supplied external
|
56 |
|
|
memory controller.
|
57 |
|
|
|
58 |
|
|
The core provides a large number of status and control signals that external
|
59 |
|
|
logic may use. It also provides access to many internal signals such as all of
|
60 |
|
|
the registers, A, X, Y, S, and P. The *Mode*, *Done*, *SC*, and *RMW* status
|
61 |
|
|
outputs may be used to provide additional signals to external devices.
|
62 |
|
|
|
63 |
|
|
*Mode* provides an indication of the kind of instruction being executed:
|
64 |
|
|
|
65 |
|
|
|
66 |
|
|
1 - INV - invalid instruction (uniformly treated a single cycle NOPs),
|
67 |
|
|
2 - BRK - break instruction being executed
|
68 |
|
|
3 - JMP - branch/jump/return (Bcc, BBRx/BBSx, JMP/JSR, RTS/RTI),
|
69 |
|
|
4 - STK - stack access (PHA/PLA, PHX/PLX, PHY/PLY),
|
70 |
|
|
5 - INT - single cycle instruction (INC/DEC A, TAX/TXA, SEI/CLI, etc.),
|
71 |
|
|
6 - MEM - multi-cycle instruction with memory access for operands,
|
72 |
|
|
7 - WAI - wait for interrupt instruction being executed.
|
73 |
|
|
|
74 |
|
|
*Done* is asserted during the instruction fetch of the next instruction.
|
75 |
|
|
During that fetch cycle, all instructions complete execution. Thus, the M65C02
|
76 |
|
|
is pipelined, and executes many instructions in fewer cycles than the 65C02.
|
77 |
|
|
|
78 |
|
|
*SC* is used to indicate a single cycle instruction.
|
79 |
|
|
|
80 |
|
|
*RMW* indicates that a read-modify-write instruction will be performed. External
|
81 |
|
|
logic can use this signal to lock memory.
|
82 |
|
|
|
83 |
|
|
*IO_Op* indicates the I/O cycle required. *IO_Op* signals data memory writes,
|
84 |
|
|
data memory reads, and instruction memory reads. Therefore, external logic may
|
85 |
|
|
implement separate data and instruction memories and potentially double the
|
86 |
|
|
amount of memory that an implementation may access.
|
87 |
|
|
|
88 |
|
|
Implementation
|
89 |
|
|
--------------
|
90 |
|
|
|
91 |
|
|
The implementation of the core provided consists of five Verilog source files
|
92 |
|
|
and several memory initialization files:
|
93 |
|
|
|
94 |
|
|
M65C02_Core.v - Top level module
|
95 |
|
|
M65C02_MPCv3.v - M65C02 MPC with microcycle length controller
|
96 |
|
|
M65C02_AddrGen.v - M65C02 Address Generator module
|
97 |
|
|
M65C02_ALU.v - M65C02 ALU module
|
98 |
|
|
M65C02_BIN.v - M65C02 Binary Mode Adder module
|
99 |
|
|
M65C02_BCD.v - M65C02 Decimal Mode Adder module
|
100 |
|
|
|
101 |
|
|
M65C02_Decoder_ROM.coe - M65C02 core microprogram ALU control fields
|
102 |
|
|
M65C02_uPgm_V3a.coe - M65C02 core microprogram (sequence control)
|
103 |
|
|
|
104 |
|
|
M65C02_Core.ucf - User Constraints File: period and pin LOCs
|
105 |
|
|
M65C02.tcl - Project settings file
|
106 |
|
|
|
107 |
|
|
tb_M65C02_Core.v - Completed core testbench with test RAM
|
108 |
|
|
|
109 |
|
|
M65C02_Tst3.txt - Memory configuration file of M65C02 "ROM" program
|
110 |
|
|
M65C02_Tst3.a65 - Kingswood A65 assembler source code test program
|
111 |
|
|
|
112 |
|
|
tb_M65C02_ALU.v - testbench for the ALU module
|
113 |
|
|
tb_M65C02_BCD.v - testbench for the BCD adder module
|
114 |
|
|
|
115 |
|
|
Synthesis
|
116 |
|
|
---------
|
117 |
|
|
|
118 |
|
|
The objective for the core is to synthesize such that the FF-FF speed is 100 MHz
|
119 |
|
|
or higher in a Xilinx XC3S200AN-5FGG256 FPGA using Xilinx ISE 10.1i SP3. In that
|
120 |
|
|
regard, the core provided meets and exceeds that objective. Using the settings
|
121 |
|
|
provided in the M65C02.tcl file, ISE 10.1i tool implements the design and
|
122 |
|
|
reports that the 10.000 ns period (100 MHz) constraint is satisfied.
|
123 |
|
|
|
124 |
|
|
The ISE 10.1i SP3 implementation results are as follows:
|
125 |
|
|
|
126 |
|
|
Number of Slice FFs: 191
|
127 |
|
|
Number of 4-input LUTs: 747
|
128 |
|
|
Number of Occupied Slices: 459
|
129 |
|
|
Total Number of 4-input LUTs: 760 (13 used as route-throughs)
|
130 |
|
|
|
131 |
|
|
Number of BUFGMUXs: 1
|
132 |
|
|
Number of RAMB16BWEs 2 (M65C02_Decoder_ROM, M65C02_uPgm_V3a)
|
133 |
|
|
|
134 |
|
|
Best Case Achievable: 9.962 ns (0.038 ns Setup, 1.028 ns Hold)
|
135 |
|
|
|
136 |
|
|
Status
|
137 |
|
|
------
|
138 |
|
|
|
139 |
|
|
Design and verification is complete.
|
140 |
|
|
|
141 |
|
|
Release Notes
|
142 |
|
|
-------------
|
143 |
|
|
|
144 |
|
|
###Release 1
|
145 |
|
|
|
146 |
|
|
Release 1 of the M65C02 had an issue in that addressing wrapping of zero page
|
147 |
|
|
addressing was not properly implemented. Unlike the W65C02 and MOS6502, the
|
148 |
|
|
M65C02 synthesizable core implemented the addressing modes, but allowed page
|
149 |
|
|
boundaries to be crossed for all addressing modes. This initial behavior is
|
150 |
|
|
more like that of the WDC 65C802/816 microprocessors in native mode. With this
|
151 |
|
|
release, Release 2, the zero page addressing modes of the M65C02 core behave
|
152 |
|
|
like those of the WDC W65C02.
|
153 |
|
|
|
154 |
|
|
Following Release 1, a couple of quick patches were made to the zero page
|
155 |
|
|
addressing, but these failed to address all of the issues. Release 2 uses the
|
156 |
|
|
same basic next address generation logic, except that it now allows the
|
157 |
|
|
microcode to control when addresses are computed modulo 256. With this change,
|
158 |
|
|
all outstanding issues with respect to zero page addressing have been
|
159 |
|
|
corrected.
|
160 |
|
|
|
161 |
|
|
###Release 2
|
162 |
|
|
|
163 |
|
|
Release 2 has reworked the Microprogram Controller (MPC) to include a
|
164 |
|
|
microcycle length controller directly. With this new MPC, it is expected that
|
165 |
|
|
it will be easier to adapt the core to use LUT RAM for page 0 (data page) and
|
166 |
|
|
page 1 (stack page), and to attach a external memory controller with variable
|
167 |
|
|
length access cycles. The microcycle length controller allows 1, 2, or 4 cycle
|
168 |
|
|
microcycles. Neither the 1 and 2 cycle microcyles support wait state
|
169 |
|
|
insertion, but the 4 cycle microcycle allows the insertion of wait states.
|
170 |
|
|
With this architecture, LUT and internal Block RAMs can be used to provide
|
171 |
|
|
high speed operation. The 4 cycle external memory microcycle should easily
|
172 |
|
|
allow the core to support asynchronous or synchronous external memory. Release
|
173 |
|
|
1 allowed variable length microcycles, but the address-based mechanism
|
174 |
|
|
implemented was difficult to use in practice. Release 1 targeted a single
|
175 |
|
|
cycle memory like that provided by the distributed LUT RAMs of the target
|
176 |
|
|
FPGAs. The approach used in Release 2 should make it much easier to adapt the
|
177 |
|
|
M65C02 core.
|
178 |
|
|
|
179 |
|
|
####Release 2.1
|
180 |
|
|
|
181 |
|
|
Release 2.1 has modified the core to export signals to an external memory
|
182 |
|
|
controller that would allow the memory controller to drive the core logic with
|
183 |
|
|
the required microcycle length value for the next microcycle. The test bench for
|
184 |
|
|
the core is running in parallel with the original Release 1 (with zero page
|
185 |
|
|
adressing corrected) core (M65C02_Base.v) so that a self-checking configuration
|
186 |
|
|
is achieved between the two cores and the common test program. Release 2.1 also
|
187 |
|
|
includes a modified memory model module, M65C02_RAM,v, that supports all three
|
188 |
|
|
types of memory that is expected to be used with the core: LUT (page 0), BRAM
|
189 |
|
|
(page 1 and internal program/data memory), and external pipelined SynchRAM.
|
190 |
|
|
|
191 |
|
|
####Release 2.2
|
192 |
|
|
|
193 |
|
|
Release 2.2 has been tested using microcycles of 1, 2, or 4 cycles in length.
|
194 |
|
|
During testing, some old issues returned when multi-cycle microcycles were
|
195 |
|
|
used. With single cycle microcycles there were no problems with either of the
|
196 |
|
|
two cores: M65C02_Core.v or M65C02_Base.v. For example, with 2 and 4 cycle
|
197 |
|
|
microcycles, the modification of the PSW before the first instruction of the
|
198 |
|
|
ISR was found to be taking place several microcycles before it should. This
|
199 |
|
|
issue was tracked down to the fact that the microprogram ROMs and the PSW
|
200 |
|
|
update logic were not being qualified by the internal Rdy signal, or end-of-
|
201 |
|
|
microcycle. In the single cycle microcycle case, previous corrections applied
|
202 |
|
|
to address this issue still worked, but the single cycle solutions applied did
|
203 |
|
|
not generalize to the multi-cycle cases. Thus, several modules were modified
|
204 |
|
|
so that ISR, BCD, and zero page addressing modes now behave correctly for
|
205 |
|
|
single and multi-cycle microcycles.
|
206 |
|
|
|
207 |
|
|
####Release 2.3
|
208 |
|
|
|
209 |
|
|
Release 2.3 implements the standard 6502/65C02 vector fetch operations and
|
210 |
|
|
adds the WAI and STP instructions. Both versions are updated to incorporate
|
211 |
|
|
these features. The testbench has been modified to include another M6502_RAM
|
212 |
|
|
module, and to separate the two modules into "ROM" at high memory and "RAM" at
|
213 |
|
|
low memory. The test program has been updated to include initialization of
|
214 |
|
|
"RAM" by the test program running from "ROM". Initialization of the stack
|
215 |
|
|
pointer is still part of the core logic, and the test program expects that S
|
216 |
|
|
is initialized to 0xFF on reset, and that the reset vector fetch sequence does
|
217 |
|
|
not modify the stack. In other words, the Release 2.3 core does not write to
|
218 |
|
|
the stack before fetching the vector and starting execution at that address.
|
219 |
|
|
|
220 |
|
|
####Release 2.4
|
221 |
|
|
|
222 |
|
|
Release 2.4 incorporates the 32 Rockwell instruction opcodes and the WAI and STP
|
223 |
|
|
instructions.
|
224 |
|
|
|
225 |
|
|
####Release 2.5
|
226 |
|
|
|
227 |
|
|
Release 2.5 makes some minor modifications to the M65C02 core module to allow
|
228 |
|
|
the output of some signals that allow the generation of interface signals such
|
229 |
|
|
as the active low Vector Pull output of the W65C02S microprocessor. In
|
230 |
|
|
addition to bringing out of these signals, Release 2.5 also provides an
|
231 |
|
|
implementation of a standalone microprocessor, or system-on-chip, which
|
232 |
|
|
demonstrates how the M65C02 can be used to provide a stand-alone
|
233 |
|
|
implementation of a 65C02 processor. This implementation is composed of the
|
234 |
|
|
following files:
|
235 |
|
|
|
236 |
|
|
M65C02.v - M65C02 microprocessor demonstration
|
237 |
|
|
ClkGen.xaw - Xilinx Architecture Wizard clock generator file
|
238 |
|
|
|
239 |
|
|
M65C02.ucf - User Constraints File: period and pin LOCs
|
240 |
|
|
M65C02.tcl - Project settings file
|
241 |
|
|
|
242 |
|
|
tb_M65C02.v - M65C02 testbench with RAM/ROM and interrupt sources
|
243 |
|
|
|
244 |
|
|
The header of the M65C02.v module provides details of the differences between
|
245 |
|
|
the 65C02 microprocessor implementation represented by the M65C02.v and a
|
246 |
|
|
65C02 processor implementation as represented by the WDC W65C02S microprocessor.
|
247 |
|
|
|
248 |
|
|
The M65C02 implementation is targeted at an XC3S50A-4VQG100I FPGA. The User
|
249 |
|
|
Constraints File (ucf) has been developed so that the resulting implementation
|
250 |
|
|
can be used as a fully functional microprocessor when attached to external I/O
|
251 |
|
|
devices, external SRAM device(s) (25ns or faster), and external an NOR Flash
|
252 |
|
|
device (4kB, 45ns or faster). A development board is presently being developed
|
253 |
|
|
to demonstrate the M65C02, and to provide a suitable platform for further
|
254 |
|
|
development of the remaining FPGA resources into a more complete system-on-
|
255 |
|
|
chip based on the M65C02 core.
|
256 |
|
|
|
257 |
|
|
The Xilinx ISE 10.1i SP3 synthesis results for the M65C02 are as follows:
|
258 |
|
|
|
259 |
|
|
Used Avail %
|
260 |
|
|
Number of Slice Flip Flops 200 1408 14%
|
261 |
|
|
Number of 4 input LUTs 736 1408 52%
|
262 |
|
|
Logic Distribution
|
263 |
|
|
|
264 |
|
|
Number of occupied Slices 426 704 60%
|
265 |
|
|
Number of Slices related logic 426 426 100%
|
266 |
|
|
Number of Slices unrelated logic 0 426 0%
|
267 |
|
|
Total Number of 4 input LUTs 745 1408 52%
|
268 |
|
|
Number used as logic 735
|
269 |
|
|
Number used as a route-thru 9
|
270 |
|
|
Number used as Shift registers 1
|
271 |
|
|
Number of bonded IOBs
|
272 |
|
|
Number of bonded pads 53 68 77%
|
273 |
|
|
IOB Flip Flops 79
|
274 |
|
|
Number of BUFGMUXs 4 24 16%
|
275 |
|
|
Number of DCMs 1 2 50%
|
276 |
|
|
Number of RAMB16BWEs 2 3 66%
|
277 |
|
|
|
278 |
|
|
Best Case Achievable: 13.213ns (0.037ns Setup, 1.023ns Hold)
|
279 |
|
|
|
280 |
|
|
Please read the header and other comments for more details on the M65C02
|
281 |
|
|
processor implementation. In particular, read and understand the discussion
|
282 |
|
|
regarding the use of an FPGA-specific clock multiplexer to manage the memory
|
283 |
|
|
cycle length in lieu of supporting wait state generation/insertion.
|
284 |
|
|
|
285 |
|
|
#####Release 2.6
|
286 |
|
|
|
287 |
|
|
Modified the M65C02 processor to use the last available block RAM in the
|
288 |
|
|
XC3S50A-xVQG100I device as a 2kB Boot/Monitor ROM. Added an external pin to
|
289 |
|
|
inhibit writes into this block RAM. The UCF file includes a PULLUP on the pin
|
290 |
|
|
which enables writes. Also modified the clock stretch logic to only apply when
|
291 |
|
|
system ROM, CE[2], or User ROM, CE[1], are addressed. The Boot/Monitor
|
292 |
|
|
ROM/RAM, IO (CE[3]), and User RAM, CE[0], do not use the clock stretching
|
293 |
|
|
logic and therefore require devices able to respond in a single memory cycle of
|
294 |
|
|
the M65C02, ~25ns.
|
295 |
|
|
|
296 |
|
|
Adding the additional (internal) device select and data multiplexer to the
|
297 |
|
|
M65C02 caused a drop in performance. External memory operating frequency
|
298 |
|
|
decreased from ~20 MHz (max) to ~16 MHz for a -5 speed grade part. There was
|
299 |
|
|
also an increase in the size of the implementation, but that was expected and
|
300 |
|
|
did use a reasonable number of additional resources.
|
301 |
|
|
|
302 |
|
|
The following table summarizes PAR results for the new release of the M65C02
|
303 |
|
|
processor:
|
304 |
|
|
|
305 |
|
|
Used Avail %
|
306 |
|
|
Number of Slice Flip Flops 205 1408 14%
|
307 |
|
|
Number of 4 input LUTs 724 1408 51%
|
308 |
|
|
Logic Distribution
|
309 |
|
|
|
310 |
|
|
Number of occupied Slices 443 704 62%
|
311 |
|
|
Number of Slices related logic 443 443 100%
|
312 |
|
|
Number of Slices unrelated logic 0 426 0%
|
313 |
|
|
Total Number of 4 input LUTs 732 1408 51%
|
314 |
|
|
Number used as logic 723
|
315 |
|
|
Number used as a route-thru 8
|
316 |
|
|
Number used as Shift registers 1
|
317 |
|
|
Number of bonded IOBs
|
318 |
|
|
Number of bonded pads 54 68 79%
|
319 |
|
|
IOB Flip Flops 80
|
320 |
|
|
Number of BUFGMUXs 4 24 16%
|
321 |
|
|
Number of DCMs 1 2 50%
|
322 |
|
|
Number of RAMB16BWEs 3 3 100%
|
323 |
|
|
|
324 |
|
|
Best Case Achievable: 15.147ns (0.003ns Setup, 0.817ns Hold)
|
325 |
|
|
|
326 |
|
|
The modified files are:
|
327 |
|
|
|
328 |
|
|
M65C02.v - M65C02 microprocessor demonstration
|
329 |
|
|
M65C02.ucf - User Constraints File: period and pin LOCs
|
330 |
|
|
tb_M65C02.v - M65C02 testbench with RAM/ROM and interrupt sources
|
331 |
|
|
|
332 |
|
|
Additional work is needed for verification, but this release successfully
|
333 |
|
|
executes the same test program as the previous release of the M65C02 processor
|
334 |
|
|
and the M65C02 core.
|
335 |
|
|
|
336 |
|
|
#####Release 2.7
|
337 |
|
|
|
338 |
|
|
Modified the Release 2.6 M65C02 processor to use a newly released version of the
|
339 |
|
|
microprogram controller. The new microprogram controller, M65C02_MPCv4.v,
|
340 |
|
|
modifies the behavior of the built-in microcycle length controller. It fixes the
|
341 |
|
|
microcycle length to 4, and adds four additional states by which external
|
342 |
|
|
devices can request wait states. The new microprogram controller adds wait
|
343 |
|
|
states in integer multiples of the memory cycle. In this way, the clock stretch
|
344 |
|
|
logic built using a FF and a BUFGMUX clock multiplexer can be removed, and the
|
345 |
|
|
external Phi1O and Phi2O signals will maintain their natural 50% DC signal
|
346 |
|
|
characteristic.
|
347 |
|
|
|
348 |
|
|
The change to the microprogram controller required a change to the core and to
|
349 |
|
|
the interface between the core and the M65C02 processor. Within the core, the
|
350 |
|
|
change in the microprogram controller removed the need for the cycle extension
|
351 |
|
|
logic used to insert an extra state in the microcycle whenever a BCD instruction
|
352 |
|
|
is executed. That extra cycle is only needed when the core is operating with
|
353 |
|
|
single memory. Since the microcycle is fixed to 4 with the new microprogram
|
354 |
|
|
controller, the BCD mode microcycle extension logic was removed.
|
355 |
|
|
|
356 |
|
|
The interface change refers to the need to increase the width of the microstate
|
357 |
|
|
signal, MC, from 2 to 3 bits. Within the M65C02 processor, the additional states
|
358 |
|
|
supported by the larger MC port required that the clock enable for the external
|
359 |
|
|
memory data input register be modified. The nominal external input data sampling
|
360 |
|
|
point is cycle 3, falling edge of Phi2O. With wait states, the data sampling
|
361 |
|
|
point becomed cycle 3 or cycle 7. For data sampling, the external Rdy input
|
362 |
|
|
signal must also be asserted. A final change to the M65C02 processor is that the
|
363 |
|
|
Phi1O and Phi2O signals are now set and reset using four microstate decode
|
364 |
|
|
signals rather than two.
|
365 |
|
|
|
366 |
|
|
The incorporation of the last block memory into the design resulted in a loss
|
367 |
|
|
of performance. The M65C02 processor is unable to maintain an external memory
|
368 |
|
|
cycle rate of 18.432 MHz when the internal block RAM is included. The
|
369 |
|
|
additional decode and input data multiplexer impose a path delay that lowers
|
370 |
|
|
the memory interface operating speed to 16 MHz. Thus, the nearest baud rate
|
371 |
|
|
frequency is 14.7456 MHz.
|
372 |
|
|
|
373 |
|
|
Operating at 14.7456 MHz requires external devices to request a wait state if
|
374 |
|
|
they are unable to accept or supply data within 33.908ns. (At 16 MHz
|
375 |
|
|
operation, the access time requirement is 31.25ns.) A single wait state
|
376 |
|
|
extends the memory access time to 101.725ns. At 14.7456 MHz or 16 MHz, the
|
377 |
|
|
memory cycle characteristics of the M65C02 processor allow the use of low-cost
|
378 |
|
|
high-speed asynchronous SRAMs, and with one wait state, low-cost NOR Flash
|
379 |
|
|
EEPROMs in 45, 55, 70, or 90ns speed grades.
|
380 |
|
|
|
381 |
|
|
The following table summarizes PAR results for Release 2.7 of the M65C02
|
382 |
|
|
processor:
|
383 |
|
|
|
384 |
|
|
Used Avail %
|
385 |
|
|
Number of Slice Flip Flops 205 1408 14%
|
386 |
|
|
Number of 4 input LUTs 720 1408 51%
|
387 |
|
|
|
388 |
|
|
Number of occupied Slices 401 704 56%
|
389 |
|
|
Number of Slices related logic 401 401 100%
|
390 |
|
|
Number of Slices unrelated logic 0 401 0%
|
391 |
|
|
Total Number of 4 input LUTs 728 1408 51%
|
392 |
|
|
Number used as logic 719
|
393 |
|
|
Number used as a route-thru 8
|
394 |
|
|
Number used as Shift registers 1
|
395 |
|
|
Number of bonded IOBs
|
396 |
|
|
Number of bonded pads 54 68 79%
|
397 |
|
|
IOB Flip Flops 79
|
398 |
|
|
Number of BUFGMUXs 4 24 16%
|
399 |
|
|
Number of DCMs 1 2 50%
|
400 |
|
|
Number of RAMB16BWEs 3 3 100%
|
401 |
|
|
|
402 |
|
|
Best Case Achievable: 15.625ns (0.000ns Setup, 0.961ns Hold)
|
403 |
|
|
|
404 |
|
|
The files modified in this release are:
|
405 |
|
|
|
406 |
|
|
M65C02.v - M65C02 microprocessor demonstration
|
407 |
|
|
M65C02_Core.v - M65C02 core logic
|
408 |
|
|
M65C02_MPCv4.v - M65C02 core microprogram controller
|
409 |
|
|
M65C02.ucf - User Constraints File: period and pin LOCs
|
410 |
|
|
M65C02.tcl - M65C02 ISE tool configurations/settings
|
411 |
|
|
tb_M65C02.v - M65C02 testbench with RAM/ROM and interrupt sources
|
412 |
|
|
|
413 |
|
|
Testing with the current testbench demonstrates that the M65C02 processor
|
414 |
|
|
correctly executes the 65C02 test program, M65C02_Tst3.a65, used in previous
|
415 |
|
|
testing of the M65C02 core with tb_M65C02_Core.v. That provides confidence
|
416 |
|
|
that the integration of the core logic with the memory interface, interrupt
|
417 |
|
|
handler, reset controller, and internal block RAM did not introduce any errors
|
418 |
|
|
related to the core. However, the circuits in the wrapper around the core
|
419 |
|
|
logic have not been extensively tested. The testing that has been performed to
|
420 |
|
|
date indicate these circuits are operating correctly, but the tests performed
|
421 |
|
|
to date only test the nominal cases and not those cases on the margins.
|
422 |
|
|
|
423 |
|
|
For example, the interrupt handler has demonstrated that it is able to handle
|
424 |
|
|
vector generation for RST, IRQ, and BRK; NMI vector processing has not yet
|
425 |
|
|
been tested. Another signal not yet tested is the reset logic's characteristic
|
426 |
|
|
that requires the external nRst signal to be asserted for four cycle of the
|
427 |
|
|
input clock before it is recognized. This behavior has not yet been tested, nor
|
428 |
|
|
has the related behavior that a loss of lock of the internal clock generator
|
429 |
|
|
will assert reset to the M65C02 processor.
|
430 |
|
|
|
431 |
|
|
#####Release 2.71
|
432 |
|
|
|
433 |
|
|
Corrected logic for generating an internal reset signal, Rst, based on an
|
434 |
|
|
external reset, nRst, and the state of the DCM_Locked signal. The vector
|
435 |
|
|
reduction operator applied, '&', is incorrect. The correct vector reduction
|
436 |
|
|
operator is '|', or logic OR. The correction has been made, and the FPGA
|
437 |
|
|
correctly drives the nRstO output with the complement of the internal reset
|
438 |
|
|
signal, Rst.
|
439 |
|
|
|
440 |
|
|
The changes have been made to the M65C02.v module, and only that module has
|
441 |
|
|
been loaded into the MAM65C02 GitHUB repository.
|
442 |
|
|
|
443 |
|
|
#####Release 2.72
|
444 |
|
|
|
445 |
|
|
Improved the timing of the soft-core microprocessor, M65C02, by using a more
|
446 |
|
|
efficient scheme for the internal bus multiplexers. Previous releases of the
|
447 |
|
|
core, M65C02_Core, and the soft-core microprocessor used multiplexers
|
448 |
|
|
generated using _switch/case select_ constructs.
|
449 |
|
|
|
450 |
|
|
Although these constructs are an effective and fast means for generating bus
|
451 |
|
|
multiplexers, there are some penalties. This latest release has resorted to
|
452 |
|
|
using one-hot decode ROMs tied to the various bus selects in the
|
453 |
|
|
implementation, and then forcing the various data sources to connect to the
|
454 |
|
|
busses as gated signals. When not gated, a logic 0 is driven onto the bus. At
|
455 |
|
|
the terminal end, a simple OR gate is used to collect all of the desired gated
|
456 |
|
|
signals.
|
457 |
|
|
|
458 |
|
|
The result of this effort has been a significant improvement in the
|
459 |
|
|
combinatorial path delays. Prior to this optimization, the synthesizer
|
460 |
|
|
reported a clock period performance of ~55 MHz. After the OR bus optimization
|
461 |
|
|
was fully incorporated, the synthesizer reports a minimum period of ~74 MHz.
|
462 |
|
|
This is nearly a 35% improvement in the combinatorial path delays.
|
463 |
|
|
|
464 |
|
|
The resulting improvement is sufficient to allow the soft-core processor to
|
465 |
|
|
support an operating speed of **73.728 MHz** which corresponds to a single
|
466 |
|
|
instruction cycle time of **18.432 MHz** given this core's 4 cycle microcycle.
|
467 |
|
|
In addition to the improved combinatorial path delays, the improvement in path
|
468 |
|
|
delays has allowed the core to be synthesized, Mapped, and PARed for minimum
|
469 |
|
|
area. The result is a significant reduction in the resource utilization in the
|
470 |
|
|
target XC3S50A-4VQG100I FPGA.
|
471 |
|
|
|
472 |
|
|
The following table summarizes PAR results for Release 2.7 of the M65C02
|
473 |
|
|
processor: **XC3S50A-4VQG100I**
|
474 |
|
|
|
475 |
|
|
Used Avail %
|
476 |
|
|
Number of Slice Flip Flops 248 1408 17%
|
477 |
|
|
Number of 4 input LUTs 647 1408 45%
|
478 |
|
|
|
479 |
|
|
Number of occupied Slices 400 704 56%
|
480 |
|
|
Number of Slices related logic 400 400 100%
|
481 |
|
|
Number of Slices unrelated logic 0 400 0%
|
482 |
|
|
Total Number of 4 input LUTs 661 1408 46%
|
483 |
|
|
Number used as logic 646
|
484 |
|
|
Number used as a route-thru 14
|
485 |
|
|
Number used as Shift registers 1
|
486 |
|
|
Number of bonded IOBs
|
487 |
|
|
Number of bonded pads 54 68 79%
|
488 |
|
|
IOB Flip Flops 79
|
489 |
|
|
Number of BUFGMUXs 3 24 16%
|
490 |
|
|
Number of DCMs 1 2 50%
|
491 |
|
|
Number of RAMB16BWEs 3 3 100%
|
492 |
|
|
|
493 |
|
|
Best Case Achievable: 13.516ns (0.047ns Setup, 1.021ns Hold)
|
494 |
|
|
|
495 |
|
|
The files modified in this release are:
|
496 |
|
|
|
497 |
|
|
M65C02.v - M65C02 microprocessor demonstration
|
498 |
|
|
M65C02_Core.v - M65C02 core logic
|
499 |
|
|
M65C02_AddrGen.v - M65C02 core microprogram controller
|
500 |
|
|
M65C02_ALU.v - M65C02 core ALU
|
501 |
|
|
M65C02_BIN.v - M65C02 ALU Binary mode adder
|
502 |
|
|
M65C02_BCD.v - M65C02 ALU Decimal mode adder
|
503 |
|
|
M65C02.ucf - User Constraints File: period and pin LOCs
|
504 |
|
|
M65C02.tcl - M65C02 ISE tool configurations/settings
|
505 |
|
|
|
506 |
|
|
Additional optimizations in the ALU can be applied, but with the improvements
|
507 |
|
|
made with this release, a -5 speed grade part can be made to operate at 90+
|
508 |
|
|
MHz. If higher speeds are needed, then further optimization, including adding
|
509 |
|
|
pipeline registers to the ALU, can be made. Some pipelining can be easily
|
510 |
|
|
added because of the 4 clock microcycle around which the soft-core processor
|
511 |
|
|
is built.
|
512 |
|
|
|
513 |
|
|
#####Release 2.73
|
514 |
|
|
|
515 |
|
|
Improved the modularity of the M65C02 top level module by creating modules for
|
516 |
|
|
clock generation and interrupt handling. Updated the design document, and
|
517 |
|
|
deleted unnecessary files.
|