|
The Memotech MTX Series |
|
PAL Reader / Decoder for
PAL14L4s
Generating the PAL Equations : Option 2
Requirements
- The PAL Reader Board
- An MTX Computer with an FDX/SDX disk drive and CP/M
- A program functionally equivalent to the part of PALRD.COM
that exercises the PAL, recording the output states for each
of the possible input states in a binary file for further
processing. (The user could also write a CP/M program that
performs the analysis of the file and produces the minimised
PAL equations, but creating this functionality is not
trivial.)
- A PC capable of running a user written binary file
processing program and a copy of Logic Friday
This page describes the use of
PALRD.BAS and Logic Friday to process
the binary file, generating a suitable input file for
Logic Friday and, optionally, processes the a
CSV output of Logic Friday to produce a
more readable text file
Note : |
PALRD.BAS is
not available for download.
The function of PALRD.BAS is
purely manipulation of the binary data file to
produce useable .CSV files, and optionally, to
format the resultant equations. With the
description of the required functionality on
this page, it should be relatively easy to
duplicate its function in a language of your
choice.
|
Minimum
Functionality for PALRD.COM (or Equivalent)
The program should first synchronously set the active low
CLR signals to low, clearing the counters,
and the CLK signal
high, generating a "0000" pattern on the counters. 16383
subsequent CLK low-high transitions (with
CLR held
high) "clock" the counter to generate each of the
possible 16384 input combinations to the PAL. After each counter
increment, the computer should read and store the state of the PAL outputs to
determine the output state for a given input combination.
The program should save 64 blocks (16kbytes) of memory to
file. Creating a binary file in this way allows the PAL to be read once only, then
replaced in its socket. The PAL program can be decoded from the
Binary at any later time on any system with the appropriate
software.
Analysing the
Binary File
PALRD.BAS (Or User Program) File Processing
The program should create a Comma Separated Value
file that will be used as the input to Logic Friday.
The first line of the .CSV file should contain the names of the
pins that will be used in the generated equations.
PALRD.BAS uses default names such as PIN1,
PIN2, etc., but also has the option for the user
to input the pin signal names from the appropriate circuit
diagram. This is useful if a PAL with identical functions is to
be read a number of times. Alternatively, the Pin names can be
added to the equations in Logic Friday, or
manually, at the end of the process.
The order of the pins should correspond to the order of the
pins in the binary file, e.g.,
|
|
|
Columns
in .CSV |
Inputs |
Outputs |
Inputs |
|
|
Pin # |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
gnd |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
vcc |
Input
States
0
to
16383 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
|
0 |
0 |
0 |
O1 |
O2 |
O3 |
O4 |
0 |
0 |
|
1 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
|
0 |
0 |
0 |
O1 |
O2 |
O3 |
O4 |
0 |
0 |
|
0 |
1 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
|
0 |
0 |
0 |
O1 |
O2 |
O3 |
O4 |
0 |
0 |
|
1 |
1 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
|
0 |
0 |
0 |
O1 |
O2 |
O3 |
O4 |
0 |
0 |
|
.. |
.. |
.. |
.. |
.. |
.. |
.. |
.. |
.. |
|
.. |
.. |
.. |
O1 |
O2 |
O3 |
O4 |
.. |
.. |
|
1 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
|
1 |
1 |
1 |
O1 |
O2 |
O3 |
O4 |
1 |
1 |
|
The .CSV file should contain 1 row for each of the possible
input states from 0 to 1638310
(111111111111112), along with
the corresponding output states read from the binary file.
Analysis using Logic Friday
The .CSV file is imported into Logic Friday and
the program generates minimised equations corresponding to the
PAL logic.
The Logic Friday output window shows the
minimised equations in a readable form, but not in the exact
format of the logic equations required to program a replacement
PAL (or GAL), e.g.,
Minimized:
PIN14 = PIN19' + PIN2 PIN6' + PIN3' PIN4' PIN5 ;
PIN15 = PIN3 PIN4' PIN7' PIN8' PIN9' PIN11' ;
PIN16 = 0;
PIN17 = PIN2' PIN3 PIN4' PIN8 ;
|
In this example, negated pins are shown as,
e.g., PIN19' instead of the more usual
/PIN19 format |
The logical OR symbol is shown as
expected, i.e., + |
Logical AND symbols are not shown,
i.e., * are missing but should be inferred where two
pins are separated by a <space>, e.g., PIN1
PIN2 is more correctly represented as
PIN1 * PIN2 |
|
A second function in PALRD.BAS
reads the .CSV file exported from Logic Friday
and formats the equations into a more readable form,
e.g., /PIN14 = /PIN19
+ PIN2 * /PIN6
+ /PIN3 * /PIN4 * PIN5
/PIN15 = PIN3 * /PIN4 * /PIN7 * /PIN8 * /PIN9 *
/PIN11
/PIN17 = /PIN2 * PIN3 * /PIN4 * PIN8
|
(In this example, Pin 16 is not used) |
|
The user program could do the same
post-processing as PALRD.BAS to
generate the logic equations in the required format,
or the user could just manipulate the format used in
Logic Friday to produce the required
format |
An Example Using
PALRD.BAS (QBASIC Program)
Start QBASIC, load
PALRD.BAS and and hit <F5>
to run the program At the "Enter filename:"
prompt, enter the name of the Input binary file,
e.g., G:\512S2, without .bin file type |
|
The program will create a CSV with
the same name and a .CSV extension The program
will then pause, waiting for confirmation that the
Logic Friday output file has been
created. |
|
Start Logic Friday and
select the "Import Truth Table..."
option from the "File" menu.
Logic
Friday will display all of the input permutations
and the resultant outputs in the in the left
hand pane. |
|
Select the "Minimize..."
option from the "Operation" menu
Choose the "Exact" mode
And ensure that "Minimise each output
independently" is selected |
|
Logic Friday will
display the minimised terms that define the outputs
Select the "Export Truth
Table..." option from the "File"
menu and select the same CSV filename as used for
the import.
Unless you want to process more files, you can
now close Logic Friday |
|
When the Logic Friday
truth table has been produced, hit <ESC>
and PALRD.BAS will read the new CSV
file and generate an .EQN file. The
.EQN file is a text file that contains
the minimised equations based on the PAL pin
numbers. |
|
By default,
PALRD.BAS uses generic names for the input
and output pins, so, for example, the .EQN
file created by reading the PAL from an MTX512S2
The .EQN file will contain output similar
to that shown below :
/PIN14 = |
PIN2 * PIN3 *
/PIN8 |
+ |
PIN2 * /PIN4 * /PIN8 * /PIN18 |
+ |
PIN3 * /PIN4 * /PIN8 * /PIN18 |
+ |
/PIN4 * /PIN8 * PIN13 *
/PIN18 |
|
|
/PIN15 = |
PIN2 * PIN3 |
+ |
/PIN7 * /PIN11 |
+ |
PIN11 * /PIN12 |
|
|
/PIN16 = |
PIN1 * /PIN2 *
/PIN3 * PIN5 *
PIN6 * /PIN8 * /PIN9 * /PIN13 * PIN19 |
+ |
PIN1 * /PIN2 * /PIN3 *
/PIN5 *
/PIN6 * /PIN8 * /PIN9 * /PIN13 * PIN19 |
|
|
/PIN17 = |
/PIN1 * /PIN2 * /PIN3 *
/PIN8 * /PIN9 * /PIN13 |
+ |
/PIN2 * /PIN3 * /PIN5 * /PIN6
* /PIN8 * /PIN9 * /PIN13 * PIN19 |
The signal names can be
determined from the appropriate circuit diagram,
e.g., for the MTX512S2 PAL :
GAL Pin |
Reference |
GAL Pin |
Reference |
1 |
A13 |
I |
20 |
(VCC) |
2 |
A14 |
I |
19 |
R0 |
I |
3 |
A15 |
I |
18 |
P3 |
I |
4 |
P2 |
I |
17 |
CEA |
O |
5 |
R1 |
I |
16 |
CE64 |
O |
6 |
R2 |
I |
15 |
MA8 |
O |
7 |
P1 |
I |
14 |
RAM |
O |
8 |
MREQL |
I |
13 |
RELCPMH |
I |
9 |
RDL |
I |
12 |
PO |
I |
10 |
(GND) |
11 |
MPX |
I |
So, for example, line 1 in the
.EQN file above translates to :
RAM = |
A14 * A15 * /MREQL |
+ |
A14 * /P2 * /MREQL * /P3 |
+ |
A15 * /P2 * /MREQL * /P3 |
+ |
/P2 * /MREQL * RELCPMH *
/P3 |
|
When analysing a single
PAL, it is not too much trouble to manually
translate the generic signal names each time.
However, if the same, or an equivalent PAL is likely
to be read more than once, there are a couple of
ways to name the signals before the .EQN
file is created.
Load PALRD.BAS and page down to
"REM Set pin names" (line 22) and edit the
default names to match the signals names from
the Memotech circuit diagram or other source
prior to running the program.
If you are likely to need to decode this PAL
again or another with the same signal names, you
can save modified file under a new name using
the <File> <Save As...>
option from the QBASIC menu
e.g.
G:\512S2.BAS
QBASIC will read the signal
names from the .CSV file exported by Logic
Friday
|
Having modified
PALRD.BAS to reflect the signal names used
in the MTX512S2 memory PAL, the program produces the
output shown
|
Required Software |
|
Program Name |
Description |
Author / Publisher |
X |
PALRD.COM |
CP/M Executable file |
Tony Brewer |
X |
PALRD.BAS |
PC Program, written in Microsoft
QBASIC |
Tony Brewer |
These programs are not available for download,
with a knowledge of Z80 assembler, QBASIC and
the description of the programs functions, you
may be able to "roll your own" |
Support Software
Downloads |
|
QBASIC.EXE V1.1 |
QBASIC Interpreter - Version 1.1
(Will need to be run inside a Virtual Machine
when used with later versions of Windows) |
Microsoft |
|
QBASIC.EXE V4.5 |
QBASIC Interpreter - Version 4.5
(I have not tried this with the PALRD program,
other than to confirm that is also needs to run
in VM under 64-Bit Windows 7) |
Microsoft |
|
Logic Friday V1.1.4 |
"Free software for boolean logic
optimization, analysis, and synthesis" (The Import
and Export CSV files need to be in a location
accessible by Logic Friday and
QBASIC) |
sontrack.com |
|