/** Program to convert logic equations * of 16 inputs and 8 outputs * to a 64-kilobyte truth table. * @author Marko Mäkelä (msmakela@nic.funet.fi) * @date 9th July 2003, based on a version from 2nd July 2002 * The equations in this program have been translated from the * MACHXL design description supplied by Jens Schönfeld (jens@ami.ga), * and verified against the 64-kilobyte dumps supplied by Jens Schönfeld. * * Compilation: * cc -o pla 906114-4.c * Example usage: * ./pla | diff - pla-dump.bin * or * ./pla > pla-dump.bin */ #include /** Extract an input bit * @param b the bit to be extracted * @return nonzero if the input bit b is set */ #define I(b) (!!((i) & (1 << b))) /** @name The input signals. * This mapping corresponds to the 82S100 to 27512 adapter made by * Jens Schönfeld (jens@ami.ga). Note also the permutation of outputs * in the main loop. */ /*@{*/ #define I0 I(1) #define I1 I(2) #define I2 I(3) #define I3 I(4) #define I4 I(5) #define I5 I(6) #define RAS I(7) #define CAS I(12) #define REFEN I(14) #define ECAS I(13) #define ERAS I(8) #define BUSY2 I(9) #define BP3 I(11) #define BP2 I(15) #define BP1 I(10) #define BP0 I(0) /*@}*/ /** @name The output signals. */ /*@{*/ /* RAS1 */ #define F1 !((!BP3 && !BP2 && !BP1 && BP0 && !RAS && BUSY2)|| \ (!RAS && BUSY2 && REFEN)|| \ (!BP3 && !BP2 && !BP1 && BP0 && !ERAS && !BUSY2)|| \ (!ERAS && !BUSY2 && REFEN)) /*RAS2*/ #define F2 !((!BP3 && !BP2 && BP1 && !BP0 && !RAS && BUSY2)|| \ (!RAS && BUSY2 && REFEN)|| \ (!BP3 && !BP2 && BP1 && !BP0 && !ERAS && !BUSY2)|| \ (!ERAS && !BUSY2 && REFEN)) /*RAS3*/ #define F7 !((!BP3 && !BP2 && BP1 && BP0 && !RAS && BUSY2)|| \ (!RAS && BUSY2 && REFEN)|| \ (!BP3 && !BP2 && BP1 && BP0 && !ERAS && !BUSY2)|| \ (!ERAS && !BUSY2 && REFEN)) /*RAS4*/ #define F4 !((!BP3 && BP2 && !BP1 && !BP0 && !RAS && BUSY2)|| \ (!RAS && BUSY2 && REFEN)|| \ (!BP3 && BP2 && !BP1 && !BP0 && !ERAS && !BUSY2)|| \ (!ERAS && !BUSY2 && REFEN)) /*CAS1*/ #define F0 !((!BP3 && !BP2 && !BP1 && BP0 && !CAS && BUSY2 && !REFEN)|| \ (!BP3 && !BP2 && !BP1 && BP0 && !ECAS && !BUSY2 && !REFEN)) /*CAS2*/ #define F3 !((!BP3 && !BP2 && BP1 && !BP0 && !CAS && BUSY2 && !REFEN)|| \ (!BP3 && !BP2 && BP1 && !BP0 && !ECAS && !BUSY2 && !REFEN)) /*CAS3*/ #define F6 !((!BP3 && !BP2 && BP1 && BP0 && !CAS && BUSY2 && !REFEN)|| \ (!BP3 && !BP2 && BP1 && BP0 && !ECAS && !BUSY2 && !REFEN)) /*CAS4*/ #define F5 !((!BP3 && BP2 && !BP1 && !BP0 && !CAS && BUSY2 && !REFEN)|| \ (!BP3 && BP2 && !BP1 && !BP0 && !ECAS && !BUSY2 && !REFEN)) /*@}*/ /** The main program * @param argc command line argument count * @param argv command line argument vector * @return zero on successful termination */ int main (int argc, char** argv) { /** The input combination, at least 16 bits */ register unsigned int i = 0; do { /** The output combination, 8 bits */ register unsigned char o = 0; /* The outputs are permuted so that they correspond to the adapter * made by Jens Schönfeld. */ if (F0) o |= 1 << 6; if (F1) o |= 1 << 5; if (F2) o |= 1 << 4; if (F3) o |= 1 << 3; if (F4) o |= 1 << 2; if (F5) o |= 1 << 1; if (F6) o |= 1 << 0; if (F7) o |= 1 << 7; putchar (o); } while (++i & 0xffff); return 0; }