Designation method of digital circuit simulation compilation file

Table of contents

1 The most basic way

2 specify multiple files

3. Use the filelist file

4 Specify all files with the specified suffix in the entire directory

5 Specify the search path for include files

6 Add macro definition

7 Verdi related options

8 Processing methods in Vivado


1 The most basic way


        The most basic way is to specify a single source file directly on the command line, for example (vcs is used as an example here, but it is basically applicable to other common tools, the same below):

vlogan -sverilog design1.sv

        Among them, vlogan is the compilation command of vcs. The above command compiles against one design file. -sverilog indicates that the following files should be compiled according to SystemVerilog syntax. If no file type is specified, the default is verilog. However, the details are handled differently among the various tools. For example, vcs uses -sverilog, while QuestaSim, irun, etc. use "-sv". For another example, some EDA tools will also infer the type based on the file name suffix. Unless the file name suffix is ​​.v, but you want to interpret it according to SystemVerilog syntax, you need to explicitly specify the "-sv" option. However, vcs does not look at the file name suffix, and must explicitly specify "-sverilog" to compile according to the systemverilog syntax.

2 specify multiple files


        Specifying multiple files is naturally, as an intuition, just follow multiple files on the command line.

vlogan -sverilog design1.sv design2.sv design3.sv ...

        But think about it, if there are many files (for example, a dozen), and the debugging stage needs to execute the compilation command repeatedly, it will become a crashing thing to enter so many file names each time (although generally speaking, use up/ The down key can check the command history to avoid repeated input). When the number of files is more, even if you only need to enter it once on the command line (you can use the up/down key to find the command history and reuse it later), it is a terrible thing. At this time, you need to consider using a file to include all files, see the next section.

3. Use the filelist file


        List the source files that need to be added in a text file, and then use the "-f" option on the command line to reference the file, thus solving the problems raised in the previous section. For example:

        file.lst (ASCII file, ie text file):

-sverilog design1.sv 

-sverilog design2.sv 

-sverilog design3.sv

....

-sverilog design100.sv

        Then you just need to do the following on the command line:

vlogan -f file.lst

        When the source file is added or deleted (note, it does not mean that the content of the source file has been modified, but that a file needs to be added or deleted), only file.lst needs to be modified separately. Note that "file.lst" is not a special file name, you can choose any suitable file name.

        However, when a large-scale project has many source file directories and a lot of files (for example, different modules and subsystems are developed by different teams, and now they are doing system integration), list them one by one like this Coming out is also a laborious thing. At this time, you can consider adding all the files of the specified suffix type in the specified directory by specifying the directory and combining the specified file type (file suffix), see the next section.

        

4 Specify all files with the specified suffix in the entire directory


        "-y" is used to specify the directory path

        "-libext+" is used to specify the file extension

        For example, if you want to add all the files with .v and .sv suffixes under the directory src1 to the compilation list, you can specify the following in the command line, of course, in a file more commonly:

/************************************************************************
*    compile list specification
************************************************************************/
-y ../../../src/IP_LIB1
-y ../../../src/WAFE_RX
-y ../../../src/HIF
+libext+.v

+libext+.sv

5 Specify the search path for include files


        Some files, usually header files used to define parameters or macro definitions, are included in other source files in the form of include, and usually the "`include" statement does not include path information. The compiler needs to search where that file is when it sees an "`include" statement. At this time, you can use the "+incdir+" option to tell the compiler where to find the included header file, as shown in the following example:

+incdir+../../../src/header/
-y ../../../src/IP_LIB1
-y ../../../src/WAFE_RX
-y ../../../src/HIF
+libext+.v

+libext+.sv

../../../src/TOP/design1.sv

../../../src/TOP/design2.sv

        Of course, a single file can still be specified in the above file.lst file, as shown in the last two lines.

6 Add macro definition


        A design may usually be able to control the configuration or the switching of design options through the preprocessor macro switch, which is essentially switching the compilation scope. Design parameters are also sometimes specified via macros.

        For example, in a DMA design, whether there are 4 channels or 8 channels, the value of the macro is specified at compile time to determine the design and configuration of several channels, and the definition of the macro can also be specified on the command line or file.lst. There are two situation. It looks like this (the last two lines):

 
+incdir+../../../src/header/
-y ../../../src/IP_LIB1
-y ../../../src/WAFE_RX
-y ../../../src/HIF
+libext+.v
+libext+.sv
../../../src/TOP/design1.sv
../../../src/TOP/design2.sv
+define+NUM_CH=8
+define+DMA_ON


        in,

        NUM_CH corresponds to a parameter class macro used in the design, for example, it is used to specify the number of channels as 8.

        DMA_ON corresponds to a switch-like macro used in the design, for example, to turn on or off a certain piece of code.

7 Verdi related options


        The library directory is specified by -y above, and the library suffix name is specified by +libext+.v. Sometimes -v is used to specify the library file. However, the hierarchy and files cannot be displayed after being directly eaten by verdi. For example, when you use Verdi to view the schematic diagram of the circuit, you cannot click to see the next level.

        The solution provided by verdi is (is it exclusive to verdi? To be confirmed): -ssy (used to cancel the library specified by -y as a library cell) -ssv (used to cancel the library specified by -v as a library cell)


-ssy
-ssv
+incdir+../../../src/header/
-y ../../../src/IP_LIB1
-y ../../../src/WAFE_RX
-y ../../../src/HIF
+libext+.v
+libext+.sv
../../../src/TOP/design1.sv
../../../src/TOP/design2.sv
+define+NUM_CH=8
+define+DMA_ON

8 Processing methods in Vivado


        In Vivado's Tcl script, you can use the set_property command to implement the same functions as some of the above options.

For Vivado in project mode:

For \+incdir\+:

    set_property include_dirs <directory_name> [current_fileset]

For \+define\+:

    set_property verilog_define a=b [current_fileset]

        As for -y and \+incdir\+, the Vivado Tcl script should not be supported (?). You can consider adding the file (or the entire directory) in the GUI mode, and then export it as a Tcl script, which will look like the following figure:



 

        For more digital design verification knowledge, see: Getting started with common digital design simulation tools (Questa, VCS, IUS/Xcelium, Verdi, etc.) 

Guess you like

Origin blog.csdn.net/chenxy_bwave/article/details/130893972