41.4 Precompilation Support
To speed up the full build of your project you can load a precompiled section of code (also referred to as a precompiled library, precompiled database fragment or simply precompiled db).
First you need to figure out which section of the project should be precompiled, usually libraries or IPs which rarely get modified, and refactor the project's original build configuration in two files:
a
precompiled_save.build config file to save the database, usually comprising of one or more
+dvt_init sections
a
precompiled_load.build config file to load the database and compile other files on top of it
For clarity it is recommended to use suggestive filenames, however there is no hard constraint.
Next you need to perform a build using the
precompiled_save.build config, either from the IDE or in batch mode using
dvt_build.sh.
Once the precompiled database is saved, switch to the
precompiled_load.build config and rebuild.
You will get the same compilation result as with the original build config, however with a significantly faster full build.
The
precompiled_save.build config file must specify the
+dvt_precompiled_db_save+<path> directive and the database location:
+dvt_precompiled_db_save+/path/to/precompiled/database/location
... build configuration directives ...
The
precompiled_load.build config file must start with a
+dvt_init_precompiled_db_load directive and specify the database location:
+dvt_init_precompiled_db_load
+dvt_precompiled_db_location+/path/to/precompiled/database/location
The
+dvt_init_precompiled_db_load is a special kind of
invocation and
only precompile-related configuration directives are allowed inside it.
Files compiled on top of the precompiled database must be specified in subsequent
+dvt_init sections.
You must rebuild the precompiled database when:
Tip: Precompiled files are marked with a decorator in Compile Order View.
Note: Only one +dvt_init_precompiled_db_load directive is allowed in a build configuration file.
Note: You can use IDE features like navigation and visualization in precompiled source files but they
cannot be edited.
Note: In order to disable MD5 checksum change detection for precompiled files, you must use the
+dvt_precompiled_db_disable_md5_change_detection directive when loading a precompiled database:
+dvt_init_precompiled_db_load
+dvt_precompiled_db_location+/path/to/precompiled/database/location
+dvt_precompiled_db_disable_md5_change_detection
Tip: When the precompiled database needs to be rebuilt, you can either do it from the GUI or in batch mode using
dvt_build.sh.
The batch mode command can be specified inside the
+dvt_init_precompiled_db_load section, and will be triggered from the GUI in case load fails, for example:
+dvt_init_precompiled_db_load
+dvt_precompiled_db_location+/path/to/precompiled/database/location
+dvt_precompiled_db_build_cmd+"$DVT_HOME/bin/dvt_build.sh -lang vlog -cmd /path/to/precompile_save.build"