contents.gifindex.gif

Macro Keyword

Syntax

macro_id MACRO [ ( dummy_arg[,dummy_arg]... ) ] {block} ;

macro_id - An identifier naming the macro.

dummy_arg - A dummy argument.

block - A block.

Use

The macro declaration statement defines a macro. You can use macros to include ABEL code in a source file without typing or copying the code everywhere you need it. A macro is defined once in the declarations section of a module and then used anywhere within the module as frequently as needed. Macros can be used only within the module in which they are declared.

Example

The dummy arguments used in the declaration of the macro allow different actual arguments to be used in the macro each time it is invoked in the module. Within the macro, dummy arguments are preceded by a "?" to indicate that an actual argument will be substituted for the dummy by the ABEL compiler.

D = NAND3 (Clock,Hello,Busy) ;

brings the text in the block associated with NAND3 into the code, with Clock substituted for ?A, Hello for ?B, and Busy for ?C. This results in

D = ! ( Clock & Hello & Busy ) ;

which is the three input NAND.


See Also

Arguments and Argument Substitution

Declarations