Using Altera-Provided Unparameterized Functions (AHDL)

The Quartus® Prime software includes libraries of primitives that are not inherently parameterized. These Quartus® Prime primitives can be used in AHDL to create hierarchical logic designs.

There are two ways to use (that is, insert an instance of) an unparameterized function in AHDL:

Function Prototypes for Quartus® Prime primitives are built into the Quartus® Prime software. Therefore, when implementing Quartus® Prime primitives in AHDL, you do not need to declare Function Prototypes using Include Statements.

In the example below, an Instance Declaration creates an instance of a DFF and a TRI primitive.

SUBDESIGN example1
(
   data, clock      : INPUT;
   clearn, presetn  : INPUT;
   a, b             : INPUT;
   q_out, t_out     : OUTPUT;
)
VARIABLE
   dff1 : dff;
   tri1 : tri;
BEGIN
   dff1.d = data;
   dff1.clk = clock;
   dff1.clrn = clearn;
   dff1.prn = presetn;
   q_out = dff1.q;
   tri1.in = b;
   tri1.oe = a;
   t_out = tri.out;
END;

Instance Declarations in the Variable section declare the variables dff1 and tri1 as instances of the DFF and TRI primitives, respectively. The ports of the primitives, which are in the format <<instance name>.<port name>, are assigned values in the Boolean equations in the Logic Section.

Note: The help topic describing an Altera-provided function shows the Function Prototype for that function.

The example2.tdf file shown below has the same functionality as example1.tdf, but creates instances of the DFF and TRI primitives with in-line logic function references:

SUBDESIGN example1
(
  data, clock      : INPUT;
  clearn, presetn  : INPUT;
  a, b             : INPUT;
  q_out, t_out     : OUTPUT;
)
BEGIN
   q_out = dff1: dff (data, clock, clearn, presetn);
   t_out = tri1: tri (.oe = a, .in = b);
END;

The in-line logic function reference for the DFF and TRI primitives appear in the Boolean equations in the Logic Section. The in-line logic function reference for dff1 uses positional port association, whereas the in-line logic function reference for tri1 uses named port association. When positional port association is used, the order of ports is important because there is a one-to-one correspondence between the order of the ports in the Function Prototype and the ports defined in the Logic Section.

Note: Because primitives do not necessarily have default values for unconnected inputs, you must ensure that all required ports are connected.