Difference between revisions of "Compile-time/run-time flags"

From Verific Design Automation FAQ
Jump to: navigation, search
Line 3: Line 3:
 
There are compile-time flags and run-time flags to control Verific software's behavior.
 
There are compile-time flags and run-time flags to control Verific software's behavior.
  
The compile-time flags are set at compile time. They are in these files:
+
When compile-time flags are changed, it will be necessary to rebuild the software for the flags to take effect. These flags reside in the following files:
  
database/DBCompileFlags.h
+
  database/DBCompileFlags.h
hdl_file_sort/HdlFileSortCompileFlags.h
+
  hdl_file_sort/HdlFileSortCompileFlags.h
synlib/SynlibCompileFlags.h
+
  synlib/SynlibCompileFlags.h
verilog_nl/VeriNetlistCompileFlags.h
+
  util/VerificSystem.h
verilog/VeriCompileFlags.h
+
  verilog_nl/VeriNetlistCompileFlags.h
vhdl/VhdlCompileFlags.h
+
  verilog/VeriCompileFlags.h
 +
  vhdl/VhdlCompileFlags.h
  
The run-time flags are set at run time with the C++ API 'RuntimeFlags::SetVar()' or the TCL command 'set_runtime_flag'. They are in these files:
+
If the behavior of the software needs to be changed dynamically, this can be accomplished using run-time flags. With run-time flags, toggling of behavior can occur at any time without requiring re-compilation of the software. In most cases setting a flag to '1' will enable it and setting to '0' will disable it, although there are some flags that may take on other values, such as 'veri_loop_limit' = 10000, and 'db_record_naming_style' = "%s.%s". Run-time flags reside in the following files:
  
database/DBRuntimeFlags.h
+
  database/DBRuntimeFlags.h
edif/EdifRuntimeFlags.h
+
  edif/EdifRuntimeFlags.h
hier_tree/HierRuntimeFlags.h
+
  hier_tree/HierRuntimeFlags.h
synlib/SynlibRuntimeFlags.h
+
  pct/PCTRuntimeFlags.h
upf/UpfRuntimeFlags.h
+
  synlib/SynlibRuntimeFlags.h
util/RuntimeFlags.h
+
  upf/UpfRuntimeFlags.h
verilog_nl/VeriNetlistRuntimeFlags.h
+
  util/RuntimeFlags.cpp
verilog/VeriRuntimeFlags.h
+
  verilog_nl/VeriNetlistRuntimeFlags.h
vhdl/VhdlRuntimeFlags.h
+
  verilog/VeriRuntimeFlags.h
 +
  vhdl/VhdlRuntimeFlags.h
  
(Depending on your Verific product configuration, you may not have all the files).
+
Note that depending on your Verific product configuration, you may or may not have all the files listed above. Also, most of the compile-time flags have an equivalent run-time flag to facilitate toggling of the desired behavior. For a full list of Verific's run-time flags with descriptions of their functionality, please refer to this page: [https://www.verific.com/docs/index.php?title=RuntimeFlags Verific Runtime Flags]
  
Note that most, but not all, compile-time flags have run-time equivalent.
+
For C++, use the following APIs to control the run-time flags:
 +
<nowiki>
 +
    RuntimeFlags::SetVar()      - Set a run-time flag to a particular value (value is a non-negative integer or 0)
 +
    RuntimeFlags::GetVar()      - Get the value of a run-time flag (for flags that return a non-negative integer or 0)
 +
    RuntimeFlags::SetStringVar() - Set a run-time flag to a particular string value
 +
    RuntimeFlags::GetStringVar() - Get the value of a run-time flag (for flags that return a string value)
 +
</nowiki>
 +
 
 +
Below are some examples on how to call these APIs:
 +
<nowiki>
 +
    RuntimeFlags::SetVar("veri_preserve_comments", 1) ;                        // enable flag 'veri_preserve_comments' 
 +
    RuntimeFlags::GetVar("veri_preserve_comments") ;                            // retrieve the value of 'veri_preserve_comments'
 +
    RuntimeFlags::SetStringVar("db_interface_modport_field_separator", "_") ;  // set "db_interface_modport_field_separator" to be "_"
 +
    RuntimeFlags::GetStringVar("db_array_naming_style") ;                      // retrieve the value of 'db_array_naming_style'
 +
</nowiki>
 +
 
 +
 
 +
For Tcl scripting, use the following commands to control the run-time flags:
 +
<nowiki>
 +
    set_runtime_flag      - Set a run-time flag to a particular value
 +
    get_runtime_flag      - Get the value of a run-time flag
 +
</nowiki>
 +
 
 +
Below are some examples on how to call these commands:
 +
<nowiki>
 +
    set_runtime_flag "db_array_naming_style" "%s\[%d\]" 
 +
    get_runtime_flag "veri_preserve_comments"               
 +
</nowiki>

Revision as of 20:05, 2 March 2023

Q: Are there options to control Verific software's behavior?

There are compile-time flags and run-time flags to control Verific software's behavior.

When compile-time flags are changed, it will be necessary to rebuild the software for the flags to take effect. These flags reside in the following files:

  database/DBCompileFlags.h
  hdl_file_sort/HdlFileSortCompileFlags.h
  synlib/SynlibCompileFlags.h
  util/VerificSystem.h
  verilog_nl/VeriNetlistCompileFlags.h
  verilog/VeriCompileFlags.h
  vhdl/VhdlCompileFlags.h

If the behavior of the software needs to be changed dynamically, this can be accomplished using run-time flags. With run-time flags, toggling of behavior can occur at any time without requiring re-compilation of the software. In most cases setting a flag to '1' will enable it and setting to '0' will disable it, although there are some flags that may take on other values, such as 'veri_loop_limit' = 10000, and 'db_record_naming_style' = "%s.%s". Run-time flags reside in the following files:

  database/DBRuntimeFlags.h
  edif/EdifRuntimeFlags.h
  hier_tree/HierRuntimeFlags.h
  pct/PCTRuntimeFlags.h
  synlib/SynlibRuntimeFlags.h
  upf/UpfRuntimeFlags.h
  util/RuntimeFlags.cpp
  verilog_nl/VeriNetlistRuntimeFlags.h
  verilog/VeriRuntimeFlags.h
  vhdl/VhdlRuntimeFlags.h

Note that depending on your Verific product configuration, you may or may not have all the files listed above. Also, most of the compile-time flags have an equivalent run-time flag to facilitate toggling of the desired behavior. For a full list of Verific's run-time flags with descriptions of their functionality, please refer to this page: Verific Runtime Flags

For C++, use the following APIs to control the run-time flags:

    RuntimeFlags::SetVar()       - Set a run-time flag to a particular value (value is a non-negative integer or 0) 
    RuntimeFlags::GetVar()       - Get the value of a run-time flag (for flags that return a non-negative integer or 0)
    RuntimeFlags::SetStringVar() - Set a run-time flag to a particular string value 
    RuntimeFlags::GetStringVar() - Get the value of a run-time flag (for flags that return a string value) 
 

Below are some examples on how to call these APIs:

    RuntimeFlags::SetVar("veri_preserve_comments", 1) ;                         // enable flag 'veri_preserve_comments'  
    RuntimeFlags::GetVar("veri_preserve_comments") ;                            // retrieve the value of 'veri_preserve_comments'
    RuntimeFlags::SetStringVar("db_interface_modport_field_separator", "_") ;   // set "db_interface_modport_field_separator" to be "_" 
    RuntimeFlags::GetStringVar("db_array_naming_style") ;                       // retrieve the value of 'db_array_naming_style' 
 


For Tcl scripting, use the following commands to control the run-time flags:

    set_runtime_flag       - Set a run-time flag to a particular value 
    get_runtime_flag       - Get the value of a run-time flag 
 

Below are some examples on how to call these commands:

    set_runtime_flag "db_array_naming_style" "%s\[%d\]"   
    get_runtime_flag "veri_preserve_comments"