
The primary method for generating FHDL statements is the text statement. Each text statement causes a complete FHDL statement to be generated. At times you may wish to generate only a part of an FHDL statement. To illustrate, let us return to the example of Section 3. Recall that this example generated a NOT gate for each input/output pair. Let us modify this example to produce a subnetwork rather than generating the not gates "in line." Because a text statement has a fixed number of operands, a single text statement cannot be used to generate the input and output lists. However the 'disp statement can be used to get around this problem, as the following example illustrates.
not.m: 'macro
'if 'count('ilist)'!='count('olist)
'error s,"not.m inputs and outputs don't match"
'exit
'endif
circuit
'int 'i
'disp "\tinputs\t"#'ilist(1)
'assign 'i,1
'while 'i'<'count('ilist)
'disp ","#'ilist('i)
'assign 'i,'i+1
'endwhile
'disp "\n\tinputs\t"#'olist(1)
'assign 'i,1
'while 'i'<'count('olist)
'disp ","#'ilist('i)
'assign 'i,'i+1
'endwhile
'disp "\n"
'assign 'i,0
'while 'i'<'count('ilist)
not 'ilist('i),'olist('i)
'assign 'i,'i+1
'endwhile
endcircuit
'endmacro
The 'disp statement is used to generate unformatted text. The statement has one operand, which is evaluated and placed in the output. Note that opcodes, separators and statement terminators must be explicitly specified. This example also illustrates the use of special characters in character strings. In general, anything that is acceptable in the C language is acceptable to the macro preprocessor, except the null character (\0). The 'disp statement can be used to create non-FHDL output.