11. Synthesis directive

“include” directive

In NSL, an external source file can be taken by using “include” directive just like C language.
Description method of “include” directive is as follows.

#include “File_path_name”

With this “include” directive, it becomes easy to control NSL file in terms of module.
A example42 of “include” is shown as follows.

<<Example 42. include1>>
	declare sub_ex42 {
		input a[4], b[4] ;
		output o[4] ;

		func_in exec(a, b) ;
	}
	module sub_ex42 {
	    function exec {
	        o = a + b ;
	    }
	}
	
<<Example 42. include2>>

	#include "sub_ex42.nsl"

	declare ex42 {
	    input inA[4], inB[4] ;
	    output outF[4] ;
	}
	module ex42 {
	    reg result[4] ;

	    sub_ex42 U_SUB ;

	    result := U_SUB.exec(inA, inB).o ;
	}

	

“define” “undef” directive

The “define” directive is prepared to give the parameter when a module described in NSL is
called as a lower module. (The parameter syntax is used when a parameter is given to the
module described in Verilog HDL/VHDL/SystemC.)
The “define” directive is a directive that substitutes the character string and the expression
with another character string, etc. as well as C language.
For example, it becomes possible to replace “0′b0″ with “ZERO”. However, NSL reserved
word cannot be replaced with.
The description method is as follows.

#define Identifier_string Replaced_expression

The character string distinguishes between capital letters and small letters.
The defined character string can be used in the source of NSL.

In addition, the defined character string can be released by using “undef” directive. It is described
as follows.

#undef Defined_string

A description example of “define” directive is shown as follows.

<<Example43.Define>>
#define VAL_ZERO 0b00000000
#define VAL_ONE  0b00000001
#define VAL_MAX  0b00010000

declare ex43 {
    func_out cnt_end_call ;
}
module ex43 {
    reg cnt[8] ;

    any {
	    cnt == VAL_MAX : {
		    cnt := VAL_ZERO ;
            cnt_end_call() ;
        }
        else : cnt := VAL_ONE + cnt ;
    }
}