1 |
2 |
MichaelA |
M65C02 Processor Core Utilities
|
2 |
|
|
===============================
|
3 |
|
|
|
4 |
|
|
Copyright (C) 2012, Michael A. Morris .
|
5 |
|
|
All Rights Reserved.
|
6 |
|
|
|
7 |
|
|
Released under LGPL.
|
8 |
|
|
|
9 |
|
|
Directory Contents
|
10 |
|
|
------------------
|
11 |
|
|
|
12 |
|
|
This subdirectory provides two utilities to support the M65C02 Microprogrammed
|
13 |
|
|
Processor Core:
|
14 |
|
|
|
15 |
|
|
(1) Bin2Txt.exe
|
16 |
|
|
(2) SMRTool.exe
|
17 |
|
|
|
18 |
|
|
Bin2Txt.exe
|
19 |
|
|
===========
|
20 |
|
|
|
21 |
|
|
**Bin2Txt.exe** convert binary assembler output files from the Kingswood A65
|
22 |
|
|
6502 Assembler into ASCII hexadecimal memory initialization files as required
|
23 |
|
|
by Xilinx ISE.
|
24 |
|
|
|
25 |
|
|
Usage
|
26 |
|
|
-----
|
27 |
|
|
|
28 |
|
|
The utility **bin2txt.exe** and its associated source file, **bin2txt.c**,
|
29 |
|
|
operate as a DOS command line utility. It was compiled using the Borland Turbo
|
30 |
|
|
C/C++ 2.0 compiler.
|
31 |
|
|
|
32 |
|
|
The utility requires the path and filename of a binary input file and the path
|
33 |
|
|
and filename of an output file.
|
34 |
|
|
|
35 |
|
|
The input file is opened for reading as binary. The output file is opened for
|
36 |
|
|
writing as a text (ASCII, single byte character set) file. Data is read from
|
37 |
|
|
the input file, converted to ASCII Hexadecimal, and written to the output
|
38 |
|
|
file. Each input byte is written to the output as two ASCII characters on a
|
39 |
|
|
single line. Each line is terminated with a standard newline terminator, "\n".
|
40 |
|
|
|
41 |
|
|
While reading the input file, a count of the number of bytes processed is
|
42 |
|
|
kept. After all input data has been read from the input file and written to
|
43 |
|
|
the output file, the output file is padded with 0x00 so that the total number
|
44 |
|
|
of lines is equal to a power of two.
|
45 |
|
|
|
46 |
|
|
Documentation
|
47 |
|
|
-------------
|
48 |
|
|
|
49 |
|
|
If the number of required arguments are not supplied, then before terminating
|
50 |
|
|
the utility will print out a prompt to the user that defines the needed
|
51 |
|
|
arguments.
|
52 |
|
|
|
53 |
|
|
Status
|
54 |
|
|
------
|
55 |
|
|
|
56 |
|
|
Design and verification is complete.
|
57 |
|
|
|
58 |
|
|
SMRTool.exe
|
59 |
|
|
===========
|
60 |
|
|
|
61 |
|
|
**SMRTool.exe** is a tool used to convert text source files into VHDL,
|
62 |
|
|
Verilog, or Xilinx memory intialization files. The source files can be used to
|
63 |
|
|
construct simple ROM for a number of usefull purposes. It's particular use in
|
64 |
|
|
the MAM65C02 Microprogrammed Processor Core is to convert the microprogram
|
65 |
|
|
source files provided into two memory initialization files which are loaded
|
66 |
|
|
into the fixed and variable microprogram ROMs.
|
67 |
|
|
|
68 |
|
|
Usage
|
69 |
|
|
-----
|
70 |
|
|
|
71 |
|
|
The primary use for **SMRTool** is as a tool to convert human-readable
|
72 |
|
|
microprogrammed state machine descriptions into synthesizable VHDL and/or
|
73 |
|
|
Verilog RTL descriptions of ROMs. **SMRTool** also provides memory
|
74 |
|
|
initialization files, and this is its primary method of usage for the MAM65C02
|
75 |
|
|
Microprogrammed Processor Core.
|
76 |
|
|
|
77 |
|
|
**SMRTool** is a Windows-based tool which provides the user graphical user
|
78 |
|
|
interface specify the input source file, and check boxes and text boxes to
|
79 |
|
|
select various output options and files. It is written in C#, and requires the
|
80 |
|
|
.NET framework to run.
|
81 |
|
|
|
82 |
|
|
In the final analysis, **SMRTool** is a text substitution tool. As such, it
|
83 |
|
|
has a number of limitations, but it is invaluable for its intended purpose.
|
84 |
|
|
Extensions are being continually added to the tool as additional functionality
|
85 |
|
|
is required to support more complex state machines, and to improve the
|
86 |
|
|
simulation and testing of the state machines in VHDL/Verilog or SystemVerilog
|
87 |
|
|
verification environment.
|
88 |
|
|
|
89 |
|
|
Documentation
|
90 |
|
|
-------------
|
91 |
|
|
|
92 |
|
|
A complete description of the tool is not available. The source files provided
|
93 |
|
|
in the sources subdirectory, **M65C02_Decode_ROM.txt** and
|
94 |
|
|
**M65C02_uPgm_V3.txt**, provide an example of the format and syntax that is
|
95 |
|
|
required by **SMRTool**. This section will provide additional information
|
96 |
|
|
about the structure and syntax, but the source files provided are the
|
97 |
|
|
definitive syntax references for the tool; they make use of all of the current
|
98 |
|
|
directives and features of **SMRTool**.
|
99 |
|
|
|
100 |
|
|
First and foremost, **SMRTool** is a text substitution tool. No provision is
|
101 |
|
|
made for in-line symbolic equations in the publicly released version of the
|
102 |
|
|
tool provided herein.
|
103 |
|
|
|
104 |
|
|
Each source file must start with a header. The header is marked by the symbol
|
105 |
|
|
**header** in column 1 of the first line of the source file, and demarcated by
|
106 |
|
|
the symbol **endh**. Within the header, the tool presently recognizes four
|
107 |
|
|
fields. Each header field is terminated by a colon, **:**, and followed by a
|
108 |
|
|
string which the tool extracts and places into the appropriate GUI text boxes.
|
109 |
|
|
The currently recognized header fields are:
|
110 |
|
|
|
111 |
|
|
(1) Project
|
112 |
|
|
(2) File Revision
|
113 |
|
|
(3) Author(s)
|
114 |
|
|
(4) Description
|
115 |
|
|
|
116 |
|
|
Comments may be used, and are introduced using the VHDL comment symbol **--**,
|
117 |
|
|
a double hyphen. The comment extents from that point to the end of the line.
|
118 |
|
|
Presently there is no support for multi-line block comments such as is
|
119 |
|
|
avaiable in Verilog and C.
|
120 |
|
|
|
121 |
|
|
Following the header section, the source file must define all substitution
|
122 |
|
|
symbols. Owing to its intended design and implementation as a microprogram
|
123 |
|
|
source file processor, there are several directives recognized by **SMRTool**
|
124 |
|
|
to aid in this process.
|
125 |
|
|
|
126 |
|
|
Each line in the file may be blank, a comment line, or contain symbols to be
|
127 |
|
|
processed. Each source line is divided into at least one or more fields. With
|
128 |
|
|
the exception of the first and second fields on a source line, fields are
|
129 |
|
|
separated by commas. Each field is specified to have a constant width, and the
|
130 |
|
|
values assigned to the symbols must be defined to fit into the specified
|
131 |
|
|
width. Each field is positionally located in a line of source.
|
132 |
|
|
|
133 |
|
|
On a line of source, fields may be skipped, and the default value is inserted
|
134 |
|
|
by **SMRTool**, using consecutive commas. From the last used field on a line
|
135 |
|
|
to the end, or to a comment, there is no need to include the commas to skip
|
136 |
|
|
the unused fields. The tool will automatically substitute the default value
|
137 |
|
|
for all skipped fields. **The default value of a field is zero.** A limitation
|
138 |
|
|
of the present tool is that the default value can not be changed.
|
139 |
|
|
|
140 |
|
|
The current implementation of the tool recognizes the following directives:
|
141 |
|
|
|
142 |
|
|
(1) .asm
|
143 |
|
|
(2) .def
|
144 |
|
|
(3) .equ
|
145 |
|
|
(4) .org
|
146 |
|
|
|
147 |
|
|
|
148 |
|
|
The **.asm** directive defines the microprogram controller's instructions.
|
149 |
|
|
Unless a label (described below) is used at the start of a source line, a
|
150 |
|
|
symbol defined by the **.asm** directive must be the first symbol on a source
|
151 |
|
|
line.
|
152 |
|
|
|
153 |
|
|
The **.def** defines the width of each field in the source file. The first
|
154 |
|
|
field defined by a **.def** directive will be the leftmost field in the
|
155 |
|
|
output, followed by the second field, etc. The sum of all of the widths of all
|
156 |
|
|
defined fields is the total width of the data written to the tool's output.
|
157 |
|
|
There is no limit to the total field width, but with respect to to Block RAMs
|
158 |
|
|
in Xilinx FPGAs, in particular, the maximum practical width of a ROM is 36 or
|
159 |
|
|
72 bits.
|
160 |
|
|
|
161 |
|
|
The **.equ** directive is used to define all other text substitution symbols
|
162 |
|
|
beyond those defined by the **.asm** directive. A limitation of the present
|
163 |
|
|
implementation is that all symbols must be unique.
|
164 |
|
|
|
165 |
|
|
The **.org** directive defines the location counter address of all source
|
166 |
|
|
lines which follow the directive. If multiple **.org** directives are used in
|
167 |
|
|
a source file, then the intervening locations are automatically filled by the
|
168 |
|
|
tool with zeros. In the present implementation there is a limitation that all
|
169 |
|
|
**.org** directives be increasing in magnitude. If an **.org** is placed in
|
170 |
|
|
the source with a lesser value than one already used, the location counter is
|
171 |
|
|
assigned the new value, and the previously defined values may be overwritten
|
172 |
|
|
by any new output lines.
|
173 |
|
|
|
174 |
|
|
Labels are used to define the symbols to which the **.asm** and **.equ**
|
175 |
|
|
directives assigns values, or labels may used to capture the value of the
|
176 |
|
|
location counter to a symbol. When labels are used to capture the location
|
177 |
|
|
counter value, the labels must always start with an underscore character,
|
178 |
|
|
**_**. All labels in a source file must be unique, and all labels capturing
|
179 |
|
|
the value of the location counter must be terminated by a colon. Location
|
180 |
|
|
counter labels, terminated by a colon, may appear on a source line before a
|
181 |
|
|
**.org** directive, or one of the **.asm** symbols.
|
182 |
|
|
|
183 |
|
|
The current value of the location counter is the special symbol: **$** or
|
184 |
|
|
dollar sign.
|
185 |
|
|
|
186 |
|
|
The last line of the source file must be labeled **_end** terminated by colon.
|
187 |
|
|
|
188 |
|
|
Extensions
|
189 |
|
|
----------
|
190 |
|
|
|
191 |
|
|
At the present time, there are no plans to port the tool to C/C++ and Linux.
|
192 |
|
|
If there is sufficient interest expressed in such a conversion, then
|
193 |
|
|
consideration will be given to that task.
|
194 |
|
|
|
195 |
|
|
Status
|
196 |
|
|
------
|
197 |
|
|
|
198 |
|
|
Mature. **SMRTool** is in continous usage for a number of FPGA designs, and
|
199 |
|
|
being actively maintained.
|
200 |
|
|
|
201 |
|
|
Error Reports
|
202 |
|
|
-------------
|
203 |
|
|
|
204 |
|
|
If there are any problems found, please open a GitHub issue. Each reported
|
205 |
|
|
issue with **SMRTool** will be evaluated. In order to evaluate a problem
|
206 |
|
|
report, a description of the problem and the relevant sources are required.
|
207 |
|
|
Without both of these components of a problem report, the likelihood of any
|
208 |
|
|
significant investigation into a reported problem is a low probability.
|