AHDL

Using Custom Megafunctions & Macrofunctions



You can create a user-defined megafunction or macrofunction in AHDL by generating an AHDL AHDL Include File (.inc), which contains an AHDL Function Prototype, for each lower-level logic function that is instantiated in the top-level Text Design File (.tdf). You can either manually create the AHDL Include File, or create an AHDL Include File from any Quartus® II-supported design file in the Quartus II Text Editor, Block Editor, or Symbol Editor. In addition, the Quartus II MegaWizard® Plug-In Manager automatically generates an AHDL Include File containing a Function Prototype when you use it to create a custom megafunction variation.

After you create the user-defined function, you can then instantiate the function in a TDF as described in Using an Altera® Unparameterized Function or Using an Altera Parameterized Function.

  1. The AHDL Include File must have the same filename as the design file, with the extension .inc.

  2. To use a particular logic function in multiple projects, use the User Libraries page of the Settings dialog box (Assignments menu) to specify the directory that contains the function's design file and AHDL Include File as a user library for each project. Make sure you use the User Libraries page for each project. You can also save copies of the files to the directory of an existing user library. Otherwise, you must save copies of the files to the directory containing the project that will use the custom function.

  3. There is no distinction between output ports and bidirectional ports in Function Prototypes; instead, all ports listed after the RETURNS keyword are treated as output ports. As a result, if you specify a bidirectional port in a logic function's Function Prototype and do not connect the port to a top-level bidirectional pin or to other logic in the design where you instantiate the logic function, an error can occur.

Back to Top

- PLDWorld -

 

Created by chm2web html help conversion utility.