contents.gifindex.gif

Arguments and Argument Substitution

Variable values can be used in macros, modules and directives. These values are called the arguments of the construct that uses them. In ABEL-HDL, there are two types of arguments: actual and dummy. Their definitions are given here.

Dummy argument - An identifier used to indicate where an actual argument is to be substituted in the macro, module, or directive.

Actual argument - The argument (value) used in the macro, directive or module. The actual argument is substituted for the dummy argument. An actual argument can be any text, including identifiers, numbers, strings, operators, sets, or any other element of ABEL-HDL.

Dummy arguments are specified in macro declarations and in the bodies of macros, modules and directives. The dummy argument is preceded by a question mark in the places where an actual argument is to be substituted. The question mark distinguishes the dummy arguments from other ABEL-HDL identifiers occurring in the source file.

Take for example, the following macro declaration arguments:

OR_EM MACRO (a,b,c) { ?a # ?b # ?c };

This defines a macro named OR_EM that is the logical OR of three arguments. These arguments are represented in the definition of the macro by the dummy arguments, a, b, and c. In the body of the macro, which is surrounded by braces, the dummy arguments are preceded by question marks to indicate that an actual argument will be substituted.

The equation

D = OR_EM (x,y,z&1);

invokes the OR_EM macro with the actual arguments, x, y, and z&1. This results in the equation:

D = x # y # z&1;

Arguments are substituted into the source file before checking syntax and logic, so if an actual argument contains unsupported syntax or logic, the compiler detects and reports the error.

Argument Guidelines

Dummy arguments are place holders for actual arguments.

A question mark preceding the dummy argument indicates that an actual argument is to be substituted.

Actual arguments replace dummy arguments before the source file is checked for correctness.

Spaces in actual arguments are retained. Usually spaces will not change the functionality, but they are significant with directives that compare two values, such as @ifiden.


See Also

Module

Macro

Directives