.c1.Using PTOC 4 PTOC converts PALASM source files into CUPL and CSIM source files in order to maintain existing designs and develop new ones while using only one universal language. Use PTOC on files that have assembled successfully with a PALASM assembler. The output of PTOC is directly compatible with CUPL syntax and may be compiled without modifications. o .c2.RUNNING PTOC Run PTOC with the following format: ptoc palasm_file1 palasm_file2 ... where palasm_file1, palasm_file2 are PALASM source files to be translated. There is no standard file extension for PALASM source files; specify the full filename and extension when running PTOC. For each input PALASM file, PTOC generates a CUPL logic description file, filename.PLD; the filename is the same as the input PALASM filename. If the PALASM file contains a function table (that is, test vector information) PTOC also generates a test specification file, filename.SI, that can be input to CSIM. It is possible to specify more than one file to be translated with a single PTOC command line. For example, to translate the files COUNT2 and DECADE, type the following: ptoc count2 decade PTOC generates the files COUNT2.PLD and DECADE.PLD. If the PALASM files contain test vectors, PTOC also generates COUNT2.SI and DECADE.SI. o .c2.PALASM SOURCE FILE FORMAT Because of variations in PALASM assemblers, PTOC follows the standard set by Monolithic Memories in the PAL Handbook (Third Edition). Figure 4-1 shows a sample PALASM source file in the format required by PTOC. ----------------------------------------------------------------- PAL16R8 Line 1, col 1 - PAL part #PART NO 1234B Line 2 - User's part #SAMPLE Line 3 - Name of device GYRO, SAN JOSE, CA Line 4 - Company, city,state CLK I0 I1 I2 I3 I4 I5 I6 I7 Line 5 - Pin list (must start on GND /OE O1 O2 O3 NC NC line 5), consists of 20 or 24 NC NC NC VCC symbolic names that are consecutively assigned to pins 1 through 20 (24). /O1 := /I0*/I1*/I2 + /I1*/I2*/I3 Equations /O2 := /I0*/I1*/I2 + /I1*/I2*/I4 /O3 := /I0*/I1*/I2 + /I1*/I2*/I5 FUNCTION TABLE Keyword (must start in column 1) I0 I1 I2 I3 I4 I5 CLK /OE 01 02 03 Function table pin list; I0-I5 CLK /OE 01-03 COMMENTS Optional comments -------------------------------- Dashed line (length optional) LLLLLL C L LLL LOAD ZEROS Function table vectors, HHHHHH C L HHH LOAD ONES one vector per line HHHHHL C L HHH WHATEVER followed by optional comments HHHHLL C L HHH HHHLLL C L HHH -------------------------------- Dashed line(length optional) DESCRIPTION Keyword, optional if following THIS IS A SAMPLE PALASM FILE function table (must start in column FOR A PAL16R8 DEVICE 1 followed by comments ----------------------------------------------------------------- Figure 4-1. Sample PALASM File with Explanations The following sections refer back to this sample file to show how PTOC converts PALASM files to CUPL format. o .c2.PTOC .PLD OUTPUT FILE PTOC generates a CUPL source file (palasm_file.PLD) for each PALASM file that it translates. The CUPL source file is organized into header information, pin assignments, and equations. o .c3.Header Information PALASM header information cannot be directly translated into CUPL header information. PTOC places dummy header information into the CUPL source file, and puts the PALASM header information within comments. Use a text editor to replace the dummy header information with valid information to maintain consistent documentation. Figure 4-2 shows the header information created by translating the PALASM sample file in Figure 4-1. NAME XXXXX ; PARTNO XXXXX ; REV XXXXX ; DATE XXXXX ; DESIGNER XXXXX ; COMPANY XXXXX ; ASSEMBLY XXXXX ; LOCATION XXXXX ; /* PAL16R8 */ /* PART NO 1234B */ /* SAMPLE */ /* GYRO, SAN JOSE, CA */ Figure 4-2. Header Information Translation o .c3.Pin List PTOC translates the PALASM pin list into CUPL pin assignments beginning at line five in the PALASM source file. CUPL does not translate GND, NC and VCC pins. Figure 4-3 shows the pin list translation from the sample PALASM file in Figure 4-1. ----------------------------------------------------------------- PIN 1 = CLK ; PIN 2 = I0 ; PIN 3 = I1 ; PIN 4 = I2 ; PIN 5 = I3 ; PIN 6 = I4 ; PIN 7 = I5 ; PIN 11 = !OE ; PIN 12 = O1 ; PIN 13 = O2 ; PIN 14 = O3 ; ----------------------------------------------------------------- Figure 4-3. Pin List Translation o .c3.Equations PTOC translates PALASM equations into CUPL equations, replacing symbols, and adding parentheses and variable extensions as necessary. Figure 6-4 shows the equation translation for the PALASM sample file shown in Figure 4-1. !O1.D = !I0 & !I1 & !I2 # !I1 & !I2 & !I3 ; !O2.D = !I0 & !I1 & !I2 # !I1 & !I2 & !I4 ; !O3.D = !I0 & !I1 & !I2 # !I1 & !I2 & !I5 ; Figure 4-4. Equation Translation PTOC replaces the *, +, and / symbols in the PALASM file with the CUPL &, # and ! symbols respectively. PTOC translates the assignment operator for registered outputs, :=, by adding the .D extension to the variable name on the left side of the assignment statement (see the subtopic, Extensions in Chapter 1). o .c2.PTOC .SI OUTPUT FILE When PTOC translates a PALASM file containing a function table, it generates a CSIM source file, (palasm_file.SI). This CSIM source file is organized into header information, pin order, and vectors. The header information is translated in the same manner as the CUPL source file header information (see the subtopic, Header Information in this chapter). PTOC translates the PALASM function table pin list into a CSIM pin order list. Figure 4-5 shows the function table pin list translation for the PALASM sample file shown in Figure 4-1. ORDER:I0, I1, I2, I3, I4, I5, CLK, !OE, O1, O2, O3; Figure 4-5. CSIM Pin Order List PTOC translates the PALASM function table vectors into a CSIM vectors list. Figure 4-6 shows the function table vectors translation for the PALASM sample file shown in Figure 4-1. VECTORS: 000000 C 0 LLL /* LOAD ZEROS */ 111111 C 0 HHH /* LOAD ONES */ 111110 C 0 HHH /* WHATEVER */ 111100 C 0 HHH 111000 C 0 HHH Figure 4-6. Vectors List o .c3.Translation Ambiguities Because of inherent ambiguities in PALASM syntax, certain conditions cannot be accurately translated into CUPL syntax. Many PALASM assemblers do not verify that the correct assignment statement, "=" for combinatorial outputs and ":=" for registered outputs, is being used. For example, source assemblers treat the following equations in the same manner: OUT = INA * INB OUT := INA * INB PTOC translates them respectively as follows: OUT = INA & INB OUT.D = INA & INB Another ambiguity concerns the use of exclusive OR devices. PTOC requires the use of the PALASM exclusive OR symbol ":+:" to explicitly define the position of the exclusive OR in the equation. However, some PALASM assemblers allow an exclusive OR output to be organized by position without explicitly defining the exclusive OR. For example, some PALASM assemblers treat the following two equations in the same manner: OUT := INA * INB + INC * IND + INE * INF OUT := INA * INB + INC * IND :+: INE * INF PTOC translates them respectively as follows: OUT.D = INA & INB # INC & IND # INE & INF; OUT.D = INA & INB # INC & IND $ INE & INF; The most troublesome ambiguity is in the function table of source files with bi-directional pins. Since the same values are used by PALASM to indicate inputs and outputs during simulation, PTOC cannot accurately determine whether a bidirectional pin should be treated as an input or an output. If a PALASM source file has bidirectional pins, check the vector table translation in the source specification file to determine whether PTOC's interpretation is correct.