Вы находитесь на странице: 1из 96

WinCUPL Users Guide

WinCUPL
Users Guide

i
WinCUPL Users Guide

Copyright
Copyright 1983, 1998 by Logical Devices, Inc.(LDI)

All rights reserved. No part of this publication may be reproduced, stored in a retrieval
system, or transmitted, in any form or by any means electronic, mechanical,
photocopying, recording, or otherwise without the written permission of LDI.

Logical Devices, Inc. provides this manual as is without warranty of any kind, either
expressed or implied, including, but not limited to, the implied warranties of
merchantability and fitness for a particular purpose. LDI may make improvements and/or
changes in the product(s) and/or program(s) described in this manual without notice.

Although LDI has gone to great effort to verify the integrity of the information herein,
this publication could contain technical inaccuracies or typographical errors. Changes are
periodically made to the information herein. These changes will be incorporated in new
editions of this publication.

TRADEMARKS

CUPL, CUPL TotalDesigner, PLPartition, SMCUPL, are trademarks of Logical Devices,


Inc. All other brand and product names are trademarks of their respective owners.

Logical Devices, Inc.


1221 S Clarkson St. Suite 200
Denver, CO 80210
Technical Support Telephone: (303) 722-6868

Web Site www.logicaldevices.com

ii
WinCUPL Users Guide

TABLE OF CONTENTS

1. Overview..............................................................................................................................1
CUPL Data Flow...............................................................................................................3
2. File menu commands...........................................................................................................5
New(File menu)................................................................................................................6
Open (File menu)..............................................................................................................7
Open Project (File menu)..................................................................................................8
Close (File menu)..............................................................................................................8
Close Project (File menu).................................................................................................8
Save (File menu)...............................................................................................................8
Save As (File menu)..........................................................................................................8
Save All (File menu).........................................................................................................9
Printer Setup (File menu)..................................................................................................9
Print (File menu)...............................................................................................................9
MRU File List (File menu).............................................................................................10
Exit command (File menu).............................................................................................10
Import (File menu)..........................................................................................................11
Export (File menu)..........................................................................................................12
3. Edit menu commands........................................................................................................13
Undo (Edit menu)...........................................................................................................15
Cut command (Edit menu)..............................................................................................15
Copy command (Edit menu)...........................................................................................15
Paste command (Edit menu)...........................................................................................16
Find command (Edit menu)............................................................................................16
Find Next command (Edit menu)...................................................................................17
Replace command (Edit menu).......................................................................................17
Insert CUPL Macro Definition command (Edit menu)..................................................22
Update Macro Symbol Table (Edit menu)......................................................................25
Insert Table command (Edit menu).................................................................................27
4. View menu commands.......................................................................................................32
Toolbar command (View menu).....................................................................................33
StatusBar command (View menu)..................................................................................34
Project (View menu).......................................................................................................35
Font (View menu)...........................................................................................................36
5. Options menu commands..................................................................................................37
Compiler Options Dialog.................................................................................................38
Compiler Options - Library............................................................................................41
Compiler Options - Device.............................................................................................41
Compiler Options - Files.................................................................................................44

iii
WinCUPL Users Guide

Compiler Options - Minimization...................................................................................48


Compiler Options - Optimization...................................................................................50
Simulator Options Dialog.................................................................................................51
VHDL Options Dialog......................................................................................................52
VHDL Options Synthesis............................................................................................52
VHDL Options Debug.................................................................................................54
6. Customizing WinCUPL.....................................................................................................56
WinCUPL Options General.........................................................................................57
WinCUPL Options - Tools..............................................................................................59
WinCUPL Options - Syntax............................................................................................62
WinCUPL Options - Fonts..............................................................................................64
Defining and Using Editor Macros.................................................................................65
7. Run menu commands........................................................................................................67
Device Dependent Compile (Run menu)........................................................................67
Device Independent Compile (Run menu).....................................................................67
Device Independent Simulation (Run menu)..................................................................68
VHDL Compile (Run menu)..........................................................................................68
8. Utilities menu commands..................................................................................................69
BackPin (Utilities menu)................................................................................................70
PlPartition (Utilities menu).............................................................................................71
ISP Download (Utilities menu).......................................................................................75
CUPL Tools (Utilities menu)..........................................................................................76
9. Window menu commands.................................................................................................77
Cascade command (Window menu)...............................................................................77
Tile Horizontal command (Window menu)....................................................................77
Tile Vertical command (Window menu).........................................................................77
Window Arrange Icons Command..................................................................................77
10. Help menu commands.......................................................................................................78
11. Sample Design Session......................................................................................................79
Step 1: Create the PLD file from template.......................................................................79
Step 2: Create the Binary Truth Table..............................................................................81
Step 3: Set Binary Truth Table Values..............................................................................82
Step 4: Assign Output Enables.........................................................................................82
Step 5: Compile The Design.............................................................................................82
Step 6: Create Simulation File..........................................................................................86
Step 7: Add Simulation Signals And Vectors...................................................................87
Step 8: Specifying Simulation Values..............................................................................88
Step 9: Examine Results...................................................................................................90

iv
WinCUPL Users Guide

1. Overview
This chapter will show the features available in WinCUPL. These include graphical waveform
simulation, highlighted text editor, bubble entry to CUPL source, schematic to CUPL source,
macro insertion, and table wizard.

The WinCUPL package is comprised of four different modules.

WinCUPL A powerful front end and user interface for all of the
WinCUPL tools including the compiler.
WinSim Designs can be graphically simulated with WinSim to test
the design with user defined inputs to verify the design.
Both the simulation inputs and the results of the simulation
can be graphically viewed and modified with WinSim.
Schematic Schematic is a tool used for creating schematic diagrams for
initial design analysis. Once the diagram has been created,
the diagram is validated to determine if all of the
components are connected by wires to other components or
to grounds, ports or power ports. In addition, several tests
are performed to insure that inputs and outputs are not tied
together, and that all components have been named. If the
diagram passes the validation process, CUPL source code
describing the behavior of the drawing is generated which
can be can be compiled and the design simulated using the
CUPL Compiler and simulators.
SMCupl SMCupl is a tool used for creating State Diagrams for initial
design analysis. Once the state diagram has been created,
the diagram is validated to determine if all of the states and
transitions are meaningful and can be reached. The
validation process also check the usage of all variables
within the diagram. If the state diagram passes the
validation process, a CUPL language source file can be
generated that can be compiled and the design simulated
using the CUPL Compiler and simulators

1
WinCUPL Users Guide

WinCUPL provides a powerful integrated development environment (IDE) for developing designs
using the CUPL compiler and tools. Key features of the IDE include:

Figure 1 WinCUPL Editor

Syntax highlighting in the WinCUPL editor that can be completely customized for any
language using color and other text attributes.
User customizable tool bar and menus for seamless integration of all WinCUPL tools and
any other tools and programs you desire.
Easy navigation of all WinCUPL tools using the toolbar
Truth table editor that allows you to enter binary truth tables into your CUPL source code
graphically.
Automated tools for generating and managing CUPL macros and for referencing CUPL
macros within source files.
Complete 32 bit version of the CUPL compiler and supporting tools.
Powerful file import features_import capabilities.

2
WinCUPL Users Guide

Integrated Backpin utility


Integrated PlPartition utility
Integrated ISP utility

CUPL Data Flow

The following diagram illustrates the data flow for creating a design and implementing the design
using CUPL.

First, a logic description is created using the CUPL language which may be generated from
Schematic, SMCupl or manually created using the WinCUPL source editor.

Then, the design is compiled to create a fusemap file for downloading to a device programmer.
Optionally, a test specification file may be created to verify the design. CSIM is executed to
compare the expected values in the test file to the actual values in the absolute file created by
CUPL. When simulation is complete without any errors, the verified test vectors can be appended
to the download file generated by CUPL.

3
WinCUPL Users Guide

Figure 2 CUPL Data Flow

4
WinCUPL Users Guide

2. File menu commands


The File menu offers the following commands:

New Creates a new Design, Project or Text file.


Open Opens an existing file.
Close Closes the active window.
Save Saves the active file.
Save As Saves the active file with a new name.
Save All Saves all open files.
Open Project Opens an existing project file.
Close Project Closes the project.
Import Imports design files described by another
language and translates them to CUPL
source code.
Export Exports a design described by CUPL
language to a number of other common file
formats.
Print Setup Selects a printer and printer connection.
Print Prints the active document.
MRU
Exit Exits WinCupl.

5
WinCUPL Users Guide

New(File menu)

Use this command to create a new Design, Project or Text file.

Figure 3 File- Selection

If you choose Design, you will be prompted for the header information and the number of inputs,
outputs and pinnodes for the design. You may enter a number for the inputs, outputs and pinnodes
or you may select cancel to skip any of the sections. When you complete the dialogs, a new
design template will be opened for you.

6
WinCUPL Users Guide

Figure 4 File- New - Design

If you choose Project, you will be prompted for all of the above information and the project
window will be opened as well. The project window will display new files as they are created by
the compiler or other WinCUPL tools.

If you choose Text, a new empty text file will be opened for you

Shortcuts
Toolbar: Opens a new Text file.
Keys: CTRL+N Opens a new Text file.

Open (File menu)


Use this command to open an existing file.

Shortcuts
Toolbar:
Keys: CTRL+O

7
WinCUPL Users Guide

Open Project (File menu)


Use this command to open an existing project.

This command opens an existing .PLD source file and also displays the associated project window.

Close (File menu)


Use this command to close the active document window. If the document in the window has been
altered you will be prompted to save the file.

Shortcuts
Toolbar:
Keys: CTRL+F4

Close Project (File menu)


Use this command to close the active project. All open files for the project will be closed as well
as the project window. If any documents in the project have been altered you will be prompted to
save each altered file.

Save (File menu)


Use this command to save the active document to a disk file.

Shortcuts
Toolbar:
Keys: CTRL+S

Save As (File menu)


Use this command to save the active document to a disk file with a new name.

8
WinCUPL Users Guide

Save All (File menu)


Use this command to save all open documents to a disk files.

Printer Setup (File menu)


Use this command to select a printer and to set the printer options. This command displays the
standard Windows printer setup dialog.

Figure 6 File- Print

Print (File menu)


Use this command to send the active document to the selected printer.

Shortcuts
Toolbar:
Keys: CTRL+P

9
WinCUPL Users Guide

MRU File List (File menu)


The MRU (Most Recently Used) menu displays the six most recently active files. Selecting a file
from this list will open the named file.

Exit command (File menu)


Use this command to end your WinCupl session. You can also use the Close command on the
application Control menu.

Shortcuts
Keys: ALT+F4

10
WinCUPL Users Guide

Import (File menu)


Use this command to import source files written in a different language and to convert them to
CUPL source code.

The file formats that may be imported into CUPL include: PALASM, PLA, Altera TDF, and ABEL
and VHDL.

Format Menu Selection


Altera TDF AHDL
Berkley PLA PLA
Liaison Schematic Netlist (EDIF 2 0 0 only)
ONCUPL ONCUPL
PALASM Palasm
Verilog Not yet available
VHDL Available on the Run Menu

Select the import type and you will be prompted for the import file. Choose the import file and
Open. The file will be converted to CUPL source code and a document will be opened containing
the imported design.

11
WinCUPL Users Guide

Export (File menu)


Use this command to export a CUPL source file to another language.

Choose Export from the file menu and you will be presented with the File Export dialog as shown
below.

Figure 5 File- Export

12
WinCUPL Users Guide

3. Edit menu commands


The Edit menu is displayed when the active window is a document. The menu offers the
following commands:

Figure 7 Edit

Undo
Cut Deletes selected text from the document and places
them on the clipboard.
Copy Copies selected text from the document to the
clipboard.
Paste Pastes text from the clipboard into the document at the
current cursor position.
Find Searches for text within the active document.
Find Next Searches for the next occurrence of the last text string
searched.
Replace Finds and replaces text within the active document.
Insert CUPL Macro Inserts a CUPL macro reference into the active
Reference document.

13
WinCUPL Users Guide

Insert CUPL Macro Inserts a CUPL macro definition into the active
Definition document.
Update Macro Symbol Table Updates the macro reference symbol table.
Insert Table Inserts a binary table into the active document.

14
WinCUPL Users Guide

Undo (Edit menu)


Use this command to reverse the last editor action performed on the document. This command is
available only when an action can accurately be reversed.

Shortcuts
Keys: CTRL+Z

Cut command (Edit menu)


Use this command to remove the currently selected text from the active document and put it on the
Windows clipboard. This command is unavailable if there are no items selected.

Cutting data to the clipboard replaces the contents previously stored there.

Shortcuts

Toolbar:
Keys: CTRL+X
Del

Copy command (Edit menu)


Use this command to copy selected text to the Windows clipboard. This command is unavailable
if there is no text currently selected.

Copying data to the clipboard replaces the contents previously stored there.

Shortcuts
Toolbar:
Keys: CTRL+C

15
WinCUPL Users Guide

Paste command (Edit menu)


Use this command to insert a copy of the Windows clipboard contents into the document. The
data will be inserted at the current cursor position. It may be necessary to refresh the document to
update the syntax highlighting of the inserted data.

Shortcuts
Toolbar:
Keys: CTRL+V

Find command (Edit menu)


Use this command to open the Find dialog. The Find dialog is used to search for text strings
within a document

Figure 8 Edit Find


Text to find

Enter the text string you wish to search for.

Options - Case sensitive

Normally, the search will locate the text entered ignoring case. Select this option if you wish to
have a case sensitive search.

Options - Whole words only

16
WinCUPL Users Guide

Normally, the search will locate text embedded within whole words. If you wish to have the
search find only whole words matching the search string, select this option.

Options - Regular expressions

Direction

Select the search direction from the cursor

Scope

To search for a string within a selected block of code, choose Selected text. To search the whole
file, choose Global.

Origin

Select the starting point for the search. Entire scope searches from the top of the file, Current
position searches using the current cursor position as the starting point.

Find Next command (Edit menu)


This command will search for the next occurrence of the text string last searched for in the Find
command.

Replace command (Edit menu)


Use this command to display the Search and Replace dialog. The Search and Replace dialog
allows you to replace specified occurrences of text with new text.

17
WinCUPL Users Guide

Figure 9 Edit - Replace

Text to find

Enter the text string you wish to search for.

Replace with

Enter the text string you wish to use as the replacement text.

Options - Case sensitive

Normally, the search will locate the text entered ignoring case. Select this option if you wish to
have a case sensitive search.

Options - Whole words only

Normally, the search will locate text embedded within whole words. If you wish to have the
search find only whole words matching the search string, select this option.

Options - Regular expressions

Options - Prompt on replace

18
WinCUPL Users Guide

Select this option if you wish to confirm each replacement before it occurs.

Direction

Select the search direction from the cursor

Scope

To search for a string within a selected block of code, choose Selected text. To search the whole
file, choose Global.

Origin

Select the starting point for the search. Entire scope searches from the top of the file, Current
position searches using the current cursor position as the starting point.

Change All

Choose this option if you wish to globally replace all occurrences of the search text with the
replacement text.

19
WinCUPL Users Guide

Insert CUPL Macro Reference command (Edit menu)

Use this command to insert a CUPL Macro reference in the source file at the current cursor
position. The Insert Macro Reference dialog is displayed to allow you to choose the defined
macro to place into the source file.

Figure 10 Edit Insert Macro

Note: The macro file containing the macro definitions must be selected first. These are contained
in the MACRO subdirectory and are selected by the Insert CUPL Macro Definition

Select CUPL Macro

The Defined Macros drop down list will show all defined macros within the scope of the source
file. You may select any macro present in the drop down list.

When you select a macro, the Assign Arguments frame will be filled in.

20
WinCUPL Users Guide

Figure 11 Edit Insert Macro

Assign Arguments

The Argument List displays a list of the macros arguments and the variables which will replace
the argument values. The argument name is displayed followed by a colon and the replacement
variable name.

Initially, all arguments are assigned a No Connection variable which denoted with NC in CUPL
syntax. Use the Argument List to assign program variables to the macro arguments.

When you select an argument in the Argument List, the variable name that will replace the
argument name is displayed in the Variable list. Below the selected variable name is a list of all
program variables that may be assigned to an argument. Select the variable name from the list to
replace the argument when the macro reference is placed in the source file.

After you have assigned variables to all of the arguments, choose OK to place the macro reference
in the source file

21
WinCUPL Users Guide

This will paste the following code into the source file at the current cursor position.
T7482 C1 C2 X1 X2 Y1 Y2 Carry;

Insert CUPL Macro Definition command (Edit menu)

The Insert Macro Definition dialog allow you to easily insert a macro definition into your source
file. The Insert Macro Definition dialog is displayed to allow you to choose the defined macro to
place into the source file or a reference to the file containing the macro definition.

Figure 12 Edit Insert Macro Definitions

Include the selected macro file in the source file

Select this option to place an include statement in the source file that includes the entire macro file
that is selected. This allows you to reference any macro that is in the included macro file from
anywhere in the source file.

22
WinCUPL Users Guide

This is the default option, and will result in a smaller source file.

Insert the selected macro definitions into the source file

Select this option to place a copy of the macros in the Selected Macros box directly into the source
file. This option is useful if you are only referencing a single macro from a file with several
macros.

Macro Selection

The macro files presented in the selection list are those macro files present in the \Macro directory
under the WinCUPL directory.

When you select a file from the drop down File/Name list, all named macros within the selected
file are displayed in the list below the file name drop down. Select a macro from the list and the
macro is displayed in the Definition box to the right of the selection lists. This allows you to
preview the selected macro to insure that it is the one you desire to use.

Once you find the macro you wish to use, you can insert it into the source file in one of two ways:

If you have the default Include the selected macro file in the source file option selected, all
you need to do is choose OK and an include statement referencing the macro file will be
placed in the source file.

$INCLUDE TTL.MAC

If you have selected the Insert the selected macro definitions into the source file option, you
must choose Add to create a copy of the selected macro and place it into the Selected Macros
box. Then, when you press OK, the macro definition will be placed into the source file at the
current cursor position.
$MACRO T7482 A1 A2 B1 B2 S1 S2 C2
/* 2-bit full adder */
S1 = A1 $ B1 $ C0;
S2 = A2 $ B2 $ (A1 & B1 # (C0 & (A1 $ B1)));
C2 = A2 & B2 # ((A1 & B1 # (C0 & (A1 $ B1))) & (A2 $ B2));
$MEND

New

23
WinCUPL Users Guide

You can create a new macro file or add a new macro to an existing file by choosing the New
button. This will guide you through the process of creating a new CUPL Macro. This process has
the following steps:

1. You will be prompted for the name of the new CUPL macro.
2. You will be prompted for the number of arguments for the new CUPL macro.
3. You will be prompted for the name of each of the arguments for the new CUPL macro.
4. The Create CUPL Macro dialog will be displayed with a template for creating the new CUPL
macro.

The Create CUPL Macro dialog provides a template for easily creating CUPL macros and
integrating them into the source file.

Add macro to file:

You may choose an existing macro file to save the newly created macro in, or you may choose
New Macro File from the drop down list. If you choose New Macro File, you will be prompted
for the new file name when you choose OK to save the macro.

Editor Window

Use the editor window to fill in the source code for the new macro. After adding the macro the
Editor Window will have the below code.

$MACRO MyMacro Arg1, Arg2, Arg3

$MEND

The user then enters the macro characteristics and saves the file. A complete macro is shown
below for a two input AND gate.

$MACRO MyMacro Arg1, Arg2, Arg3


Arg1 = Arg2 & Arg3;
$MEND

24
WinCUPL Users Guide

Macro Selection

Multiple macros can be selected by double-clicking on the macro name. Selected macros will be
displayed in the text box.

Figure 13 Edit Insert Macro Definitions

Update Macro Symbol Table (Edit menu)

Use this command to update the macro symbol table for matching symbols to macro references.
To automatically update the symbol table whenever a new reference is created, see the General
Tab of the WinCUPL options dialog

25
WinCUPL Users Guide

Figure 14 Automatically Update Macros

26
WinCUPL Users Guide

Insert Table command (Edit menu)

Use this command to define and insert a binary conversion table in the source file at the current
cursor position. The Insert Table dialog is displayed to allow you to define the binary conversion
table.

Use the binary table editor to create conversion and lookup tables in CUPL.

Figure 15 Insert Table

Input

Enter the name of the input variable for your table. Set the bit field width in the Width field.

Output

Enter the name of the Output variable for your table. Set the bit field width in the Width field.

27
WinCUPL Users Guide

Rows

Enter the number of rows for your table. Once the input, output and rows have been defined, an
initial table will be displayed. There are several options for automatically setting the input values.

Font Size

Choose the font size for the editor window. A smaller font will display more of the table in the
editor window.

Set Input

Option Behavior Notes


Increasing Value Enter the initial value
in the From field and
reselect the option to
change the values.

Decreasing Value Enter the initial value


in the From field and
reselect the option to
change the values.

Zero Clears all bits

28
WinCUPL Users Guide

Set Sets all bits

One Hot Left

One Hot Right

Fill Left

29
WinCUPL Users Guide

Fill Right

Editing the table

The bit patterns in either the input or output variable definitions can be changed simply by clicking
on the 0 or 1. The value will be toggled for each click.

You may also set a row of bits for the input or output values by clicking on the hex value
displayed in the first column of either variable. You will be prompted for a new hex value for the
row of bits.

When you are finished editing the table, choose OK. The table will be coded in CUPL syntax and
inserted at the cursor position in the source file.

Example

30
WinCUPL Users Guide

Figure 16 Create Table

The above table generates the following CUPL source code.

TABLE Input => Output {


'b'000 => 'b'0000;
'b'001 => 'b'0000;
'b'010 => 'b'0000;
'b'011 => 'b'0000;
'b'100 => 'b'0000;
'b'101 => 'b'0000;
'b'110 => 'b'0000;
'b'111 => 'b'0000;}

The input and output lists need to be defined using Field statements.

Field Input = [In0..1];


Field Output = [Out0..3];

31
WinCUPL Users Guide

4. View menu commands


The View menu is displayed when the active window is a document. The menu offers the
following commands:

Figure 17 View Main

Toolbar
Status Bar Toggles the Status Bar On/Off
Project Window Displays and hides the project window on the right
hand side of the user interface.
Font Displays the font dialog to change the default editor
font settings.
Refresh Updates the editor display colors and formatting

32
WinCUPL Users Guide

Toolbar command (View menu)

Figure 18 Toolbar Main

Use this command to display and hide the Toolbar, which includes buttons for some of the most
common commands in WinCupl such as File Open and Print. A check mark appears next to the
menu item when the Toolbar is displayed.

Click To

Create a new editor document.

Open an existing file in the editor.

Save the active document in a disk file.

Print the active document on the currently selected printer.

Remove ( Cut ) the currently selected text to the windows clipboard.

Copy the currently selected text to the windows clipboard.

Paste the contents of the windows clipboard into the active document.

Perform a Device Dependent Compile.

Perform a Device Independent Compile.

Perform a Device Dependent Simulation.

33
WinCUPL Users Guide

Perform a Device Independent Simulation.

Customizable Buttons: (Set up with the WinCUPL - Tools dialog

Starts the Windows Calculator.

Starts the Windows Explorer.

Opens an MS-DOS Window.

Starts the SMCupl tool.

Starts the Schematic tool.

Starts the Chip Programmer tool.

Starts the WinSim tool.

Defines or Runs an Editor Macros.

Starts and tiles the SMCupl, Schematic and WinSim tools.

To hide or display the Toolbar, choose Toolbar from the View menu (ALT, V, T).

To determine what the buttons on the toolbar do, hold the mouse pointer over the button for a few
seconds and a tip window will be presented describing the tool.

StatusBar command (View menu)

Use this command to display and hide the Status Bar, which describes the action to be executed by
the selected menu item or depressed toolbar button, and keyboard latch state. A check mark
appears next to the menu item when the Status Bar is displayed.

34
WinCUPL Users Guide

Figure 19 Status Bar

The status bar is displayed at the bottom of the main application window. To display or hide the
status bar, use the Status Bar command in the View menu.

The status bar is split into six panes. The left most pane displays a variety of informational
messages depending on what you are doing at the time. The second pane displays the current
position of the cursor within the file, and the remainder of the panes display the settings of
keyboard locks.

Project (View menu)

Use this command to hide or display the Project Window.

Figure 20 Project Window

35
WinCUPL Users Guide

Font (View menu)

Use this command to change the font of the active document.

Refresh (View menu)

Use this command to refresh the document window. This command will update the syntax
highlighting.

36
WinCUPL Users Guide

5. Options menu commands


The Options menu offers the following commands:

Compiler Sets the CUPL compiler options.


Simulator Sets the simulator options.
VHDL Sets the VHDL Compile and Analysis options.
WinCUPL Sets the options for the WinCUPL environment.

37
WinCUPL Users Guide

Compiler Options Dialog

Figure 21 Compiler Options - General

Use the compiler options tabbed dialog for setting the options for the CUPL compiler.

Select a tab name below or click on a tab above to view the help for the specific tabs of the
Compiler Options dialog.

General
Library
Device
Output Files
Minimization
Optimization

38
WinCUPL Users Guide

Compiler Options - General

Figure 22 Compiler Options - General

Secure Device

Adds the necessary code in the JEDEC download file to automatically allow the device
programmer to blow the security fuse when programming. Not all programmers support this
option.

Deactivate Unused OR Terms

In IFL devices, the OR-gate output array is driven by each of the AND-gate product terms.
Normally, unused OR-gate inputs are left connected to the product term array so that new terms
may be added. However, with this option, the unused OR-gate inputs are removed (deactivated)
from the product term array. The result is reduced propagation delay from input to output.

Simulate

39
WinCUPL Users Guide

Creates the absolute file and automatically runs the CSIM logic simulator. CSIM is run with the
option to create a list file. If the JEDEC name = PLD name option is selected it will be passed to
CSIM creating a JEDEC download file with test vectors.

One hot bit State Machine


This option will cause the compiler to generate state machine equations as one-hot-bit. This has
some distinct advantages in register rich architectures such as Xilinx devices. The fanin is reduced
making routing much easier and timing problems associated with variable length feedback paths
from register to register are eliminated. To use this feature each state machine must be defined
with a one-hot-bit pattern. All state machines in the design will be treated as one-hot if this
option is selected.

JEDEC name = PLD name

If the Download file format for JEDEC/POF/PRG option is selected on the Files Tab is selected,
this option will force the name of the JEDEG file to be generated from the name of the logic
description file rather than the NAME statement in the header section of the logic description file.

40
WinCUPL Users Guide

Compiler Options - Library

Figure 23 Compiler Options - Library

Device Library

Enter the path to the Device Library file used by CUPL and CSIM. The default library file is set
to ..WinCUPL\CUPL.DL. The device library contains a description of each of the target devices
supported in the current versions of CUPL and CSIM.

Library

Press the Library button to search for a device library file.

Compiler Options - Device

41
WinCUPL Users Guide

Figure 24 Compiler Options - Device

This tab displays all of the devices which may be programmed using CUPL.

Device Type

This list displays the types of devices that may be selected.

Device Selection

Use this list to select a specific device. The selection made from this list overrides the DEVICE
statement in the header section of the logic description file

Find mnemonic

Use the Find mnemonic button to look up devices and their functionality. The Device Information
dialog is opened which displays information to aid in selecting a device.

Device Information

42
WinCUPL Users Guide

The Device Information dialog displays information for available devices that aids in the selection
of a specific device.

Figure 25 Compiler Options Device Information

This dialog can be sized to make reading the device descriptions easier.

Find

Find allows you to enter a mnemonic to search for within the device information file. The device
name can also can be entered to search for the corresponding mnemonic.

Next

Next repeats the last search.

OK

This button closes the Device Information dialog.

43
WinCUPL Users Guide

Compiler Options - Files

Figure 26 Compiler Options Output Files

Output Files

Option Download File Format


JEDEC/POF/PRD Generates a JEDEC-compatible ASCII
download file with the .JED extension. The file
name is not necessarily the logic description file
name input into CUPL. The NAME statement
in the header information section of the logic
description file determines the download file
name. You may select JEDEC name = PLD
name on the General Tab to force the JEDEC
file name to be created from the logic
description file name. See the NAME statement
in the online or printed CUPL Reference guide.

HL Generates an HL download file with the .HL

44
WinCUPL Users Guide

extension. This format is available only for the


Signetics IFL devices. The filename is not
necessarily the same as the logic description file
name input into CUPL. The NAME statement in
the header information section of the logic
description file determines the download file
name See the NAME statement in the online or
printed CUPL Reference guide.

ASCII/Hex Generates an ASCII-hex download file with


the .HEX extension. This format is available
only for PROMS. The filename is not
necessarily the same as the logic description file
name input into CUPL. The NAME statement in
the header information section of the logic
description file determines the download file
name See the NAME statement in the online or
printed CUPL Reference guide.

Doc File Options

Option Download File Format


Fuse Plot Generates a fuse plot in the documentation file.
For PAL devices, each output pin is listed and
the associated product term rows are shown with
the starting JEDEC fuse number. Fuses present
are denoted with x. Fuses blown are denoted
with . For IFL devices, the HL download
format is used showing JEDEC fuse numbers
with input terms denoted as H, L, 0 or -.

Equations Generates a documentation file which contains


an expanded listing of the logic terms in sum-of-
products format and a symbol table of all
variables used in the source file. It includes the
total number of product terms and the number
available for each output.

General

45
WinCUPL Users Guide

Option Download File Format


Absolute Generates an absolute file with the .ABS
extension for use by the CSIM logic simulator.

List Generates an error listing file with the .LST


extension. Each line in the original source file is
numbered. Error messages are listed at the end
of the file and use the line numbers for
reference.

Expanded Macro Generates an expanded macro definition file


with the .MX extension containing an expanded
listing of all macros used in the source file. It
also contains the expanded expressions that use
the REPEAT statement.

PDIF Generates a PDIF (P-CAD Database Interchange


Format) file using the .PDF extension. This file
can be translated by the PDIFIN program into a
symbol file for the PC-CAPS (P-CAD
Schematic Capture) program. The generated
symbol file will contain packaging information
for the PLD.

PLA Generates a Berkeley PLA file using the .PLA


extension for use by the Berkeley PLA tools,
such as PLEASURE, or other PLA layout tools
which use the Berkeley PLA format.

PALASM Generates input files for other logic design tools


and gate array fitters such as PDS2XNF from
XILINX.

EDIF Generates an EDIF file

XNF Generates a XILINX XNF file...

QDIF Generates a Quick Logic QDIF file

46
WinCUPL Users Guide

47
WinCUPL Users Guide

Compiler Options - Minimization

Figure 27 Compiler Options Minimization

Option Download File Format


None Disables logic minimization during a CUPL
compilation. It is useful when working with
PROMs, to keep contained product terms from
being eliminated.

Quick Balances the reduction efficiency, memory


usage, and execution time.

Quine-McCluskey Provides the highest level of reduction


efficiency, but requires more memory and time
to compile.

Presto Provides a high level of reduction efficiency, but


requires less memory and time to compile. This
option will perform multiple output

48
WinCUPL Users Guide

minimization in IFL devices. This maximizes


product sharing in these types of devices.

Expresso Provides a higher level of reduction efficiency


than Presto, requires more memory to compile
than Presto, but requires less time for
compilation. As with Presto, this option will
perform multiple output minimization in IFL
devices. This maximizes product sharing in
these types of devices.

49
WinCUPL Users Guide

Compiler Options - Optimization

Figure 28 Compiler Options Optimization

Option Download File Format


Best For Polarity Optimize product term usage for pin or pinnode
variables. This overrides the DEMORGAN
statement if it appears in the source file.

Demorgan DeMorganize all pin and pinnode variables.


This overrides the DEMORGAN statement if it
appears in the source file.

Keep XOR Equations Do not expand XOR to AND-OR equations.


This is used for device independent designs or
designs targeted for fitter-supported devices
where the fitter supports XOR gates.

P-Term Sharing Force product term sharing during minimization.


This is also referred to as group reduction.

50
WinCUPL Users Guide

Simulator Options Dialog

Figure 29 Simulator Options


Listing File

Generates a simulator listing file with an extension of .SO. The input and output values for each
variable are listed. Error messages are listed following each vector, with the signal name in error
displayed.

Append Vectors

Appends the structured test vectors generated by the simulation onto the existing JEDEC
download file.

Display Results

Displays the contents of the listing file in a window. When the display appears, press Ctrl-S to
freeze the display and any key to resume.

51
WinCUPL Users Guide

VHDL Options Dialog

Use the VHDL options dialog for setting the options for the VHDL utilities.

VHDL Options Synthesis

Figure 30 VHDL Synthesis Options

Analyze Only

Specifies that only analysis be performed. Analysis is VHDL syntax checking, type checking, and
static usage checking.

Use Pinnodes

Signals will be declared as pinnodes rather than off-chip pin signals.

52
WinCUPL Users Guide

No synchronous Presets or Resets

Forces the compiler to not use set or preset terms to implement the design.

Use Clock Enable

Enables the inference of register clock enable. Allows synthesis of a clock enable structure from
certain VHDL coding conventions. Does not change the behavior of the design, but allows the
compiler to take advantage of a clock enable if it exists in the target hardware.

Force registers with Presets to use Resets

Forces all registers with preset to use reset. Transforms registers with asynchronous preset into
registers with asynchronous reset. The design behavior remains unchanged. Resisters with both
preset and reset are not transformed.

Maximum Product Terms

Sets maximum PLA product terms --


set to zero for FPGAs.

Maximum AND Inputs

Sets maximum number of PLA inputs.

Optimization Level

Optimize level 0 thru 5.

A value of 0 means no optimization effort, a larger value indicates increased optimization effort.

53
WinCUPL Users Guide

VHDL Options Debug

Figure 31 VHDL Debug Options

Window - Always Close

Closes the VHDL window if there were errors in the compilation or not.

Window - Close On Success

Only closes the VHDL window if there are no errors in the compilation.

Window - Never Close

The VHDL window stays open in all cases. The user must close the window manually.

54
WinCUPL Users Guide

Create Log File

Writes a copy of the VHDL window to a file.

Display Register and Macrocell Inference

Specifies verbose mode, which causes debug information about register and macrocell inference to
be displayed.

55
WinCUPL Users Guide

6. Customizing WinCUPL
This section explains how the user can customize WinCUPL. The available options include Syntax
Highlighting , Menu Customizing , Toolbar Setup , Editor Macros , and Default Directory
specification.

Figure 32 WinCUPL Options Selection

56
WinCUPL Users Guide

WinCUPL Options General

Figure 33 WinCUPL Options Selection

Working Directory

Set the default working directory for WinCUPL. The directory in this field will be used as the
default directory for storing all files created with WinCUPL. This directory is the default
whenever a file save or file open dialog is displayed.

Schematic
Select the schematic capture package that is being used with WinCUPL.

Auto arrange windows on main window resize

57
WinCUPL Users Guide

Select this option to automatically set the position of the Editor, Messages and Project windows.

Always update symbols when adding macro

Select this option to automatically update the macro symbol table whenever a macro reference is
inserted into the source file. See Insert Macro Reference for more information.

58
WinCUPL Users Guide

WinCUPL Options - Tools

Figure 34 WinCUPL Options Selection

Standard Utilities

Use the Tools tab to customize the toolbar and editor macro capabilities of WinCUPL The top
section of the tab lists the standard utilities that can be added to the toolbar or Utilities menu.
Select the Toolbar or Menu check box next to a program to include it on the toolbar or menu.

Customize

59
WinCUPL Users Guide

This section allows you to add a program or to define an editor macro and assign the program or
macro to a button on the toolbar or to the utilities menu. You may add up to six programs or editor
macro definitions to the list box.

Add Tool

When you choose Add Tool, the following dialog is displayed to let you tell WinCUPL where the
program is and what to call it on the menu and toolbar.

Figure 35 WinCUPL Options Add Tool

Program

Enter the full path to the program. You may choose the Browse button to open a file
open dialog that will assist you in making an accurate selection. Find the program
executable file in the File Open dialog and choose Open. The full path to the program
will automatically be set in the Program field.

Name

Enter the name you wish to associate with the program. The name will appear on the
Utilities menu and/or in the Tool Tip window for the toolbar button.

Once you have a program defined, select the Toolbar or Menu check box to include the entry on
the menu or toolbar as desired. Macro command buttons on the toolbar appear as {bmc
macro.bmp}

Edit Tool

The Edit Tool button will be available to change the program or name of the selected item.
Review the section above (Add Tool) for more information on selecting a program and name.

Macro

60
WinCUPL Users Guide

The Macro button adds an Editor Macro entry to the toolbar or utilities menu. See Defining and
Using Editor Macros for more information on how to set up and use an Editor Macro.

61
WinCUPL Users Guide

WinCUPL Options - Syntax

The Syntax tab is used to define the syntax highlighting attributes to be used in the editor window.

Figure 36 WinCUPL Options - Syntax

Enable Syntax Highlighting

Check this box to enable syntax highlighting in the editor window for .PLD source files. The
editor will respond faster if this option is not selected.

Keyword List

62
WinCUPL Users Guide

The keyword list contains all of the words that will be highlighted. Use this list to set the
attributes for the keywords in the list by selecting a word in the list and setting the appropriate
color and attributes for the word. Once you have selected the color and attributes for the word,
press the Apply button to save the settings. Each occurrence of the word in a PLD source file will
be displayed with the colors and attributes selected.

Add

This button allows you to add new words to the keyword list. You cannot enter standard CUPL
operators or white space to the list. Each word must be a complete single keyword, multiple
words or phrases are not allowed.

Remove

You may remove a keyword from the list by selecting the keyword and pressing the Remove
button.

Current Text and Sample Text

The Current Text field displays the keyword with its the current setting. The Sample Text field
displays any selections you make on the dialog page. The Sample Text setting will become the
Current Text setting when the Apply button is pressed.

Defaults

This button resets the original default keywords and colors. The keyword list is composed of all
of the CUPL reserved words.

63
WinCUPL Users Guide

WinCUPL Options - Fonts

Figure 37 WinCUPL Options - Fonts

Use the Fonts tab to set the default fonts for each type of window. The default font will be applied
each time a new window is opened.
The Font button displays the common font selection dialog. Font color selections will be ignored.

64
WinCUPL Users Guide

Defining and Using Editor Macros

Step 1 - Setting up the macro command

Before you can define and use an editor macro you must provide a command for the macro. The
command may either be a menu item on the Utilities menu or a toolbar button. To define a macro
command, choose WinCUPL from the Options menu and choose the Tools tab. Press the Macro
button to add a Macro command the list, then select the Macro n item in the list and choose the
Toolbar or Menu checkbox to add the command to the toolbar or utilities menu.

Step 2 - Defining the macro

There are two types of editor macros, block macros and keystroke macros. A block macro is
defined to be a block of text that can be repeatedly inserted into the source file. The block macro
does not use the Windows clipboard, therefore once the macro is defined is available until it is
redefined. The keystroke macro is defined as a sequence of keystrokes that are recorded. Once
the recording is complete, the macro will replay the keystrokes each time the macro is invoked.

Defining a block macro on a toolbar button

Select the text in the editor window and Right Click the macro toolbar button. {bmc
macro.bmp} You will be prompted for a name to assign to the macro. This name will be
displayed as the tool tip when you pause the mouse pointer over the macro button.

To redefine the macro, simply select a new block of text and Right Click the macro toolbar
button.

Defining a keystroke macro on a toolbar button

Make sure that no text is selected in the editor window and Right Click the macro toolbar
button. {bmc macro.bmp} You will be prompted for a name to assign to the macro. This
name will be displayed as the tool tip when you pause the mouse pointer over the macro
button.

All keystrokes captured until Ctrl-Break is pressed will be recorded as the macro. When
you are finished recording, press Ctrl-Break to end the macro.

To redefine the macro, simply Right Click the macro toolbar button and repeat the above
procedures.

65
WinCUPL Users Guide

Defining a block macro on the menu

Select the text in the editor window and choose the macro from the Utilities menu you wish
to define. If there is no current definition for the macro, the currently selected text will be
assigned as the macro. You will be prompted for a name to assign to the macro. This name
will be displayed on the Utilities menu for the macro.

To redefine the macro, choose Clear Macro from the utilities menu. You will be prompted to
select the macro you wish to clear. Next, choose the macro you wish to clear from the
Utilities menu. The macro will now be undefined and can be defined following the above
procedures.

Defining a keystroke macro on the menu


With no text selected in the editor window and choose the macro from the Utilities menu you
wish to define. If there is no current definition for the macro, the keystroke recording
process begins. Press Ctrl-Break to end the recording process. You will be prompted for a
name to assign to the macro. This name will be displayed on the Utilities menu for the
macro.

To redefine the macro, choose Clear Macro from the utilities menu. You will be prompted to
select the macro you wish to clear. Next, choose the macro you wish to clear from the
Utilities menu. The macro will now be undefined and can be defined following the above
procedures.

Step 3 - Using the macro

To invoke the macro, Left Click the toolbar button or select the macro from the Utilities menu.

66
WinCUPL Users Guide

7. Run menu commands


The Run menu offers the following commands:

Device Dependent Compile Performs a Device Dependent Compile.


Device Independent Compile Performs a Device Independent Compile.
Device Dependent Simulation Performs a Device Dependent Simulation.
Device Independent Simulation Performs a Device Independent Simulation.
VHDL Compile Compiles a VHDL file.
VHDL Analysis Runs a VHDL analysis.

Device Dependent Compile (Run menu)

This command compiles the design using the specified device. You may specify a device either
with the DEVICE statement in the header section or by selecting a device on the Device Tab of the
Compiler Options dialog.

If the specified device is virtual, the function of this command is same as Device Independent
Compile

Shortcut
Keys: F9
Toolbar:

Device Independent Compile (Run menu)

Compile the design using the virtual device. If a device is specified in PLD file using the DEVICE
statement, or a device selected on the Device Tab of the Compiler Options dialog, the device will
be ignored.

Shortcut
Keys: Ctrl - F9
Toolbar:

67
WinCUPL Users Guide

Device Dependent Simulation (Run menu)

Simulate the design using the specified device. You may specify a device either with the DEVICE
statement in the header section or by selecting a device on the Device Tab of the Compiler Options
dialog.

If a specified device is virtual, the function of this command is same as Device Independent
Compile

Shortcut
Keys: F7
Toolbar:

Device Independent Simulation (Run menu)

Simulate the design using the virtual device. If a device is specified in PLD file using the DEVICE
statement, or a device selected on the Device Tab of the Compiler Options dialog, the device will
be ignored.

Shortcut
Keys: Ctrl - F7
Toolbar:

VHDL Compile (Run menu)

Compiles a VHDL source file using the Metamor VHDL compiler. If the file compiles
successfully the CUPL compiler will be automatically be called.

VHDL Analysis (Run menu)

Runs a VHDL analysis file using the Metamor VHDL compiler. The CUPL compiler is not called.

68
WinCUPL Users Guide

8. Utilities menu commands


The Utilities menu offers the following commands:

BackPin Runs the BackPin utility.


PlPartition Configures and runs the PlPartition utility.
ISP Download Runs the ISP Download utility.
Custom Tools Runs standard and custom tools if configured. See Customizing
WinCUPL for more information on setting up the standard and
custom tools.
CUPL Tools Launches all WinCUPL tools and tiles them on the display.

69
WinCUPL Users Guide

BackPin (Utilities menu)

Float All Pins and Nodes

Removes all pin and pinnode numbers from the design file.

Assign Pins And Pinnodes

Places the fitter assigned pin and node numbers (.plc file) into the design file.

Assign Pins Only

Places the fitters assigned pin numbers only. Pinnodes are allowed to remain
floating.

70
WinCUPL Users Guide

PlPartition (Utilities menu)

Setup PlPartition

Use this command to display the PlPartition Fitting Parameters dialog for setting the
options for the PlPartition utility

Run PlPartition

Use this command to run the PlPartition utility and display the results in the
PlPartition Results dialog.

PlPartition Fitting Setup

Figure 38 PlPartition Fitting Options

Best Fit. Optimize pin usage

71
WinCUPL Users Guide

Always makes most efficient use of product terms. Compares the fitting solutions and uses the set
that minimizes the number of chips and pin signals.

First Fit. Optimize product term usage

Starts with the first chip, fills that chip then adds another to the partition set until the design fits.
Has the advantage of being faster.

Design based on history file

This option allows modification of the design without changing the previously assigned pin
configuration.

Split product terms

Allows the partitioner to split product terms that remain in the same device. This feature may
avoid the use of large devices if propagation delay is not critical.

Maximum number of chips

Specifies the maximum number of chips that can be used to fit the design.

Maximum number of solutions

Partitioner stops when this number of solutions have been found.

% product term utilization

Percentage of product terms that can be used on any signal. Allows the possibility of future
expansion.

Maximum running time

Maximum time in minutes that the partitioner can run.

PlPartition Files Setup

72
WinCUPL Users Guide

Figure 39 PlPartition Output Files

Generate a report file

Generates a report file showing the details for each of the devices used. This includes signals in
each chip, signal type, product term usage, and chip utilization.

Generate a solution list

Writes the solution list window to a text file. The solution list window is arranged in ascending
order of cost. Redundant solutions are removed.

Generate PLD files

Generates the new source files. These files are named file@##.pld where the file numbers start at
01.

73
WinCUPL Users Guide

PlPartition Priority Setup

Figure 40 PlPartition Priority Settings

Sort based on cost

The solution list is sorted with the lowest cost fit being listed first

Sort based on power

The solution list is sorted with the lowest power fit being listed first

Sort based on number of devices

The solution list is sorted with the least number of devices fit being listed first

PlPartition Device Selection

74
WinCUPL Users Guide

Figure 41 PlPartition Device Selection

Select all of the devices to include in the PlPartition utility.

Running PlPartition

The PlPartition dialog displays the results of the PlPartition utility.


The solution fit compiled by selecting the solution andrecompiling the file.

ISP Download (Utilities menu)

Use this command to run the ISP download utility from Lattice. For details on
the Lattice software refer to the ISP reference manual.

75
WinCUPL Users Guide

CUPL Tools (Utilities menu)

Use this command to start the three standard CUPL tools and tile them on the
screen. The standard tools are: SMCupl, Schematic and WinSim.

Shortcut
Toolbar:

76
WinCUPL Users Guide

9. Window menu commands


The Window menu offers the following commands, which enable you to arrange multiple views of
multiple documents in the application window:

Cascade Arranges windows in an overlapped fashion.


Tile Horizontal Tiles the windows horizontally.
Tile Vertical
Arrange Icons Arranges icons of closed windows.

Cascade command (Window menu)

Use this command to arrange multiple opened windows in an overlapped fashion.

Tile Horizontal command (Window menu)

Use this command to arrange multiple opened windows from top to bottom in a non-overlapped
fashion.

Tile Vertical command (Window menu)

Use this command to arrange multiple opened windows side by side in a non-overlapped fashion.

Window Arrange Icons Command

Use this command to arrange the icons for minimized windows at the bottom of the main window.
If there is an open document window at the bottom of the main window, then some or all of the
icons may not be visible because they will be underneath this document window.

77
WinCUPL Users Guide

10. Help menu commands


The Help menu offers the following commands, which provide you assistance with this
application:

Contents Offers you an index to topics on which you can get help.
Search Displays the search dialog for the online help topics
Reference Guide Displays the CUPL Language Reference Manual
Simulator Displays the WinSim Users Manual
Schematic Displays the Schematic Users Manual
Bubble Entry Displays the SMCUPL Users Manual
VHDL Displays the Metamor compilers Users Manual
About WinCupl Displays the version number of this application.

78
WinCUPL Users Guide

11. Sample Design Session


In this design a TC74HC138 IC will be implemented in a pld. It is a 3-8 line decoder. If the device
is enabled, 3 binary select inputs (A, B, C) determine which of the outputs go low. If the enable
input G1 is low or either of the active-low inputs G2A or G2B are high, decoding is inhibited and
the 8 outputs will go to a tristate level.

Step 1: Create the PLD file from template


The first step is to create the pld file file using design template. This dialog is launched from the
File New menu.

Figure 1A New Design File Template

After filling in the header information we specify that our design has six inputs and eight outputs
with no pinnodes the following is loaded into the WinCUPL editor.

79
WinCUPL Users Guide

Figure 2A Design File

General editor settings such as font size and highlighting can be customized from the Options
menu.
We now enter our pin declarations as shown below.

/* *************** INPUT PINS *********************/


PIN = G1 ; /* Enable Input */
PIN = !G2A ; /* Enable Input */
PIN = !G2B ; /* Enable Input */
PIN = A ; /* Binary Input */
PIN = B ; /* */
PIN = C ; /* */

/* *************** OUTPUT PINS *********************/


PIN = ![Y0..Y7] ; /* Selected Output */

80
WinCUPL Users Guide

Step 2: Create the Binary Truth Table


For this design we will create a binary truth table. This is done by selecting Insert Table from the
Edit menu. We will assign our select inputs the field name Select and our Y0..7 output the field
name Outputs. The number of rows is eight and we want our input field to increase by one starting
at zero. The complete dialog is shown in Figure 3A.

Figure 3A Truth Table Dialog

The following code is then placed in the design file at the last cursor location before the Truth
Table Dialog is launched.

FIELD Select = [A,B,C];


FIELD Outputs = [Y0..7];

TABLE Select => Outputs {


'b'000 => 'b'00000000;
'b'001 => 'b'00000000;

81
WinCUPL Users Guide

'b'010 => 'b'00000000;


'b'011 => 'b'00000000;
'b'100 => 'b'00000000;
'b'101 => 'b'00000000;
'b'110 => 'b'00000000;
'b'111 => 'b'00000000;}

Step 3: Set Binary Truth Table Values


The next step is to fill the table with the decoder values. The completed table is shown below for
this design.

TABLE Select => Outputs {


'b'000 => 'b'00000001;
'b'001 => 'b'00000010;
'b'010 => 'b'00000100;
'b'011 => 'b'00001000;
'b'100 => 'b'00010000;
'b'101 => 'b'00100000;
'b'110 => 'b'01000000;
'b'111 => 'b'10000000;}

Step 4: Assign Output Enables


We need to assign the output enable terms for the Y0..7 values so that if G1 goes low or G2A or
G2B goes high (False) they will be tristated. Notice that since we declared G2A and G2B to be
active-low we use the inversion symbol to assign the False state (H) to the equation.

[Y0..7].OE = !G1 # !G2A # !G2B;

Step 5: Compile The Design


We now use the Options menu to specify the compiler options. Since we are targetting a virtual
device we will only specify the expanded product terms (.doc) file and a listing file (.lst) file to
view any errors that are in the file.

82
WinCUPL Users Guide

Figure 4A Compiler Options Dialog

We then successfully compile the file. The documentation file generated is listed below.

*************************************************************************
TC74HC138
*************************************************************************

CUPL(WM) 4.9a Serial# 00000000


Device virtual Library DLIB-h-39-1
Created Mon Jun 29 11:16:42 1998
Name TC74HC138
Partno 01
Revision 01
Date 06/29/98
Designer Engineer
Company Logical Devices, Inc
Assembly None
Location

=========================================================================
Expanded Product Terms

83
WinCUPL Users Guide

=========================================================================

Outputs =>
Y0 , Y1 , Y2 , Y3 , Y4 , Y5 , Y6 , Y7

Select =>
A , B , C

Y0 =>
!A & !B & !C

Y0.oe =>
!G1
# !G2A
# !G2B

Y1 =>
!A & !B & C

Y1.oe =>
!G1
# !G2A
# !G2B

Y2 =>
!A & B & !C

Y2.oe =>
!G1
# !G2A
# !G2B

Y3 =>
!A & B & C

Y3.oe =>
!G1
# !G2A
# !G2B

Y4 =>
A & !B & !C

Y4.oe =>
!G1
# !G2A

84
WinCUPL Users Guide

# !G2B

Y5 =>
A & !B & C

Y5.oe =>
!G1
# !G2A
# !G2B

Y6 =>
A & B & !C

Y6.oe =>
!G1
# !G2A
# !G2B

Y7 =>
A & B & C

Y7.oe =>
!G1
# !G2A
# !G2B

=========================================================================
Symbol Table
=========================================================================

Pin Variable Pterms Max Min


Pol Name Ext Pin Type Used Pterms Level
--- -------- --- --- ---- ------ ------ -----

A 0 V - - -
B 0 V - - -
C 0 V - - -
G1 0 V - - -
! G2A 0 V - - -
! G2B 0 V - - -
Outputs 0 F - - -
Select 0 F - - -
! Y0 0 V 1 0 1
Y0 oe 0 X 3 0 1
! Y1 0 V 1 0 1

85
WinCUPL Users Guide

Y1 oe 0 X 3 0 1
! Y2 0 V 1 0 1
Y2 oe 0 X 3 0 1
! Y3 0 V 1 0 1
Y3 oe 0 X 3 0 1
! Y4 0 V 1 0 1
Y4 oe 0 X 3 0 1
! Y5 0 V 1 0 1
Y5 oe 0 X 3 0 1
! Y6 0 V 1 0 1
Y6 oe 0 X 3 0 1
! Y7 0 V 1 0 1
Y7 oe 0 X 3 0 1

LEGEND D : default variable F : field G : group


I : intermediate variable N : node M : extended node
U : undefined V : variable X : extended
variable
T : function

Step 6: Create Simulation File


The next step is to create a simulation file to verify the logic of the design. We do this by
launching the WinSim editor. Upon start-up no simulation input file will be found by the
simulator. Selecting File New and seelcting our design file will fill in the header information from
the pld file. The signals are then added to the simulator database.

86
WinCUPL Users Guide

Figure 5A Simulator Header Information

A blank simulator window will then be displayed.

Step 7: Add Simulation Signals And Vectors

The next step is to add the signals we want to test to the simulation file. We do this by selecting
Signal Add from the menu. This displays the Add Signal dialog. Signals that are not being
currently displayed can be selected. Buses are identified by a * at the end of the field name.
These fields must be declared in the pld file. Individual signals and the bus that contains them can
be displayed.

87
WinCUPL Users Guide

Figure 6A Add Signal Dialog

After selecting the signals to be tested the number of vectors to be displayed is then selected. For
this example we will use twelve. This is done by selecting Signal Add Vector and entering the
number of vectors.

Step 8: Specifying Simulation Values

The value of an individual signal can be specified by clicking on areas of the cell. To make this
easier right clicking on the mouse when in the signal display window will display the available
selections.

88
WinCUPL Users Guide

Figure 7A Setting Signal Values

Bus values can be set by expanding the bus signal (right click in name box) and setting the
indivual signals or selecting that vector on the ruler and changing the value.
The finished vectors are displayed below.

Figure 8A Vector Display

The output values can be left Simulator Determined (*) and those results assigned to the
simulation file after the simulation is run.

89
WinCUPL Users Guide

Step 9: Examine Results


The simulator is then run from the Simulator menu. In this example we allowed the simulator to
determine the Output field values. If there had been an error on a vector it would be displayed in
red. Individual signals can be examined by selecting the View Signal Definitions and selecting the
output signal. The Signal Definitions box will display the reduced equations for that signal to
determine the cause of the error.

90
WinCUPL Users Guide

INDEX

B S
Backpin.......................................................69, 70 Schematic....................1, 3, 11, 34, 46, 57, 76, 78
Simulator..........................................................67
Simulator Options.............................................51
C SMCupl...............................................1, 3, 34, 76
Compiler
Options. .38, 39, 41, 42, 43, 44, 48, 50, 67, 68, T
83
Compiling.........................................................67 Toolbar..............................................................33
Customizing WInCUPL..............................56, 69
V
D
VHDL Options............................................52, 54
Data Flow.......................................................3, 4
W
E
WinSim........................1, 34, 76, 78, 86
Editor Macros..................................34, 56, 61, 65
Export...........................................................5, 12

I
Import...........................................................5, 11

K
Key Features.......................................................2

M
Macros......................................13, 14, 20, 22, 24
Editor..........................................34, 56, 61, 65

P
Partitioning......................3, 69, 71, 72, 73, 74, 75
Printing...............................................................9
Project...................................5, 6, 7, 8, 32, 35, 58

91
WinCUPL Users Guide

92

Вам также может понравиться