summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Scott Stone <tafoid@users.noreply.github.com>2012-09-05 22:44:28 +0000
committer Scott Stone <tafoid@users.noreply.github.com>2012-09-05 22:44:28 +0000
commitec94908b351fef1990102cf15b8766d90de130fa (patch)
treec384039540e8b1debeb69d73ddcf5c6eeb3ff3e6
parent47c42009c7548eaeb50442c4588920eb5eef3f77 (diff)
Numerous jedutil tool improvements. [Kevin Eshbach]
Made some modifications to the jedutil tool to allow the viewing of simple combinatorial jeds (adding support for registered and gals in the future) by taking a jed file and printing out human-readable equations. Changed the command line options of the jedutil tool to know take an initial argument to specify what the tool should do. For example to convert a jed to bin the command is now: jedutil –convert <source.jed> <dest.bin> jedutil –convert <source.bin> <dest.jed> To view a jed file with human-readable equations the command is jedutil –view <source.jed> <pal type> Added a simple regression test for the tool that just verifies that the currently known pals have the row and column fuse location mapped correctly and at the moment this tool runs under windows only. Under the directory src/regtests/jedutil there is a Windows Script File with the name jedtest.wsf that if run from the command line with the command “cscript jedtest.wsf” will verify that a dump of the jeds in src/regtests/jedutil/jeds matches the good dumps in src/regtests/jedutil/baseline. Reference jed files created using the tool eqn2jed which is included with Opal Jr and these files are in src/regtests/jedutil/eqns.
-rw-r--r--.gitattributes35
-rw-r--r--src/regtests/jedutil/baseline/pal10h8.txt33
-rw-r--r--src/regtests/jedutil/baseline/pal10l8.txt33
-rw-r--r--src/regtests/jedutil/baseline/pal12h6.txt29
-rw-r--r--src/regtests/jedutil/baseline/pal12l6.txt29
-rw-r--r--src/regtests/jedutil/baseline/pal14h4.txt25
-rw-r--r--src/regtests/jedutil/baseline/pal14l4.txt25
-rw-r--r--src/regtests/jedutil/baseline/pal16h2.txt21
-rw-r--r--src/regtests/jedutil/baseline/pal16l2.txt21
-rw-r--r--src/regtests/jedutil/baseline/pal16l8.txt73
-rw-r--r--src/regtests/jedutil/baseline/pal20l10.txt51
-rw-r--r--src/regtests/jedutil/baseline/pal20l8.txt73
-rw-r--r--src/regtests/jedutil/eqns/pal10h8.eqn30
-rw-r--r--src/regtests/jedutil/eqns/pal10l8.eqn30
-rw-r--r--src/regtests/jedutil/eqns/pal12h6.eqn28
-rw-r--r--src/regtests/jedutil/eqns/pal12l6.eqn28
-rw-r--r--src/regtests/jedutil/eqns/pal14h4.eqn26
-rw-r--r--src/regtests/jedutil/eqns/pal14l4.eqn26
-rw-r--r--src/regtests/jedutil/eqns/pal16h2.eqn24
-rw-r--r--src/regtests/jedutil/eqns/pal16l2.eqn24
-rw-r--r--src/regtests/jedutil/eqns/pal16l8.eqn79
-rw-r--r--src/regtests/jedutil/eqns/pal20l10.eqn56
-rw-r--r--src/regtests/jedutil/eqns/pal20l8.eqn78
-rw-r--r--src/regtests/jedutil/eqns/readme.txt1
-rw-r--r--src/regtests/jedutil/jeds/pal10h8.jed36
-rw-r--r--src/regtests/jedutil/jeds/pal10l8.jed36
-rw-r--r--src/regtests/jedutil/jeds/pal12h6.jed34
-rw-r--r--src/regtests/jedutil/jeds/pal12l6.jed34
-rw-r--r--src/regtests/jedutil/jeds/pal14h4.jed32
-rw-r--r--src/regtests/jedutil/jeds/pal14l4.jed32
-rw-r--r--src/regtests/jedutil/jeds/pal16h2.jed30
-rw-r--r--src/regtests/jedutil/jeds/pal16l2.jed30
-rw-r--r--src/regtests/jedutil/jeds/pal16l8.jed85
-rw-r--r--src/regtests/jedutil/jeds/pal20l10.jed62
-rw-r--r--src/regtests/jedutil/jeds/pal20l8.jed84
-rw-r--r--src/regtests/jedutil/jedtest.wsf209
-rw-r--r--src/tools/jedutil.c1477
37 files changed, 3032 insertions, 27 deletions
diff --git a/.gitattributes b/.gitattributes
index f7c19e97a2b..ec8b6fc39b3 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -7656,6 +7656,41 @@ src/osd/windows/winutf8.h svneol=native#text/plain
src/osd/windows/winutil.c svneol=native#text/plain
src/osd/windows/winutil.h svneol=native#text/plain
src/osd/windows/winwork.c svneol=native#text/plain
+src/regtests/jedutil/baseline/pal10h8.txt svneol=native#text/plain
+src/regtests/jedutil/baseline/pal10l8.txt svneol=native#text/plain
+src/regtests/jedutil/baseline/pal12h6.txt svneol=native#text/plain
+src/regtests/jedutil/baseline/pal12l6.txt svneol=native#text/plain
+src/regtests/jedutil/baseline/pal14h4.txt svneol=native#text/plain
+src/regtests/jedutil/baseline/pal14l4.txt svneol=native#text/plain
+src/regtests/jedutil/baseline/pal16h2.txt svneol=native#text/plain
+src/regtests/jedutil/baseline/pal16l2.txt svneol=native#text/plain
+src/regtests/jedutil/baseline/pal16l8.txt svneol=native#text/plain
+src/regtests/jedutil/baseline/pal20l10.txt svneol=native#text/plain
+src/regtests/jedutil/baseline/pal20l8.txt svneol=native#text/plain
+src/regtests/jedutil/eqns/pal10h8.eqn svneol=native#text/plain
+src/regtests/jedutil/eqns/pal10l8.eqn svneol=native#text/plain
+src/regtests/jedutil/eqns/pal12h6.eqn svneol=native#text/plain
+src/regtests/jedutil/eqns/pal12l6.eqn svneol=native#text/plain
+src/regtests/jedutil/eqns/pal14h4.eqn svneol=native#text/plain
+src/regtests/jedutil/eqns/pal14l4.eqn svneol=native#text/plain
+src/regtests/jedutil/eqns/pal16h2.eqn svneol=native#text/plain
+src/regtests/jedutil/eqns/pal16l2.eqn svneol=native#text/plain
+src/regtests/jedutil/eqns/pal16l8.eqn svneol=native#text/plain
+src/regtests/jedutil/eqns/pal20l10.eqn svneol=native#text/plain
+src/regtests/jedutil/eqns/pal20l8.eqn svneol=native#text/plain
+src/regtests/jedutil/eqns/readme.txt svneol=native#text/plain
+src/regtests/jedutil/jeds/pal10h8.jed svneol=native#text/plain
+src/regtests/jedutil/jeds/pal10l8.jed svneol=native#text/plain
+src/regtests/jedutil/jeds/pal12h6.jed svneol=native#text/plain
+src/regtests/jedutil/jeds/pal12l6.jed svneol=native#text/plain
+src/regtests/jedutil/jeds/pal14h4.jed svneol=native#text/plain
+src/regtests/jedutil/jeds/pal14l4.jed svneol=native#text/plain
+src/regtests/jedutil/jeds/pal16h2.jed svneol=native#text/plain
+src/regtests/jedutil/jeds/pal16l2.jed svneol=native#text/plain
+src/regtests/jedutil/jeds/pal16l8.jed svneol=native#text/plain
+src/regtests/jedutil/jeds/pal20l10.jed svneol=native#text/plain
+src/regtests/jedutil/jeds/pal20l8.jed svneol=native#text/plain
+src/regtests/jedutil/jedtest.wsf svneol=native#text/plain
src/tools/chdman.c svneol=native#text/plain
src/tools/jedutil.c svneol=native#text/plain
src/tools/ldresample.c svneol=native#text/plain
diff --git a/src/regtests/jedutil/baseline/pal10h8.txt b/src/regtests/jedutil/baseline/pal10h8.txt
new file mode 100644
index 00000000000..25e7c611d65
--- /dev/null
+++ b/src/regtests/jedutil/baseline/pal10h8.txt
@@ -0,0 +1,33 @@
+o12 = /i1 & i2 & i3 & i4 & i5 & i6 & i7 & i8 +
+ i9 & i11
+o12.oe = vcc
+
+o13 = i1 & /i2 & i3 & i4 & i5 & i6 & i7 & i8 +
+ /i9 & i11
+o13.oe = vcc
+
+o14 = i1 & i2 & /i3 & i4 & i5 & i6 & i7 & i8 +
+ i9 & /i11
+o14.oe = vcc
+
+o15 = i1 & i2 & i3 & /i4 & i5 & i6 & i7 & i8 +
+ /i9 & /i11
+o15.oe = vcc
+
+o16 = i1 & i2 & i3 & i4 & /i5 & i6 & i7 & i8 +
+ /i9 & /i11
+o16.oe = vcc
+
+o17 = i1 & i2 & i3 & i4 & i5 & /i6 & i7 & i8 +
+ i9 & /i11
+o17.oe = vcc
+
+o18 = i1 & i2 & i3 & i4 & i5 & i6 & /i7 & i8 +
+ /i9 & i11
+o18.oe = vcc
+
+o19 = i1 & i2 & i3 & i4 & i5 & i6 & i7 & /i8 +
+ i11
+o19.oe = vcc
+
+
diff --git a/src/regtests/jedutil/baseline/pal10l8.txt b/src/regtests/jedutil/baseline/pal10l8.txt
new file mode 100644
index 00000000000..74a47cfe5c0
--- /dev/null
+++ b/src/regtests/jedutil/baseline/pal10l8.txt
@@ -0,0 +1,33 @@
+/o12 = /i1 & i2 & i3 & i4 & i5 & i6 & i7 & i8 +
+ i9 & i11
+o12.oe = vcc
+
+/o13 = i1 & /i2 & i3 & i4 & i5 & i6 & i7 & i8 +
+ /i9 & i11
+o13.oe = vcc
+
+/o14 = i1 & i2 & /i3 & i4 & i5 & i6 & i7 & i8 +
+ i9 & /i11
+o14.oe = vcc
+
+/o15 = i1 & i2 & i3 & /i4 & i5 & i6 & i7 & i8 +
+ /i9 & /i11
+o15.oe = vcc
+
+/o16 = i1 & i2 & i3 & i4 & /i5 & i6 & i7 & i8 +
+ /i9 & /i11
+o16.oe = vcc
+
+/o17 = i1 & i2 & i3 & i4 & i5 & /i6 & i7 & i8 +
+ i9 & /i11
+o17.oe = vcc
+
+/o18 = i1 & i2 & i3 & i4 & i5 & i6 & /i7 & i8 +
+ i11
+o18.oe = vcc
+
+/o19 = i1 & i2 & i3 & i4 & i5 & i6 & i7 & /i8 +
+ /i9
+o19.oe = vcc
+
+
diff --git a/src/regtests/jedutil/baseline/pal12h6.txt b/src/regtests/jedutil/baseline/pal12h6.txt
new file mode 100644
index 00000000000..3ba3b54cc6c
--- /dev/null
+++ b/src/regtests/jedutil/baseline/pal12h6.txt
@@ -0,0 +1,29 @@
+o13 = /i1 & i2 & i3 & i4 & i5 & i6 & i7 & i8 +
+ i9 & i11 +
+ /i19 +
+ i12
+o13.oe = vcc
+
+o14 = i1 & /i2 & i3 & i4 & i5 & i6 & i7 & i8 +
+ /i9 & i11
+o14.oe = vcc
+
+o15 = i1 & i2 & i3 & /i4 & i5 & i6 & i7 & i8 +
+ /i9 & /i11
+o15.oe = vcc
+
+o16 = i1 & i2 & i3 & i4 & i5 & i6 & /i7 & i8 +
+ i9 & /i11
+o16.oe = vcc
+
+o17 = i1 & i2 & i3 & i4 & /i5 & i6 & i7 & i8 +
+ /i9 & /i11
+o17.oe = vcc
+
+o18 = i1 & i2 & i3 & i4 & i5 & /i6 & i7 & i8 +
+ /i9 & i11 +
+ i19 +
+ /i12
+o18.oe = vcc
+
+
diff --git a/src/regtests/jedutil/baseline/pal12l6.txt b/src/regtests/jedutil/baseline/pal12l6.txt
new file mode 100644
index 00000000000..1ad002f171b
--- /dev/null
+++ b/src/regtests/jedutil/baseline/pal12l6.txt
@@ -0,0 +1,29 @@
+/o13 = /i1 & i2 & i3 & i4 & i5 & i6 & i7 & i8 +
+ i9 & i11 +
+ /i19 +
+ i12
+o13.oe = vcc
+
+/o14 = i1 & /i2 & i3 & i4 & i5 & i6 & i7 & i8 +
+ /i9 & i11
+o14.oe = vcc
+
+/o15 = i1 & i2 & /i3 & i4 & i5 & i6 & i7 & i8 +
+ i9 & i11
+o15.oe = vcc
+
+/o16 = i1 & i2 & i3 & /i4 & i5 & i6 & i7 & i8 +
+ /i9 & /i11
+o16.oe = vcc
+
+/o17 = i1 & i2 & i3 & i4 & /i5 & i6 & i7 & i8 +
+ /i9 & /i11
+o17.oe = vcc
+
+/o18 = i1 & i2 & i3 & i4 & i5 & /i6 & i7 & i8 +
+ /i9 & i11 +
+ i19 +
+ /i12
+o18.oe = vcc
+
+
diff --git a/src/regtests/jedutil/baseline/pal14h4.txt b/src/regtests/jedutil/baseline/pal14h4.txt
new file mode 100644
index 00000000000..7e3c7cb05bd
--- /dev/null
+++ b/src/regtests/jedutil/baseline/pal14h4.txt
@@ -0,0 +1,25 @@
+o14 = /i1 & i2 & i3 & i4 & i5 & i6 & i7 & i8 +
+ i9 & i11 +
+ /i12 & /i13 +
+ i18 & /i19
+o14.oe = vcc
+
+o15 = i1 & /i2 & i3 & i4 & i5 & i6 & i7 & i8 +
+ i9 & /i11 +
+ i12 & i13 +
+ /i18 & i19
+o15.oe = vcc
+
+o16 = i1 & i2 & /i3 & i4 & i5 & i6 & i7 & i8 +
+ /i9 & i11 +
+ i12 & /i13 +
+ /i18 & /i19
+o16.oe = vcc
+
+o17 = i1 & i2 & i3 & /i4 & i5 & i6 & i7 & i8 +
+ i9 & i11 +
+ /i12 & i13 +
+ i18 & i19
+o17.oe = vcc
+
+
diff --git a/src/regtests/jedutil/baseline/pal14l4.txt b/src/regtests/jedutil/baseline/pal14l4.txt
new file mode 100644
index 00000000000..26b9cc817b1
--- /dev/null
+++ b/src/regtests/jedutil/baseline/pal14l4.txt
@@ -0,0 +1,25 @@
+/o14 = i1 & /i2 & i3 & i4 & i5 & i6 & i7 & i8 +
+ /i9 & i11 +
+ i12 & /i13 +
+ i18 & i19
+o14.oe = vcc
+
+/o15 = i1 & i2 & i3 & /i4 & i5 & i6 & i7 & i8 +
+ /i9 & /i11 +
+ /i12 & i13 +
+ /i18 & i19
+o15.oe = vcc
+
+/o16 = i1 & i2 & i3 & i4 & /i5 & i6 & i7 & i8 +
+ /i9 & /i11 +
+ i12 & i13 +
+ i18 & /i19
+o16.oe = vcc
+
+/o17 = i1 & i2 & i3 & i4 & i5 & /i6 & i7 & i8 +
+ /i9 & i11 +
+ /i12 & /i13 +
+ /i18 & /i19
+o17.oe = vcc
+
+
diff --git a/src/regtests/jedutil/baseline/pal16h2.txt b/src/regtests/jedutil/baseline/pal16h2.txt
new file mode 100644
index 00000000000..ab5aa6656ee
--- /dev/null
+++ b/src/regtests/jedutil/baseline/pal16h2.txt
@@ -0,0 +1,21 @@
+o15 = i1 & i2 & i3 & /i4 & i5 & /i6 & i7 & i8 +
+ i9 +
+ /i11 +
+ i12 +
+ /i13 +
+ i14 +
+ /i17 +
+ i18 & /i19
+o15.oe = vcc
+
+o16 = i1 & i2 & /i3 & i4 & /i5 & i6 & i7 & i8 +
+ /i9 +
+ i11 +
+ /i12 +
+ i13 +
+ /i14 +
+ i17 +
+ /i18 & i19
+o16.oe = vcc
+
+
diff --git a/src/regtests/jedutil/baseline/pal16l2.txt b/src/regtests/jedutil/baseline/pal16l2.txt
new file mode 100644
index 00000000000..7db39f9fe3e
--- /dev/null
+++ b/src/regtests/jedutil/baseline/pal16l2.txt
@@ -0,0 +1,21 @@
+/o15 = i1 & i2 & i3 & /i4 & i5 & i6 & i7 & i8 +
+ /i9 +
+ /i11 +
+ /i12 +
+ i13 +
+ i14 +
+ i17 +
+ i18 & i19
+o15.oe = vcc
+
+/o16 = i1 & i2 & i3 & i4 & i5 & i6 & /i7 & i8 +
+ i9 +
+ i11 +
+ i12 +
+ /i13 +
+ /i14 +
+ /i17 +
+ /i18 & /i19
+o16.oe = vcc
+
+
diff --git a/src/regtests/jedutil/baseline/pal16l8.txt b/src/regtests/jedutil/baseline/pal16l8.txt
new file mode 100644
index 00000000000..e591b1004eb
--- /dev/null
+++ b/src/regtests/jedutil/baseline/pal16l8.txt
@@ -0,0 +1,73 @@
+/o12 = i3 & i7 & /i9 +
+ i1 & o13 +
+ i3 +
+ /i6 +
+ i8 +
+ /i9 +
+ i7 & /o13
+o12.oe = vcc
+
+/o13 = i11 & /o14 +
+ /i9 +
+ i8 +
+ /i7 +
+ /i6 & o14 +
+ i5 +
+ i4
+o13.oe = i2 & o14
+
+/o14 = i1 & /o15 +
+ /i8 +
+ i1 & /i8 +
+ i1 & /i2 & /o15 +
+ /i2 +
+ i2 & /i8 & o15 +
+ i3
+o14.oe = vcc
+
+/o15 = i3 & i6 & i7 & /i11 +
+ i6 & o16 +
+ i3 & /o16 +
+ i7 +
+ /i11 +
+ i6 & i7 +
+ i7 & /i11
+o15.oe = vcc
+
+/o16 = /i3 & /o17 +
+ /i4 & /i11 +
+ /i3 & /i4 +
+ /i3 & i4 +
+ /i7 & o17 +
+ /i7 & /i11 +
+ i4
+o16.oe = vcc
+
+/o17 = i2 & i5 & i6 & /i7 +
+ i2 & /o18 +
+ i5 +
+ i6 +
+ /i7 & o18 +
+ i2 & /i7 +
+ i5 & i6
+o17.oe = /o16
+
+/o18 = /i2 & i5 & i6 & /i7 +
+ i3 & i6 & i7 & i11 +
+ i3 +
+ /i2 & /i7 +
+ i3 & i11 +
+ i5 & i6 & /i7 +
+ i7 & i11
+o18.oe = vcc
+
+/o19 = i5 & i6 & /i7 & i11 +
+ i3 & i6 & i7 +
+ i5 +
+ i6 +
+ i7 +
+ i11 +
+ /i7
+o19.oe = vcc
+
+
diff --git a/src/regtests/jedutil/baseline/pal20l10.txt b/src/regtests/jedutil/baseline/pal20l10.txt
new file mode 100644
index 00000000000..20292efa87c
--- /dev/null
+++ b/src/regtests/jedutil/baseline/pal20l10.txt
@@ -0,0 +1,51 @@
+/o14 = /i11 +
+ i10 +
+ i9 & /o15
+o14.oe = o15
+
+/o15 = /i1 & i2 & /i3 & i4 & i11 +
+ /i1 & i2 & /i3 & /i5 & /i13 & o16 +
+ /i1 & i2 & /i3 & i6
+o15.oe = /o16
+
+/o16 = i1 & /i2 & /o17 +
+ i3 & /i4 +
+ i3 & i9 & o17
+o16.oe = vcc
+
+/o17 = /o18 +
+ i10 & o18 +
+ i9
+o17.oe = i4 & i5
+
+/o18 = i1 & /i2 & i3 & /i4 & /i8 +
+ /i6 & i7 & i8 & i9 & i10 & /o19 +
+ i1 & i2 & i3 & /i4 & /i5 & o19
+o18.oe = i1 & i10
+
+/o19 = i11 & o20 +
+ i2 & /i10 +
+ i9 & i11
+o19.oe = i8 & /o20
+
+/o20 = o21 +
+ /i6 +
+ /i7 & /o21
+o20.oe = vcc
+
+/o21 = i1 & i8 +
+ /i4 & /o22 +
+ o22
+o21.oe = i5 & i6
+
+/o22 = i1 & /i8 +
+ /i8 +
+ i1
+o22.oe = i3 & /i7
+
+/o23 = i7 +
+ i11 +
+ /i13
+o23.oe = vcc
+
+
diff --git a/src/regtests/jedutil/baseline/pal20l8.txt b/src/regtests/jedutil/baseline/pal20l8.txt
new file mode 100644
index 00000000000..5a824490618
--- /dev/null
+++ b/src/regtests/jedutil/baseline/pal20l8.txt
@@ -0,0 +1,73 @@
+/o15 = /i1 & i2 & /i3 & i4 & i11 +
+ /i1 & i2 & /i3 & /i5 & /i13 +
+ /i1 & i2 & /i3 & i6 & i14 +
+ /i1 & i2 & /i3 & /i7 & /i23 +
+ /i1 & i2 & /i3 & i8 & /i11 +
+ /i1 & i2 & /i3 & /i9 & i13 +
+ /o16
+o15.oe = o16
+
+/o16 = i1 & /i2 & /o17 +
+ i3 & /i4 +
+ i5 & /i6 +
+ i7 & /i8 +
+ i3 & i9 & o17 +
+ i1 & /i2 & i3 & /i4 & i5 & /i6 & i7 & /i8 & /i9 +
+ /i8 & /i9
+o16.oe = vcc
+
+/o17 = /o18 & /i23 +
+ i10 & o18 +
+ i9 +
+ i8 +
+ /i7 +
+ /i6 +
+ i5
+o17.oe = i4 & i5
+
+/o18 = i1 & /i2 & i3 & /i4 & /i8 & i23 +
+ i1 & i2 & i3 & /i4 & /i5 +
+ /i6 & i7 & i8 & i9 & i10 & /o19 +
+ i11 & i13 & i14 & i23 +
+ /i6 & i7 & i8 & i9 & i10 +
+ i3 & i13 & i14 & i23 +
+ i1 & i2 & i3 & /i4 & /i5 & o19
+o18.oe = i1 & i10 & i23
+
+/o19 = i9 & /i10 & i11 & i23 +
+ i9 +
+ /i10 +
+ i11 & o20 +
+ i23 +
+ i2 & /i10 & i23 +
+ i9 & i11
+o19.oe = i8 & /o20
+
+/o20 = o21 +
+ /i2 +
+ /i3 +
+ /i4 +
+ /i5 +
+ /i6 +
+ /i7 & /o21
+o20.oe = vcc
+
+/o21 = i1 & i8 +
+ /i14 +
+ i1 & /i5 & i8 +
+ i23 +
+ i1 & i8 & /i14 +
+ i13 +
+ i1 & i11
+o21.oe = i5 & i6
+
+/o22 = i1 & /i8 +
+ /i8 +
+ i1 +
+ /i10 +
+ /i23 +
+ i8 & /i13 +
+ /i11
+o22.oe = i3 & /i7
+
+
diff --git a/src/regtests/jedutil/eqns/pal10h8.eqn b/src/regtests/jedutil/eqns/pal10h8.eqn
new file mode 100644
index 00000000000..690cdcf090a
--- /dev/null
+++ b/src/regtests/jedutil/eqns/pal10h8.eqn
@@ -0,0 +1,30 @@
+chip 2000 PAL10H8
+
+i1=1 i2=2 i3=3 i4=4 i5=5 i6=6 i7=7 i8=8 i9=9 GND=10 i11=11
+o12=12 o13=13 o14=14 o15=15 o16=16 o17=17 o18=18 o19=19 VCC=20
+
+equations
+
+o12 = /i1 & i2 & i3 & i4 & i5 & i6 & i7 & i8 +
+ i9 & i11
+
+o13 = i1 & /i2 & i3 & i4 & i5 & i6 & i7 & i8 +
+ /i9 & i11
+
+o14 = i1 & i2 & /i3 & i4 & i5 & i6 & i7 & i8 +
+ i9 & /i11
+
+o15 = i1 & i2 & i3 & /i4 & i5 & i6 & i7 & i8 +
+ /i9 & /i11
+
+o16 = i1 & i2 & i3 & i4 & /i5 & i6 & i7 & i8 +
+ /i9 & /i11
+
+o17 = i1 & i2 & i3 & i4 & i5 & /i6 & i7 & i8 +
+ i9 & /i11
+
+o18 = i1 & i2 & i3 & i4 & i5 & i6 & /i7 & i8 +
+ /i9 & i11
+
+o19 = i1 & i2 & i3 & i4 & i5 & i6 & i7 & /i8 +
+ i11
diff --git a/src/regtests/jedutil/eqns/pal10l8.eqn b/src/regtests/jedutil/eqns/pal10l8.eqn
new file mode 100644
index 00000000000..b316ec32d26
--- /dev/null
+++ b/src/regtests/jedutil/eqns/pal10l8.eqn
@@ -0,0 +1,30 @@
+chip 2000 PAL10L8
+
+i1=1 i2=2 i3=3 i4=4 i5=5 i6=6 i7=7 i8=8 i9=9 GND=10 i11=11
+o12=12 o13=13 o14=14 o15=15 o16=16 o17=17 o18=18 o19=19 VCC=20
+
+equations
+
+/o12 = /i1 & i2 & i3 & i4 & i5 & i6 & i7 & i8 +
+ i9 & i11
+
+/o13 = i1 & /i2 & i3 & i4 & i5 & i6 & i7 & i8 +
+ /i9 & i11
+
+/o14 = i1 & i2 & /i3 & i4 & i5 & i6 & i7 & i8 +
+ i9 & /i11
+
+/o15 = i1 & i2 & i3 & /i4 & i5 & i6 & i7 & i8 +
+ /i9 & /i11
+
+/o16 = i1 & i2 & i3 & i4 & /i5 & i6 & i7 & i8 +
+ /i9 & /i11
+
+/o17 = i1 & i2 & i3 & i4 & i5 & /i6 & i7 & i8 +
+ i9 & /i11
+
+/o18 = i1 & i2 & i3 & i4 & i5 & i6 & /i7 & i8 +
+ i11
+
+/o19 = i1 & i2 & i3 & i4 & i5 & i6 & i7 & /i8 +
+ /i9
diff --git a/src/regtests/jedutil/eqns/pal12h6.eqn b/src/regtests/jedutil/eqns/pal12h6.eqn
new file mode 100644
index 00000000000..43b72ca6dc3
--- /dev/null
+++ b/src/regtests/jedutil/eqns/pal12h6.eqn
@@ -0,0 +1,28 @@
+chip 2000 PAL12H6
+
+i1=1 i2=2 i3=3 i4=4 i5=5 i6=6 i7=7 i8=8 i9=9 GND=10 i11=11
+i12=12 o13=13 o14=14 o15=15 o16=16 o17=17 o18=18 i19=19 VCC=20
+
+equations
+
+o13 = /i1 & i2 & i3 & i4 & i5 & i6 & i7 & i8 +
+ i9 & i11 +
+ /i19 +
+ i12
+
+o14 = i1 & /i2 & i3 & i4 & i5 & i6 & i7 & i8 +
+ /i9 & i11
+
+o15 = i1 & i2 & i3 & /i4 & i5 & i6 & i7 & i8 +
+ /i9 & /i11
+
+o16 = i1 & i2 & i3 & i4 & i5 & i6 & /i7 & i8 +
+ i9 & /i11
+
+o17 = i1 & i2 & i3 & i4 & /i5 & i6 & i7 & i8 +
+ /i9 & /i11
+
+o18 = i1 & i2 & i3 & i4 & i5 & /i6 & i7 & i8 +
+ /i9 & i11 +
+ i19 +
+ /i12
diff --git a/src/regtests/jedutil/eqns/pal12l6.eqn b/src/regtests/jedutil/eqns/pal12l6.eqn
new file mode 100644
index 00000000000..a1867dd827a
--- /dev/null
+++ b/src/regtests/jedutil/eqns/pal12l6.eqn
@@ -0,0 +1,28 @@
+chip 2000 PAL12L6
+
+i1=1 i2=2 i3=3 i4=4 i5=5 i6=6 i7=7 i8=8 i9=9 GND=10 i11=11
+i12=12 o13=13 o14=14 o15=15 o16=16 o17=17 o18=18 i19=19 VCC=20
+
+equations
+
+/o13 = /i1 & i2 & i3 & i4 & i5 & i6 & i7 & i8 +
+ i9 & i11 +
+ /i19 +
+ i12
+
+/o14 = i1 & /i2 & i3 & i4 & i5 & i6 & i7 & i8 +
+ /i9 & i11
+
+/o15 = i1 & i2 & /i3 & i4 & i5 & i6 & i7 & i8 +
+ i9 & i11
+
+/o16 = i1 & i2 & i3 & /i4 & i5 & i6 & i7 & i8 +
+ /i9 & /i11
+
+/o17 = i1 & i2 & i3 & i4 & /i5 & i6 & i7 & i8 +
+ /i9 & /i11
+
+/o18 = i1 & i2 & i3 & i4 & i5 & /i6 & i7 & i8 +
+ /i9 & i11 +
+ i19 +
+ /i12
diff --git a/src/regtests/jedutil/eqns/pal14h4.eqn b/src/regtests/jedutil/eqns/pal14h4.eqn
new file mode 100644
index 00000000000..7db1b42ee27
--- /dev/null
+++ b/src/regtests/jedutil/eqns/pal14h4.eqn
@@ -0,0 +1,26 @@
+chip 2000 PAL14H4
+
+i1=1 i2=2 i3=3 i4=4 i5=5 i6=6 i7=7 i8=8 i9=9 GND=10 i11=11
+i12=12 i13=13 o14=14 o15=15 o16=16 o17=17 i18=18 i19=19 VCC=20
+
+equations
+
+o14 = /i1 & i2 & i3 & i4 & i5 & i6 & i7 & i8 +
+ i9 & i11 +
+ /i12 & /i13 +
+ i18 & /i19
+
+o15 = i1 & /i2 & i3 & i4 & i5 & i6 & i7 & i8 +
+ i9 & /i11 +
+ i12 & i13 +
+ /i18 & i19
+
+o16 = i1 & i2 & /i3 & i4 & i5 & i6 & i7 & i8 +
+ /i9 & i11 +
+ i12 & /i13 +
+ /i18 & /i19
+
+o17 = i1 & i2 & i3 & /i4 & i5 & i6 & i7 & i8 +
+ i9 & i11 +
+ /i12 & i13 +
+ i18 & i19
diff --git a/src/regtests/jedutil/eqns/pal14l4.eqn b/src/regtests/jedutil/eqns/pal14l4.eqn
new file mode 100644
index 00000000000..0e63b68c612
--- /dev/null
+++ b/src/regtests/jedutil/eqns/pal14l4.eqn
@@ -0,0 +1,26 @@
+chip 2000 PAL14L4
+
+i1=1 i2=2 i3=3 i4=4 i5=5 i6=6 i7=7 i8=8 i9=9 GND=10 i11=11
+i12=12 i13=13 o14=14 o15=15 o16=16 o17=17 i18=18 i19=19 VCC=20
+
+equations
+
+/o14 = i1 & /i2 & i3 & i4 & i5 & i6 & i7 & i8 +
+ /i9 & i11 +
+ i12 & /i13 +
+ i18 & i19
+
+/o15 = i1 & i2 & i3 & /i4 & i5 & i6 & i7 & i8 +
+ /i9 & /i11 +
+ /i12 & i13 +
+ /i18 & i19
+
+/o16 = i1 & i2 & i3 & i4 & /i5 & i6 & i7 & i8 +
+ /i9 & /i11 +
+ i12 & i13 +
+ i18 & /i19
+
+/o17 = i1 & i2 & i3 & i4 & i5 & /i6 & i7 & i8 +
+ /i9 & i11 +
+ /i12 & /i13 +
+ /i18 & /i19
diff --git a/src/regtests/jedutil/eqns/pal16h2.eqn b/src/regtests/jedutil/eqns/pal16h2.eqn
new file mode 100644
index 00000000000..cd597b209c2
--- /dev/null
+++ b/src/regtests/jedutil/eqns/pal16h2.eqn
@@ -0,0 +1,24 @@
+chip 2000 PAL16H2
+
+i1=1 i2=2 i3=3 i4=4 i5=5 i6=6 i7=7 i8=8 i9=9 GND=10 i11=11
+i12=12 i13=13 i14=14 o15=15 o16=16 i17=17 i18=18 i19=19 VCC=20
+
+equations
+
+o15 = i1 & i2 & i3 & /i4 & i5 & /i6 & i7 & i8 +
+ i9 +
+ /i11 +
+ i12 +
+ /i13 +
+ i14 +
+ /i17 +
+ i18 & /i19
+
+o16 = i1 & i2 & /i3 & i4 & /i5 & i6 & i7 & i8 +
+ /i9 +
+ i11 +
+ /i12 +
+ i13 +
+ /i14 +
+ i17 +
+ /i18 & i19
diff --git a/src/regtests/jedutil/eqns/pal16l2.eqn b/src/regtests/jedutil/eqns/pal16l2.eqn
new file mode 100644
index 00000000000..d68a83e9173
--- /dev/null
+++ b/src/regtests/jedutil/eqns/pal16l2.eqn
@@ -0,0 +1,24 @@
+chip 2000 PAL16L2
+
+i1=1 i2=2 i3=3 i4=4 i5=5 i6=6 i7=7 i8=8 i9=9 GND=10 i11=11
+i12=12 i13=13 i14=14 o15=15 o16=16 i17=17 i18=18 i19=19 VCC=20
+
+equations
+
+/o15 = i1 & i2 & i3 & /i4 & i5 & i6 & i7 & i8 +
+ /i9 +
+ /i11 +
+ /i12 +
+ i13 +
+ i14 +
+ i17 +
+ i18 & i19
+
+/o16 = i1 & i2 & i3 & i4 & i5 & i6 & /i7 & i8 +
+ i9 +
+ i11 +
+ i12 +
+ /i13 +
+ /i14 +
+ /i17 +
+ /i18 & /i19
diff --git a/src/regtests/jedutil/eqns/pal16l8.eqn b/src/regtests/jedutil/eqns/pal16l8.eqn
new file mode 100644
index 00000000000..6daddee92dd
--- /dev/null
+++ b/src/regtests/jedutil/eqns/pal16l8.eqn
@@ -0,0 +1,79 @@
+md
+chip 2000 PAL16L8
+
+i1=1 i2=2 i3=3 i4=4 i5=5 i6=6 i7=7 i8=8 i9=9 GND=10
+i11=11 o12=12 o13=13 o14=14 o15=15 o16=16 o17=17 o18=18 o19=19 VCC=20
+
+equations
+
+/o12 = i3 & i7 & /i9 +
+ i1 & o13 +
+ i3 +
+ /i6 +
+ i8 +
+ /i9 +
+ i7 & /o13
+o12.oe = vcc
+
+/o13 = i11 & /o14 +
+ /i9 +
+ i8 +
+ /i7 +
+ /i6 & o14 +
+ i5 +
+ i4
+o13.oe = i2 & o14
+
+/o14 = i1 & /o15 +
+ /i8 +
+ i1 & /i8 +
+ i1 & /i2 & /o15 +
+ /i2 +
+ i2 & /i8 & o15 +
+ i3
+o14.oe = vcc
+
+/o15 = i3 & i6 & i7 & /i11 +
+ i6 & o16 +
+ i3 & /o16 +
+ i7 +
+ /i11 +
+ i6 & i7 +
+ i7 & /i11
+o15.oe = vcc
+
+/o16 = /i3 & /o17 +
+ /i4 & /i11 +
+ /i4 & /i3 +
+ /i3 & i4 +
+ /i7 & o17 +
+ /i7 & /i11 +
+ i4
+o16.oe = vcc
+
+/o17 = i2 & i5 & i6 & /i7 +
+ i2 & /o18 +
+ i5 +
+ i6 +
+ /i7 & o18 +
+ i2 & /i7 +
+ i5 & i6
+o17.oe = /o16
+
+/o18 = /i2 & i5 & i6 & /i7 +
+ i3 & i6 & i7 & i11 +
+ i3 +
+ /i2 & /i7 +
+ i3 & i11 +
+ i5 & i6 & /i7 +
+ i7 & i11
+o18.oe = vcc
+
+/o19 = i5 & i6 & /i7 & i11 +
+ i3 & i6 & i7 +
+ i5 +
+ i6 +
+ i7 +
+ i11 +
+ /i7
+o19.oe = vcc
diff --git a/src/regtests/jedutil/eqns/pal20l10.eqn b/src/regtests/jedutil/eqns/pal20l10.eqn
new file mode 100644
index 00000000000..d6639bdf9f4
--- /dev/null
+++ b/src/regtests/jedutil/eqns/pal20l10.eqn
@@ -0,0 +1,56 @@
+chip 2000 PAL20L10
+
+i1=1 i2=2 i3=3 i4=4 i5=5 i6=6 i7=7 i8=8 i9=9 i10=10 i11=11 GND=12
+i13=13 o14=14 o15=15 o16=16 o17=17 o18=18 o19=19 o20=20 o21=21 o22=22 o23=23 VCC=24
+
+equations
+
+/o14 = /i11 +
+ i10 +
+ i9 & /o15
+o14.oe = o15
+
+/o15 = /i1 & i2 & /i3 & i4 & i11 +
+ /i1 & i2 & /i3 & /i5 & /i13 & o16 +
+ /i1 & i2 & /i3 & i6
+o15.oe = /o16
+
+/o16 = i1 & /i2 & /o17 +
+ i3 & /i4 +
+ i3 & i9 & o17
+o16.oe = vcc
+
+/o17 = /o18 +
+ i10 & o18 +
+ i9
+o17.oe = i4 & i5
+
+/o18 = i1 & /i2 & i3 & /i4 & /i8 +
+ /i6 & i7 & i8 & i9 & i10 & /o19 +
+ i1 & i2 & i3 & /i4 & /i5 & o19
+o18.oe = i1 & i10
+
+/o19 = i11 & o20 +
+ i2 & /i10 +
+ i9 & i11
+o19.oe = i8 & /o20
+
+/o20 = o21 +
+ /i6 +
+ /i7 & /o21
+o20.oe = vcc
+
+/o21 = i1 & i8 +
+ /i4 & /o22 +
+ o22
+o21.oe = i5 & i6
+
+/o22 = i1 & /i8 +
+ /i8 +
+ i1
+o22.oe = i3 & /i7
+
+/o23 = i7 +
+ i11 +
+ /i13
+o23.oe = vcc
diff --git a/src/regtests/jedutil/eqns/pal20l8.eqn b/src/regtests/jedutil/eqns/pal20l8.eqn
new file mode 100644
index 00000000000..f7280b6150f
--- /dev/null
+++ b/src/regtests/jedutil/eqns/pal20l8.eqn
@@ -0,0 +1,78 @@
+chip 2000 PAL20L8
+
+i1=1 i2=2 i3=3 i4=4 i5=5 i6=6 i7=7 i8=8 i9=9 i10=10 i11=11 GND=12
+i13=13 i14=14 o15=15 o16=16 o17=17 o18=18 o19=19 o20=20 o21=21 o22=22 i23=23 VCC=24
+
+equations
+
+/o15 = /i1 & i2 & /i3 & i4 & i11 +
+ /i1 & i2 & /i3 & /i5 & /i13 +
+ /i1 & i2 & /i3 & i6 & i14 +
+ /i1 & i2 & /i3 & /i7 & /i23 +
+ /i1 & i2 & /i3 & i8 & /i11 +
+ /i1 & i2 & /i3 & /i9 & i13 +
+ /o16
+o15.oe = o16
+
+/o16 = i1 & /i2 & /o17 +
+ i3 & /i4 +
+ i5 & /i6 +
+ i7 & /i8 +
+ i3 & i9 & o17 +
+ i1 & /i2 & i3 & /i4 & i5 & /i6 & i7 & /i8 & /i9 +
+ /i8 & /i9
+o16.oe = vcc
+
+/o17 = /i23 & /o18 +
+ i10 & o18 +
+ i9 +
+ i8 +
+ /i7 +
+ /i6 +
+ i5
+o17.oe = i4 & i5
+
+/o18 = i1 & /i2 & i3 & /i4 & /i8 & i23 +
+ i1 & i2 & i3 & /i4 & /i5 +
+ /i6 & i7 & i8 & i9 & i10 & /o19 +
+ i11 & i13 & i14 & i23 +
+ /i6 & i7 & i8 & i9 & i10 +
+ i3 & i13 & i14 & i23 +
+ i1 & i2 & i3 & /i4 & /i5 & o19
+o18.oe = i1 & i10 & i23
+
+/o19 = i9 & /i10 & i11 & i23 +
+ i9 +
+ /i10 +
+ i11 & o20 +
+ i23 +
+ i2 & /i10 & i23 +
+ i9 & i11
+o19.oe = i8 & /o20
+
+/o20 = o21 +
+ /i2 +
+ /i3 +
+ /i4 +
+ /i5 +
+ /i6 +
+ /i7 & /o21
+o20.oe = vcc
+
+/o21 = i1 & i8 +
+ /i14 +
+ i1 & /i5 & i8 +
+ i23 +
+ i1 & i8 & /i14 +
+ i13 +
+ i1 & i11
+o21.oe = i5 & i6
+
+/o22 = i1 & /i8 +
+ /i8 +
+ i1 +
+ /i10 +
+ /i23 +
+ i8 & /i13 +
+ /i11
+o22.oe = i3 & /i7
diff --git a/src/regtests/jedutil/eqns/readme.txt b/src/regtests/jedutil/eqns/readme.txt
new file mode 100644
index 00000000000..94dcdf6ab46
--- /dev/null
+++ b/src/regtests/jedutil/eqns/readme.txt
@@ -0,0 +1 @@
+This files are for use with the utility eqn2jed which is a tool included with Opal Jr. The tools takes this equation files and automatically creates a jed file.
diff --git a/src/regtests/jedutil/jeds/pal10h8.jed b/src/regtests/jedutil/jeds/pal10h8.jed
new file mode 100644
index 00000000000..96ffb7005dc
--- /dev/null
+++ b/src/regtests/jedutil/jeds/pal10h8.jed
@@ -0,0 +1,36 @@
+
+PAL10H8
+EQN2JED - Boolean Equations to JEDEC file assembler (Version V101)
+Copyright (c) National Semiconductor Corporation 1990-1993
+Assembled from "pal10h8.eqn". Date: 8-27-112
+*
+NOTE PINS i1:1 i2:2 i3:3 i4:4 i5:5 i6:6 i7:7 i8:8 i9:9 GND:10*
+NOTE PINS i11:11 o12:12 o13:13 o14:14 o15:15 o16:16 o17:17 o18:18*
+NOTE PINS o19:19 VCC:20*
+QF0320*QP20*F0*
+L0000
+01010101010101101111
+11111111111111111101*
+L0040
+01010101010110011111
+11111111111111111001*
+L0080
+01010101011001011111
+11111111111111110110*
+L0120
+01010101100101011111
+11111111111111111010*
+L0160
+01010110010101011111
+11111111111111111010*
+L0200
+01011001010101011111
+11111111111111110110*
+L0240
+10010101010101011111
+11111111111111111001*
+L0280
+01100101010101011111
+11111111111111110101*
+C1E2E*
+0000
diff --git a/src/regtests/jedutil/jeds/pal10l8.jed b/src/regtests/jedutil/jeds/pal10l8.jed
new file mode 100644
index 00000000000..a5293c4e893
--- /dev/null
+++ b/src/regtests/jedutil/jeds/pal10l8.jed
@@ -0,0 +1,36 @@
+
+PAL10L8
+EQN2JED - Boolean Equations to JEDEC file assembler (Version V101)
+Copyright (c) National Semiconductor Corporation 1990-1993
+Assembled from "pal10l8.eqn". Date: 8-27-112
+*
+NOTE PINS i1:1 i2:2 i3:3 i4:4 i5:5 i6:6 i7:7 i8:8 i9:9 GND:10*
+NOTE PINS i11:11 o12:12 o13:13 o14:14 o15:15 o16:16 o17:17 o18:18*
+NOTE PINS o19:19 VCC:20*
+QF0320*QP20*F0*
+L0000
+01010101010101101111
+11111111111111111011*
+L0040
+01010101010110011111
+11111111111111111101*
+L0080
+01010101011001011111
+11111111111111110110*
+L0120
+01010101100101011111
+11111111111111111010*
+L0160
+01010110010101011111
+11111111111111111010*
+L0200
+01011001010101011111
+11111111111111110110*
+L0240
+10010101010101011111
+11111111111111111001*
+L0280
+01100101010101011111
+11111111111111110101*
+C1E6E*
+0000
diff --git a/src/regtests/jedutil/jeds/pal12h6.jed b/src/regtests/jedutil/jeds/pal12h6.jed
new file mode 100644
index 00000000000..b6b3948455c
--- /dev/null
+++ b/src/regtests/jedutil/jeds/pal12h6.jed
@@ -0,0 +1,34 @@
+
+PAL12H6
+EQN2JED - Boolean Equations to JEDEC file assembler (Version V101)
+Copyright (c) National Semiconductor Corporation 1990-1993
+Assembled from "pal12h6.eqn". Date: 8-27-112
+*
+NOTE PINS i1:1 i2:2 i3:3 i4:4 i5:5 i6:6 i7:7 i8:8 i9:9 GND:10*
+NOTE PINS i11:11 i12:12 o13:13 o14:14 o15:15 o16:16 o17:17 o18:18*
+NOTE PINS i19:19 VCC:20*
+QF0384*QP20*F0*
+L0000
+010101110101100101111111
+111111111111111111111001
+111111011111111111111111
+111111111111111111101111*
+L0096
+010101110110010101111111
+111111111111111111111010*
+L0144
+010101110101011001111111
+111111111111111111110110*
+L0192
+010101111001010101111111
+111111111111111111111010*
+L0240
+100101110101010101111111
+111111111111111111111001*
+L0288
+011001110101010101111111
+111111111111111111110101
+111111101111111111111111
+111111111111111111011111*
+C2948*
+0000
diff --git a/src/regtests/jedutil/jeds/pal12l6.jed b/src/regtests/jedutil/jeds/pal12l6.jed
new file mode 100644
index 00000000000..58a6cecf02f
--- /dev/null
+++ b/src/regtests/jedutil/jeds/pal12l6.jed
@@ -0,0 +1,34 @@
+
+PAL12L6
+EQN2JED - Boolean Equations to JEDEC file assembler (Version V101)
+Copyright (c) National Semiconductor Corporation 1990-1993
+Assembled from "pal12l6.eqn". Date: 8-27-112
+*
+NOTE PINS i1:1 i2:2 i3:3 i4:4 i5:5 i6:6 i7:7 i8:8 i9:9 GND:10*
+NOTE PINS i11:11 i12:12 o13:13 o14:14 o15:15 o16:16 o17:17 o18:18*
+NOTE PINS i19:19 VCC:20*
+QF0384*QP20*F0*
+L0000
+010101110101100101111111
+111111111111111111111001
+111111011111111111111111
+111111111111111111101111*
+L0096
+010101110110010101111111
+111111111111111111111010*
+L0144
+010101111001010101111111
+111111111111111111111010*
+L0192
+010110110101010101111111
+111111111111111111110101*
+L0240
+100101110101010101111111
+111111111111111111111001*
+L0288
+011001110101010101111111
+111111111111111111110101
+111111101111111111111111
+111111111111111111011111*
+C29B8*
+0000
diff --git a/src/regtests/jedutil/jeds/pal14h4.jed b/src/regtests/jedutil/jeds/pal14h4.jed
new file mode 100644
index 00000000000..f673ba3d820
--- /dev/null
+++ b/src/regtests/jedutil/jeds/pal14h4.jed
@@ -0,0 +1,32 @@
+
+PAL14H4
+EQN2JED - Boolean Equations to JEDEC file assembler (Version V101)
+Copyright (c) National Semiconductor Corporation 1990-1993
+Assembled from "PAL14H4.eqn". Date: 8-24-112
+*
+NOTE PINS i1:1 i2:2 i3:3 i4:4 i5:5 i6:6 i7:7 i8:8 i9:9 GND:10*
+NOTE PINS i11:11 i12:12 i13:13 o14:14 o15:15 o16:16 o17:17 i18:18*
+NOTE PINS i19:19 VCC:20*
+QF0448*QP20*F0*
+L0000
+0101011110110101011101111111
+1111111111111111111111110101
+1111111111111111110111101111
+1111110111011111111111111111*
+L0112
+0101101101110101011101111111
+1111111111111111111111111001
+1111111111111111111011011111
+1111111011101111111111111111*
+L0224
+1001011101110101011101111111
+1111111111111111111111110110
+1111111111111111110111011111
+1111110111101111111111111111*
+L0336
+0110011101110101011101111111
+1111111111111111111111110101
+1111111111111111111011101111
+1111111011011111111111111111*
+C3116*
+0000
diff --git a/src/regtests/jedutil/jeds/pal14l4.jed b/src/regtests/jedutil/jeds/pal14l4.jed
new file mode 100644
index 00000000000..d01cfd872e9
--- /dev/null
+++ b/src/regtests/jedutil/jeds/pal14l4.jed
@@ -0,0 +1,32 @@
+
+PAL14L4
+EQN2JED - Boolean Equations to JEDEC file assembler (Version V101)
+Copyright (c) National Semiconductor Corporation 1990-1993
+Assembled from "PAL14L4.eqn". Date: 8-24-112
+*
+NOTE PINS i1:1 i2:2 i3:3 i4:4 i5:5 i6:6 i7:7 i8:8 i9:9 GND:10*
+NOTE PINS i11:11 i12:12 i13:13 o14:14 o15:15 o16:16 o17:17 i18:18*
+NOTE PINS i19:19 VCC:20*
+QF0448*QP20*F0*
+L0000
+0101011101110110011101111111
+1111111111111111111111111001
+1111111111111111111011101111
+1111111011101111111111111111*
+L0112
+0101011101111001011101111111
+1111111111111111111111111010
+1111111111111111110111011111
+1111111011011111111111111111*
+L0224
+0101011110110101011101111111
+1111111111111111111111111010
+1111111111111111110111101111
+1111110111101111111111111111*
+L0336
+1001011101110101011101111111
+1111111111111111111111111001
+1111111111111111111011011111
+1111110111011111111111111111*
+C306A*
+0000
diff --git a/src/regtests/jedutil/jeds/pal16h2.jed b/src/regtests/jedutil/jeds/pal16h2.jed
new file mode 100644
index 00000000000..df7112dfaed
--- /dev/null
+++ b/src/regtests/jedutil/jeds/pal16h2.jed
@@ -0,0 +1,30 @@
+
+PAL16H2
+EQN2JED - Boolean Equations to JEDEC file assembler (Version V101)
+Copyright (c) National Semiconductor Corporation 1990-1993
+Assembled from "PAL16H2.eqn". Date: 8-24-112
+*
+NOTE PINS i1:1 i2:2 i3:3 i4:4 i5:5 i6:6 i7:7 i8:8 i9:9 GND:10*
+NOTE PINS i11:11 i12:12 i13:13 i14:14 o15:15 o16:16 i17:17 i18:18*
+NOTE PINS i19:19 VCC:20*
+QF0512*QP20*F0*
+L0000
+01011011011110110111011101111111
+11111111111111111111111111111011
+11111111111111111111111111111101
+11111111111111111111111111101111
+11111111111111111111110111111111
+11111111111111111110111111111111
+11111111111111011111111111111111
+11111101111011111111111111111111*
+L0256
+01010111101101111011011101111111
+11111111111111111111111111110111
+11111111111111111111111111111110
+11111111111111111111111111011111
+11111111111111111111111011111111
+11111111111111111101111111111111
+11111111111111101111111111111111
+11111110110111111111111111111111*
+C3BDA*
+0000
diff --git a/src/regtests/jedutil/jeds/pal16l2.jed b/src/regtests/jedutil/jeds/pal16l2.jed
new file mode 100644
index 00000000000..855019dd8e2
--- /dev/null
+++ b/src/regtests/jedutil/jeds/pal16l2.jed
@@ -0,0 +1,30 @@
+
+PAL16L2
+EQN2JED - Boolean Equations to JEDEC file assembler (Version V101)
+Copyright (c) National Semiconductor Corporation 1990-1993
+Assembled from "PAL16L2.eqn". Date: 8-24-112
+*
+NOTE PINS i1:1 i2:2 i3:3 i4:4 i5:5 i6:6 i7:7 i8:8 i9:9 GND:10*
+NOTE PINS i11:11 i12:12 i13:13 i14:14 o15:15 o16:16 i17:17 i18:18*
+NOTE PINS i19:19 VCC:20*
+QF0512*QP20*F0*
+L0000
+01010111011101110111101101111111
+11111111111111111111111111110111
+11111111111111111111111111111101
+11111111111111111111111111011111
+11111111111111111111111011111111
+11111111111111111110111111111111
+11111111111111101111111111111111
+11111110111011111111111111111111*
+L0256
+01010111101101110111011101111111
+11111111111111111111111111111011
+11111111111111111111111111111110
+11111111111111111111111111101111
+11111111111111111111110111111111
+11111111111111111101111111111111
+11111111111111011111111111111111
+11111101110111111111111111111111*
+C3BEB*
+0000
diff --git a/src/regtests/jedutil/jeds/pal16l8.jed b/src/regtests/jedutil/jeds/pal16l8.jed
new file mode 100644
index 00000000000..80940fac0a4
--- /dev/null
+++ b/src/regtests/jedutil/jeds/pal16l8.jed
@@ -0,0 +1,85 @@
+
+PAL16L8
+EQN2JED - Boolean Equations to JEDEC file assembler (Version V101)
+Copyright (c) National Semiconductor Corporation 1990-1993
+Assembled from "pal16l8.eqn". Date: 8-29-112
+md
+*
+NOTE PINS i1:1 i2:2 i3:3 i4:4 i5:5 i6:6 i7:7 i8:8 i9:9 GND:10*
+NOTE PINS i11:11 o12:12 o13:13 o14:14 o15:15 o16:16 o17:17 o18:18*
+NOTE PINS o19:19 VCC:20*
+QF2048*QP20*F0*
+L0000
+11111111111111111111111111111111
+11111111111101110111101111111101
+11110111111111110111011111111111
+11111111111101111111111111111111
+11111111111111110111111111111111
+11111111111111111111011111111111
+11111111111111111111111111111101
+11111111111111111111101111111111*
+L0256
+11111111111111111111111111111111
+10111111111101110111101111111111
+11110111111111110111011111111101
+11110111111111111111111111111111
+10111111111111111111101111111111
+11110111111111111111111111111101
+11111111111101110111101111111111
+11111111111111111111011111111101*
+L0512
+11111111111111101111111111111111
+01111111111101110111101111111111
+01111110111111111111111111111111
+11111111111101111111111111111111
+11111111111111110111111111111111
+11111101111111111111101111111111
+01111111111111111111101111111111
+11111111111101110111111111111111*
+L0768
+11111111111111111111111111111111
+11111011111011111111111111111111
+11111111101111111111111111111110
+11111011101111111111111111111111
+11111011011111111111111111111111
+11111111110111111111101111111111
+11111111111111111111101111111110
+11111111011111111111111111111111*
+L1024
+11111111111111111111111111111111
+11110111111111110111011111111110
+11111111111111010111111111111111
+11110111111111101111111111111111
+11111111111111111111011111111111
+11111111111111111111111111111110
+11111111111111110111011111111111
+11111111111111111111011111111110*
+L1280
+11111111111111111111111111111111
+11011111111111111110111111111111
+11111111111111111111111110111111
+11011111111111111111111110111111
+10011111111111111110111111111111
+10111111111111111111111111111111
+01111111111111111101111110111111
+11110111111111111111111111111111*
+L1536
+01111111111111111111110111111111
+11111111111111111111111011111101
+11111111111111111111111111111011
+11111111111111111111111101111111
+11111111111111111111101111111111
+11111111111111111011110111111111
+11111111111101111111111111111111
+11111111011111111111111111111111*
+L1792
+11111111111111111111111111111111
+11110111111111111111011111111011
+11011111111111111111111111011111
+11110111111111111111111111111111
+11111111111111111011111111111111
+11111111111111111111111101111111
+11111111111111111111111111111011
+11111111111111111111011111101111*
+CF3C8*
+0000
diff --git a/src/regtests/jedutil/jeds/pal20l10.jed b/src/regtests/jedutil/jeds/pal20l10.jed
new file mode 100644
index 00000000000..4019ea407dd
--- /dev/null
+++ b/src/regtests/jedutil/jeds/pal20l10.jed
@@ -0,0 +1,62 @@
+
+PAL20L10
+EQN2JED - Boolean Equations to JEDEC file assembler (Version V101)
+Copyright (c) National Semiconductor Corporation 1990-1993
+Assembled from "pal20l10.eqn". Date: 8-31-112
+*
+NOTE PINS i1:1 i2:2 i3:3 i4:4 i5:5 i6:6 i7:7 i8:8 i9:9 i10:10*
+NOTE PINS i11:11 GND:12 i13:13 o14:14 o15:15 o16:16 o17:17 o18:18*
+NOTE PINS o19:19 o20:20 o21:21 o22:22 o23:23 VCC:24*
+QF1600*QP24*F0*
+L0000
+1111111111111111111111111111111111111111
+1111111111111111111101111111111111111111
+1111111111111111111111111111111111110111
+1111111111111111111111111111111111111110*
+L0160
+1111011111111111111110111111111111111111
+1101111111111111111111111011111111111111
+1111111111111111111111111011111111111111
+1101111111111111111111111111111111111111*
+L0320
+1111111111110111011111111111111111111111
+1101111111111111111111110111111111111111
+1111111010111111111111111111111111111111
+1111110111111111111111111111111111111111*
+L0480
+1111111111111111111111111111111111111111
+1111111111011111111111111111111111111111
+1111111111111111101111111111111111111111
+1111111111101111111110111111111111111111*
+L0640
+1111111111111110111111110111111111111111
+1111111111111101111111111111111111110111
+0111111111111111111111111111111110111111
+1111111111111111111111111111011111110111*
+L0800
+1101111111111111111111111111111101111111
+1001011110111111111111111011111111111111
+1111111111111111101001110111011101111111
+0101011110111011110111111111111111111111*
+L0960
+1111111101110111111111111111111111111111
+1111111111111111111111101111111111111111
+1111111111111111111111011111111101111111
+1111111111111111111111111111011111111111*
+L1120
+1111111111111111111111111111111111111111
+1001111111111111111111111110111111111111
+1111011110111111111111111111111111111111
+1111011111111111111111111101011111111111*
+L1280
+1111111111111111111111111111111011111111
+0110101101111111111111111111111111110111
+0110101111111011111111111111110111111110
+0110101111111111011111111111111111111111*
+L1440
+1111111111111111111111111111111111011111
+1111111111111111111111111111111111111011
+1111111111111111111111111111111101111111
+1111111111111111111111111111011111101111*
+CC08C*
+0000
diff --git a/src/regtests/jedutil/jeds/pal20l8.jed b/src/regtests/jedutil/jeds/pal20l8.jed
new file mode 100644
index 00000000000..4ab694fefea
--- /dev/null
+++ b/src/regtests/jedutil/jeds/pal20l8.jed
@@ -0,0 +1,84 @@
+
+PAL20L8
+EQN2JED - Boolean Equations to JEDEC file assembler (Version V101)
+Copyright (c) National Semiconductor Corporation 1990-1993
+Assembled from "PAL20L8.eqn". Date: 8-30-112
+*
+NOTE PINS i1:1 i2:2 i3:3 i4:4 i5:5 i6:6 i7:7 i8:8 i9:9 i10:10*
+NOTE PINS i11:11 GND:12 i13:13 i14:14 o15:15 o16:16 o17:17 o18:18*
+NOTE PINS o19:19 o20:20 o21:21 o22:22 i23:23 VCC:24*
+QF2560*QP24*F0*
+L0000
+1111011111111111111110111111111111111111
+1101111111111111111111111011111111111111
+1111111111111111111111111011111111111111
+1101111111111111111111111111111111111111
+1111111111111111111111111111111110111111
+1111111011111111111111111111111111111111
+1111111111111111111111110111111111111110
+1111111111111111111111111111111111111011*
+L0320
+1111111111110111011111111111111111111111
+1101111111111111111111110111111111111111
+1111111111111111111111111111111111101111
+1101111111111011111111110111111111111111
+1111110111111111111111111111111111111111
+1101111111111111111111110111111111101111
+1111111111111111111111111111111111111101
+1101111111111111111111111111111111110111*
+L0640
+1111111111111111111111111111111111111111
+1111111111011111111111111111111111111111
+1011111111111111111111111111111111111111
+1111101111111111111111111111111111111111
+1111111110111111111111111111111111111111
+1111111111111011111111111111111111111111
+1111111111111111101111111111111111111111
+1111111111101111111110111111111111111111*
+L0960
+1111111111111110111111110111111111111111
+1111110111111111111111111111011110110111
+1111111111111111111111111111011111111111
+1111111111111111111111111111111110111111
+1111111111111101111111111111111111110111
+1111110111111111111111111111111111111111
+0111110111111111111111111111111110111111
+1111111111111111111111111111011111110111*
+L1280
+1101110111111111111111111111111101111111
+1001010110111111111111111011111111111111
+0101011110111011111111111111111111111111
+1111111111111111101001110111011101111111
+1111110111111111111111111111111111010101
+1111111111111111101101110111011101111111
+1111010111111111111111111111111111011101
+0101011110111011110111111111111111111111*
+L1600
+1111111101110111111111111111111111111111
+1111111011111111111111101111111111111111
+1111111111111111111111011111111101111111
+1111111111111111111111111111011111111111
+1111111111111111111111110111111111111111
+1111111111111111111110111111111111111111
+1111111111111111101111111111111111111111
+1111111111110111111111111111111111111111*
+L1920
+1111111111111111111111111111111111111111
+1001111111111111111111111110111111111111
+1111011110111111111111111111111111111111
+1111111111110111101111111111111111111111
+1111111111111111111101111011111111111111
+1111011111111111111111111101011111111111
+1001011110110111101101111011101111111111
+1111111111111111111111111011101111111111*
+L2240
+1111111111111111111111111111110111111111
+0110101101111111111111111111111111110111
+0110101111111011111111111111111111111110
+0110101111111111011111111111111111011111
+0110101011111111111110111111111111111111
+0110101111111111111111110111111111111011
+0110101111111111111111111111101111111101
+1111111111111111111111111111111011111111*
+C3192*
+0000
diff --git a/src/regtests/jedutil/jedtest.wsf b/src/regtests/jedutil/jedtest.wsf
new file mode 100644
index 00000000000..cb2e47b509f
--- /dev/null
+++ b/src/regtests/jedutil/jedtest.wsf
@@ -0,0 +1,209 @@
+<?xml version="1.0"?>
+<package>
+ <job id="Test"><?job debug="true" error="true"?>
+ <runtime>
+ <description>This script runs regresion tests on the jedutil tool.</description>
+ </runtime>
+
+ <script language="JScript">
+ <![CDATA[
+ var g_Verbose = false;
+
+ function diffFiles(file1, file2)
+ {
+ var WshShell = WScript.CreateObject("WScript.Shell");
+ var oExec;
+
+ if (g_Verbose)
+ {
+ WScript.Echo("Diff File 1: " + file1);
+ WScript.Echo("Diff File 2: " + file2);
+ WScript.Echo();
+ }
+
+ oExec = WshShell.Exec("diff " + file1 + " " + file2);
+
+ while (!oExec.Status)
+ {
+ WScript.Sleep(100);
+ }
+
+ if (g_Verbose)
+ {
+ WScript.StdOut.WriteLine(oExec.StdOut.ReadAll());
+ WScript.StdErr.WriteLine(oExec.StdErr.ReadAll());
+ }
+
+ return oExec.ExitCode;
+ }
+
+ function runCommandAndCaptureOutput(command, outputFile)
+ {
+ var WshShell = WScript.CreateObject("WScript.Shell");
+ var fullCommand;
+
+ fullCommand = "%comspec% /c ";
+ fullCommand += command;
+ fullCommand += " > ";
+ fullCommand += outputFile;
+ fullCommand += " 2>&1";
+
+ if (g_Verbose)
+ {
+ WScript.Echo("Running the command : " + command);
+ WScript.Echo("Output File: " + outputFile);
+ WScript.Echo();
+ }
+
+ WshShell.Run(fullCommand, 0, true);
+ }
+
+ function findJedTests(jedsPath, baselinePath, outputPath)
+ {
+ var fso = new ActiveXObject("Scripting.FileSystemObject");
+ var folder = fso.GetFolder(jedsPath)
+ var folderCollection = new Enumerator(folder.files);
+ var jedArray = new Array();
+
+ while (!folderCollection.atEnd())
+ {
+ ++jedArray.length;
+
+ jedArray[jedArray.length - 1] = new Object;
+
+ jedArray[jedArray.length - 1].name = fso.GetBaseName(folderCollection.item().name);
+ jedArray[jedArray.length - 1].jedfile = folderCollection.item().path;
+ jedArray[jedArray.length - 1].baselineFile = baselinePath + "\\" +
+ jedArray[jedArray.length - 1].name +
+ ".txt";
+ jedArray[jedArray.length - 1].outputFile = outputPath + "\\" +
+ jedArray[jedArray.length - 1].name +
+ ".txt";
+
+ folderCollection.moveNext();
+ }
+
+ return jedArray;
+ }
+
+ function runViewJedTests(jedArray, jedUtilApp)
+ {
+ var command;
+
+ for (i = 0; i < jedArray.length; ++i)
+ {
+ command = jedUtilApp + " -view " + jedArray[i].jedfile + " " +
+ jedArray[i].name;
+
+ if (g_Verbose)
+ {
+ WScript.Echo("Viewing the JED file: " + jedArray[i].jedfile);
+ WScript.Echo();
+ }
+
+ runCommandAndCaptureOutput(command, jedArray[i].outputFile);
+ }
+ }
+
+ function runDiffJedTests(jedArray)
+ {
+ var result = true;
+
+ for (i = 0; i < jedArray.length; ++i)
+ {
+ if (g_Verbose)
+ {
+ WScript.Echo("Diffing the output from viewing the JED file: " + jedArray[i].jedfile);
+ }
+
+ if (diffFiles(jedArray[i].baselineFile, jedArray[i].outputFile))
+ {
+ WScript.Echo("Results are different for " + jedArray[i].name);
+ WScript.Echo();
+
+ result = false;
+ }
+ }
+
+ return result;
+ }
+
+ function main()
+ {
+ var result = 0;
+ var WshShell = WScript.CreateObject("WScript.Shell");
+ var fso = new ActiveXObject("Scripting.FileSystemObject");
+ var jedsPath = WshShell.CurrentDirectory + "\\jeds";
+ var baselinePath = WshShell.CurrentDirectory + "\\baseline";
+ var outputPath = WshShell.CurrentDirectory + "\\output";
+ var jedUtilApp = WshShell.CurrentDirectory + "\\..\\..\\..\\jedutil.exe";
+ var jedArray = new Array();
+
+ if (g_Verbose)
+ {
+ WScript.Echo("JED Path: " + jedsPath);
+ WScript.Echo("Baseline Path: " + baselinePath);
+ WScript.Echo("Output Path: " + outputPath);
+ WScript.Echo("jedutil App: " + jedUtilApp);
+ WScript.Echo();
+ }
+
+ if (fso.FolderExists(outputPath))
+ {
+ if (g_Verbose)
+ {
+ WScript.Echo("Emptying the output directory");
+ WScript.Echo();
+ }
+
+ fso.DeleteFile(outputPath + "\\*.*");
+ }
+ else
+ {
+ if (g_Verbose)
+ {
+ WScript.Echo("Creating the output directory");
+ WScript.Echo();
+ }
+
+ fso.CreateFolder(outputPath);
+ }
+
+ jedArray = findJedTests(jedsPath, baselinePath, outputPath);
+
+ runViewJedTests(jedArray, jedUtilApp);
+
+ if (!runDiffJedTests(jedArray))
+ {
+ result = 1;
+ }
+
+ if (!result)
+ {
+ WScript.Echo("All tests ran successfully.");
+ }
+
+ return result;
+ }
+
+ try
+ {
+ var result = main();
+
+ WScript.Quit(result);
+ }
+ catch (e)
+ {
+ WScript.Echo("Error Occurred");
+ WScript.Echo("");
+ WScript.Echo("Name: " + e.name);
+ WScript.Echo("Message: " + e.message);
+ WScript.Echo("Number: " + e.number);
+ WScript.Echo("Description: " + e.description);
+
+ WScript.Quit(1);
+ }
+ ]]>
+ </script>
+ </job>
+</package>
diff --git a/src/tools/jedutil.c b/src/tools/jedutil.c
index b7e1347156d..628ac52f269 100644
--- a/src/tools/jedutil.c
+++ b/src/tools/jedutil.c
@@ -64,6 +64,9 @@
PAL16L8 = QP20 QF2048
+ PAL16R4 = QP20
+ PAL16R6 = QP20
+ PAL16R8 = QP20
PAL16RA8 = QP20 QF2056
PAL16V8R = QP20 QF2194
@@ -73,6 +76,18 @@
18CV8 = QP20 QF2696
24-pin devices:
+ PAL20L8 = QP24
+ PAL20L10 = QP24
+ PAL20R4 = QP24
+ PAL20R6 = QP24
+ PAL20R8 = QP24
+
+ PAL20X4 = QP24
+ PAL20X8 = QP24
+ PAL20X10 = QP24
+
+ PAL22V10 = QP24
+
GAL20V8A = QP24 QF2706
GAL22V10 = QP24 QF5892
@@ -90,6 +105,90 @@
/***************************************************************************
+ TYPE DEFINITIONS
+***************************************************************************/
+
+typedef int (*command_func_type)(int argc, char *argv[]);
+
+typedef struct _command_entry command_entry;
+struct _command_entry
+{
+ const char *command;
+ command_func_type command_func;
+};
+
+
+
+/* Pin fuse row configuration */
+#define CNoOutputEnableFuseRow (UINT16)~0
+
+
+
+/* Pin fuse row configuration */
+typedef struct _pin_fuse_rows pin_fuse_rows;
+struct _pin_fuse_rows
+{
+ UINT16 pin; /* Pin number */
+ UINT16 fuserowoutputenable; /* Fuse row for the output enable */
+ UINT16 fuserowtermstart; /* Fuse row for the first term */
+ UINT16 fuserowtermend; /* Fuse row for the last term */
+};
+
+
+
+/* Pin fuse column configuration */
+typedef struct _pin_fuse_columns pin_fuse_columns;
+struct _pin_fuse_columns
+{
+ UINT16 pin; /* Pin number */
+ UINT16 lowfusecolumn; /* Column number for low output */
+ UINT16 highfusecolumn; /* Column number for high output */
+};
+
+
+typedef struct _pal_data pal_data;
+
+typedef void (*print_product_terms_func)(const pal_data* pal, const jed_data* jed);
+
+struct _pal_data
+{
+ const char *name;
+ const pin_fuse_rows *pinfuserows;
+ UINT16 pinfuserowscount;
+ const pin_fuse_columns *pinfusecolumns;
+ UINT16 pinfusecolumnscount;
+ print_product_terms_func print_product_terms;
+};
+
+
+
+/***************************************************************************
+ FUNCTION PROTOTYPES
+***************************************************************************/
+
+static void print_pal10l8_product_terms(const pal_data* pal, const jed_data* jed);
+static void print_pal10h8_product_terms(const pal_data* pal, const jed_data* jed);
+static void print_pal12l6_product_terms(const pal_data* pal, const jed_data* jed);
+static void print_pal12h6_product_terms(const pal_data* pal, const jed_data* jed);
+static void print_pal14l4_product_terms(const pal_data* pal, const jed_data* jed);
+static void print_pal14h4_product_terms(const pal_data* pal, const jed_data* jed);
+static void print_pal16l2_product_terms(const pal_data* pal, const jed_data* jed);
+static void print_pal16h2_product_terms(const pal_data* pal, const jed_data* jed);
+static void print_pal16c1_product_terms(const pal_data* pal, const jed_data* jed);
+static void print_pal16l8_product_terms(const pal_data* pal, const jed_data* jed);
+static void print_pal16r4_product_terms(const pal_data* pal, const jed_data* jed);
+static void print_pal16r6_product_terms(const pal_data* pal, const jed_data* jed);
+static void print_pal16r8_product_terms(const pal_data* pal, const jed_data* jed);
+static void print_gal18v10_product_terms(const pal_data* pal, const jed_data* jed);
+static void print_pal20l8_product_terms(const pal_data* pal, const jed_data* jed);
+static void print_pal20l10_product_terms(const pal_data* pal, const jed_data* jed);
+static void print_pal20r4_product_terms(const pal_data* pal, const jed_data* jed);
+static void print_pal20r6_product_terms(const pal_data* pal, const jed_data* jed);
+static void print_pal20r8_product_terms(const pal_data* pal, const jed_data* jed);
+
+
+
+/***************************************************************************
GLOBAL VARIABLES
***************************************************************************/
@@ -99,6 +198,646 @@ static size_t srcbuflen;
static UINT8 *dstbuf;
static size_t dstbuflen;
+static UINT16 inputpins[26];
+static UINT16 inputpinscount;
+
+static UINT16 outputpins[26];
+static UINT16 outputpinscount;
+
+static pin_fuse_rows pal10l8pinfuserows[] = {
+ {12, CNoOutputEnableFuseRow, 280, 300},
+ {13, CNoOutputEnableFuseRow, 240, 260},
+ {14, CNoOutputEnableFuseRow, 200, 220},
+ {15, CNoOutputEnableFuseRow, 160, 180},
+ {16, CNoOutputEnableFuseRow, 120, 140},
+ {17, CNoOutputEnableFuseRow, 80, 100},
+ {18, CNoOutputEnableFuseRow, 40, 60},
+ {19, CNoOutputEnableFuseRow, 0, 20}};
+
+static pin_fuse_rows pal10h8pinfuserows[] = {
+ {12, CNoOutputEnableFuseRow, 280, 300},
+ {13, CNoOutputEnableFuseRow, 240, 260},
+ {14, CNoOutputEnableFuseRow, 200, 220},
+ {15, CNoOutputEnableFuseRow, 160, 180},
+ {16, CNoOutputEnableFuseRow, 120, 140},
+ {17, CNoOutputEnableFuseRow, 80, 100},
+ {18, CNoOutputEnableFuseRow, 40, 60},
+ {19, CNoOutputEnableFuseRow, 0, 20}};
+
+static pin_fuse_rows pal12l6pinfuserows[] = {
+ {13, CNoOutputEnableFuseRow, 288, 360},
+ {14, CNoOutputEnableFuseRow, 240, 264},
+ {15, CNoOutputEnableFuseRow, 192, 216},
+ {16, CNoOutputEnableFuseRow, 144, 168},
+ {17, CNoOutputEnableFuseRow, 96, 120},
+ {18, CNoOutputEnableFuseRow, 0, 72}};
+
+static pin_fuse_rows pal12h6pinfuserows[] = {
+ {13, CNoOutputEnableFuseRow, 288, 360},
+ {14, CNoOutputEnableFuseRow, 240, 264},
+ {15, CNoOutputEnableFuseRow, 192, 216},
+ {16, CNoOutputEnableFuseRow, 144, 168},
+ {17, CNoOutputEnableFuseRow, 96, 120},
+ {18, CNoOutputEnableFuseRow, 0, 72}};
+
+static pin_fuse_rows pal14l4pinfuserows[] = {
+ {14, CNoOutputEnableFuseRow, 336, 420},
+ {15, CNoOutputEnableFuseRow, 224, 308},
+ {16, CNoOutputEnableFuseRow, 112, 196},
+ {17, CNoOutputEnableFuseRow, 0, 84}};
+
+static pin_fuse_rows pal14h4pinfuserows[] = {
+ {14, CNoOutputEnableFuseRow, 336, 420},
+ {15, CNoOutputEnableFuseRow, 224, 308},
+ {16, CNoOutputEnableFuseRow, 112, 196},
+ {17, CNoOutputEnableFuseRow, 0, 84}};
+
+static pin_fuse_rows pal16l2pinfuserows[] = {
+ {15, CNoOutputEnableFuseRow, 256, 480},
+ {16, CNoOutputEnableFuseRow, 0, 224}};
+
+static pin_fuse_rows pal16h2pinfuserows[] = {
+ {15, CNoOutputEnableFuseRow, 256, 480},
+ {16, CNoOutputEnableFuseRow, 0, 224}};
+
+static pin_fuse_rows pal16c1pinfuserows[] = {
+ {15, CNoOutputEnableFuseRow, 256, 480},
+ {16, CNoOutputEnableFuseRow, 0, 224}};
+
+static pin_fuse_rows pal16l8pinfuserows[] = {
+ {12, 1792, 1824, 2016},
+ {13, 1536, 1568, 1760},
+ {14, 1280, 1312, 1504},
+ {15, 1024, 1056, 1248},
+ {16, 768, 800, 992},
+ {17, 512, 544, 736},
+ {18, 256, 288, 480},
+ {19, 0, 32, 224}};
+
+static pin_fuse_rows pal16r4pinfuserows[] = {
+ {12, 1792, 1824, 2016},
+ {13, 1536, 1568, 1760},
+ {14, CNoOutputEnableFuseRow, 1280, 1504}, /* Registered Output */
+ {15, CNoOutputEnableFuseRow, 1024, 1248}, /* Registered Output */
+ {16, CNoOutputEnableFuseRow, 768, 992}, /* Registered Output */
+ {17, CNoOutputEnableFuseRow, 512, 736}, /* Registered Output */
+ {18, 256, 288, 480},
+ {19, 0, 32, 224}};
+
+static pin_fuse_rows pal16r6pinfuserows[] = {
+ {12, 1792, 1824, 2016},
+ {13, CNoOutputEnableFuseRow, 1536, 1760}, /* Registered Output */
+ {14, CNoOutputEnableFuseRow, 1280, 1504}, /* Registered Output */
+ {15, CNoOutputEnableFuseRow, 1024, 1248}, /* Registered Output */
+ {16, CNoOutputEnableFuseRow, 768, 992}, /* Registered Output */
+ {17, CNoOutputEnableFuseRow, 512, 736}, /* Registered Output */
+ {18, CNoOutputEnableFuseRow, 256, 480}, /* Registered Output */
+ {19, 0, 32, 224}};
+
+static pin_fuse_rows pal16r8pinfuserows[] = {
+ {12, CNoOutputEnableFuseRow, 1792, 2016}, /* Registered Output */
+ {13, CNoOutputEnableFuseRow, 1536, 1760}, /* Registered Output */
+ {14, CNoOutputEnableFuseRow, 1280, 1504}, /* Registered Output */
+ {15, CNoOutputEnableFuseRow, 1024, 1248}, /* Registered Output */
+ {16, CNoOutputEnableFuseRow, 768, 992}, /* Registered Output */
+ {17, CNoOutputEnableFuseRow, 512, 736}, /* Registered Output */
+ {18, CNoOutputEnableFuseRow, 256, 480}, /* Registered Output */
+ {19, CNoOutputEnableFuseRow, 0, 224}}; /* Registered Output */
+
+static pin_fuse_rows gal18v10pinfuserows[] = {
+ {9, 3096, 3132, 3384},
+ {11, 2772, 2808, 3060},
+ {12, 2448, 2484, 2736},
+ {13, 2124, 2160, 2412},
+ {14, 1728, 1764, 2088},
+ {15, 1332, 1368, 1692},
+ {16, 1008, 1044, 1296},
+ {17, 684, 720, 972},
+ {18, 360, 396, 648},
+ {19, 36, 72, 324}};
+
+static pin_fuse_rows pal20l8pinfuserows[] = {
+ {15, 2240, 2280, 2520},
+ {16, 1920, 1960, 2200},
+ {17, 1600, 1640, 1880},
+ {18, 1280, 1320, 1560},
+ {19, 960, 1000, 1240},
+ {20, 640, 680, 920},
+ {21, 320, 360, 600},
+ {22, 0, 40, 280}};
+
+static pin_fuse_rows pal20l10pinfuserows[] = {
+ {14, 1440, 1480, 1560},
+ {15, 1280, 1320, 1400},
+ {16, 1120, 1160, 1240},
+ {17, 960, 1000, 1080},
+ {18, 800, 840, 920},
+ {19, 640, 680, 760},
+ {20, 480, 520, 600},
+ {21, 320, 360, 440},
+ {22, 160, 200, 280},
+ {23, 0, 40, 120}};
+
+static pin_fuse_rows pal20r4pinfuserows[] = {
+ {15, 2240, 2280, 2520},
+ {16, 1920, 1960, 2200},
+ {17, 1600, 1640, 1840},
+ {18, 1280, 1320, 1560},
+ {19, 960, 1000, 1240},
+ {20, 640, 680, 920},
+ {21, 320, 360, 600},
+ {22, 0, 40, 280}};
+
+static pin_fuse_rows pal20r6pinfuserows[] = {
+ {15, 2240, 2280, 2520},
+ {16, 1920, 1960, 2200},
+ {17, 1600, 1640, 1840},
+ {18, 1280, 1320, 1560},
+ {19, 960, 1000, 1240},
+ {20, 640, 680, 920},
+ {21, 320, 360, 600},
+ {22, 0, 40, 280}};
+
+static pin_fuse_rows pal20r8pinfuserows[] = {
+ {15, 2240, 2280, 2520},
+ {16, 1920, 1960, 2200},
+ {17, 1600, 1640, 1840},
+ {18, 1280, 1320, 1560},
+ {19, 960, 1000, 1240},
+ {20, 640, 680, 920},
+ {21, 320, 360, 600},
+ {22, 0, 40, 280}};
+
+static pin_fuse_columns pal10l8pinfusecolumns[] = {
+ {1, 3, 2},
+ {2, 1, 0},
+ {3, 5, 4},
+ {4, 7, 6},
+ {5, 9, 8},
+ {6, 11, 10},
+ {7, 13, 12},
+ {8, 15, 14},
+ {9, 17, 16},
+ {11, 19, 18}};
+
+static pin_fuse_columns pal10h8pinfusecolumns[] = {
+ {1, 3, 2},
+ {2, 1, 0},
+ {3, 5, 4},
+ {4, 7, 6},
+ {5, 9, 8},
+ {6, 11, 10},
+ {7, 13, 12},
+ {8, 15, 14},
+ {9, 17, 16},
+ {11, 19, 18}};
+
+static pin_fuse_columns pal12l6pinfusecolumns[] = {
+ {1, 3, 2},
+ {2, 1, 0},
+ {3, 5, 4},
+ {4, 9, 8},
+ {5, 11, 10},
+ {6, 13, 12},
+ {7, 15, 14},
+ {8, 17, 16},
+ {9, 21, 20},
+ {11, 23, 22},
+ {12, 19, 18},
+ {19, 7, 6}};
+
+static pin_fuse_columns pal12h6pinfusecolumns[] = {
+ {1, 3, 2},
+ {2, 1, 0},
+ {3, 5, 4},
+ {4, 9, 8},
+ {5, 11, 10},
+ {6, 13, 12},
+ {7, 15, 14},
+ {8, 17, 16},
+ {9, 21, 20},
+ {11, 23, 22},
+ {12, 19, 18},
+ {19, 7, 6}};
+
+static pin_fuse_columns pal14l4pinfusecolumns[] = {
+ {1, 3, 2},
+ {2, 1, 0},
+ {3, 5, 4},
+ {4, 9, 8},
+ {5, 13, 12},
+ {6, 15, 14},
+ {7, 17, 16},
+ {8, 21, 20},
+ {9, 25, 24},
+ {11, 27, 26},
+ {12, 23, 22},
+ {13, 19, 18},
+ {18, 11, 10},
+ {19, 7, 6}};
+
+static pin_fuse_columns pal14h4pinfusecolumns[] = {
+ {1, 3, 2},
+ {2, 1, 0},
+ {3, 5, 4},
+ {4, 9, 8},
+ {5, 13, 12},
+ {6, 15, 14},
+ {7, 17, 16},
+ {8, 21, 20},
+ {9, 25, 24},
+ {11, 27, 26},
+ {12, 23, 22},
+ {13, 19, 18},
+ {18, 11, 10},
+ {19, 7, 6}};
+
+static pin_fuse_columns pal16l2pinfusecolumns[] = {
+ {1, 3, 2},
+ {2, 1, 0},
+ {3, 5, 4},
+ {4, 9, 8},
+ {5, 13, 12},
+ {6, 17, 16},
+ {7, 21, 20},
+ {8, 25, 24},
+ {9, 29, 28},
+ {11, 31, 30},
+ {12, 27, 26},
+ {13, 23, 22},
+ {14, 19, 18},
+ {17, 15, 14},
+ {18, 11, 10},
+ {19, 7, 6}};
+
+static pin_fuse_columns pal16h2pinfusecolumns[] = {
+ {1, 3, 2},
+ {2, 1, 0},
+ {3, 5, 4},
+ {4, 9, 8},
+ {5, 13, 12},
+ {6, 17, 16},
+ {7, 21, 20},
+ {8, 25, 24},
+ {9, 29, 28},
+ {11, 31, 30},
+ {12, 27, 26},
+ {13, 23, 22},
+ {14, 19, 18},
+ {17, 15, 14},
+ {18, 11, 10},
+ {19, 7, 6}};
+
+static pin_fuse_columns pal16c1pinfusecolumns[] = {
+ {1, 3, 2},
+ {2, 1, 0},
+ {3, 5, 4},
+ {4, 9, 8},
+ {5, 13, 12},
+ {6, 17, 16},
+ {7, 21, 20},
+ {8, 25, 24},
+ {9, 29, 28},
+ {11, 31, 30},
+ {12, 27, 26},
+ {13, 23, 22},
+ {14, 19, 18},
+ {17, 15, 14},
+ {18, 11, 10},
+ {19, 7, 6}};
+
+static pin_fuse_columns pal16l8pinfusecolumns[] = {
+ {1, 3, 2},
+ {2, 1, 0},
+ {3, 5, 4},
+ {4, 9, 8},
+ {5, 13, 12},
+ {6, 17, 16},
+ {7, 21, 20},
+ {8, 25, 24},
+ {9, 29, 28},
+ {11, 31, 30},
+ {13, 27, 26},
+ {14, 23, 22},
+ {15, 19, 18},
+ {16, 15, 14},
+ {17, 11, 10},
+ {18, 7, 6}};
+
+static pin_fuse_columns pal16r4pinfusecolumns[] = {
+ {2, 1, 0},
+ {3, 5, 4},
+ {4, 9, 8},
+ {5, 13, 12},
+ {6, 17, 16},
+ {7, 21, 20},
+ {8, 25, 24},
+ {9, 29, 28},
+ {12, 31, 30},
+ {13, 27, 26},
+ {14, 23, 22}, /* Registered Output */
+ {15, 19, 18}, /* Registered Output */
+ {16, 15, 14}, /* Registered Output */
+ {17, 11, 10}, /* Registered Output */
+ {18, 7, 6},
+ {19, 3, 2}};
+
+static pin_fuse_columns pal16r6pinfusecolumns[] = {
+ {2, 1, 0},
+ {3, 5, 4},
+ {4, 9, 8},
+ {5, 13, 12},
+ {6, 17, 16},
+ {7, 21, 20},
+ {8, 25, 24},
+ {9, 29, 28},
+ {12, 31, 30},
+ {13, 27, 26}, /* Registered Output */
+ {14, 23, 22}, /* Registered Output */
+ {15, 19, 18}, /* Registered Output */
+ {16, 15, 14}, /* Registered Output */
+ {17, 11, 10}, /* Registered Output */
+ {18, 7, 6}, /* Registered Output */
+ {19, 3, 2}};
+
+static pin_fuse_columns pal16r8pinfusecolumns[] = {
+ {2, 1, 0},
+ {3, 5, 4},
+ {4, 9, 8},
+ {5, 13, 12},
+ {6, 17, 16},
+ {7, 21, 20},
+ {8, 25, 24},
+ {9, 29, 28},
+ {12, 31, 30}, /* Registered Output */
+ {13, 27, 26}, /* Registered Output */
+ {14, 23, 22}, /* Registered Output */
+ {15, 19, 18}, /* Registered Output */
+ {16, 15, 14}, /* Registered Output */
+ {17, 11, 10}, /* Registered Output */
+ {18, 7, 6}, /* Registered Output */
+ {19, 3, 2}}; /* Registered Output */
+
+static pin_fuse_columns gal18v10pinfusecolumns[] = {
+ {1, 1, 0},
+ {2, 5, 4},
+ {3, 9, 8},
+ {4, 13, 12},
+ {5, 17, 16},
+ {6, 21, 20},
+ {7, 25, 24},
+ {8, 29, 28},
+ {9, 35, 34},
+ {11, 33, 32},
+ {12, 31, 30},
+ {13, 27, 26},
+ {14, 23, 22},
+ {15, 19, 18},
+ {16, 15, 14},
+ {17, 11, 10},
+ {18, 7, 6},
+ {19, 3, 2}};
+
+static pin_fuse_columns pal20l8pinfusecolumns[] = {
+ {1, 3, 2},
+ {2, 1, 0},
+ {3, 5, 4},
+ {4, 9, 8},
+ {5, 13, 12},
+ {6, 17, 16},
+ {7, 21, 20},
+ {8, 25, 24},
+ {9, 29, 28},
+ {10, 33, 32},
+ {11, 37, 36},
+ {13, 39, 38},
+ {14, 35, 34},
+ {16, 31, 30},
+ {17, 27, 26},
+ {18, 23, 22},
+ {19, 19, 18},
+ {20, 15, 14},
+ {21, 11, 10},
+ {23, 7, 6}};
+
+static pin_fuse_columns pal20l10pinfusecolumns[] = {
+ {1, 3, 2},
+ {2, 1, 0},
+ {3, 5, 4},
+ {4, 9, 8},
+ {5, 13, 12},
+ {6, 17, 16},
+ {7, 21, 20},
+ {8, 25, 24},
+ {9, 29, 28},
+ {10, 33, 32},
+ {11, 37, 36},
+ {13, 39, 38},
+ {15, 35, 34},
+ {16, 31, 30},
+ {17, 27, 26},
+ {18, 23, 22},
+ {19, 19, 18},
+ {20, 15, 14},
+ {21, 11, 10},
+ {22, 7, 6}};
+
+static pin_fuse_columns pal20r4pinfusecolumns[] = {
+ {2, 1, 0},
+ {3, 5, 4},
+ {4, 9, 8},
+ {5, 13, 12},
+ {6, 17, 16},
+ {7, 21, 20},
+ {8, 25, 24},
+ {9, 29, 28},
+ {10, 33, 32},
+ {11, 37, 36},
+ {14, 39, 38},
+ {15, 35, 34},
+ {16, 31, 30},
+ {17, 27, 26},
+ {18, 23, 22},
+ {19, 19, 18},
+ {20, 15, 14},
+ {21, 11, 10},
+ {22, 7, 6},
+ {23, 3, 2}};
+
+static pin_fuse_columns pal20r6pinfusecolumns[] = {
+ {2, 1, 0},
+ {3, 5, 4},
+ {4, 9, 8},
+ {5, 13, 12},
+ {6, 17, 16},
+ {7, 21, 20},
+ {8, 25, 24},
+ {9, 29, 28},
+ {10, 33, 32},
+ {11, 37, 36},
+ {14, 39, 38},
+ {15, 35, 34},
+ {16, 31, 30},
+ {17, 27, 26},
+ {18, 23, 22},
+ {19, 19, 18},
+ {20, 15, 14},
+ {21, 11, 10},
+ {22, 7, 6},
+ {23, 3, 2}};
+
+static pin_fuse_columns pal20r8pinfusecolumns[] = {
+ {2, 1, 0},
+ {3, 5, 4},
+ {4, 9, 8},
+ {5, 13, 12},
+ {6, 17, 16},
+ {7, 21, 20},
+ {8, 25, 24},
+ {9, 29, 28},
+ {10, 33, 32},
+ {11, 37, 36},
+ {14, 39, 38},
+ {15, 35, 34},
+ {16, 31, 30},
+ {17, 27, 26},
+ {18, 23, 22},
+ {19, 19, 18},
+ {20, 15, 14},
+ {21, 11, 10},
+ {22, 7, 6},
+ {23, 3, 2}};
+
+static pal_data paldata[] = {
+ {"PAL10L8",
+ pal10l8pinfuserows,
+ sizeof(pal10l8pinfuserows) / sizeof(pal10l8pinfuserows[0]),
+ pal10l8pinfusecolumns,
+ sizeof(pal10l8pinfusecolumns) / sizeof(pal10l8pinfusecolumns[0]),
+ print_pal10l8_product_terms},
+ {"PAL10H8",
+ pal10h8pinfuserows,
+ sizeof(pal10h8pinfuserows) / sizeof(pal10h8pinfuserows[0]),
+ pal10h8pinfusecolumns,
+ sizeof(pal10h8pinfusecolumns) / sizeof(pal10h8pinfusecolumns[0]),
+ print_pal10h8_product_terms},
+ {"PAL12H6",
+ pal12h6pinfuserows,
+ sizeof(pal12h6pinfuserows) / sizeof(pal12h6pinfuserows[0]),
+ pal12h6pinfusecolumns,
+ sizeof(pal12h6pinfusecolumns) / sizeof(pal12h6pinfusecolumns[0]),
+ print_pal12h6_product_terms},
+ {"PAL14H4",
+ pal14h4pinfuserows,
+ sizeof(pal14h4pinfuserows) / sizeof(pal14h4pinfuserows[0]),
+ pal14h4pinfusecolumns,
+ sizeof(pal14h4pinfusecolumns) / sizeof(pal14h4pinfusecolumns[0]),
+ print_pal14h4_product_terms},
+ {"PAL16H2",
+ pal16h2pinfuserows,
+ sizeof(pal16h2pinfuserows) / sizeof(pal16h2pinfuserows[0]),
+ pal16h2pinfusecolumns,
+ sizeof(pal16h2pinfusecolumns) / sizeof(pal16h2pinfusecolumns[0]),
+ print_pal16h2_product_terms},
+ {"PAL16C1",
+ pal16c1pinfuserows,
+ sizeof(pal16c1pinfuserows) / sizeof(pal16c1pinfuserows[0]),
+ pal16c1pinfusecolumns,
+ sizeof(pal16c1pinfusecolumns) / sizeof(pal16c1pinfusecolumns[0]),
+ print_pal16c1_product_terms},
+ {"PAL12L6",
+ pal12l6pinfuserows,
+ sizeof(pal12l6pinfuserows) / sizeof(pal12l6pinfuserows[0]),
+ pal12l6pinfusecolumns,
+ sizeof(pal12l6pinfusecolumns) / sizeof(pal12l6pinfusecolumns[0]),
+ print_pal12l6_product_terms},
+ {"PAL14L4",
+ pal14l4pinfuserows,
+ sizeof(pal14l4pinfuserows) / sizeof(pal14l4pinfuserows[0]),
+ pal14l4pinfusecolumns,
+ sizeof(pal14l4pinfusecolumns) / sizeof(pal14l4pinfusecolumns[0]),
+ print_pal14l4_product_terms},
+ {"PAL16L2",
+ pal16l2pinfuserows,
+ sizeof(pal16l2pinfuserows) / sizeof(pal16l2pinfuserows[0]),
+ pal16l2pinfusecolumns,
+ sizeof(pal16l2pinfusecolumns) / sizeof(pal16l2pinfusecolumns[0]),
+ print_pal16l2_product_terms},
+ {"15S8", NULL, 0, NULL, 0, NULL},
+ {"PLS153", NULL, 0, NULL, 0, NULL},
+ {"PAL16L8",
+ pal16l8pinfuserows,
+ sizeof(pal16l8pinfuserows) / sizeof(pal16l8pinfuserows[0]),
+ pal16l8pinfusecolumns,
+ sizeof(pal16l8pinfusecolumns) / sizeof(pal16l8pinfusecolumns[0]),
+ print_pal16l8_product_terms},
+ {"PAL16R4",
+ pal16r4pinfuserows,
+ sizeof(pal16r4pinfuserows) / sizeof(pal16r4pinfuserows[0]),
+ pal16r4pinfusecolumns,
+ sizeof(pal16r4pinfusecolumns) / sizeof(pal16r4pinfusecolumns),
+ print_pal16r4_product_terms},
+ {"PAL16R6",
+ pal16r6pinfuserows,
+ sizeof(pal16r6pinfuserows) / sizeof(pal16r6pinfuserows[0]),
+ pal16r6pinfusecolumns,
+ sizeof(pal16r6pinfusecolumns) / sizeof(pal16r6pinfusecolumns),
+ print_pal16r6_product_terms},
+ {"PAL16R8",
+ pal16r8pinfuserows,
+ sizeof(pal16r8pinfuserows) / sizeof(pal16r8pinfuserows[0]),
+ pal16r8pinfusecolumns,
+ sizeof(pal16r8pinfusecolumns) / sizeof(pal16r8pinfusecolumns),
+ print_pal16r8_product_terms},
+ {"PAL16RA8", NULL, 0, NULL, 0, NULL},
+ {"PAL16V8R", NULL, 0, NULL, 0, NULL},
+ {"PALCE16V8", NULL, 0, NULL, 0, NULL},
+ {"GAL16V8A", NULL, 0, NULL, 0, NULL},
+ {"18CV8", NULL, 0, NULL, 0, NULL},
+ {"GAL18V10",
+ gal18v10pinfuserows,
+ sizeof(gal18v10pinfuserows) / sizeof(gal18v10pinfuserows[0]),
+ gal18v10pinfusecolumns,
+ sizeof(gal18v10pinfusecolumns) / sizeof(gal18v10pinfusecolumns),
+ print_gal18v10_product_terms},
+ {"PAL20L8",
+ pal20l8pinfuserows,
+ sizeof(pal20l8pinfuserows) / sizeof(pal20l8pinfuserows[0]),
+ pal20l8pinfusecolumns,
+ sizeof(pal20l8pinfusecolumns) / sizeof(pal20l8pinfusecolumns[0]),
+ print_pal20l8_product_terms},
+ {"PAL20L10",
+ pal20l10pinfuserows,
+ sizeof(pal20l10pinfuserows) / sizeof(pal20l10pinfuserows[0]),
+ pal20l10pinfusecolumns,
+ sizeof(pal20l10pinfusecolumns) / sizeof(pal20l10pinfusecolumns[0]),
+ print_pal20l10_product_terms},
+ {"PAL20R4",
+ pal20r4pinfuserows,
+ sizeof(pal20r4pinfuserows) / sizeof(pal20r4pinfuserows[0]),
+ pal20r4pinfusecolumns,
+ sizeof(pal20r4pinfusecolumns) / sizeof(pal20r4pinfusecolumns[0]),
+ print_pal20r4_product_terms},
+ {"PAL20R6",
+ pal20r6pinfuserows,
+ sizeof(pal20r6pinfuserows) / sizeof(pal20r6pinfuserows[0]),
+ pal20r6pinfusecolumns,
+ sizeof(pal20r6pinfusecolumns) / sizeof(pal20r6pinfusecolumns[0]),
+ print_pal20r6_product_terms},
+ {"PAL20R8",
+ pal20r8pinfuserows,
+ sizeof(pal20r8pinfuserows) / sizeof(pal20r8pinfuserows[0]),
+ pal20r8pinfusecolumns,
+ sizeof(pal20r8pinfusecolumns) / sizeof(pal20r8pinfusecolumns[0]),
+ print_pal20r8_product_terms},
+ {"PAL20X4", NULL, 0, NULL, 0, NULL},
+ {"PAL20X8", NULL, 0, NULL, 0, NULL},
+ {"PAL20X10", NULL, 0, NULL, 0, NULL},
+ {"PAL22V10", NULL, 0, NULL, 0, NULL},
+ {"GAL20V8A", NULL, 0, NULL, 0, NULL},
+ {"GAL22V10", NULL, 0, NULL, 0, NULL},
+ {"PLS100", NULL, 0, NULL, 0, NULL}};
+
/***************************************************************************
@@ -106,6 +845,576 @@ static size_t dstbuflen;
***************************************************************************/
/*-------------------------------------------------
+ is_jed_file - test if the file extension is
+ that of a JED file
+-------------------------------------------------*/
+
+static int is_jed_file(const char *file)
+{
+ int len;
+
+ /* does the source end in '.jed'? */
+ len = strlen(file);
+
+ return (file[len - 4] == '.' &&
+ tolower((UINT8)file[len - 3]) == 'j' &&
+ tolower((UINT8)file[len - 2]) == 'e' &&
+ tolower((UINT8)file[len - 1]) == 'd');
+}
+
+
+
+/*-------------------------------------------------
+ find_pal_data - finds the data associated
+ with a pal name
+-------------------------------------------------*/
+
+static pal_data* find_pal_data(const char *name)
+{
+ int index;
+
+ for (index = 0; index < sizeof(paldata) / sizeof(paldata[0]);
+ ++index)
+ {
+ if (!strcmpi(name, paldata[index].name))
+ {
+ return &paldata[index];
+ }
+ }
+
+ return NULL;
+}
+
+
+
+/*-------------------------------------------------
+ calc_fuse_column_count - calculates the total
+ columns of a pal
+-------------------------------------------------*/
+
+static UINT16 calc_fuse_column_count(const pal_data* pal)
+{
+ return pal->pinfusecolumnscount * 2;
+}
+
+
+
+/*-------------------------------------------------
+ is_fuse_row_blown - checks if a fuse row is
+ all blown
+-------------------------------------------------*/
+
+static int is_fuse_row_blown(const pal_data* pal, const jed_data* jed, UINT16 fuserow)
+{
+ UINT16 columncount = calc_fuse_column_count(pal);
+ UINT16 column;
+
+ for (column = 0; column < columncount; ++column)
+ {
+ if (!jed_get_fuse(jed, fuserow + column))
+ {
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+
+
+/*-------------------------------------------------
+ is_output_pin - determines if the pin is an
+ output pin
+-------------------------------------------------*/
+
+static int is_output_pin(UINT16 pin)
+{
+ UINT16 index;
+
+ for (index = 0; index < outputpinscount; ++index)
+ {
+ if (outputpins[index] == pin)
+ {
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+
+
+/*-------------------------------------------------
+ find_input_pins - finds the input pins of a
+ pal
+-------------------------------------------------*/
+
+static void find_input_pins(const pal_data* pal, const jed_data* jed)
+{
+ UINT16 column;
+
+ inputpinscount = 0;
+
+ for (column = 0; column < pal->pinfusecolumnscount; ++column)
+ {
+ if (!is_output_pin(pal->pinfusecolumns[column].pin))
+ {
+ inputpins[inputpinscount] = pal->pinfusecolumns[column].pin;
+
+ ++inputpinscount;
+ }
+ }
+}
+
+
+
+/*-------------------------------------------------
+ find_output_pins - finds the output pins of a
+ pal
+-------------------------------------------------*/
+
+static void find_output_pins(const pal_data* pal, const jed_data* jed)
+{
+ UINT16 column, columncount, index;
+ int fuseblown;
+
+ outputpinscount = 0;
+ columncount = calc_fuse_column_count(pal);
+
+ for (index = 0; index < pal->pinfuserowscount; ++index)
+ {
+ fuseblown = 0;
+
+ if (pal->pinfuserows[index].fuserowoutputenable == CNoOutputEnableFuseRow)
+ {
+ fuseblown = 1;
+ }
+ else
+ {
+ for (column = 0; column < columncount; ++column)
+ {
+ if (jed_get_fuse(jed, pal->pinfuserows[index].fuserowoutputenable + column) == 1)
+ {
+ fuseblown = 1;
+ }
+ }
+ }
+
+ if (fuseblown)
+ {
+ outputpins[outputpinscount] = pal->pinfuserows[index].pin;
+
+ ++outputpinscount;
+ }
+ }
+}
+
+
+
+static int is_output_pin_used(const pal_data* pal, const jed_data* jed, const pin_fuse_rows* fuse_rows)
+{
+ UINT16 row, column, columncount;
+
+ columncount = calc_fuse_column_count(pal);
+
+ for (row = fuse_rows->fuserowtermstart;
+ row <= fuse_rows->fuserowtermend;
+ row += columncount)
+ {
+ for (column = 0; column < columncount; ++column)
+ {
+ if (jed_get_fuse(jed, row + column))
+ {
+ return 1;
+ }
+ }
+ }
+
+ return 0;
+}
+
+
+
+/*-------------------------------------------------
+ generate_product_terms - prints the product terms
+ for a fuse row
+-------------------------------------------------*/
+
+static void generate_product_terms(const pal_data* pal, const jed_data* jed, UINT16 fuserow, char* buffer)
+{
+ UINT16 index;
+ int lowfusestate, highfusestate, haveterm;
+ char tmpbuffer[20];
+
+ *buffer = 0;
+ haveterm = 0;
+
+ for (index = 0; index < pal->pinfusecolumnscount; ++index)
+ {
+ lowfusestate = jed_get_fuse(jed, fuserow + pal->pinfusecolumns[index].lowfusecolumn);
+ highfusestate = jed_get_fuse(jed, fuserow + pal->pinfusecolumns[index].highfusecolumn);
+
+ if (!lowfusestate && highfusestate)
+ {
+ if (haveterm)
+ {
+ strcat(buffer, " & ");
+ }
+
+ if (!is_output_pin(pal->pinfusecolumns[index].pin))
+ {
+ sprintf(tmpbuffer, "/i%d", pal->pinfusecolumns[index].pin);
+ strcat(buffer, tmpbuffer);
+ }
+ else
+ {
+ sprintf(tmpbuffer, "/o%d", pal->pinfusecolumns[index].pin);
+ strcat(buffer, tmpbuffer);
+ }
+
+ haveterm = 1;
+ }
+ else if (lowfusestate && !highfusestate)
+ {
+ if (haveterm)
+ {
+ strcat(buffer, " & ");
+ }
+
+ if (!is_output_pin(pal->pinfusecolumns[index].pin))
+ {
+ sprintf(tmpbuffer, "i%d", pal->pinfusecolumns[index].pin);
+ strcat(buffer, tmpbuffer);
+ }
+ else
+ {
+ sprintf(tmpbuffer, "o%d", pal->pinfusecolumns[index].pin);
+ strcat(buffer, tmpbuffer);
+ }
+
+ haveterm = 1;
+ }
+ }
+}
+
+
+
+/*-------------------------------------------------
+ print_product_terms - prints the product terms
+ for a pal
+-------------------------------------------------*/
+
+static void print_product_terms(const pal_data* pal, const jed_data* jed, int activestate)
+{
+ UINT16 index, row, columncount;
+ char buffer[200];
+ int haveterms, indent, indentindex;
+
+ columncount = calc_fuse_column_count(pal);
+
+ for (index = 0; index < pal->pinfuserowscount; ++index)
+ {
+ if (is_output_pin(pal->pinfuserows[index].pin) &&
+ is_output_pin_used(pal, jed, &pal->pinfuserows[index]))
+ {
+ indent = 0;
+
+ if (!activestate)
+ {
+ printf("/");
+
+ ++indent;
+ }
+
+ sprintf(buffer, "o%d = ", pal->pinfuserows[index].pin);
+
+ printf("%s", buffer);
+
+ haveterms = 0;
+ indent += strlen(buffer);
+
+ for (row = pal->pinfuserows[index].fuserowtermstart;
+ row <= pal->pinfuserows[index].fuserowtermend;
+ row += columncount)
+ {
+ generate_product_terms(pal, jed, row, buffer);
+
+ if (strlen(buffer) > 0)
+ {
+ if (haveterms)
+ {
+ printf(" +\n");
+
+ for (indentindex = 0; indentindex < indent; ++indentindex)
+ {
+ printf(" ");
+ }
+ }
+ else
+ {
+ haveterms = 1;
+ }
+
+ printf("%s", buffer);
+ }
+ }
+
+ printf("\n");
+
+ /* output enable equations */
+
+ printf("o%d.oe = ", pal->pinfuserows[index].pin);
+
+ if (pal->pinfuserows[index].fuserowoutputenable == CNoOutputEnableFuseRow ||
+ is_fuse_row_blown(pal, jed, pal->pinfuserows[index].fuserowoutputenable))
+ {
+ printf("vcc\n");
+ }
+ else
+ {
+ generate_product_terms(pal, jed, pal->pinfuserows[index].fuserowoutputenable, buffer);
+
+ printf("%s\n", buffer);
+ }
+
+ printf("\n");
+ }
+ }
+
+ printf("\n");
+}
+
+
+
+/*-------------------------------------------------
+ print_pal10l8_product_terms - prints the product
+ terms for a PAL10L8
+-------------------------------------------------*/
+
+static void print_pal10l8_product_terms(const pal_data* pal, const jed_data* jed)
+{
+ print_product_terms(pal, jed, 0);
+}
+
+
+
+/*-------------------------------------------------
+ print_pal10h8_product_terms - prints the product
+ terms for a PAL10H8
+-------------------------------------------------*/
+
+static void print_pal10h8_product_terms(const pal_data* pal, const jed_data* jed)
+{
+ print_product_terms(pal, jed, 1);
+}
+
+
+
+/*-------------------------------------------------
+ print_pal12l6_product_terms - prints the product
+ terms for a PAL12L6
+-------------------------------------------------*/
+
+static void print_pal12l6_product_terms(const pal_data* pal, const jed_data* jed)
+{
+ print_product_terms(pal, jed, 0);
+}
+
+
+
+/*-------------------------------------------------
+ print_pal12h6_product_terms - prints the product
+ terms for a PAL12H6
+-------------------------------------------------*/
+
+static void print_pal12h6_product_terms(const pal_data* pal, const jed_data* jed)
+{
+ print_product_terms(pal, jed, 1);
+}
+
+
+
+/*-------------------------------------------------
+ print_pal14l4_product_terms - prints the product
+ terms for a PAL14L4
+-------------------------------------------------*/
+
+static void print_pal14l4_product_terms(const pal_data* pal, const jed_data* jed)
+{
+ print_product_terms(pal, jed, 0);
+}
+
+
+
+/*-------------------------------------------------
+ print_pal14h4_product_terms - prints the product
+ terms for a PAL14H4
+-------------------------------------------------*/
+
+static void print_pal14h4_product_terms(const pal_data* pal, const jed_data* jed)
+{
+ print_product_terms(pal, jed, 1);
+}
+
+
+
+/*-------------------------------------------------
+ print_pal16l2_product_terms - prints the product
+ terms for a PAL16L2
+-------------------------------------------------*/
+
+static void print_pal16l2_product_terms(const pal_data* pal, const jed_data* jed)
+{
+ print_product_terms(pal, jed, 0);
+}
+
+
+
+/*-------------------------------------------------
+ print_pal16h2_product_terms - prints the product
+ terms for a PAL16H2
+-------------------------------------------------*/
+
+static void print_pal16h2_product_terms(const pal_data* pal, const jed_data* jed)
+{
+ print_product_terms(pal, jed, 1);
+}
+
+
+
+/*-------------------------------------------------
+ print_pal16h2_product_terms - prints the product
+ terms for a PAL16C1
+-------------------------------------------------*/
+
+static void print_pal16c1_product_terms(const pal_data* pal, const jed_data* jed)
+{
+ printf("Viewing product terms are not supported.\n");
+}
+
+
+
+/*-------------------------------------------------
+ print_pal16l8_product_terms - prints the product
+ terms for a PAL16L8
+-------------------------------------------------*/
+
+static void print_pal16l8_product_terms(const pal_data* pal, const jed_data* jed)
+{
+ print_product_terms(pal, jed, 0);
+}
+
+
+
+/*-------------------------------------------------
+ print_pal16r4_product_terms - prints the product
+ terms for a PAL16R4
+-------------------------------------------------*/
+
+static void print_pal16r4_product_terms(const pal_data* pal, const jed_data* jed)
+{
+ printf("Viewing product terms are not supported.\n");
+}
+
+
+
+/*-------------------------------------------------
+ print_pal16r6_product_terms - prints the product
+ terms for a PAL16R6
+-------------------------------------------------*/
+
+static void print_pal16r6_product_terms(const pal_data* pal, const jed_data* jed)
+{
+ printf("Viewing product terms are not supported.\n");
+}
+
+
+
+/*-------------------------------------------------
+ print_pal16r8_product_terms - prints the product
+ terms for a PAL16R8
+-------------------------------------------------*/
+
+static void print_pal16r8_product_terms(const pal_data* pal, const jed_data* jed)
+{
+ printf("Viewing product terms are not supported.\n");
+}
+
+
+
+/*-------------------------------------------------
+ print_gal18v10_product_terms - prints the product
+ terms for a GAL18V10
+-------------------------------------------------*/
+
+static void print_gal18v10_product_terms(const pal_data* pal, const jed_data* jed)
+{
+ printf("Viewing product terms are not supported.\n");
+}
+
+
+
+/*-------------------------------------------------
+ print_pal20l8_product_terms - prints the product
+ terms for a PAL20L8
+-------------------------------------------------*/
+
+static void print_pal20l8_product_terms(const pal_data* pal, const jed_data* jed)
+{
+ print_product_terms(pal, jed, 0);
+}
+
+
+
+/*-------------------------------------------------
+ print_pal20l10_product_terms - prints the product
+ terms for a PAL20L10
+-------------------------------------------------*/
+
+static void print_pal20l10_product_terms(const pal_data* pal, const jed_data* jed)
+{
+ print_product_terms(pal, jed, 0);
+}
+
+
+
+/*-------------------------------------------------
+ print_pal20r4_product_terms - prints the product
+ terms for a PAL20R4
+-------------------------------------------------*/
+
+static void print_pal20r4_product_terms(const pal_data* pal, const jed_data* jed)
+{
+ printf("Viewing product terms are not supported.\n");
+}
+
+
+
+/*-------------------------------------------------
+ print_pal20r6_product_terms - prints the product
+ terms for a PAL20R6
+-------------------------------------------------*/
+
+static void print_pal20r6_product_terms(const pal_data* pal, const jed_data* jed)
+{
+ printf("Viewing product terms are not supported.\n");
+}
+
+
+
+/*-------------------------------------------------
+ print_pal20r8_product_terms - prints the product
+ terms for a PAL20R8
+-------------------------------------------------*/
+
+static void print_pal20r8_product_terms(const pal_data* pal, const jed_data* jed)
+{
+ printf("Viewing product terms are not supported.\n");
+}
+
+
+
+/*-------------------------------------------------
read_source_file - read a raw source file
into an allocated memory buffer
-------------------------------------------------*/
@@ -187,48 +1496,53 @@ static int write_dest_file(const char *dstfile)
/*-------------------------------------------------
- main - primary entry point
+ print_usage - prints out the supported command
+ line arguments
-------------------------------------------------*/
-int main(int argc, char *argv[])
+static int print_usage()
+{
+ fprintf(stderr,
+ "Usage:\n"
+ " jedutil -convert <source.jed> <target.bin> [fuses] -- convert JED to binary form\n"
+ " jedutil -convert <source.bin> <target.jed> -- convert binary to JED form\n"
+ " jedutil -view <source.jed> <pal name> -- dump JED logic equations\n"
+ " jedutil -view <source.bin> <pal name> -- dump binary logic equations\n"
+ );
+
+ return 0;
+}
+
+
+
+/*-------------------------------------------------
+ command_convert - convert files
+-------------------------------------------------*/
+
+static int command_convert(int argc, char *argv[])
{
- const char *srcfile, *dstfile;
+ const char *srcfile, *dstfile;
int src_is_jed, dst_is_jed;
int numfuses = 0;
jed_data jed;
- int len;
int err;
- /* needs at least two arguments */
- if (argc < 3)
+ if (argc < 2)
{
- fprintf(stderr,
- "Usage:\n"
- " jedutil <source.jed> <target.bin> [fuses] -- convert JED to binary form\n"
- " jedutil <source.bin> <target.jed> -- convert binary to JED form\n"
- );
- return 0;
+ return print_usage();
}
/* extract arguments */
- srcfile = argv[1];
- dstfile = argv[2];
- if (argc >= 4)
- numfuses = atoi(argv[3]);
+ srcfile = argv[0];
+ dstfile = argv[1];
+ if (argc >= 3)
+ numfuses = atoi(argv[2]);
/* does the source end in '.jed'? */
- len = strlen(srcfile);
- src_is_jed = (srcfile[len - 4] == '.' &&
- tolower((UINT8)srcfile[len - 3]) == 'j' &&
- tolower((UINT8)srcfile[len - 2]) == 'e' &&
- tolower((UINT8)srcfile[len - 1]) == 'd');
+ src_is_jed = is_jed_file(srcfile);
/* does the destination end in '.jed'? */
- len = strlen(dstfile);
- dst_is_jed = (dstfile[len - 4] == '.' &&
- tolower((UINT8)dstfile[len - 3]) == 'j' &&
- tolower((UINT8)dstfile[len - 2]) == 'e' &&
- tolower((UINT8)dstfile[len - 1]) == 'd');
+ dst_is_jed = is_jed_file(dstfile);
/* error if neither or both are .jed */
if (!src_is_jed && !dst_is_jed)
@@ -313,5 +1627,114 @@ int main(int argc, char *argv[])
return 1;
printf("Target file written successfully\n");
- return 0;
+
+ return 0;
+}
+
+
+
+/*-------------------------------------------------
+ command_view - views the contents of a file
+-------------------------------------------------*/
+
+static int command_view(int argc, char *argv[])
+{
+ const char *srcfile, *palname;
+ int is_jed;
+ pal_data* pal;
+ jed_data jed;
+ int err;
+
+ if (argc < 2)
+ {
+ return print_usage();
+ }
+
+ /* extract arguments */
+ srcfile = argv[0];
+ palname = argv[1];
+
+ /* does the source end in '.jed'? */
+ is_jed = is_jed_file(srcfile);
+
+ /* find the pal entry */
+ pal = find_pal_data(palname);
+ if (!pal)
+ {
+ fprintf(stderr, "Unknown pal name.\n");
+ return 1;
+ }
+
+ /* read the source file */
+ err = read_source_file(srcfile);
+ if (err != 0)
+ return 1;
+
+ /* if the source is JED, convert to binary */
+ if (is_jed)
+ {
+ /* read the JEDEC data */
+ err = jed_parse(srcbuf, srcbuflen, &jed);
+ switch (err)
+ {
+ case JEDERR_INVALID_DATA: fprintf(stderr, "Fatal error: Invalid .JED file\n"); return 1;
+ case JEDERR_BAD_XMIT_SUM: fprintf(stderr, "Fatal error: Bad transmission checksum\n"); return 1;
+ case JEDERR_BAD_FUSE_SUM: fprintf(stderr, "Fatal error: Bad fusemap checksum\n"); return 1;
+ }
+ }
+ else
+ {
+ /* read the binary data */
+ err = jedbin_parse(srcbuf, srcbuflen, &jed);
+ switch (err)
+ {
+ case JEDERR_INVALID_DATA: fprintf(stderr, "Fatal error: Invalid binary JEDEC file\n"); return 1;
+ }
+ }
+
+ /* generate equations from fuse map */
+
+ find_output_pins(pal, &jed);
+ find_input_pins(pal, &jed);
+
+ if (pal->print_product_terms)
+ {
+ pal->print_product_terms(pal, &jed);
+ }
+ else
+ {
+ fprintf(stderr, "Viewing product terms not supported for this pal type.");
+
+ return 1;
+ }
+
+ return 0;
+}
+
+
+
+/*-------------------------------------------------
+ main - primary entry point
+-------------------------------------------------*/
+
+int main(int argc, char *argv[])
+{
+ command_entry command_entries[] = {
+ {"-convert", &command_convert},
+ {"-view", &command_view}};
+ int index;
+
+ /* needs at least two arguments */
+ if (argc < 4)
+ {
+ return print_usage();
+ }
+
+ for (index = 0; index < sizeof(command_entries) / sizeof(command_entries[0]); ++index)
+ {
+ if (!strcmp(argv[1], command_entries[index].command))
+ return command_entries[index].command_func(argc - 2, &argv[2]);
+ }
+
+ return print_usage();
}