<><><><><><><><><><><> PAL Equation Simulator <><><><><><><><><><><> Program: PLDSIM Author: Bill Walz Date: 28-OCT-1991 This program allows the user to evaluate PAL eqautions through software exercising. The input file is a SPRINT text file with test vectors. Although the test vectors are not required the equations will not be exercised with out them. The program is written in C++ and at the present time can only be run on a system with a C++ compiler(i.e. engineering building). This program was developed because at present time there is no way to test the ECL PALS. PLDSIM has no knowledge of the device types. That is PLDSIM only uses the PIN data as an indicator of where the test vector data should go. PLDSIM does not error check pins(i.e. a power pin assigned to an output label etc.) SPRINT will do this error checking. Therefore the order of PAL programming should be: 1) Run the SPRINT file through SPRINT's PLDASM 2) After PLDASM completes successfully Run the SPRINT file through PLDSIM This order is prefered because PLDSIM only checks that the equations are correct not device specifics. To Compile PLDSIM from PAL_SIM.C type this on the command line after pal_sim.c has been ftp'ed or something similar: g++ -o pldsim pal_sim.c This will produce the executable file: pldsim note: If one is logged on a NeXT machine the 'g++' should be a 'cc++'. Once the executable file PLDSIM is generated the program is ready to run. PLDSIM assumes that 'stdin' will provide the input. PLDSIM writes to 'stdout' and 'stderr'. This allows for these forms(on the command line): pldsim < SPRINT file (reads SPRINT file from file name given after i/o redirect '<' and produces output on the screen.) pldsim (reads SPRINT file from the keyboard and produces output on the screen.) pldsim outfile (read SPRINT file from file name given after i/o redirect '<' and places output in the file name given after the '>'.) pldsim > outfile (reads SPRINT file from the keyboard and places output in the file name given after the '>'.) PLDSIM also has command line options for debugging: -e (echo flag) will cause PLDSIM to echo the important information as it is read in. i.e. pin assignments and equations. -l (long flag) will cause PLDSIM to display the values it has assigned and computed from each test vector. The label will be printed and then the value in ( )'s. -x1 (don't care) will assign the value of '1' to the don't care conditions in the test vectors(i.e X). -x0 (don't care) will assign the value of '0' to the don't care conditions in the test vectors(i.e. X). Any combination of the command line arguments is allowed. UNIX definition: pldsim [-e] [-l] [-x0 | -x1] EXAMPLES <><><><> sample.pld <-- file name of SPRINT file (could be any name though) typed on command line: pldsim < sample.pld This will read from the file sample.pld and produce its output on the screen. pldsim -e < sample.pld This will read from the file sample.pld and produce its output on the screen plus PLDSIM will echo the important information as it is read in. pldsim -l < sample.pld This will read form the file sample.pld and produce its output on the screen plus all the vector assignments and computations will be printed. pldsim -e -l < sample.pld OR pldsim -el < sample.pld This will read form the file sample.pld and produce its output on the screen plus all the vector assignments and computations will be printed and the important information will be printed as it is read in. pldsim -x0 < sample.pld This will read from the file sample.pld and produce its output on the screen the don't care condition will be set to '0'. pldsim -x1 < sample.pld This will read from the file sample.pld and produce its output on the screen the don't care condition will be set to '1'. Similarly These will work as expected. pldsim -e -l -x0 < sample.pld pldsim -e -l -x1 < sample.pld pldsim -elx0 < sample.pld If the output is to redirected to a file: pldsim -e -l sample.out Program Internals <><><><><><><><><><> The PIN assignments are kept as structures and organized with an array of pointers [PIN 1] ------> pin 1 structure [PIN 2] ------> pin 2 structure . . . . [PIN N] ------> pin n structure The equations are kept as a linked list. Then when the vector is to be evaluated the values are placed in the equation and then the equation is evaluated. The last entry in the linked list points to itself. [label] | (head) +--->[operand or operator]---->[operand or operator]-->....[operand or | operator]<-+ | ^ (current) | | | / | | +-------------/ +-------+ Label is a structure that holds the head and current pointers to its equation list. Then an array (called the equation array) holds the pointers to each label structure. Program Constants <><><><><><><><><> PLDSIM has several definitions at the begining of the program source file that can be changed before compiling. These definitions are: MAX_NUM_STACKS - This defines the maximum number of stacks allowed for computation. Set to 10. MAX_OUTPUT_TERMS - This defines the maximum number of OR terms allowed for computation. Set to 10. NUM_OF_PINS - This defines the maximum number of pins allowed in the pin declaration. Set to 25. MAX_VECTORS - This defines the maximum number of test vectors to be read in and evaluated. Set to 200. MAX_LABEL_SIZE - This defines the maximum number of characters allowed in a label. Set to 20. SANITY_CHECK - This defines the maximum number of operands and operators allowed in an equation. Set to 150. The above limits are mostly used so that PLDSIM will not take off and try to evaluate a corrupt file. These should never be violated because the SPRINT file should have passed the PLDASM process.