summaryrefslogtreecommitdiffstatshomepage
path: root/src/tools/jedutil.c
diff options
context:
space:
mode:
author smf- <smf-@users.noreply.github.com>2013-06-10 19:33:46 +0000
committer smf- <smf-@users.noreply.github.com>2013-06-10 19:33:46 +0000
commit603f354635230221498ddac8bbcc47c066f9677d (patch)
treeda8fcd00aa01c8a970188e6c12dce5698bf0c067 /src/tools/jedutil.c
parentb58b1ddc28b3b9de0e703de3a1cc3e6d2e18741d (diff)
Added support to jedutil for decoding 82S153, PLS153 & CK2605 [Kevin Eshbach, Charles MacDonald]
Diffstat (limited to 'src/tools/jedutil.c')
-rw-r--r--src/tools/jedutil.c475
1 files changed, 449 insertions, 26 deletions
diff --git a/src/tools/jedutil.c b/src/tools/jedutil.c
index 050da77b64f..2e67027c9bd 100644
--- a/src/tools/jedutil.c
+++ b/src/tools/jedutil.c
@@ -60,6 +60,8 @@
15S8 = QP20 QF0448
+ CK2605 = QP20 QF1106
+
PLS153 = QP20 QF1842
PAL16L8 = QP20 QF2048
@@ -94,6 +96,11 @@
28-pin devices:
PLS100 = QP28 QF1928
+****************************************************************************
+
+ Thanks to Charles MacDonald for providing information on how to decode
+ the PLS153 and CK2605 fuse map.
+
***************************************************************************/
#include <stdio.h>
@@ -243,14 +250,15 @@ 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_gal16v8_product_terms(const pal_data* pal, const jed_data* jed);
static void print_peel18cv8_product_terms(const pal_data* pal, const jed_data* jed);
-#if defined(include_gal18v10)
static void print_gal18v10_product_terms(const pal_data* pal, const jed_data* jed);
-#endif
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);
+static void print_82s153_product_terms(const pal_data* pal, const jed_data* jed);
+static void print_pls153_product_terms(const pal_data* pal, const jed_data* jed);
+static void print_ck2605_product_terms(const pal_data* pal, const jed_data* jed);
@@ -269,14 +277,15 @@ static void config_pal16r6_pins(const pal_data* pal, const jed_data* jed);
static void config_pal16r8_pins(const pal_data* pal, const jed_data* jed);
static void config_gal16v8_pins(const pal_data* pal, const jed_data* jed);
static void config_peel18cv8_pins(const pal_data* pal, const jed_data* jed);
-#if defined(include_gal18v10)
static void config_gal18v10_pins(const pal_data* pal, const jed_data* jed);
-#endif
static void config_pal20l8_pins(const pal_data* pal, const jed_data* jed);
static void config_pal20l10_pins(const pal_data* pal, const jed_data* jed);
static void config_pal20r4_pins(const pal_data* pal, const jed_data* jed);
static void config_pal20r6_pins(const pal_data* pal, const jed_data* jed);
static void config_pal20r8_pins(const pal_data* pal, const jed_data* jed);
+static void config_82s153_pins(const pal_data* pal, const jed_data* jed);
+static void config_pls153_pins(const pal_data* pal, const jed_data* jed);
+static void config_ck2605_pins(const pal_data* pal, const jed_data* jed);
@@ -424,7 +433,6 @@ static pin_fuse_rows peel18cv8pinfuserows[] = {
{18, 2340, 288, 540},
{19, 2304, 0, 252}};
-#if defined(include_gal18v10)
static pin_fuse_rows gal18v10pinfuserows[] = {
{9, 3096, 3132, 3384},
{11, 2772, 2808, 3060},
@@ -436,7 +444,6 @@ static pin_fuse_rows gal18v10pinfuserows[] = {
{17, 684, 720, 972},
{18, 360, 396, 648},
{19, 36, 72, 324}};
-#endif
static pin_fuse_rows pal20l8pinfuserows[] = {
{15, 2240, 2280, 2520},
@@ -490,6 +497,42 @@ static pin_fuse_rows pal20r8pinfuserows[] = {
{21, NO_OUTPUT_ENABLE_FUSE_ROW, 320, 600}, /* Registered Output */
{22, NO_OUTPUT_ENABLE_FUSE_ROW, 0, 280}}; /* Registered Output */
+static pin_fuse_rows _82s153pinfuserows[] = {
+ {9, NO_OUTPUT_ENABLE_FUSE_ROW, 0, 0},
+ {11, NO_OUTPUT_ENABLE_FUSE_ROW, 0, 0},
+ {12, NO_OUTPUT_ENABLE_FUSE_ROW, 0, 0},
+ {13, NO_OUTPUT_ENABLE_FUSE_ROW, 0, 0},
+ {14, NO_OUTPUT_ENABLE_FUSE_ROW, 0, 0},
+ {15, NO_OUTPUT_ENABLE_FUSE_ROW, 0, 0},
+ {16, NO_OUTPUT_ENABLE_FUSE_ROW, 0, 0},
+ {17, NO_OUTPUT_ENABLE_FUSE_ROW, 0, 0},
+ {18, NO_OUTPUT_ENABLE_FUSE_ROW, 0, 0},
+ {19, NO_OUTPUT_ENABLE_FUSE_ROW, 0, 0}};
+
+static pin_fuse_rows pls153pinfuserows[] = {
+ {9, 1472, 0, 0},
+ {11, 1508, 0, 0},
+ {12, 1544, 0, 0},
+ {13, 1580, 0, 0},
+ {14, 1616, 0, 0},
+ {15, 1652, 0, 0},
+ {16, 1688, 0, 0},
+ {17, 1724, 0, 0},
+ {18, 1760, 0, 0},
+ {19, 1796, 0, 0}};
+
+static pin_fuse_rows ck2605pinfuserows[] = {
+ {9, 736, 0, 0},
+ {11, 772, 0, 0},
+ {12, 808, 0, 0},
+ {13, 844, 0, 0},
+ {14, 880, 0, 0},
+ {15, 916, 0, 0},
+ {16, 952, 0, 0},
+ {17, 988, 0, 0},
+ {18, 1024, 0, 0},
+ {19, 1060, 0, 0}};
+
static pin_fuse_columns pal10l8pinfusecolumns[] = {
{1, 3, 2},
{2, 1, 0},
@@ -738,7 +781,6 @@ static pin_fuse_columns peel18cv8pinfusecolumns[] = {
{18, 11, 10},
{19, 7, 6}};
-#if defined(include_gal18v10)
static pin_fuse_columns gal18v10pinfusecolumns[] = {
{1, 1, 0},
{2, 5, 4},
@@ -758,7 +800,6 @@ static pin_fuse_columns gal18v10pinfusecolumns[] = {
{17, 11, 10},
{18, 7, 6},
{19, 3, 2}};
-#endif
static pin_fuse_columns pal20l8pinfusecolumns[] = {
{1, 3, 2},
@@ -870,6 +911,66 @@ static pin_fuse_columns pal20r8pinfusecolumns[] = {
{22, 7, 6},
{23, 3, 2}};
+static pin_fuse_columns _82s153pinfusecolumns[] = {
+ {1, 0, 0},
+ {2, 0, 0},
+ {3, 0, 0},
+ {4, 0, 0},
+ {5, 0, 0},
+ {6, 0, 0},
+ {7, 0, 0},
+ {8, 0, 0},
+ {9, 0, 0},
+ {11, 0, 0},
+ {12, 0, 0},
+ {13, 0, 0},
+ {14, 0, 0},
+ {15, 0, 0},
+ {16, 0, 0},
+ {17, 0, 0},
+ {18, 0, 0},
+ {19, 0, 0}};
+
+static pin_fuse_columns pls153pinfusecolumns[] = {
+ {1, 1, 0},
+ {2, 3, 2},
+ {3, 5, 4},
+ {4, 7, 6},
+ {5, 9, 8},
+ {6, 11, 10},
+ {7, 13, 12},
+ {8, 15, 14},
+ {9, 17, 16},
+ {11, 19, 18},
+ {12, 21, 20},
+ {13, 23, 22},
+ {14, 25, 24},
+ {15, 27, 26},
+ {16, 29, 28},
+ {17, 31, 30},
+ {18, 33, 32},
+ {19, 35, 34}};
+
+static pin_fuse_columns ck2605pinfusecolumns[] = {
+ {1, 1, 0},
+ {2, 3, 2},
+ {3, 5, 4},
+ {4, 7, 6},
+ {5, 9, 8},
+ {6, 11, 10},
+ {7, 13, 12},
+ {8, 15, 14},
+ {9, 17, 16},
+ {11, 19, 18},
+ {12, 21, 20},
+ {13, 23, 22},
+ {14, 25, 24},
+ {15, 27, 26},
+ {16, 29, 28},
+ {17, 31, 30},
+ {18, 33, 32},
+ {19, 35, 34}};
+
static pal_data paldata[] = {
{"PAL10L8",
pal10l8pinfuserows, ARRAY_LEN(pal10l8pinfuserows),
@@ -934,8 +1035,7 @@ static pal_data paldata[] = {
config_pal16l2_pins,
NULL,
NULL},
- /*{"15S8", NULL, 0, NULL, 0, NULL, NULL, NULL, NULL},
- {"PLS153", NULL, 0, NULL, 0, NULL, NULL, NULL, NULL},*/
+ /*{"15S8", NULL, 0, NULL, 0, NULL, NULL, NULL, NULL},*/
{"PAL16L8",
pal16l8pinfuserows, ARRAY_LEN(pal16l8pinfuserows),
pal16l8pinfusecolumns, ARRAY_LEN(pal16l8pinfusecolumns),
@@ -981,15 +1081,13 @@ static pal_data paldata[] = {
config_peel18cv8_pins,
NULL,
get_peel18cv8_pin_fuse_state},
-#if defined(include_gal18v10)
- {"GAL18V10",
+ {"GAL18V10",
gal18v10pinfuserows, ARRAY_LEN(gal18v10pinfuserows),
gal18v10pinfusecolumns, ARRAY_LEN(gal18v10pinfusecolumns),
print_gal18v10_product_terms,
config_gal18v10_pins,
NULL,
NULL},
-#endif
{"PAL20L8",
pal20l8pinfuserows, ARRAY_LEN(pal20l8pinfuserows),
pal20l8pinfusecolumns, ARRAY_LEN(pal20l8pinfusecolumns),
@@ -1024,14 +1122,35 @@ static pal_data paldata[] = {
print_pal20r8_product_terms,
config_pal20r8_pins,
NULL,
- NULL}/*,
- {"PAL20X4", NULL, 0, NULL, 0, NULL, NULL, NULL, NULL},
- {"PAL20X8", NULL, 0, NULL, 0, NULL, NULL, NULL, NULL},
- {"PAL20X10", NULL, 0, NULL, 0, NULL, NULL, NULL, NULL},
- {"PAL22V10", NULL, 0, NULL, 0, NULL, NULL, NULL, NULL},
- {"GAL20V8A", NULL, 0, NULL, 0, NULL, NULL, NULL, NULL},
- {"GAL22V10", NULL, 0, NULL, 0, NULL, NULL, NULL, NULL},
- {"PLS100", NULL, 0, NULL, 0, NULL, NULL, NULL, NULL}*/};
+ NULL},/*
+ {"PAL20X4", NULL, 0, NULL, 0, NULL, NULL, NULL, NULL},
+ {"PAL20X8", NULL, 0, NULL, 0, NULL, NULL, NULL, NULL},
+ {"PAL20X10", NULL, 0, NULL, 0, NULL, NULL, NULL, NULL},
+ {"PAL22V10", NULL, 0, NULL, 0, NULL, NULL, NULL, NULL},
+ {"GAL20V8A", NULL, 0, NULL, 0, NULL, NULL, NULL, NULL},
+ {"GAL22V10", NULL, 0, NULL, 0, NULL, NULL, NULL, NULL},
+ {"PLS100", NULL, 0, NULL, 0, NULL, NULL, NULL, NULL},*/
+ {"82S153",
+ _82s153pinfuserows, ARRAY_LEN(_82s153pinfuserows),
+ _82s153pinfusecolumns, ARRAY_LEN(_82s153pinfusecolumns),
+ print_82s153_product_terms,
+ config_82s153_pins,
+ NULL,
+ NULL},
+ {"PLS153",
+ pls153pinfuserows, ARRAY_LEN(pls153pinfuserows),
+ pls153pinfusecolumns, ARRAY_LEN(pls153pinfusecolumns),
+ print_pls153_product_terms,
+ config_pls153_pins,
+ NULL,
+ NULL},
+ {"CK2605",
+ ck2605pinfuserows, ARRAY_LEN(ck2605pinfuserows),
+ ck2605pinfusecolumns, ARRAY_LEN(ck2605pinfusecolumns),
+ print_ck2605_product_terms,
+ config_ck2605_pins,
+ NULL,
+ NULL}};
@@ -1938,7 +2057,6 @@ static void print_peel18cv8_product_terms(const pal_data* pal, const jed_data* j
terms for a GAL18V10
-------------------------------------------------*/
-#if defined(include_gal18v10)
static void print_gal18v10_product_terms(const pal_data* pal, const jed_data* jed)
{
char buffer[200];
@@ -1967,7 +2085,6 @@ static void print_gal18v10_product_terms(const pal_data* pal, const jed_data* je
printf("\n");
}
}
-#endif
@@ -2032,6 +2149,224 @@ static void print_pal20r8_product_terms(const pal_data* pal, const jed_data* jed
/*-------------------------------------------------
+ print_82s153_product_terms - prints the product
+ terms for a 82S153
+-------------------------------------------------*/
+
+static void print_82s153_product_terms(const pal_data* pal, const jed_data* jed)
+{
+ fprintf(stderr, "Print of product terms not supported for this device\n");
+}
+
+
+
+/*-------------------------------------------------
+ print_pls153_product_terms - prints the product
+ terms for a PLS153
+-------------------------------------------------*/
+
+static void print_pls153_product_terms(const pal_data* pal, const jed_data* jed)
+{
+ UINT16 index, columncount, flags, row, haveterms, or_column, fuserow;
+ char buffer[200];
+ int indent, indentindex;
+ const pin_fuse_rows* fuse_rows;
+
+ columncount = calc_fuse_column_count(pal);
+
+ print_input_pins();
+ print_output_pins();
+
+ printf("Equations:\n\n");
+
+ for (index = 0; index < outputpinscount; ++index)
+ {
+ flags = outputpins[index].flags;
+
+ indent = 0;
+
+ if (flags & OUTPUT_ACTIVELOW)
+ {
+ printf("/");
+
+ ++indent;
+ }
+
+ sprintf(buffer, "o%d = ", outputpins[index].pin);
+
+ printf("%s", buffer);
+
+ haveterms = 0;
+ indent += strlen(buffer);
+
+ fuse_rows = find_fuse_rows(pal, outputpins[index].pin);
+ fuserow = 0;
+
+ if (outputpins[index].pin != 9)
+ {
+ or_column = 19 - outputpins[index].pin;
+ }
+ else
+ {
+ or_column = 9;
+ }
+
+ for (row = 0; row < 32; ++row)
+ {
+ if (!jed_get_fuse(jed, fuserow + columncount + or_column))
+ {
+ generate_product_terms(pal, jed, fuserow, buffer);
+
+ if (strlen(buffer) > 0)
+ {
+ if (haveterms)
+ {
+ printf(" +\n");
+
+ for (indentindex = 0; indentindex < indent; ++indentindex)
+ {
+ printf(" ");
+ }
+ }
+ else
+ {
+ haveterms = 1;
+ }
+
+ printf("%s", buffer);
+ }
+ }
+
+ fuserow += (columncount + 10);
+ }
+
+ printf("\n");
+
+ /* output enable equations */
+
+ printf("o%d.oe = ", outputpins[index].pin);
+
+ if (all_fuses_in_row_blown(pal, jed, fuse_rows->fuserowoutputenable))
+ {
+ printf("vcc\n");
+ }
+ else
+ {
+ generate_product_terms(pal, jed, fuse_rows->fuserowoutputenable, buffer);
+
+ printf("%s\n", buffer);
+ }
+
+ printf("\n");
+ }
+}
+
+
+
+/*-------------------------------------------------
+ print_ck2605_product_terms - prints the product
+ terms for a CK2605
+-------------------------------------------------*/
+
+static void print_ck2605_product_terms(const pal_data* pal, const jed_data* jed)
+{
+ UINT16 index, columncount, flags, row, haveterms, or_column, fuserow;
+ char buffer[200];
+ int indent, indentindex;
+ const pin_fuse_rows* fuse_rows;
+
+ columncount = calc_fuse_column_count(pal);
+
+ print_input_pins();
+ print_output_pins();
+
+ printf("Equations:\n\n");
+
+ for (index = 0; index < outputpinscount; ++index)
+ {
+ flags = outputpins[index].flags;
+
+ indent = 0;
+
+ if (flags & OUTPUT_ACTIVELOW)
+ {
+ printf("/");
+
+ ++indent;
+ }
+
+ sprintf(buffer, "o%d = ", outputpins[index].pin);
+
+ printf("%s", buffer);
+
+ haveterms = 0;
+ indent += strlen(buffer);
+
+ fuse_rows = find_fuse_rows(pal, outputpins[index].pin);
+ fuserow = 0;
+
+ if (outputpins[index].pin != 9)
+ {
+ or_column = 19 - outputpins[index].pin;
+ }
+ else
+ {
+ or_column = 9;
+ }
+
+ for (row = 0; row < 16; ++row)
+ {
+ if (!jed_get_fuse(jed, fuserow + columncount + or_column))
+ {
+ generate_product_terms(pal, jed, fuserow, buffer);
+
+ if (strlen(buffer) > 0)
+ {
+ if (haveterms)
+ {
+ printf(" +\n");
+
+ for (indentindex = 0; indentindex < indent; ++indentindex)
+ {
+ printf(" ");
+ }
+ }
+ else
+ {
+ haveterms = 1;
+ }
+
+ printf("%s", buffer);
+ }
+ }
+
+ fuserow += (columncount + 10);
+ }
+
+ printf("\n");
+
+ /* output enable equations */
+
+ printf("o%d.oe = ", outputpins[index].pin);
+
+ if (all_fuses_in_row_blown(pal, jed, fuse_rows->fuserowoutputenable))
+ {
+ printf("vcc\n");
+ }
+ else
+ {
+ generate_product_terms(pal, jed, fuse_rows->fuserowoutputenable, buffer);
+
+ printf("%s\n", buffer);
+ }
+
+ printf("\n");
+ }
+}
+
+
+
+/*-------------------------------------------------
config_pal10l8_pins - configures the pins for
a PAL10L8
-------------------------------------------------*/
@@ -2782,7 +3117,6 @@ static void config_peel18cv8_pins(const pal_data* pal, const jed_data* jed)
for a GAL18V10
-------------------------------------------------*/
-#if defined(include_gal18v10)
static void config_gal18v10_pins(const pal_data* pal, const jed_data* jed)
{
typedef struct _output_logic_macrocell output_logic_macrocell;
@@ -2804,7 +3138,7 @@ static void config_gal18v10_pins(const pal_data* pal, const jed_data* jed)
{17, 3460, 3461},
{18, 3458, 3459},
{19, 3456, 3457}};
- static UINT16 input_pins[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 17, 18, 19};
+ static UINT16 input_pins[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19};
pin_output_config output_pins[ARRAY_LEN(macrocells)];
UINT16 index, output_pin_count;
@@ -2856,7 +3190,6 @@ static void config_gal18v10_pins(const pal_data* pal, const jed_data* jed)
set_input_pins(input_pins, ARRAY_LEN(input_pins));
set_output_pins(output_pins, output_pin_count);
}
-#endif
@@ -3069,6 +3402,96 @@ static void config_pal20r8_pins(const pal_data* pal, const jed_data* jed)
/*-------------------------------------------------
+ config_82s153_pins - configures the pins for
+ a 82S153
+-------------------------------------------------*/
+
+static void config_82s153_pins(const pal_data* pal, const jed_data* jed)
+{
+ fprintf(stderr, "Config not supported for this device\n");
+}
+
+
+
+/*-------------------------------------------------
+ config_pls153_pins - configures the pins for
+ a PLS153
+-------------------------------------------------*/
+
+static void config_pls153_pins(const pal_data* pal, const jed_data* jed)
+{
+ static UINT16 input_pins[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19};
+ pin_output_config output_pins[10];
+ UINT16 output_pin_count, index;
+
+ output_pin_count = 0;
+
+ for (index = 0; index < pal->pinfuserowscount; ++index)
+ {
+ if (does_output_enable_fuse_row_allow_output(pal, jed, pal->pinfuserows[index].fuserowoutputenable))
+ {
+ output_pins[output_pin_count].pin = pal->pinfuserows[index].pin;
+ output_pins[output_pin_count].flags = OUTPUT_COMBINATORIAL | OUTPUT_FEEDBACK_OUTPUT;
+
+ if (jed_get_fuse(jed, 1832 + (9 - index)))
+ {
+ output_pins[output_pin_count].flags |= OUTPUT_ACTIVELOW;
+ }
+ else
+ {
+ output_pins[output_pin_count].flags |= OUTPUT_ACTIVEHIGH;
+ }
+
+ ++output_pin_count;
+ }
+ }
+
+ set_input_pins(input_pins, ARRAY_LEN(input_pins));
+ set_output_pins(output_pins, output_pin_count);
+}
+
+
+
+/*-------------------------------------------------
+ config_ck2605_pins - configures the pins for
+ a CK2605
+-------------------------------------------------*/
+
+static void config_ck2605_pins(const pal_data* pal, const jed_data* jed)
+{
+ static UINT16 input_pins[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19};
+ pin_output_config output_pins[10];
+ UINT16 output_pin_count, index;
+
+ output_pin_count = 0;
+
+ for (index = 0; index < pal->pinfuserowscount; ++index)
+ {
+ if (does_output_enable_fuse_row_allow_output(pal, jed, pal->pinfuserows[index].fuserowoutputenable))
+ {
+ output_pins[output_pin_count].pin = pal->pinfuserows[index].pin;
+ output_pins[output_pin_count].flags = OUTPUT_COMBINATORIAL | OUTPUT_FEEDBACK_OUTPUT;
+
+ if (jed_get_fuse(jed, 1096 + (9 - index)))
+ {
+ output_pins[output_pin_count].flags |= OUTPUT_ACTIVELOW;
+ }
+ else
+ {
+ output_pins[output_pin_count].flags |= OUTPUT_ACTIVEHIGH;
+ }
+
+ ++output_pin_count;
+ }
+ }
+
+ set_input_pins(input_pins, ARRAY_LEN(input_pins));
+ set_output_pins(output_pins, output_pin_count);
+}
+
+
+
+/*-------------------------------------------------
is_gal16v8_product_term_enabled - determines if
a fuse row in a GAL16V8 is enabled
-------------------------------------------------*/