Function Prototype Statement

Function Prototype Statements have the same function as symbols in schematic design files. Both provide a shorthand description of a logic function, listing its name and its input, output, and bidirectional ports.

However, megafunction and macrofunction input port default values are not automatically assigned as they are in Block Editor files; you must assign them explicitly in the Subdesign Section of a Text Design File (.tdf). You can also assign a default value for bidirectional ports in the Subdesign Section. However, output ports cannot be assigned a default value.

When you wish to implement an instance of a megafunction or macrofunction, you must ensure that its logic is defined in its own design file. You then use a Function Prototype Statement to specify the ports of the function, and implement an instance of the function with an in-line logic function reference or an Instance Declaration.

To implement an instance of a primitive, you also use an in-line logic function reference or an Instance Declaration. However, in contrast to megafunctions and macrofunctions, primitive logic is predefined, so you do not need to define the primitive logic in a separate design file. In addition, you do not need to use a Function Prototype Statement unless you wish to change the order of the primitive inputs. Example

The following examples show Function Prototype Statements. The first is for the parameterized function lpm_add_sub; the second is for the unparameterized function compare:

FUNCTION lpm_add_sub (cin, dataa[LPM_WIDTH-1..0], datab[LPM_WIDTH-1..0],     
   RETURNS (result[LPM_WIDTH-1..0], cout, overflow);

FUNCTION compare (a[3..0], b[3..0])
	RETURNS (less, equal, greater);

The Function Prototype Statement has the following characteristics:

As an alternative to using a Function Prototype Statement in a file, you can use an Include Statement to call an AHDL Include File (.inc) that contains a Function Prototype Statement.

Function Prototypes for all Quartus® II megafunctions are stored in AHDL Include Files in the \quartus\libraries\megafunctions directory; Function Prototypes for Quartus II primitives are built into the Quartus II software. Online help for all megafunctions and primitives shows the Function Prototype for each Altera-provided function.

Back to Top

- Altera -


Created by chm2web html help conversion utility.