
The preprocessor is executed using the "alogic" command. The simplest form of this command is to use it as a filter for FHDL input, as the following illustrates. (The alogic command is executed automatically if the fhdl command with the "-n" option is used.)
alogic input.ckt | fhdl >input.c
A macro library can also be used with this form as the following command illustrates.
alogic -m maclib input.ckt | fhdl >input.c
The name of the macro library is "maclib". File names for both macro libraries and input files follow the usual UNIX rules for file name formation. The flag "-m" must precede the name of each macro library. The "-m" flag must be separated from the macro library name by one or more spaces or tabs. If more than one macro library is specified, and the same macro is defined in more than one library, the definition encountered last takes precedence. This is also true for the initialization and termination macros. Only the last encountered initialization and termination macros will be executed. The following is a command that specifies two macro libraries "mac1" and "mac2" and an include directory "include1".
alogic -m mac1 -m mac2 -m include1 input.ckt | fhdl >input.c
In most cases, complex applications such as this will have shell files that supply the library names. File names without the preceding "-m" flag are input files. There may be several input files specified as in the following example.
alogic -m mac1 input1.ckt input2.ckt input3.ckt | fhdl >input.c
Input files are processed one at a time in the order specified. After the processing of a file is complete, the macros defined in the file are retained and made available to all succeeding files. This may cause problems if several files define the same macro (in this case, break into several runs). The main use of this feature is to allow all non-library macros to be placed in a header file that precedes the circuit file on the command line.
A file name of "-" (a single dash preceded and followed by one or more spaces or tabs) indicates the standard input. The standard input is read (possibly several times) whenever the file "-" is processed.
The value of the variable 'run may be set using the "-r" flag on the command line. The "-r" flag must be preceded and followed by one or more spaces or tabs. The (command line) argument following the "-r" flag is assigned to the 'run variable. There must be only one "-r" flag on the command line. All input files in a particular run share the same value of the 'run variable. The following is an example of setting the 'run variable.
alogic -m mlib -r old input.ckt | fhdl >input.c
Normally the output of the macro preprocessor is directed to "stdout". (Error messages are directed to "stderr".) This output can be redirected in the usual fashion, or it can be explicitly directed to an output file by using the "-o" flag on the command line. The "-o" flag must be preceded and followed by one or more spaces or tabs. The output of the preprocessor will be placed in the file name following the "-o" flag. There may be at most one "-o" flag on the command line. If several output files are needed, break into several runs.