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

From Verific Design Automation FAQ
Jump to: navigation, search
Line 43: Line 43:
 
     RuntimeFlags::GetStringVar("db_array_naming_style") ;                      // retrieve the value of 'db_array_naming_style'  
 
     RuntimeFlags::GetStringVar("db_array_naming_style") ;                      // retrieve the value of 'db_array_naming_style'  
 
  </nowiki>
 
  </nowiki>
 
  
 
For Tcl scripting, use the following commands to control the run-time flags:
 
For Tcl scripting, use the following commands to control the run-time flags:

Revision as of 20:11, 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"