AHDL

In-Line Logic Function Reference



An in-line logic function reference is a Boolean equation that implements a logic function. It is a shorthand method for implementing a logic function that uses only one line of the Logic Section and does not require an Instance Declaration in the Variable Section.

When you wish to implement an instance of a megafunction or macrofunction with an in-line logic function reference, you must first ensure that the function's logic is defined in its own design file and a Function Prototype Statement specifies the ports and parameters of the function.

You can also implement an instance of a primitive with an in-line logic function reference. 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 most cases, a Function Prototype Statement is not needed. See Function Prototype Statement for more information.

NOTE Instance Declarations provide named nodes that are useful for entering resource assignments and simulating a project. In contrast, when an in-line logic function reference does not define an instance name, the instance's node names—which are based on the instance name—may change as the project logic changes. Node names do not change for an in-line logic function reference that defines an instance name.

The following examples show the Function Prototypes for the compare and lpm_add_sub functions. The compare function has input ports a[3..0] and b[3..0] and output ports less, equal, and greater; the lpm_add_sub function has the input ports dataa[LPM_WIDTH-1..0], datab[LPM_WIDTH-1..0], cin, and add_sub, and output ports result[LPM_WIDTH-1..0], cout, and overflow.

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

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

The in-line logic function references for the compare and lpm_add_sub functions appear on the right of the equations below. The instance name of the compare function is compare1.

(clockwise, , counterclockwise) = compare1: compare(position[], target[]);

sum[] = lpm_add_sub (.datab[] = b[], .dataa[] = a[]) 
   WITH (LPM_WIDTH = 8)
   RETURNS (.result[]);

The in-line logic function reference for the DFF primitive appears on the right of the equation below. The instance name of the DFF primitive is dffex.

q = dffex: dff (d, clk, clrn, prn)

 

The in-line logic function reference for a logic function has the following characteristics:


Back to Top

- Altera -

 

Created by chm2web html help conversion utility.