Previous

Creating and Editing Macros

This section describes how macro library files are created and edited in EPIC. These operations are done while EPIC is in Macro Mode.

Starting EPIC in Macro Mode

You can start EPIC in Macro Mode in either of these two ways.

From a Dialog Box

You can start an EPIC session in Macro Mode by making selections from a dialog box. You must be in a window environment (Microsoft Windows on a PC, and X Window System on a UNIX workstation).

To edit an existing macro when you start EPIC, follow these steps.

  1. Open the EPIC Start dialog box using one of the following methods.

  2. Click Open existing macro then OK.

    The Open Macro dialog box appears.

    Figure 5.4 Open Macro Dialog Box

  3. Specify the Macro library file to edit using one of the following methods.

  4. Select the Mode option from the pull-down list.

    In the option menu that appears, select one of the following modes.

  5. Click OK.

    The EPIC window appears, displaying the macro library file you specified.

From the Command Line

You can start EPIC in Macro Mode from the DOS or UNIX prompt. On a UNIX workstation, the X Window System must be running. On a PC, you can start EPIC from the DOS command line.

On a PC, from within the Microsoft Windows Program Manager, select Run from the File menu. In the Run dialog box, enter the command. (Remember that commands for a PC are case insensitive).

epic -m [-e | -r] macro_name[.nmc]

This command also applies to workstations.

The EPIC window appears, displaying the existing macro library file.

To start EPIC from the command line and create a new macro library file, enter this command.

epic -m macro_name[.nmc] arch device package speed

The EPIC window appears, displaying an empty macro library file using the designated part and speed. When you create a new macro library file, you are placed in a mode that allows you to make changes to the file.

Creating a New Macro

To create a new macro when you start EPIC, follow these steps.

  1. Open the EPIC Start dialog box in one of the following ways.

  2. Click Create new macro.

    The New Macro dialog box appears.

    Figure 5.6 New Macro Dialog Box

  3. Specify the name of the new macro library file in one of these ways.

  4. For Family, select X4000 or X4000a; then select a Package, and Speed of the macro library file to create.

    When the dialog box appears, it defaults to an XC3000 device. Currently only XC4000/XC4000A library files are supported.


    NOTE

    Although you must specify a part number and speed, a macro you create can be instantiated in any design file of the same family. For example, if you create a macro library file and specify a 4008PG191 package at a speed of 5, the macro can still be instantiated in a design file for a 4010PQ208 package at a speed of 6, or any other Xilinx XC4000 family design file.


  5. Click OK.

    The New Macro dialog box closes and the EPIC window appears. It displays a blank macro library design using the device you specified. You can this new macro.

Opening a Macro Library File from the EPIC Window

To open an existing macro library file while you are in the EPIC window, use this procedure.

  1. Select Open Macro from the File menu.

    The Open Macro dialog box appears.

    Figure 5.7 Open Macro Dialog Box

  2. Specify the macro library file to edit in one of the following ways.

  3. Select the Mode option button from the pull-down list.

    In the option menu that appears, select one of the following modes.

  4. Leave the Save current file selected, if you want to save the design or macro library file currently in the EPIC window.

    If you do not want to save changes, deselect it.

  5. Click OK.

The macro library file you specified is loaded into the EPIC window.

Creating a New Macro Library File from the EPIC Window

To create a new macro library file while you are in the EPIC window follow this procedure.

  1. Select New Macro from the File menu,

    The New Macro dialog box appears.

    Figure 5.8 New Macro Dialog Box

  2. Specify a name for the new macro library file in one of these ways.

  3. Select the Architecture, Device, Package and Speed.

  4. Leave the Save current file toggle selected, if you want to save the design or macro library file.

    If you do not want to save changes, deselect it.

  5. Click OK.

    The current design or macro library file closes and an empty (unprogrammed) macro library file is loaded. The part number and speed for the macro library file are as specified.

Saving a Design as a Macro Library File

You can create a macro library file by saving a design in the EPIC window, when EPIC is in Design Mode, as a macro. When you save a design as a macro, EPIC switches to Macro Mode. You can then edit this new macro library file.

To save the design as a macro library file, use this procedure.

  1. Select Save As Macro in the File menu.

    The Save As dialog box appears.

    Figure 5.9 Save As Dialog Box

  2. Specify the macro file name in one of the following ways.

  3. Click OK.

    The design is saved as a macro library file with the name you specified. The banner at the top of the EPIC window indicates that EPIC is in Macro Mode and displays the name of this new file, which is currently displayed in the window. When you later save or exit, it is saved to the new macro library file, not the original.

To use this macro, you must assign one or more external pins; this procedure is described in the “Adding External Pins in Macro Mode” section section.

Constraints are not retained when you save a design file as a macro library file. No constraint file is generated, even if the design had constraints defined.

Editing the Macro Library File

This section describes how to edit the macro library file. Most editing operations in Macro Mode are identical to those same operations in Design Mode. However, there are operations which are performed differently in Macro and Design modes. In addition, certain operations can only be performed in Macro Mode.

Many of the operations unique to Macro Mode are performed using the entries in the Macros menu. The Macros menu is only used in Macro Mode.

Figure 5.10 Macros Menu

Add External Pin
Designates that a selected component pin is an external pin. The pin can be connected to external nets after the macro is instantiated in a design file.
List External Pins
Lists all external pins specified in the macro library file.
Set Reference Comp
Designates a selected macro component as the macro's reference component. If the macro has at least one pre-placed component, it has a reference component. When you place, move, or copy a macro, you select a site for the reference component, and all other components are then located relative to the reference component.
If you do not designate a reference component, the component in the lower left corner is selected when the macro library file is saved.
Get Reference Comp
Displays the name of the reference component in the history area.

The following sections describe how to perform these operations in Macro Mode.

Adding External Pins in Macro Mode

External pins connect the instantiated macro to other components in the design. You define the external pins in the macro library file, and the pins cannot be modified in a macro instance. In the EPIC editing area, external pins are displayed in the macro layer color.

To add external pins to the macro library file, follow these steps.

  1. Select the pins that you want to define as external pins.

  2. Specify these pins as external pins in one of the following ways.

When you add external pins, an External Pin Attributes dialog box can appear for each newly created external pin. Whether the dialog box displays or not is controlled by the Automatic Post main window attribute. See the “Main Window Attributes” section of the “Using EPIC” chapter. Each dialog box shows the name of the new external pin and other information about the pin. You can edit the dialog boxes to modify external pin attributes or you can remove the dialog boxes by pressing Cancel. See the “External Pin Attributes” section for details.

When you add an external pin, the name assigned to the new pin is in the format $extpin_number, where number is a number assigned to each new external pin. Numbering starts at 0, and increases by one for each new external pin. For example, if you add multiple external pins, the first one will be called $extpin_0, the second will be called $extpin_1, and so on.

Macro to External Net Rules

For macro nets connected to external nets, use these rules to declare and name external pins, and to set their Type attributes.

The following examples illustrate these rules.

Example 1

The following figure shows a macro that connects an external clock pin to multiple clock input pins. Only one K pin needs to be designated as the external clock pin to the macro.

Figure 5.11 External Pins Example 1

Example 2

The following figure shows a macro that functions as a latch. External pins appear as filled-in triangles. There are two input external pins and one output external pin for the macro. The output external pin (Y) also feeds back to an input pin (the F1 pin) within the macro, but only the Y pin is used as an external pin; Y is a driver to the external circuitry, and you therefore want to designate this output pin as external.

Figure 5.12 External Pins Example 2

Deleting External Pins

When you delete an external pin, the pin is no longer defined as external. If the external pin is connected to a net, it remains connected after you delete it as an external pin.

To change pins so that they are no longer defined as external pins, follow this procedure.

  1. Select the pins that you want to eliminate as external pins.

  2. Perform the Delete command in one of the following ways.

The selected pins are no longer external pins. If you display a list of external pins, these pins will be missing from the list.

Listing External Pins

To list all currently defined external pins, select List External Pins from the Macros menu or enter the getattr main extpins command in the EPIC command line dialog box. A listing of all of the external pins currently defined for the macro appears in the history area, as shown following, and is written to the log file.


# External Pin Name   Pin Type   Comp.Pin Location 
# -----------------   --------   ----------------- 
#    Input Pins: 
#                       A<0>     INPUT    Q0.F1 
#                       A<1>     INPUT    Q0.G4 
#                       A<2>     INPUT    Q2.F1 
#                       A<3>     INPUT    Q2.G4 
#                       C        CLOCK    OFL.K 
#                       R        INPUT    OFL.F3 
#
#    Output Pins: 
#                       OFL      OUTPUT   OFL.XQ 
#                       Q<0>     OUTPUT   Q0.XQ 
#                       Q<1>     OUTPUT   Q0.YQ 
#                       Q<2>     OUTPUT   Q2.XQ 
#                       Q<3>     OUTPUT   Q2.YQ 
#
#    External Pin Summary: 
#         Number of inputs:   6 
#         Number of outputs:  5 
#         Total pin count:   11

External Pin Attributes

To view or change external pin attributes, select the external pin and then select the Attrib push button or the Post Attributes command in the Misc menu. The following dialog box appears.

Figure 5.13 External Pin Attributes Dialog Box

Name
Name of the component pin.
External Name
Name by which this pin will be known when the macro library file is instantiated in a design.
Component Name
Name of the component containing the pin. This field holds an unlimited number of characters; it is non-modifiable or scrollable.
Site Name
Site in which the component containing the pin is placed.
Type
Specifies the function of the pin within the macro. The pin type determines how paths passing through the pin are defined for timing analysis. Pin types are described in the following table.

For an input pin, the pin types are the following.

Type
Meaning
INPUT
Pin is an input to combinational logic in the macro; it is not clocked.
CLOCK
Pin is used as a clock signal within the macro.
SRDIRECT
Pin is used as an asynchronous Set or Reset signal within the macro.
ENABLE
Pin is used as an asynchronous control line (for example, a tristate buffer enable) within the macro.
SYNCINPUT
Pin is an input that is clocked within the macro (for example, a register input).
SYNCENABLE
Pin is used as a control line synchronous to a clock within the macro.

For an output pin, the pin types are the following.

Type
Meaning
OUTPUT
Pin is an output from combinational logic within the macro; it is not clocked within the macro.
SYNCOUTPUT
Pin is an output from clocked logic within the macro. The pin is synchronous with respect to the macro clock.
DIRECTIN
Pin should be treated as a direct input pin, that is, a pin with no internal delay. This pin type should not be specified for an external macro pin.

Reference Component in Macro Mode

A reference component is a component in the macro library file used as the origin when a macro instance is placed, moved, or copied. Placement and routing of all other macro components are determined relative to this component.

If a macro library file has at least one pre-placed component, the macro will have a reference component. A macro can have only one reference component, which you specify when the macro library file is created or edited. If you do not specify one, the system assigns one automatically.

When you place, move, or copy a macro instance, select a site, then execute the appropriate command. The macro's reference component is placed in the site you designated, and all other placed components in the macro are located in sites relative to the reference component.

To designate the reference component follow this procedure.

  1. Select the component you want as the reference component.

  2. Indicate that the selected component is to be the reference component in one of these ways.

You can change the reference component at any time while EPIC is in Macro Mode. If you do not designate a reference component, the component in the lower-left corner is selected by default when the macro file is saved.

To determine which component is the reference component, select Get Reference Comp from the Macros menu or enter getattr main refcomp in the EPIC Command Line dialog box. The name of the reference component appears in the history area.

You can define a macro with unplaced components and unrouted nets. In this case, there will be no reference component, and it will not be possible to place an instance of this library file, except by placing each macro component individually.

Adding a Macro in Macro Mode

A macro instance can be added to a macro definition file. The procedure for adding a macro instance is identical, whether EPIC is in Macro or Design Mode. This procedure is described in the “Adding Macros” section.

When you add a macro while EPIC is in Macro Mode, the macro instance is unbound that is, the components and nets in the instance are added as separate components and nets, not as macro elements. After instantiation, there is no indication that these components or nets were added as a macro.

Placement and Routing in Macro Mode

In Macro Mode, you can place components in the editing area and route the connecting nets. When you later instantiate the macro library file in a design, the placement of the components relative to each other is maintained in the instantiated macro. Also, routing in the instantiated macro will follow the routing specified in the library file.

Placement and routing operations in Macro Mode are identical to these same operations in Design Mode.

When you instantiate a pre-routed macro into a design, the design can take a substantially longer time to place and route, depending on the route complexity and the number of connections in the macro nets. Therefore, make sure that you do not add any unnecessary routing to your library file.

Do not define a macro with CLB K pins routed together using long lines. This configuration may be impossible to route when the macro is instantiated into a design.

Macro DRC Checks in Macro Mode

There are a number of physical DRC checks that test the macro you are editing. You can execute these tests during your EPIC session. Also, the tests run automatically whenever you save the macro library file.

To run the macro DRC check follow these steps.

  1. Make sure nothing is selected in the editing area or the EPIC List dialog box.

    If necessary, select the Clear push button to deselect any objects.

  2. Perform the DRC command using one of the following methods.

The macro DRC is performed (along with other DRC tests). DRC results appear in the history area.

Saving a Macro Library File

At any time during an EPIC session, you can save the macro library file.


NOTE

When you save a macro library file, you cannot save a constraint file along with the NMC file, even if constraints were created when the macro library file was edited. All constraints are lost when you save the NMC file.


To save your current macro library file, select Save in the File menu. The macro library file is written to disk.

To save the macro library file under a different name follow these steps.

  1. Select Save As in the File menu.

    The Macro Save As dialog box appears.

    Figure 5.14 Macro Save as Dialog Box

  2. Use one of the following methods to save a macro library file.

  3. Click OK.

    The macro library file is saved to the name you specified. The filename r at the top of the EPIC window changes to indicate that this new file is currently displayed. When you later save or exit the file, it is saved to the new file, not the original file.

Saving a Macro Library File as a Design File


NOTE

If you are using the default aliases supplied with EPIC, you can enter the save command instead the unload command.


To save a macro library file as a design file, enter this command.

unload design design_name [pcffile_name]

Your macro library file is saved as a design file. Any constraints in the macro library file are written to the constraint file you specified.

Exiting EPIC (Macro Mode)

To exit EPIC while in Macro Mode follow this procedure.

  1. Use the Exit command in one of the following ways.

  2. If you want to save changes made to the macro library file, leave the Save Design Changes toggle button selected.

    If you do not want to save changes, deselect it.

  3. Click OK.

    The EPIC window closes.

Next