<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://www.verific.com/faq/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mohammad</id>
		<title>Verific Design Automation FAQ - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://www.verific.com/faq/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mohammad"/>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=Special:Contributions/Mohammad"/>
		<updated>2026-05-02T12:38:46Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.26.3</generator>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=Simple_example_of_visitor_pattern&amp;diff=972</id>
		<title>Simple example of visitor pattern</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=Simple_example_of_visitor_pattern&amp;diff=972"/>
				<updated>2026-04-04T02:13:34Z</updated>
		
		<summary type="html">&lt;p&gt;Mohammad: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Example 1:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
$ cat test.cpp&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
#include &amp;quot;veri_file.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriModule.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriVisitor.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriConstVal.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Map.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Strings.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#ifdef VERIFIC_NAMESPACE&lt;br /&gt;
using namespace Verific ;&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
class MyVisitor : public VeriVisitor&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
    MyVisitor() : VeriVisitor() { }&lt;br /&gt;
    virtual ~MyVisitor() { }&lt;br /&gt;
&lt;br /&gt;
    virtual void VERI_VISIT(VeriConst, node)&lt;br /&gt;
    {&lt;br /&gt;
        char *str = node.GetPrettyPrintedString() ;&lt;br /&gt;
        node.Info(&amp;quot;Got expression: %s&amp;quot;, str) ;&lt;br /&gt;
        Strings::free(str) ;&lt;br /&gt;
    }&lt;br /&gt;
} ;&lt;br /&gt;
&lt;br /&gt;
int main (int argc, char **argv)&lt;br /&gt;
{&lt;br /&gt;
    const char *file_name = &amp;quot;test.sv&amp;quot; ; &lt;br /&gt;
    if (argc &amp;gt; 1) file_name = argv[1] ; &lt;br /&gt;
    if (!veri_file::Analyze(file_name, veri_file::SYSTEM_VERILOG)) return 1 ;&lt;br /&gt;
#if 0&lt;br /&gt;
    if (!veri_file::ElaborateAllStatic()) return 1 ;&lt;br /&gt;
#endif&lt;br /&gt;
    MyVisitor mv ;&lt;br /&gt;
&lt;br /&gt;
    MapIter mi ;&lt;br /&gt;
    VeriModule *mod ;&lt;br /&gt;
    FOREACH_VERILOG_MODULE(mi, mod) if (mod) mod-&amp;gt;Accept(mv) ;&lt;br /&gt;
&lt;br /&gt;
    return 0 ;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
$ cat test.sv&lt;br /&gt;
module test ;&lt;br /&gt;
    (* a = 1, b = 2.6 *) wire w ;&lt;br /&gt;
    assign w = 2'b00 ;&lt;br /&gt;
endmodule&lt;br /&gt;
&lt;br /&gt;
$ test-linux&lt;br /&gt;
-- Analyzing Verilog file 'test.sv' (VERI-1482)&lt;br /&gt;
test.sv(2): INFO: Got expression: 1&lt;br /&gt;
test.sv(2): INFO: Got expression: 2.6&lt;br /&gt;
test.sv(3): INFO: Got expression: 2'b0&lt;br /&gt;
$&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Example 2:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
$ cat test.cpp&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
#include &amp;quot;veri_file.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriModule.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriVisitor.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriExpression.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriId.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Strings.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#ifdef VERIFIC_NAMESPACE&lt;br /&gt;
using namespace Verific ;&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
class MyVisitor : public VeriVisitor&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
    MyVisitor() : VeriVisitor() { }&lt;br /&gt;
    virtual ~MyVisitor() { }&lt;br /&gt;
&lt;br /&gt;
    virtual void VERI_VISIT(VeriBindDirective, node)&lt;br /&gt;
    {&lt;br /&gt;
        char *str = node.GetPrettyPrintedString() ;&lt;br /&gt;
        std::cout &amp;lt;&amp;lt; &amp;quot;    bind directive: &amp;quot; &amp;lt;&amp;lt; str;&lt;br /&gt;
        Strings::free(str) ;&lt;br /&gt;
        VeriModuleItem *verimoduleitem = node.GetInstantiation();&lt;br /&gt;
        if (verimoduleitem-&amp;gt;IsInstantiation()) {&lt;br /&gt;
            VeriModuleInstantiation *instantiation = static_cast &amp;lt;VeriModuleInstantiation *&amp;gt;(verimoduleitem);&lt;br /&gt;
            str = instantiation-&amp;gt;GetPrettyPrintedString() ;&lt;br /&gt;
            std::cout &amp;lt;&amp;lt; &amp;quot;        instantiation: &amp;quot; &amp;lt;&amp;lt; str ;&lt;br /&gt;
            VeriModule *mod = instantiation-&amp;gt;GetInstantiatedModule();&lt;br /&gt;
            if (mod) {&lt;br /&gt;
                std::cout &amp;lt;&amp;lt; &amp;quot;            instantiated module: &amp;quot; &amp;lt;&amp;lt; mod-&amp;gt;Name() &amp;lt;&amp;lt; &amp;quot;\n&amp;quot;;;&lt;br /&gt;
            }&lt;br /&gt;
            Array *ids = instantiation-&amp;gt;GetIds();&lt;br /&gt;
            unsigned i;&lt;br /&gt;
            VeriInstId *instid;&lt;br /&gt;
            FOREACH_ARRAY_ITEM (ids, i, instid) {&lt;br /&gt;
                std::cout &amp;lt;&amp;lt; &amp;quot;            instance name: &amp;quot; &amp;lt;&amp;lt; instid-&amp;gt;Name() &amp;lt;&amp;lt; &amp;quot;\n&amp;quot;;;&lt;br /&gt;
            }&lt;br /&gt;
            Strings::free(str) ;&lt;br /&gt;
        }&lt;br /&gt;
        Array *target_inst_list = node.GetTargetInstanceList();&lt;br /&gt;
        unsigned i;&lt;br /&gt;
        VeriExpression *target_instance ;&lt;br /&gt;
        FOREACH_ARRAY_ITEM(target_inst_list, i, target_instance) {&lt;br /&gt;
            if (!target_instance) continue ;&lt;br /&gt;
            char *str = target_instance-&amp;gt;GetPrettyPrintedString() ;&lt;br /&gt;
            std::cout &amp;lt;&amp;lt; &amp;quot;        target_instance: &amp;quot; &amp;lt;&amp;lt; str;&lt;br /&gt;
            Strings::free(str) ;&lt;br /&gt;
            std::cout &amp;lt;&amp;lt; &amp;quot;\n&amp;quot;;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
} ;&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char **argv)&lt;br /&gt;
{&lt;br /&gt;
    if (!veri_file::Analyze(&amp;quot;test.v&amp;quot;, veri_file::SYSTEM_VERILOG)) return 1 ;&lt;br /&gt;
&lt;br /&gt;
    MyVisitor mv ;&lt;br /&gt;
&lt;br /&gt;
    MapIter mi ;&lt;br /&gt;
    VeriModule *mod ;&lt;br /&gt;
    FOREACH_VERILOG_MODULE(mi, mod) if (mod) mod-&amp;gt;Accept(mv) ;&lt;br /&gt;
&lt;br /&gt;
    return 0 ;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
$ cat test.v&lt;br /&gt;
module test;&lt;br /&gt;
  sub inst();&lt;br /&gt;
endmodule&lt;br /&gt;
&lt;br /&gt;
module foo;&lt;br /&gt;
endmodule&lt;br /&gt;
&lt;br /&gt;
bind test.inst foo i_foo(.*);&lt;br /&gt;
&lt;br /&gt;
$ test-linux&lt;br /&gt;
-- Analyzing Verilog file 'test.v' (VERI-1482)&lt;br /&gt;
    bind directive: bind test.inst foo i_foo (.* ) ;&lt;br /&gt;
        instantiation: foo i_foo (.* ) ;&lt;br /&gt;
            instantiated module: foo&lt;br /&gt;
            instance name: i_foo&lt;br /&gt;
        target_instance: test.inst&lt;br /&gt;
&lt;br /&gt;
$&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mohammad</name></author>	</entry>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=How_to_evaluate_a_Verilog_expression&amp;diff=966</id>
		<title>How to evaluate a Verilog expression</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=How_to_evaluate_a_Verilog_expression&amp;diff=966"/>
				<updated>2025-11-19T04:53:50Z</updated>
		
		<summary type="html">&lt;p&gt;Mohammad: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Evaluating a Verilog expression requires 'Static Elaboration' or 'Hierarchy Tree' feature.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Static evaluate an expression not in the design ==&lt;br /&gt;
&lt;br /&gt;
In the example below, a, b, and c are declared in the Verilog module. There is no need to run static elaboration on the whole module. But 'Static Elaboration' feature is still required because the API VeriExpression::StaticEvaluate() is available only with 'Static Elaboration' feature.&lt;br /&gt;
&lt;br /&gt;
C++:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
#include &amp;quot;veri_file.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriExpression.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriModule.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriBaseValue_Stat.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriId.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;Strings.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Array.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Map.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#ifdef VERIFIC_NAMESPACE&lt;br /&gt;
using namespace Verific ;&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
int main(int argc, const char **argv)&lt;br /&gt;
{&lt;br /&gt;
    const char *file_name = (argc &amp;gt; 1) ? argv[1] : &amp;quot;test.v&amp;quot; ;&lt;br /&gt;
    const char *module_name = (argc &amp;gt; 2) ? argv[2] : &amp;quot;test_module&amp;quot; ;&lt;br /&gt;
&lt;br /&gt;
    Array files(1) ;&lt;br /&gt;
    files.Insert(file_name) ;&lt;br /&gt;
    if (!veri_file::AnalyzeMultipleFiles(&amp;amp;files, veri_file::SYSTEM_VERILOG)) return 1 ; &lt;br /&gt;
&lt;br /&gt;
    const VeriModule *mod = veri_file::GetModule(module_name) ;&lt;br /&gt;
    if (!mod) return 2 ; &lt;br /&gt;
&lt;br /&gt;
    // Apply following known values to evaluate &amp;quot;a[b] + c&amp;quot;: &lt;br /&gt;
    //   a = {1'b1, 1'b1}&lt;br /&gt;
    //   b = 2'b00&lt;br /&gt;
    //   c = 2'b01  &lt;br /&gt;
&lt;br /&gt;
    const char *expr_string = &amp;quot;a[b] + c&amp;quot; ;&lt;br /&gt;
    Map known_values(STRING_HASH) ;&lt;br /&gt;
    (void) known_values.Insert(&amp;quot;a&amp;quot;, &amp;quot;{1'b1, 1'b1}&amp;quot;) ;&lt;br /&gt;
    (void) known_values.Insert(&amp;quot;b&amp;quot;, &amp;quot;2'b00&amp;quot;) ;&lt;br /&gt;
    (void) known_values.Insert(&amp;quot;c&amp;quot;, &amp;quot;2'b01&amp;quot;) ;&lt;br /&gt;
&lt;br /&gt;
    ValueTable df ;&lt;br /&gt;
    Map old_param_val(POINTER_HASH) ;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    MapIter mi ;&lt;br /&gt;
    const char *id_name ;&lt;br /&gt;
    const char *val_str ;&lt;br /&gt;
    FOREACH_MAP_ITEM(&amp;amp;known_values, mi, &amp;amp;id_name, &amp;amp;val_str) {&lt;br /&gt;
        if (!id_name || !val_str) continue ;&lt;br /&gt;
&lt;br /&gt;
        // Find the identifier:&lt;br /&gt;
        VeriIdDef *id = mod-&amp;gt;FindDeclared(id_name) ;&lt;br /&gt;
        if (!id) return 3 ; &lt;br /&gt;
&lt;br /&gt;
        // Create the expression:&lt;br /&gt;
        VeriExpression *expr = veri_file::AnalyzeExpr(val_str, veri_file::SYSTEM_VERILOG) ;&lt;br /&gt;
        if (!expr) return 4 ;&lt;br /&gt;
&lt;br /&gt;
        if (id-&amp;gt;IsParam()) {&lt;br /&gt;
            // Param values are NOT taken from value-table, initial value is used:&lt;br /&gt;
            old_param_val.Insert(id, id-&amp;gt;TakeInitialValue()) ; // Store current value&lt;br /&gt;
            (void) id-&amp;gt;SetInitialValue(expr) ; // Absorbed&lt;br /&gt;
            continue ;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        // Evaluate the expression:&lt;br /&gt;
        // If this is a literal expression, we do not need the value value or Resolve() call or else we need both:&lt;br /&gt;
        VeriBaseValue *val = expr-&amp;gt;StaticEvaluate(0 /* self context */, 0 /* value table */) ;&lt;br /&gt;
        delete expr ;&lt;br /&gt;
        if (!val) return 5 ; &lt;br /&gt;
&lt;br /&gt;
        // Insert into the table to be used later:&lt;br /&gt;
        if (!df.Insert(id, val)) {&lt;br /&gt;
            delete val ;&lt;br /&gt;
            return 6 ;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // Now create the expression for to be evaluated:&lt;br /&gt;
    VeriExpression *expr = veri_file::AnalyzeExpr(expr_string, veri_file::SYSTEM_VERILOG) ;&lt;br /&gt;
    if (!expr) return 7 ;&lt;br /&gt;
&lt;br /&gt;
    // Resolve the expression so that the id-refs are resolved:&lt;br /&gt;
    expr-&amp;gt;Resolve(mod-&amp;gt;GetScope(), VeriTreeNode::VERI_UNDEF_ENV) ;&lt;br /&gt;
&lt;br /&gt;
    VeriBaseValue *val = expr-&amp;gt;StaticEvaluate(0 /* self context */, &amp;amp;df /* use this table with the known values */) ;&lt;br /&gt;
    delete expr ;&lt;br /&gt;
&lt;br /&gt;
    VeriIdDef *id ;&lt;br /&gt;
    FOREACH_MAP_ITEM(&amp;amp;old_param_val, mi, &amp;amp;id, &amp;amp;expr) {&lt;br /&gt;
        // Restore back old initial value:&lt;br /&gt;
        (void) id-&amp;gt;SetInitialValue(expr) ; // Old value deleted&lt;br /&gt;
    }&lt;br /&gt;
    if (!val) return 8 ; // Failed to evaluate&lt;br /&gt;
&lt;br /&gt;
    char *image = val-&amp;gt;Image() ;&lt;br /&gt;
    int result = val-&amp;gt;GetIntegerValue() ;&lt;br /&gt;
    mod-&amp;gt;Info(&amp;quot;Evaluated value: %s (%d)&amp;quot;, ((image)?image:&amp;quot;&amp;quot;), result) ;&lt;br /&gt;
    Strings::free(image) ;&lt;br /&gt;
    delete val ;&lt;br /&gt;
&lt;br /&gt;
    return 0 ;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verilog testcase:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
module test_module;&lt;br /&gt;
    wire a [1:0];&lt;br /&gt;
    wire [1:0] b;&lt;br /&gt;
    wire [1:0] c;&lt;br /&gt;
endmodule&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
$ test-linux &lt;br /&gt;
-- Analyzing Verilog file 'test.v' (VERI-1482)&lt;br /&gt;
test.v(5): INFO: Evaluated value: 2'b10 (2)&lt;br /&gt;
$ &lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Static evaluate a function call in the design and generate variables (genvar)==&lt;br /&gt;
&lt;br /&gt;
Function calls are similar to other expressions, and you can evaluate them using StaticEvaluate().&lt;br /&gt;
&lt;br /&gt;
Giving a value to a generate variable is a little different. 'genvar' is treated like a parameter; we try to use the initial value instead of looking into the passed-in VeriValueTable. But since 'genvar' doesn't have a single value, we need to set it to a desired value before evaluating the expression.&lt;br /&gt;
&lt;br /&gt;
In the example below, you can see how this can be done:&lt;br /&gt;
&lt;br /&gt;
C++:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
#include &amp;quot;veri_file.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriModule.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriVisitor.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriExpression.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriId.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriBaseValue_Stat.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Map.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Strings.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#ifdef VERIFIC_NAMESPACE&lt;br /&gt;
using namespace Verific ;&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
class MyVisitor : public VeriVisitor&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
    MyVisitor() : VeriVisitor() { }&lt;br /&gt;
    virtual ~MyVisitor() { }&lt;br /&gt;
&lt;br /&gt;
    virtual void VERI_VISIT(VeriFunctionCall, node)&lt;br /&gt;
    {&lt;br /&gt;
        char *str = node.GetPrettyPrintedString() ;&lt;br /&gt;
        node.Info(&amp;quot;Got function call: %s&amp;quot;, str) ;&lt;br /&gt;
&lt;br /&gt;
        ValueTable df ;&lt;br /&gt;
        Map old_param_val(POINTER_HASH) ;&lt;br /&gt;
&lt;br /&gt;
        if (Strings::compare(str, &amp;quot;A(i)&amp;quot;)) {&lt;br /&gt;
&lt;br /&gt;
            // Apply following known values to evaluate: &lt;br /&gt;
            //   i = 2 (or 2'b10)&lt;br /&gt;
&lt;br /&gt;
            Map known_values(STRING_HASH) ;&lt;br /&gt;
            (void) known_values.Insert(&amp;quot;i&amp;quot;, &amp;quot;2'b10&amp;quot;) ;&lt;br /&gt;
&lt;br /&gt;
            unsigned i ;&lt;br /&gt;
            VeriExpression *expr ;&lt;br /&gt;
            // Going through arguments of the function call&lt;br /&gt;
            FOREACH_ARRAY_ITEM(node.GetArgs(), i, expr) {&lt;br /&gt;
                if (!expr) continue ;&lt;br /&gt;
                if (!expr-&amp;gt;IsIdRef()) continue ;&lt;br /&gt;
&lt;br /&gt;
                // Find the identifier:&lt;br /&gt;
                VeriIdDef *id = expr-&amp;gt;GetId() ;&lt;br /&gt;
                if (!id) return ; &lt;br /&gt;
&lt;br /&gt;
                // Get the value that we want to set for this id&lt;br /&gt;
                const char *val_str = (const char *) known_values.GetValue(expr-&amp;gt;GetName()) ;&lt;br /&gt;
&lt;br /&gt;
                // Create the expression:&lt;br /&gt;
                VeriExpression *expr = veri_file::AnalyzeExpr(val_str, veri_file::SYSTEM_VERILOG) ;&lt;br /&gt;
                if (!expr) return ;&lt;br /&gt;
&lt;br /&gt;
                if (id-&amp;gt;IsParam()) {&lt;br /&gt;
                    // Param values are NOT taken from value-table, initial value is used:&lt;br /&gt;
                    old_param_val.Insert(id, id-&amp;gt;TakeInitialValue()) ; // Store current value&lt;br /&gt;
                    (void) id-&amp;gt;SetInitialValue(expr) ; // Absorbed&lt;br /&gt;
                    continue ;&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
                // Evaluate the expression:&lt;br /&gt;
                // If this is a literal expression, we do not need the value value or Resolve() call or else we need both:&lt;br /&gt;
                VeriBaseValue *val = expr-&amp;gt;StaticEvaluate(0 /* self context */, 0 /* value table */) ;&lt;br /&gt;
                delete expr ;&lt;br /&gt;
                if (!val) return ; &lt;br /&gt;
&lt;br /&gt;
                // Insert into the table to be used later:&lt;br /&gt;
                if (!df.Insert(id, val)) {&lt;br /&gt;
                    delete val ;&lt;br /&gt;
                    return ;&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        VeriBaseValue *val = node.StaticEvaluate(0 /* self context */, &amp;amp;df /* use this table with the known values */) ;&lt;br /&gt;
&lt;br /&gt;
        MapIter mi ;&lt;br /&gt;
        VeriIdDef *id ;&lt;br /&gt;
        VeriExpression *expr ;&lt;br /&gt;
        FOREACH_MAP_ITEM(&amp;amp;old_param_val, mi, &amp;amp;id, &amp;amp;expr) {&lt;br /&gt;
            // Restore back old initial value:&lt;br /&gt;
            (void) id-&amp;gt;SetInitialValue(expr) ; // Old value deleted&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        if (!val) {&lt;br /&gt;
            node.Info(&amp;quot;Couldn't evaluate the expression&amp;quot;); &lt;br /&gt;
            return ; // Failed to evaluate&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        char *image = val-&amp;gt;Image() ;&lt;br /&gt;
        int result = val-&amp;gt;GetIntegerValue() ;&lt;br /&gt;
        node.Info(&amp;quot;Evaluated value: %s (%d)&amp;quot;, ((image)?image:&amp;quot;&amp;quot;), result) ;&lt;br /&gt;
        Strings::free(image) ;&lt;br /&gt;
        delete val ;&lt;br /&gt;
        Strings::free(str) ;&lt;br /&gt;
    }&lt;br /&gt;
} ;&lt;br /&gt;
&lt;br /&gt;
int main (int argc, char **argv)&lt;br /&gt;
{&lt;br /&gt;
    const char *file_name = &amp;quot;test.v&amp;quot; ; // default input filename&lt;br /&gt;
    if (argc &amp;gt; 1) file_name = argv[1] ; // Set the file name as specified by the user&lt;br /&gt;
&lt;br /&gt;
    // veri_file::Analyze(const char *file_name, unsigned verilog_mode=VERILOG_2K, const char *lib_name=&amp;quot;work&amp;quot;, unsigned cu_mode=NO_MODE) ;&lt;br /&gt;
    if (!veri_file::Analyze(file_name, veri_file::SYSTEM_VERILOG)) return 1 ;&lt;br /&gt;
&lt;br /&gt;
    //if (!veri_file::ElaborateAllStatic()) return 1 ;&lt;br /&gt;
&lt;br /&gt;
    MyVisitor mv ;&lt;br /&gt;
&lt;br /&gt;
    MapIter mi ;&lt;br /&gt;
    VeriModule *mod ;&lt;br /&gt;
    FOREACH_VERILOG_MODULE(mi, mod) if (mod) mod-&amp;gt;Accept(mv) ;&lt;br /&gt;
&lt;br /&gt;
    return 0 ;&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verilog testcase:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
module test();&lt;br /&gt;
    parameter d = 0;&lt;br /&gt;
endmodule&lt;br /&gt;
&lt;br /&gt;
module top();  &lt;br /&gt;
    parameter PARAM = 5;&lt;br /&gt;
     &lt;br /&gt;
    function[3:0] A(input [2:0] c);  &lt;br /&gt;
        return (2 + c);  &lt;br /&gt;
    endfunction  &lt;br /&gt;
     &lt;br /&gt;
    test#(A(PARAM)) test_e();&lt;br /&gt;
&lt;br /&gt;
    genvar i;&lt;br /&gt;
    for(i = 0; i &amp;lt; 10; i = i + 1) begin&lt;br /&gt;
        test#(A(i)) test_i();&lt;br /&gt;
    end&lt;br /&gt;
endmodule&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
$ ./test-linux &lt;br /&gt;
-- Analyzing Verilog file 'test.v' (VERI-1482)&lt;br /&gt;
test.v(12): INFO: Got function call: A(PARAM)&lt;br /&gt;
test.v(12): INFO: Evaluated value: 4'b0111 (7)&lt;br /&gt;
test.v(16): INFO: Got function call: A(i)&lt;br /&gt;
test.v(16): INFO: Evaluated value: 4'b0100 (4)&lt;br /&gt;
$&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Static evaluate an expression that crosses module boundaries ==&lt;br /&gt;
If an element in the expression to be evaluated crosses module boundaries, elaboration needs to be run as in the Verilog testcase below ('my_int' is to be evaluated):&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
interface ifc #(int N=10);&lt;br /&gt;
    logic [N-1:0] data;&lt;br /&gt;
endinterface&lt;br /&gt;
 &lt;br /&gt;
module test();&lt;br /&gt;
    ifc #(.N(13)) I();&lt;br /&gt;
    int my_int = $bits(I.data); // want to evaluated 'my_int' or '$bits(I.data)'&lt;br /&gt;
endmodule&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The C++ example below calls static elaboration:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
#include &amp;quot;veri_file.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriModule.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriVisitor.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriExpression.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#ifdef VERIFIC_NAMESPACE&lt;br /&gt;
using namespace Verific ;&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
class MyVisitor : public VeriVisitor&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
    MyVisitor() : VeriVisitor() { }&lt;br /&gt;
    virtual ~MyVisitor() { }&lt;br /&gt;
&lt;br /&gt;
    virtual void VERI_VISIT(VeriExpression, node)&lt;br /&gt;
    {&lt;br /&gt;
        char *str = node.GetPrettyPrintedString() ;&lt;br /&gt;
        VeriExpression *new_exp = node.StaticEvaluateToExpr(0,0,0);&lt;br /&gt;
        if (new_exp) {&lt;br /&gt;
            char *str2 = new_exp-&amp;gt;GetPrettyPrintedString() ;&lt;br /&gt;
            node.Info(&amp;quot;    Expression: '%s', evaluated to '%s'&amp;quot;, str, str2) ;&lt;br /&gt;
            Strings::free(str) ;&lt;br /&gt;
            Strings::free(str2) ;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
} ;&lt;br /&gt;
&lt;br /&gt;
int main (int argc, char **argv)&lt;br /&gt;
{&lt;br /&gt;
    const char *file_name = &amp;quot;test.sv&amp;quot; ; // defaulf input filename&lt;br /&gt;
    if (argc &amp;gt; 1) file_name = argv[1] ; // Set the file name as specified by the user&lt;br /&gt;
    if (!veri_file::Analyze(file_name, veri_file::SYSTEM_VERILOG)) return 1 ;&lt;br /&gt;
&lt;br /&gt;
    if (!veri_file::ElaborateAllStatic()) return 1 ;&lt;br /&gt;
&lt;br /&gt;
    MyVisitor mv ;&lt;br /&gt;
&lt;br /&gt;
    VeriModule *mod = veri_file::GetModule(&amp;quot;test&amp;quot;) ;&lt;br /&gt;
    if (!mod) return 2 ;&lt;br /&gt;
    mod-&amp;gt;Info(&amp;quot;In module '%s'&amp;quot;, mod-&amp;gt;Name()) ;&lt;br /&gt;
    mod-&amp;gt;Accept(mv) ;&lt;br /&gt;
    return 0 ;&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
$ test-linux &lt;br /&gt;
-- Analyzing Verilog file 'test.sv' (VERI-1482)&lt;br /&gt;
test.sv(5): INFO: compiling module 'test' (VERI-1018)&lt;br /&gt;
test.sv(8): INFO: In module 'test'&lt;br /&gt;
test.sv(7): INFO:     Expression: 'int ', evaluated to 'int '&lt;br /&gt;
test.sv(7): INFO:     Expression: '$bits(I.data)', evaluated to '13'&lt;br /&gt;
$ &lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Using Hierarchy Tree Elaboration to evaluate ==&lt;br /&gt;
If for some reason static elaboration is not desirable (it does take memory and CPU time), hierarchy-tree elaboration can be run instead. Hierarchy-tree elaboration takes much less memory anc CPU time than static elaborations does.&lt;br /&gt;
&lt;br /&gt;
Reference: https://www.verific.com/docs/index.php?title=Hierarchy_Tree&lt;br /&gt;
&lt;br /&gt;
The C++ example below uses hierarchy-tree elaboration instead of static elaboration:&lt;br /&gt;
&lt;br /&gt;
C++:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
#include &amp;quot;veri_file.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriModule.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriId.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriExpression.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriBaseValue_Stat.h&amp;quot;&lt;br /&gt;
#include &amp;quot;hier_tree.h&amp;quot;&lt;br /&gt;
#include &amp;quot;HierTreeNode.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#ifdef VERIFIC_NAMESPACE&lt;br /&gt;
using namespace Verific ;&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
int main(int argc, const char **argv)&lt;br /&gt;
{&lt;br /&gt;
    const char *file_name = &amp;quot;test.sv&amp;quot; ;&lt;br /&gt;
    const char *top_name = &amp;quot;test&amp;quot; ;&lt;br /&gt;
    const char *my_name = &amp;quot;my_int&amp;quot; ;&lt;br /&gt;
&lt;br /&gt;
    if (!veri_file::Analyze(file_name, veri_file::SYSTEM_VERILOG)) return 1 ;&lt;br /&gt;
&lt;br /&gt;
    VeriModule *top = veri_file::GetModule(top_name) ;&lt;br /&gt;
    if (!top) return 2 ;&lt;br /&gt;
&lt;br /&gt;
    VeriIdDef *my_id = top-&amp;gt;FindDeclared(my_name) ;&lt;br /&gt;
    if (!my_id) return 3 ;&lt;br /&gt;
&lt;br /&gt;
    VeriExpression *init_val = my_id-&amp;gt;GetInitialValue() ;&lt;br /&gt;
    if (!init_val) return 4 ;&lt;br /&gt;
&lt;br /&gt;
    Array top_mods(1) ;&lt;br /&gt;
    top_mods.Insert(top) ;&lt;br /&gt;
&lt;br /&gt;
    const Map *top_nodes = hier_tree::CreateHierarchicalTree(&amp;amp;top_mods, 0, 0, 0) ;&lt;br /&gt;
    if (!top_nodes) return 5 ;&lt;br /&gt;
&lt;br /&gt;
    HierTreeNode *top_node = (HierTreeNode *)top_nodes-&amp;gt;GetValue(top_name) ;&lt;br /&gt;
    if (!top_node) {&lt;br /&gt;
        hier_tree::DeleteHierarchicalTree() ;&lt;br /&gt;
        return 6 ;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    InterfaceInfo *info = top_node-&amp;gt;GetParamValue(my_id) ;&lt;br /&gt;
    VeriBaseValue *val = 0 ;&lt;br /&gt;
    VeriBaseValue *delete_val = 0 ;&lt;br /&gt;
    if (info) {&lt;br /&gt;
        // We already have the value evaluated, get from node:&lt;br /&gt;
        val = info-&amp;gt;GetVeriEvaluatedValue() ;&lt;br /&gt;
    } else {&lt;br /&gt;
        // Need to evaluate the value, use the context from the node:&lt;br /&gt;
        Map *context = top_node-&amp;gt;PushContext() ;&lt;br /&gt;
        hier_tree::PushNode(top_node) ;&lt;br /&gt;
&lt;br /&gt;
        val = init_val-&amp;gt;StaticEvaluate(0, 0, 0, 0) ;&lt;br /&gt;
        delete_val = val ;&lt;br /&gt;
&lt;br /&gt;
        hier_tree::PopNode() ;&lt;br /&gt;
        top_node-&amp;gt;PopContext(context) ;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    char *val_img = (val) ? val-&amp;gt;Image() : 0 ;&lt;br /&gt;
    init_val-&amp;gt;Info(&amp;quot;%s(%s) evaluated to %s&amp;quot;, my_name, my_id-&amp;gt;GetPrettyPrintedString(), ((val_img)?val_img:&amp;quot;&amp;lt;NULL&amp;gt;&amp;quot;)) ;&lt;br /&gt;
    Strings::free(val_img) ;&lt;br /&gt;
&lt;br /&gt;
    delete delete_val ;&lt;br /&gt;
&lt;br /&gt;
    hier_tree::DeleteHierarchicalTree() ;&lt;br /&gt;
&lt;br /&gt;
    return 0 ;&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
$ test-linux &lt;br /&gt;
-- Analyzing Verilog file 'test.sv' (VERI-1482)&lt;br /&gt;
test.sv(7): INFO: my_int(my_int = $bits(I.data)) evaluated to 13&lt;br /&gt;
$ &lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mohammad</name></author>	</entry>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=How_to_evaluate_a_Verilog_expression&amp;diff=965</id>
		<title>How to evaluate a Verilog expression</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=How_to_evaluate_a_Verilog_expression&amp;diff=965"/>
				<updated>2025-11-18T20:08:36Z</updated>
		
		<summary type="html">&lt;p&gt;Mohammad: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Evaluating a Verilog expression requires 'Static Elaboration' or 'Hierarchy Tree' feature.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Static evaluate an expression not in the design ==&lt;br /&gt;
&lt;br /&gt;
In the example below, a, b, and c are declared in the Verilog module. There is no need to run static elaboration on the whole module. But 'Static Elaboration' feature is still required because the API VeriExpression::StaticEvaluate() is available only with 'Static Elaboration' feature.&lt;br /&gt;
&lt;br /&gt;
C++:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
#include &amp;quot;veri_file.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriExpression.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriModule.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriBaseValue_Stat.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;Strings.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Array.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Map.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#ifdef VERIFIC_NAMESPACE&lt;br /&gt;
using namespace Verific ;&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
int main(int argc, const char **argv)&lt;br /&gt;
{&lt;br /&gt;
    const char *file_name = (argc &amp;gt; 1) ? argv[1] : &amp;quot;test.v&amp;quot; ;&lt;br /&gt;
    const char *module_name = (argc &amp;gt; 2) ? argv[2] : &amp;quot;test_module&amp;quot; ;&lt;br /&gt;
&lt;br /&gt;
    Array files(1) ;&lt;br /&gt;
    files.Insert(file_name) ;&lt;br /&gt;
    if (!veri_file::AnalyzeMultipleFiles(&amp;amp;files, veri_file::SYSTEM_VERILOG)) return 1 ; &lt;br /&gt;
&lt;br /&gt;
    const VeriModule *mod = veri_file::GetModule(module_name) ;&lt;br /&gt;
    if (!mod) return 2 ; &lt;br /&gt;
&lt;br /&gt;
    // Apply following known values to evaluate &amp;quot;a[b] + c&amp;quot;: &lt;br /&gt;
    //   a = {1'b1, 1'b1}&lt;br /&gt;
    //   b = 2'b00&lt;br /&gt;
    //   c = 2'b01  &lt;br /&gt;
&lt;br /&gt;
    const char *expr_string = &amp;quot;a[b] + c&amp;quot; ;&lt;br /&gt;
    Map known_values(STRING_HASH) ;&lt;br /&gt;
    (void) known_values.Insert(&amp;quot;a&amp;quot;, &amp;quot;{1'b1, 1'b1}&amp;quot;) ;&lt;br /&gt;
    (void) known_values.Insert(&amp;quot;b&amp;quot;, &amp;quot;2'b00&amp;quot;) ;&lt;br /&gt;
    (void) known_values.Insert(&amp;quot;c&amp;quot;, &amp;quot;2'b01&amp;quot;) ;&lt;br /&gt;
&lt;br /&gt;
    ValueTable df ;&lt;br /&gt;
&lt;br /&gt;
    MapIter mi ;&lt;br /&gt;
    const char *id_name ;&lt;br /&gt;
    const char *val_str ;&lt;br /&gt;
    FOREACH_MAP_ITEM(&amp;amp;known_values, mi, &amp;amp;id_name, &amp;amp;val_str) {&lt;br /&gt;
        if (!id_name || !val_str) continue ;&lt;br /&gt;
&lt;br /&gt;
        // Find the identifier:&lt;br /&gt;
        VeriIdDef *id = mod-&amp;gt;FindDeclared(id_name) ;&lt;br /&gt;
        if (!id) return 3 ; &lt;br /&gt;
&lt;br /&gt;
        // Create the expression:&lt;br /&gt;
        VeriExpression *expr = veri_file::AnalyzeExpr(val_str, veri_file::SYSTEM_VERILOG) ;&lt;br /&gt;
        if (!expr) return 4 ;&lt;br /&gt;
&lt;br /&gt;
        // Evaluate the expression:&lt;br /&gt;
        // If this is a literal expression, we do not need the value value or Resolve() call or else we need both:&lt;br /&gt;
        VeriBaseValue *val = expr-&amp;gt;StaticEvaluate(0 /* self context */, 0 /* value table */) ;&lt;br /&gt;
        delete expr ;&lt;br /&gt;
        if (!val) return 5 ; &lt;br /&gt;
&lt;br /&gt;
        // Insert into the table to be used later:&lt;br /&gt;
        if (!df.Insert(id, val)) {&lt;br /&gt;
            delete val ;&lt;br /&gt;
            return 6 ;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // Now create the expression for to be evaluated:&lt;br /&gt;
    VeriExpression *expr = veri_file::AnalyzeExpr(expr_string, veri_file::SYSTEM_VERILOG) ;&lt;br /&gt;
    if (!expr) return 7 ;&lt;br /&gt;
&lt;br /&gt;
    // Resolve the expression so that the id-refs are resolved:&lt;br /&gt;
    expr-&amp;gt;Resolve(mod-&amp;gt;GetScope(), VeriTreeNode::VERI_UNDEF_ENV) ;&lt;br /&gt;
&lt;br /&gt;
    VeriBaseValue *val = expr-&amp;gt;StaticEvaluate(0 /* self context */, &amp;amp;df /* use this table with the known values */) ;&lt;br /&gt;
    delete expr ;&lt;br /&gt;
    if (!val) return 8 ; // Failed to evaluate&lt;br /&gt;
&lt;br /&gt;
    char *image = val-&amp;gt;Image() ;&lt;br /&gt;
    int result = val-&amp;gt;GetIntegerValue() ;&lt;br /&gt;
    mod-&amp;gt;Info(&amp;quot;Evaluated value: %s (%d)&amp;quot;, ((image)?image:&amp;quot;&amp;quot;), result) ;&lt;br /&gt;
    Strings::free(image) ;&lt;br /&gt;
    delete val ;&lt;br /&gt;
&lt;br /&gt;
    return 0 ;&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verilog testcase:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
module test_module;&lt;br /&gt;
    wire a [1:0];&lt;br /&gt;
    wire [1:0] b;&lt;br /&gt;
    wire [1:0] c;&lt;br /&gt;
endmodule&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
$ test-linux &lt;br /&gt;
-- Analyzing Verilog file 'test.v' (VERI-1482)&lt;br /&gt;
test.v(5): INFO: Evaluated value: 2'b10 (2)&lt;br /&gt;
$ &lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Static evaluate a function call in the design and generate variables (genvar)==&lt;br /&gt;
&lt;br /&gt;
Function calls are similar to other expressions, and you can evaluate them using StaticEvaluate().&lt;br /&gt;
&lt;br /&gt;
Giving a value to a generate variable is a little different. 'genvar' is treated like a parameter; we try to use the initial value instead of looking into the passed-in VeriValueTable. But since 'genvar' doesn't have a single value, we need to set it to a desired value before evaluating the expression.&lt;br /&gt;
&lt;br /&gt;
In the example below, you can see how this can be done:&lt;br /&gt;
&lt;br /&gt;
C++:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
#include &amp;quot;veri_file.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriModule.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriVisitor.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriExpression.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriId.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriBaseValue_Stat.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Map.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Strings.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#ifdef VERIFIC_NAMESPACE&lt;br /&gt;
using namespace Verific ;&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
class MyVisitor : public VeriVisitor&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
    MyVisitor() : VeriVisitor() { }&lt;br /&gt;
    virtual ~MyVisitor() { }&lt;br /&gt;
&lt;br /&gt;
    virtual void VERI_VISIT(VeriFunctionCall, node)&lt;br /&gt;
    {&lt;br /&gt;
        char *str = node.GetPrettyPrintedString() ;&lt;br /&gt;
        node.Info(&amp;quot;Got function call: %s&amp;quot;, str) ;&lt;br /&gt;
&lt;br /&gt;
        ValueTable df ;&lt;br /&gt;
        Map old_param_val(POINTER_HASH) ;&lt;br /&gt;
&lt;br /&gt;
        if (Strings::compare(str, &amp;quot;A(i)&amp;quot;)) {&lt;br /&gt;
&lt;br /&gt;
            // Apply following known values to evaluate: &lt;br /&gt;
            //   i = 2 (or 2'b10)&lt;br /&gt;
&lt;br /&gt;
            Map known_values(STRING_HASH) ;&lt;br /&gt;
            (void) known_values.Insert(&amp;quot;i&amp;quot;, &amp;quot;2'b10&amp;quot;) ;&lt;br /&gt;
&lt;br /&gt;
            unsigned i ;&lt;br /&gt;
            VeriExpression *expr ;&lt;br /&gt;
            // Going through arguments of the function call&lt;br /&gt;
            FOREACH_ARRAY_ITEM(node.GetArgs(), i, expr) {&lt;br /&gt;
                if (!expr) continue ;&lt;br /&gt;
                if (!expr-&amp;gt;IsIdRef()) continue ;&lt;br /&gt;
&lt;br /&gt;
                // Find the identifier:&lt;br /&gt;
                VeriIdDef *id = expr-&amp;gt;GetId() ;&lt;br /&gt;
                if (!id) return ; &lt;br /&gt;
&lt;br /&gt;
                // Get the value that we want to set for this id&lt;br /&gt;
                const char *val_str = (const char *) known_values.GetValue(expr-&amp;gt;GetName()) ;&lt;br /&gt;
&lt;br /&gt;
                // Create the expression:&lt;br /&gt;
                VeriExpression *expr = veri_file::AnalyzeExpr(val_str, veri_file::SYSTEM_VERILOG) ;&lt;br /&gt;
                if (!expr) return ;&lt;br /&gt;
&lt;br /&gt;
                if (id-&amp;gt;IsParam()) {&lt;br /&gt;
                    // Param values are NOT taken from value-table, initial value is used:&lt;br /&gt;
                    old_param_val.Insert(id, id-&amp;gt;TakeInitialValue()) ; // Store current value&lt;br /&gt;
                    (void) id-&amp;gt;SetInitialValue(expr) ; // Absorbed&lt;br /&gt;
                    continue ;&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
                // Evaluate the expression:&lt;br /&gt;
                // If this is a literal expression, we do not need the value value or Resolve() call or else we need both:&lt;br /&gt;
                VeriBaseValue *val = expr-&amp;gt;StaticEvaluate(0 /* self context */, 0 /* value table */) ;&lt;br /&gt;
                delete expr ;&lt;br /&gt;
                if (!val) return ; &lt;br /&gt;
&lt;br /&gt;
                // Insert into the table to be used later:&lt;br /&gt;
                if (!df.Insert(id, val)) {&lt;br /&gt;
                    delete val ;&lt;br /&gt;
                    return ;&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        VeriBaseValue *val = node.StaticEvaluate(0 /* self context */, &amp;amp;df /* use this table with the known values */) ;&lt;br /&gt;
&lt;br /&gt;
        MapIter mi ;&lt;br /&gt;
        VeriIdDef *id ;&lt;br /&gt;
        VeriExpression *expr ;&lt;br /&gt;
        FOREACH_MAP_ITEM(&amp;amp;old_param_val, mi, &amp;amp;id, &amp;amp;expr) {&lt;br /&gt;
            // Restore back old initial value:&lt;br /&gt;
            (void) id-&amp;gt;SetInitialValue(expr) ; // Old value deleted&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        if (!val) {&lt;br /&gt;
            node.Info(&amp;quot;Couldn't evaluate the expression&amp;quot;); &lt;br /&gt;
            return ; // Failed to evaluate&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        char *image = val-&amp;gt;Image() ;&lt;br /&gt;
        int result = val-&amp;gt;GetIntegerValue() ;&lt;br /&gt;
        node.Info(&amp;quot;Evaluated value: %s (%d)&amp;quot;, ((image)?image:&amp;quot;&amp;quot;), result) ;&lt;br /&gt;
        Strings::free(image) ;&lt;br /&gt;
        delete val ;&lt;br /&gt;
        Strings::free(str) ;&lt;br /&gt;
    }&lt;br /&gt;
} ;&lt;br /&gt;
&lt;br /&gt;
int main (int argc, char **argv)&lt;br /&gt;
{&lt;br /&gt;
    const char *file_name = &amp;quot;test.v&amp;quot; ; // default input filename&lt;br /&gt;
    if (argc &amp;gt; 1) file_name = argv[1] ; // Set the file name as specified by the user&lt;br /&gt;
&lt;br /&gt;
    // veri_file::Analyze(const char *file_name, unsigned verilog_mode=VERILOG_2K, const char *lib_name=&amp;quot;work&amp;quot;, unsigned cu_mode=NO_MODE) ;&lt;br /&gt;
    if (!veri_file::Analyze(file_name, veri_file::SYSTEM_VERILOG)) return 1 ;&lt;br /&gt;
&lt;br /&gt;
    //if (!veri_file::ElaborateAllStatic()) return 1 ;&lt;br /&gt;
&lt;br /&gt;
    MyVisitor mv ;&lt;br /&gt;
&lt;br /&gt;
    MapIter mi ;&lt;br /&gt;
    VeriModule *mod ;&lt;br /&gt;
    FOREACH_VERILOG_MODULE(mi, mod) if (mod) mod-&amp;gt;Accept(mv) ;&lt;br /&gt;
&lt;br /&gt;
    return 0 ;&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verilog testcase:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
module test();&lt;br /&gt;
    parameter d = 0;&lt;br /&gt;
endmodule&lt;br /&gt;
&lt;br /&gt;
module top();  &lt;br /&gt;
    parameter PARAM = 5;&lt;br /&gt;
     &lt;br /&gt;
    function[3:0] A(input [2:0] c);  &lt;br /&gt;
        return (2 + c);  &lt;br /&gt;
    endfunction  &lt;br /&gt;
     &lt;br /&gt;
    test#(A(PARAM)) test_e();&lt;br /&gt;
&lt;br /&gt;
    genvar i;&lt;br /&gt;
    for(i = 0; i &amp;lt; 10; i = i + 1) begin&lt;br /&gt;
        test#(A(i)) test_i();&lt;br /&gt;
    end&lt;br /&gt;
endmodule&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
$ ./test-linux &lt;br /&gt;
-- Analyzing Verilog file 'test.v' (VERI-1482)&lt;br /&gt;
test.v(12): INFO: Got function call: A(PARAM)&lt;br /&gt;
test.v(12): INFO: Evaluated value: 4'b0111 (7)&lt;br /&gt;
test.v(16): INFO: Got function call: A(i)&lt;br /&gt;
test.v(16): INFO: Evaluated value: 4'b0100 (4)&lt;br /&gt;
$&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Static evaluate an expression that crosses module boundaries ==&lt;br /&gt;
If an element in the expression to be evaluated crosses module boundaries, elaboration needs to be run as in the Verilog testcase below ('my_int' is to be evaluated):&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
interface ifc #(int N=10);&lt;br /&gt;
    logic [N-1:0] data;&lt;br /&gt;
endinterface&lt;br /&gt;
 &lt;br /&gt;
module test();&lt;br /&gt;
    ifc #(.N(13)) I();&lt;br /&gt;
    int my_int = $bits(I.data); // want to evaluated 'my_int' or '$bits(I.data)'&lt;br /&gt;
endmodule&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The C++ example below calls static elaboration:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
#include &amp;quot;veri_file.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriModule.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriVisitor.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriExpression.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#ifdef VERIFIC_NAMESPACE&lt;br /&gt;
using namespace Verific ;&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
class MyVisitor : public VeriVisitor&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
    MyVisitor() : VeriVisitor() { }&lt;br /&gt;
    virtual ~MyVisitor() { }&lt;br /&gt;
&lt;br /&gt;
    virtual void VERI_VISIT(VeriExpression, node)&lt;br /&gt;
    {&lt;br /&gt;
        char *str = node.GetPrettyPrintedString() ;&lt;br /&gt;
        VeriExpression *new_exp = node.StaticEvaluateToExpr(0,0,0);&lt;br /&gt;
        if (new_exp) {&lt;br /&gt;
            char *str2 = new_exp-&amp;gt;GetPrettyPrintedString() ;&lt;br /&gt;
            node.Info(&amp;quot;    Expression: '%s', evaluated to '%s'&amp;quot;, str, str2) ;&lt;br /&gt;
            Strings::free(str) ;&lt;br /&gt;
            Strings::free(str2) ;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
} ;&lt;br /&gt;
&lt;br /&gt;
int main (int argc, char **argv)&lt;br /&gt;
{&lt;br /&gt;
    const char *file_name = &amp;quot;test.sv&amp;quot; ; // defaulf input filename&lt;br /&gt;
    if (argc &amp;gt; 1) file_name = argv[1] ; // Set the file name as specified by the user&lt;br /&gt;
    if (!veri_file::Analyze(file_name, veri_file::SYSTEM_VERILOG)) return 1 ;&lt;br /&gt;
&lt;br /&gt;
    if (!veri_file::ElaborateAllStatic()) return 1 ;&lt;br /&gt;
&lt;br /&gt;
    MyVisitor mv ;&lt;br /&gt;
&lt;br /&gt;
    VeriModule *mod = veri_file::GetModule(&amp;quot;test&amp;quot;) ;&lt;br /&gt;
    if (!mod) return 2 ;&lt;br /&gt;
    mod-&amp;gt;Info(&amp;quot;In module '%s'&amp;quot;, mod-&amp;gt;Name()) ;&lt;br /&gt;
    mod-&amp;gt;Accept(mv) ;&lt;br /&gt;
    return 0 ;&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
$ test-linux &lt;br /&gt;
-- Analyzing Verilog file 'test.sv' (VERI-1482)&lt;br /&gt;
test.sv(5): INFO: compiling module 'test' (VERI-1018)&lt;br /&gt;
test.sv(8): INFO: In module 'test'&lt;br /&gt;
test.sv(7): INFO:     Expression: 'int ', evaluated to 'int '&lt;br /&gt;
test.sv(7): INFO:     Expression: '$bits(I.data)', evaluated to '13'&lt;br /&gt;
$ &lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Using Hierarchy Tree Elaboration to evaluate ==&lt;br /&gt;
If for some reason static elaboration is not desirable (it does take memory and CPU time), hierarchy-tree elaboration can be run instead. Hierarchy-tree elaboration takes much less memory anc CPU time than static elaborations does.&lt;br /&gt;
&lt;br /&gt;
Reference: https://www.verific.com/docs/index.php?title=Hierarchy_Tree&lt;br /&gt;
&lt;br /&gt;
The C++ example below uses hierarchy-tree elaboration instead of static elaboration:&lt;br /&gt;
&lt;br /&gt;
C++:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
#include &amp;quot;veri_file.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriModule.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriId.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriExpression.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriBaseValue_Stat.h&amp;quot;&lt;br /&gt;
#include &amp;quot;hier_tree.h&amp;quot;&lt;br /&gt;
#include &amp;quot;HierTreeNode.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#ifdef VERIFIC_NAMESPACE&lt;br /&gt;
using namespace Verific ;&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
int main(int argc, const char **argv)&lt;br /&gt;
{&lt;br /&gt;
    const char *file_name = &amp;quot;test.sv&amp;quot; ;&lt;br /&gt;
    const char *top_name = &amp;quot;test&amp;quot; ;&lt;br /&gt;
    const char *my_name = &amp;quot;my_int&amp;quot; ;&lt;br /&gt;
&lt;br /&gt;
    if (!veri_file::Analyze(file_name, veri_file::SYSTEM_VERILOG)) return 1 ;&lt;br /&gt;
&lt;br /&gt;
    VeriModule *top = veri_file::GetModule(top_name) ;&lt;br /&gt;
    if (!top) return 2 ;&lt;br /&gt;
&lt;br /&gt;
    VeriIdDef *my_id = top-&amp;gt;FindDeclared(my_name) ;&lt;br /&gt;
    if (!my_id) return 3 ;&lt;br /&gt;
&lt;br /&gt;
    VeriExpression *init_val = my_id-&amp;gt;GetInitialValue() ;&lt;br /&gt;
    if (!init_val) return 4 ;&lt;br /&gt;
&lt;br /&gt;
    Array top_mods(1) ;&lt;br /&gt;
    top_mods.Insert(top) ;&lt;br /&gt;
&lt;br /&gt;
    const Map *top_nodes = hier_tree::CreateHierarchicalTree(&amp;amp;top_mods, 0, 0, 0) ;&lt;br /&gt;
    if (!top_nodes) return 5 ;&lt;br /&gt;
&lt;br /&gt;
    HierTreeNode *top_node = (HierTreeNode *)top_nodes-&amp;gt;GetValue(top_name) ;&lt;br /&gt;
    if (!top_node) {&lt;br /&gt;
        hier_tree::DeleteHierarchicalTree() ;&lt;br /&gt;
        return 6 ;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    InterfaceInfo *info = top_node-&amp;gt;GetParamValue(my_id) ;&lt;br /&gt;
    VeriBaseValue *val = 0 ;&lt;br /&gt;
    VeriBaseValue *delete_val = 0 ;&lt;br /&gt;
    if (info) {&lt;br /&gt;
        // We already have the value evaluated, get from node:&lt;br /&gt;
        val = info-&amp;gt;GetVeriEvaluatedValue() ;&lt;br /&gt;
    } else {&lt;br /&gt;
        // Need to evaluate the value, use the context from the node:&lt;br /&gt;
        Map *context = top_node-&amp;gt;PushContext() ;&lt;br /&gt;
        hier_tree::PushNode(top_node) ;&lt;br /&gt;
&lt;br /&gt;
        val = init_val-&amp;gt;StaticEvaluate(0, 0, 0, 0) ;&lt;br /&gt;
        delete_val = val ;&lt;br /&gt;
&lt;br /&gt;
        hier_tree::PopNode() ;&lt;br /&gt;
        top_node-&amp;gt;PopContext(context) ;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    char *val_img = (val) ? val-&amp;gt;Image() : 0 ;&lt;br /&gt;
    init_val-&amp;gt;Info(&amp;quot;%s(%s) evaluated to %s&amp;quot;, my_name, my_id-&amp;gt;GetPrettyPrintedString(), ((val_img)?val_img:&amp;quot;&amp;lt;NULL&amp;gt;&amp;quot;)) ;&lt;br /&gt;
    Strings::free(val_img) ;&lt;br /&gt;
&lt;br /&gt;
    delete delete_val ;&lt;br /&gt;
&lt;br /&gt;
    hier_tree::DeleteHierarchicalTree() ;&lt;br /&gt;
&lt;br /&gt;
    return 0 ;&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
$ test-linux &lt;br /&gt;
-- Analyzing Verilog file 'test.sv' (VERI-1482)&lt;br /&gt;
test.sv(7): INFO: my_int(my_int = $bits(I.data)) evaluated to 13&lt;br /&gt;
$ &lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mohammad</name></author>	</entry>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=How_to_evaluate_a_Verilog_expression&amp;diff=964</id>
		<title>How to evaluate a Verilog expression</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=How_to_evaluate_a_Verilog_expression&amp;diff=964"/>
				<updated>2025-11-18T20:05:57Z</updated>
		
		<summary type="html">&lt;p&gt;Mohammad: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Evaluating a Verilog expression requires 'Static Elaboration' or 'Hierarchy Tree' feature.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Evaluate an expression not in the design ==&lt;br /&gt;
&lt;br /&gt;
In the example below, a, b, and c are declared in the Verilog module. There is no need to run static elaboration on the whole module. But 'Static Elaboration' feature is still required because the API VeriExpression::StaticEvaluate() is available only with 'Static Elaboration' feature.&lt;br /&gt;
&lt;br /&gt;
C++:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
#include &amp;quot;veri_file.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriExpression.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriModule.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriBaseValue_Stat.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;Strings.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Array.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Map.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#ifdef VERIFIC_NAMESPACE&lt;br /&gt;
using namespace Verific ;&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
int main(int argc, const char **argv)&lt;br /&gt;
{&lt;br /&gt;
    const char *file_name = (argc &amp;gt; 1) ? argv[1] : &amp;quot;test.v&amp;quot; ;&lt;br /&gt;
    const char *module_name = (argc &amp;gt; 2) ? argv[2] : &amp;quot;test_module&amp;quot; ;&lt;br /&gt;
&lt;br /&gt;
    Array files(1) ;&lt;br /&gt;
    files.Insert(file_name) ;&lt;br /&gt;
    if (!veri_file::AnalyzeMultipleFiles(&amp;amp;files, veri_file::SYSTEM_VERILOG)) return 1 ; &lt;br /&gt;
&lt;br /&gt;
    const VeriModule *mod = veri_file::GetModule(module_name) ;&lt;br /&gt;
    if (!mod) return 2 ; &lt;br /&gt;
&lt;br /&gt;
    // Apply following known values to evaluate &amp;quot;a[b] + c&amp;quot;: &lt;br /&gt;
    //   a = {1'b1, 1'b1}&lt;br /&gt;
    //   b = 2'b00&lt;br /&gt;
    //   c = 2'b01  &lt;br /&gt;
&lt;br /&gt;
    const char *expr_string = &amp;quot;a[b] + c&amp;quot; ;&lt;br /&gt;
    Map known_values(STRING_HASH) ;&lt;br /&gt;
    (void) known_values.Insert(&amp;quot;a&amp;quot;, &amp;quot;{1'b1, 1'b1}&amp;quot;) ;&lt;br /&gt;
    (void) known_values.Insert(&amp;quot;b&amp;quot;, &amp;quot;2'b00&amp;quot;) ;&lt;br /&gt;
    (void) known_values.Insert(&amp;quot;c&amp;quot;, &amp;quot;2'b01&amp;quot;) ;&lt;br /&gt;
&lt;br /&gt;
    ValueTable df ;&lt;br /&gt;
&lt;br /&gt;
    MapIter mi ;&lt;br /&gt;
    const char *id_name ;&lt;br /&gt;
    const char *val_str ;&lt;br /&gt;
    FOREACH_MAP_ITEM(&amp;amp;known_values, mi, &amp;amp;id_name, &amp;amp;val_str) {&lt;br /&gt;
        if (!id_name || !val_str) continue ;&lt;br /&gt;
&lt;br /&gt;
        // Find the identifier:&lt;br /&gt;
        VeriIdDef *id = mod-&amp;gt;FindDeclared(id_name) ;&lt;br /&gt;
        if (!id) return 3 ; &lt;br /&gt;
&lt;br /&gt;
        // Create the expression:&lt;br /&gt;
        VeriExpression *expr = veri_file::AnalyzeExpr(val_str, veri_file::SYSTEM_VERILOG) ;&lt;br /&gt;
        if (!expr) return 4 ;&lt;br /&gt;
&lt;br /&gt;
        // Evaluate the expression:&lt;br /&gt;
        // If this is a literal expression, we do not need the value value or Resolve() call or else we need both:&lt;br /&gt;
        VeriBaseValue *val = expr-&amp;gt;StaticEvaluate(0 /* self context */, 0 /* value table */) ;&lt;br /&gt;
        delete expr ;&lt;br /&gt;
        if (!val) return 5 ; &lt;br /&gt;
&lt;br /&gt;
        // Insert into the table to be used later:&lt;br /&gt;
        if (!df.Insert(id, val)) {&lt;br /&gt;
            delete val ;&lt;br /&gt;
            return 6 ;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // Now create the expression for to be evaluated:&lt;br /&gt;
    VeriExpression *expr = veri_file::AnalyzeExpr(expr_string, veri_file::SYSTEM_VERILOG) ;&lt;br /&gt;
    if (!expr) return 7 ;&lt;br /&gt;
&lt;br /&gt;
    // Resolve the expression so that the id-refs are resolved:&lt;br /&gt;
    expr-&amp;gt;Resolve(mod-&amp;gt;GetScope(), VeriTreeNode::VERI_UNDEF_ENV) ;&lt;br /&gt;
&lt;br /&gt;
    VeriBaseValue *val = expr-&amp;gt;StaticEvaluate(0 /* self context */, &amp;amp;df /* use this table with the known values */) ;&lt;br /&gt;
    delete expr ;&lt;br /&gt;
    if (!val) return 8 ; // Failed to evaluate&lt;br /&gt;
&lt;br /&gt;
    char *image = val-&amp;gt;Image() ;&lt;br /&gt;
    int result = val-&amp;gt;GetIntegerValue() ;&lt;br /&gt;
    mod-&amp;gt;Info(&amp;quot;Evaluated value: %s (%d)&amp;quot;, ((image)?image:&amp;quot;&amp;quot;), result) ;&lt;br /&gt;
    Strings::free(image) ;&lt;br /&gt;
    delete val ;&lt;br /&gt;
&lt;br /&gt;
    return 0 ;&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verilog testcase:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
module test_module;&lt;br /&gt;
    wire a [1:0];&lt;br /&gt;
    wire [1:0] b;&lt;br /&gt;
    wire [1:0] c;&lt;br /&gt;
endmodule&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
$ test-linux &lt;br /&gt;
-- Analyzing Verilog file 'test.v' (VERI-1482)&lt;br /&gt;
test.v(5): INFO: Evaluated value: 2'b10 (2)&lt;br /&gt;
$ &lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== A function call in the design and generate variables (genvar)==&lt;br /&gt;
&lt;br /&gt;
Function calls are similar to other expressions, and you can evaluate them using StaticEvaluate().&lt;br /&gt;
&lt;br /&gt;
Giving a value to a generate variable is a little different. 'genvar' is treated like a parameter; we try to use the initial value instead of looking into the passed-in VeriValueTable. But since 'genvar' doesn't have a single value, we need to set it to a desired value before evaluating the expression.&lt;br /&gt;
&lt;br /&gt;
In the example below, you can see how this can be done:&lt;br /&gt;
&lt;br /&gt;
C++:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
#include &amp;quot;veri_file.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriModule.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriVisitor.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriExpression.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriId.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriBaseValue_Stat.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Map.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Strings.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#ifdef VERIFIC_NAMESPACE&lt;br /&gt;
using namespace Verific ;&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
class MyVisitor : public VeriVisitor&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
    MyVisitor() : VeriVisitor() { }&lt;br /&gt;
    virtual ~MyVisitor() { }&lt;br /&gt;
&lt;br /&gt;
    virtual void VERI_VISIT(VeriFunctionCall, node)&lt;br /&gt;
    {&lt;br /&gt;
        char *str = node.GetPrettyPrintedString() ;&lt;br /&gt;
        node.Info(&amp;quot;Got function call: %s&amp;quot;, str) ;&lt;br /&gt;
&lt;br /&gt;
        ValueTable df ;&lt;br /&gt;
        Map old_param_val(POINTER_HASH) ;&lt;br /&gt;
&lt;br /&gt;
        if (Strings::compare(str, &amp;quot;A(i)&amp;quot;)) {&lt;br /&gt;
&lt;br /&gt;
            // Apply following known values to evaluate: &lt;br /&gt;
            //   i = 2 (or 2'b10)&lt;br /&gt;
&lt;br /&gt;
            Map known_values(STRING_HASH) ;&lt;br /&gt;
            (void) known_values.Insert(&amp;quot;i&amp;quot;, &amp;quot;2'b10&amp;quot;) ;&lt;br /&gt;
&lt;br /&gt;
            unsigned i ;&lt;br /&gt;
            VeriExpression *expr ;&lt;br /&gt;
            // Going through arguments of the function call&lt;br /&gt;
            FOREACH_ARRAY_ITEM(node.GetArgs(), i, expr) {&lt;br /&gt;
                if (!expr) continue ;&lt;br /&gt;
                if (!expr-&amp;gt;IsIdRef()) continue ;&lt;br /&gt;
&lt;br /&gt;
                // Find the identifier:&lt;br /&gt;
                VeriIdDef *id = expr-&amp;gt;GetId() ;&lt;br /&gt;
                if (!id) return ; &lt;br /&gt;
&lt;br /&gt;
                // Get the value that we want to set for this id&lt;br /&gt;
                const char *val_str = (const char *) known_values.GetValue(expr-&amp;gt;GetName()) ;&lt;br /&gt;
&lt;br /&gt;
                // Create the expression:&lt;br /&gt;
                VeriExpression *expr = veri_file::AnalyzeExpr(val_str, veri_file::SYSTEM_VERILOG) ;&lt;br /&gt;
                if (!expr) return ;&lt;br /&gt;
&lt;br /&gt;
                if (id-&amp;gt;IsParam()) {&lt;br /&gt;
                    // Param values are NOT taken from value-table, initial value is used:&lt;br /&gt;
                    old_param_val.Insert(id, id-&amp;gt;TakeInitialValue()) ; // Store current value&lt;br /&gt;
                    (void) id-&amp;gt;SetInitialValue(expr) ; // Absorbed&lt;br /&gt;
                    continue ;&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
                // Evaluate the expression:&lt;br /&gt;
                // If this is a literal expression, we do not need the value value or Resolve() call or else we need both:&lt;br /&gt;
                VeriBaseValue *val = expr-&amp;gt;StaticEvaluate(0 /* self context */, 0 /* value table */) ;&lt;br /&gt;
                delete expr ;&lt;br /&gt;
                if (!val) return ; &lt;br /&gt;
&lt;br /&gt;
                // Insert into the table to be used later:&lt;br /&gt;
                if (!df.Insert(id, val)) {&lt;br /&gt;
                    delete val ;&lt;br /&gt;
                    return ;&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        VeriBaseValue *val = node.StaticEvaluate(0 /* self context */, &amp;amp;df /* use this table with the known values */) ;&lt;br /&gt;
&lt;br /&gt;
        MapIter mi ;&lt;br /&gt;
        VeriIdDef *id ;&lt;br /&gt;
        VeriExpression *expr ;&lt;br /&gt;
        FOREACH_MAP_ITEM(&amp;amp;old_param_val, mi, &amp;amp;id, &amp;amp;expr) {&lt;br /&gt;
            // Restore back old initial value:&lt;br /&gt;
            (void) id-&amp;gt;SetInitialValue(expr) ; // Old value deleted&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        if (!val) {&lt;br /&gt;
            node.Info(&amp;quot;Couldn't evaluate the expression&amp;quot;); &lt;br /&gt;
            return ; // Failed to evaluate&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        char *image = val-&amp;gt;Image() ;&lt;br /&gt;
        int result = val-&amp;gt;GetIntegerValue() ;&lt;br /&gt;
        node.Info(&amp;quot;Evaluated value: %s (%d)&amp;quot;, ((image)?image:&amp;quot;&amp;quot;), result) ;&lt;br /&gt;
        Strings::free(image) ;&lt;br /&gt;
        delete val ;&lt;br /&gt;
        Strings::free(str) ;&lt;br /&gt;
    }&lt;br /&gt;
} ;&lt;br /&gt;
&lt;br /&gt;
int main (int argc, char **argv)&lt;br /&gt;
{&lt;br /&gt;
    const char *file_name = &amp;quot;test.v&amp;quot; ; // default input filename&lt;br /&gt;
    if (argc &amp;gt; 1) file_name = argv[1] ; // Set the file name as specified by the user&lt;br /&gt;
&lt;br /&gt;
    // veri_file::Analyze(const char *file_name, unsigned verilog_mode=VERILOG_2K, const char *lib_name=&amp;quot;work&amp;quot;, unsigned cu_mode=NO_MODE) ;&lt;br /&gt;
    if (!veri_file::Analyze(file_name, veri_file::SYSTEM_VERILOG)) return 1 ;&lt;br /&gt;
&lt;br /&gt;
    //if (!veri_file::ElaborateAllStatic()) return 1 ;&lt;br /&gt;
&lt;br /&gt;
    MyVisitor mv ;&lt;br /&gt;
&lt;br /&gt;
    MapIter mi ;&lt;br /&gt;
    VeriModule *mod ;&lt;br /&gt;
    FOREACH_VERILOG_MODULE(mi, mod) if (mod) mod-&amp;gt;Accept(mv) ;&lt;br /&gt;
&lt;br /&gt;
    return 0 ;&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verilog testcase:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
module test();&lt;br /&gt;
    parameter d = 0;&lt;br /&gt;
endmodule&lt;br /&gt;
&lt;br /&gt;
module top();  &lt;br /&gt;
    parameter PARAM = 5;&lt;br /&gt;
     &lt;br /&gt;
    function[3:0] A(input [2:0] c);  &lt;br /&gt;
        return (2 + c);  &lt;br /&gt;
    endfunction  &lt;br /&gt;
     &lt;br /&gt;
    test#(A(PARAM)) test_e();&lt;br /&gt;
&lt;br /&gt;
    genvar i;&lt;br /&gt;
    for(i = 0; i &amp;lt; 10; i = i + 1) begin&lt;br /&gt;
        test#(A(i)) test_i();&lt;br /&gt;
    end&lt;br /&gt;
endmodule&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
$ ./test-linux &lt;br /&gt;
-- Analyzing Verilog file 'test.v' (VERI-1482)&lt;br /&gt;
test.v(12): INFO: Got function call: A(PARAM)&lt;br /&gt;
test.v(12): INFO: Evaluated value: 4'b0111 (7)&lt;br /&gt;
test.v(16): INFO: Got function call: A(i)&lt;br /&gt;
test.v(16): INFO: Evaluated value: 4'b0100 (4)&lt;br /&gt;
$&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== An expression that crosses module boundaries ==&lt;br /&gt;
If an element in the expression to be evaluated crosses module boundaries, elaboration needs to be run as in the Verilog testcase below ('my_int' is to be evaluated):&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
interface ifc #(int N=10);&lt;br /&gt;
    logic [N-1:0] data;&lt;br /&gt;
endinterface&lt;br /&gt;
 &lt;br /&gt;
module test();&lt;br /&gt;
    ifc #(.N(13)) I();&lt;br /&gt;
    int my_int = $bits(I.data); // want to evaluated 'my_int' or '$bits(I.data)'&lt;br /&gt;
endmodule&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The C++ example below calls static elaboration:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
#include &amp;quot;veri_file.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriModule.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriVisitor.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriExpression.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#ifdef VERIFIC_NAMESPACE&lt;br /&gt;
using namespace Verific ;&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
class MyVisitor : public VeriVisitor&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
    MyVisitor() : VeriVisitor() { }&lt;br /&gt;
    virtual ~MyVisitor() { }&lt;br /&gt;
&lt;br /&gt;
    virtual void VERI_VISIT(VeriExpression, node)&lt;br /&gt;
    {&lt;br /&gt;
        char *str = node.GetPrettyPrintedString() ;&lt;br /&gt;
        VeriExpression *new_exp = node.StaticEvaluateToExpr(0,0,0);&lt;br /&gt;
        if (new_exp) {&lt;br /&gt;
            char *str2 = new_exp-&amp;gt;GetPrettyPrintedString() ;&lt;br /&gt;
            node.Info(&amp;quot;    Expression: '%s', evaluated to '%s'&amp;quot;, str, str2) ;&lt;br /&gt;
            Strings::free(str) ;&lt;br /&gt;
            Strings::free(str2) ;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
} ;&lt;br /&gt;
&lt;br /&gt;
int main (int argc, char **argv)&lt;br /&gt;
{&lt;br /&gt;
    const char *file_name = &amp;quot;test.sv&amp;quot; ; // defaulf input filename&lt;br /&gt;
    if (argc &amp;gt; 1) file_name = argv[1] ; // Set the file name as specified by the user&lt;br /&gt;
    if (!veri_file::Analyze(file_name, veri_file::SYSTEM_VERILOG)) return 1 ;&lt;br /&gt;
&lt;br /&gt;
    if (!veri_file::ElaborateAllStatic()) return 1 ;&lt;br /&gt;
&lt;br /&gt;
    MyVisitor mv ;&lt;br /&gt;
&lt;br /&gt;
    VeriModule *mod = veri_file::GetModule(&amp;quot;test&amp;quot;) ;&lt;br /&gt;
    if (!mod) return 2 ;&lt;br /&gt;
    mod-&amp;gt;Info(&amp;quot;In module '%s'&amp;quot;, mod-&amp;gt;Name()) ;&lt;br /&gt;
    mod-&amp;gt;Accept(mv) ;&lt;br /&gt;
    return 0 ;&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
$ test-linux &lt;br /&gt;
-- Analyzing Verilog file 'test.sv' (VERI-1482)&lt;br /&gt;
test.sv(5): INFO: compiling module 'test' (VERI-1018)&lt;br /&gt;
test.sv(8): INFO: In module 'test'&lt;br /&gt;
test.sv(7): INFO:     Expression: 'int ', evaluated to 'int '&lt;br /&gt;
test.sv(7): INFO:     Expression: '$bits(I.data)', evaluated to '13'&lt;br /&gt;
$ &lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Using Hierarchy Tree Elaboration to evaluate ==&lt;br /&gt;
If for some reason static elaboration is not desirable (it does take memory and CPU time), hierarchy-tree elaboration can be run instead. Hierarchy-tree elaboration takes much less memory anc CPU time than static elaborations does.&lt;br /&gt;
&lt;br /&gt;
Reference: https://www.verific.com/docs/index.php?title=Hierarchy_Tree&lt;br /&gt;
&lt;br /&gt;
The C++ example below uses hierarchy-tree elaboration instead of static elaboration:&lt;br /&gt;
&lt;br /&gt;
C++:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
#include &amp;quot;veri_file.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriModule.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriId.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriExpression.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriBaseValue_Stat.h&amp;quot;&lt;br /&gt;
#include &amp;quot;hier_tree.h&amp;quot;&lt;br /&gt;
#include &amp;quot;HierTreeNode.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#ifdef VERIFIC_NAMESPACE&lt;br /&gt;
using namespace Verific ;&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
int main(int argc, const char **argv)&lt;br /&gt;
{&lt;br /&gt;
    const char *file_name = &amp;quot;test.sv&amp;quot; ;&lt;br /&gt;
    const char *top_name = &amp;quot;test&amp;quot; ;&lt;br /&gt;
    const char *my_name = &amp;quot;my_int&amp;quot; ;&lt;br /&gt;
&lt;br /&gt;
    if (!veri_file::Analyze(file_name, veri_file::SYSTEM_VERILOG)) return 1 ;&lt;br /&gt;
&lt;br /&gt;
    VeriModule *top = veri_file::GetModule(top_name) ;&lt;br /&gt;
    if (!top) return 2 ;&lt;br /&gt;
&lt;br /&gt;
    VeriIdDef *my_id = top-&amp;gt;FindDeclared(my_name) ;&lt;br /&gt;
    if (!my_id) return 3 ;&lt;br /&gt;
&lt;br /&gt;
    VeriExpression *init_val = my_id-&amp;gt;GetInitialValue() ;&lt;br /&gt;
    if (!init_val) return 4 ;&lt;br /&gt;
&lt;br /&gt;
    Array top_mods(1) ;&lt;br /&gt;
    top_mods.Insert(top) ;&lt;br /&gt;
&lt;br /&gt;
    const Map *top_nodes = hier_tree::CreateHierarchicalTree(&amp;amp;top_mods, 0, 0, 0) ;&lt;br /&gt;
    if (!top_nodes) return 5 ;&lt;br /&gt;
&lt;br /&gt;
    HierTreeNode *top_node = (HierTreeNode *)top_nodes-&amp;gt;GetValue(top_name) ;&lt;br /&gt;
    if (!top_node) {&lt;br /&gt;
        hier_tree::DeleteHierarchicalTree() ;&lt;br /&gt;
        return 6 ;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    InterfaceInfo *info = top_node-&amp;gt;GetParamValue(my_id) ;&lt;br /&gt;
    VeriBaseValue *val = 0 ;&lt;br /&gt;
    VeriBaseValue *delete_val = 0 ;&lt;br /&gt;
    if (info) {&lt;br /&gt;
        // We already have the value evaluated, get from node:&lt;br /&gt;
        val = info-&amp;gt;GetVeriEvaluatedValue() ;&lt;br /&gt;
    } else {&lt;br /&gt;
        // Need to evaluate the value, use the context from the node:&lt;br /&gt;
        Map *context = top_node-&amp;gt;PushContext() ;&lt;br /&gt;
        hier_tree::PushNode(top_node) ;&lt;br /&gt;
&lt;br /&gt;
        val = init_val-&amp;gt;StaticEvaluate(0, 0, 0, 0) ;&lt;br /&gt;
        delete_val = val ;&lt;br /&gt;
&lt;br /&gt;
        hier_tree::PopNode() ;&lt;br /&gt;
        top_node-&amp;gt;PopContext(context) ;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    char *val_img = (val) ? val-&amp;gt;Image() : 0 ;&lt;br /&gt;
    init_val-&amp;gt;Info(&amp;quot;%s(%s) evaluated to %s&amp;quot;, my_name, my_id-&amp;gt;GetPrettyPrintedString(), ((val_img)?val_img:&amp;quot;&amp;lt;NULL&amp;gt;&amp;quot;)) ;&lt;br /&gt;
    Strings::free(val_img) ;&lt;br /&gt;
&lt;br /&gt;
    delete delete_val ;&lt;br /&gt;
&lt;br /&gt;
    hier_tree::DeleteHierarchicalTree() ;&lt;br /&gt;
&lt;br /&gt;
    return 0 ;&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
$ test-linux &lt;br /&gt;
-- Analyzing Verilog file 'test.sv' (VERI-1482)&lt;br /&gt;
test.sv(7): INFO: my_int(my_int = $bits(I.data)) evaluated to 13&lt;br /&gt;
$ &lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mohammad</name></author>	</entry>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=How_to_get_parameters_creation-time_initial_expression/value_after_Static_Elaboration&amp;diff=931</id>
		<title>How to get parameters creation-time initial expression/value after Static Elaboration</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=How_to_get_parameters_creation-time_initial_expression/value_after_Static_Elaboration&amp;diff=931"/>
				<updated>2025-02-19T22:51:04Z</updated>
		
		<summary type="html">&lt;p&gt;Mohammad: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;To ensure the proper functionality of this example, please enable the `VERILOG_PRESERVE_CREATION_INIT_VALUE_OF_PARAMS` compile flag. This flag is necessary because it adds a field to VeriParamId that stores the design-specified initial value.&lt;br /&gt;
&lt;br /&gt;
We cannot use GetInitialValue for this purpose, as its value is overwritten with the evaluated parameter value during Static Elaboration. However, the creation-time initial value added by the flag will remain unaffected by Static Elaboration.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
C++:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
#include &amp;quot;Map.h&amp;quot;            // Make class Map available&lt;br /&gt;
#include &amp;quot;veri_file.h&amp;quot;      // Make verilog reader available&lt;br /&gt;
#include &amp;quot;VeriModule.h&amp;quot;     // Definition of a VeriModule and VeriPrimitive&lt;br /&gt;
#include &amp;quot;VeriExpression.h&amp;quot; // Definition of a VeriExpression&lt;br /&gt;
#include &amp;quot;Array.h&amp;quot;          // Make class Array available&lt;br /&gt;
#include &amp;quot;VeriId.h&amp;quot;         // Definitions of all verilog identifier nodes&lt;br /&gt;
&lt;br /&gt;
#ifdef VERIFIC_NAMESPACE&lt;br /&gt;
using namespace Verific ;&lt;br /&gt;
#endif&lt;br /&gt;
class ExModuleVisit : public VeriVisitor&lt;br /&gt;
{&lt;br /&gt;
public :&lt;br /&gt;
    ExModuleVisit() {}&lt;br /&gt;
    virtual ~ExModuleVisit() {}&lt;br /&gt;
&lt;br /&gt;
    virtual void VERI_VISIT(VeriModule, node) &lt;br /&gt;
    {&lt;br /&gt;
        std::cout &amp;lt;&amp;lt; &amp;quot;-- Processing module &amp;quot; &amp;lt;&amp;lt; node.GetName() &amp;lt;&amp;lt; std::endl ;&lt;br /&gt;
        VeriVisitor::VERI_VISIT_NODE(VeriModule, node) ;&lt;br /&gt;
    }&lt;br /&gt;
    virtual void VERI_VISIT(VeriParamId, node)&lt;br /&gt;
    {&lt;br /&gt;
        std::cout &amp;lt;&amp;lt; &amp;quot;--    Param &amp;quot; &amp;lt;&amp;lt; node.GetName() &amp;lt;&amp;lt; std::endl ;&lt;br /&gt;
        VeriExpression *init_val = node.GetInitialValue() ;&lt;br /&gt;
        if (init_val) {&lt;br /&gt;
            std::cout &amp;lt;&amp;lt; &amp;quot;--        Initial value :&amp;quot; ;&lt;br /&gt;
            init_val-&amp;gt;PrettyPrint(std::cout, 0) ; std::cout &amp;lt;&amp;lt; std::endl ;&lt;br /&gt;
        }&lt;br /&gt;
        VeriExpression *creation_val = node.GetCreationInitialValue() ;&lt;br /&gt;
        if (creation_val) {&lt;br /&gt;
            std::cout &amp;lt;&amp;lt; &amp;quot;--        Creation initial value :&amp;quot; ;&lt;br /&gt;
            creation_val-&amp;gt;PrettyPrint(std::cout, 0) ; std::cout &amp;lt;&amp;lt; std::endl ;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
} ;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char **argv)&lt;br /&gt;
{&lt;br /&gt;
#ifndef VERILOG_PRESERVE_CREATION_INIT_VALUE_OF_PARAMS&lt;br /&gt;
    std::cout &amp;lt;&amp;lt; &amp;quot;Compile flag 'VERILOG_PRESERVE_CREATION_INIT_VALUE_OF_PARAMS' needs to be enabled for this application.\n&amp;quot;; &lt;br /&gt;
    return 1 ;&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
    const char *file_name = 0 ;&lt;br /&gt;
    if (argc&amp;gt;1) {&lt;br /&gt;
        file_name = argv[1] ; // Set the file name as specified by the user&lt;br /&gt;
    } else {&lt;br /&gt;
        file_name = &amp;quot;test.sv&amp;quot; ; // Set default file name&lt;br /&gt;
    }&lt;br /&gt;
   &lt;br /&gt;
    if (!veri_file::Analyze(file_name, veri_file::SYSTEM_VERILOG)) return 1 ;&lt;br /&gt;
    &lt;br /&gt;
    // Return in case of failure.&lt;br /&gt;
    if (!veri_file::ElaborateStatic(&amp;quot;top&amp;quot;, &amp;quot;work&amp;quot;, 0)) {&lt;br /&gt;
        return 4 ;&lt;br /&gt;
    }&lt;br /&gt;
    ExModuleVisit m_obj ;                &lt;br /&gt;
    VeriModule *mod ;&lt;br /&gt;
    MapIter mi ;&lt;br /&gt;
    FOREACH_VERILOG_MODULE(mi, mod) {&lt;br /&gt;
        if (!mod) continue ;&lt;br /&gt;
        std::cout &amp;lt;&amp;lt; &amp;quot;\n-- Processing module &amp;quot; &amp;lt;&amp;lt; mod-&amp;gt;GetName() &amp;lt;&amp;lt; std::endl ;&lt;br /&gt;
        mod-&amp;gt;Accept(m_obj) ;&lt;br /&gt;
        std::cout &amp;lt;&amp;lt; &amp;quot;--&amp;gt; Calling StaticEvaluateCreationInitValuesOfParams on &amp;quot; &amp;lt;&amp;lt; mod-&amp;gt;GetName() &amp;lt;&amp;lt; std::endl ;&lt;br /&gt;
        mod-&amp;gt;StaticEvaluateCreationInitValuesOfParams() ;&lt;br /&gt;
        mod-&amp;gt;Accept(m_obj) ; &lt;br /&gt;
        if (mod-&amp;gt;ResetStaticEvaluatedCreationInitValuesOfParams()) {&lt;br /&gt;
            std::cout &amp;lt;&amp;lt; &amp;quot;--&amp;gt; Successfully called ResetStaticEvaluatedCreationInitValuesOfParams on &amp;quot; &amp;lt;&amp;lt; mod-&amp;gt;GetName() &amp;lt;&amp;lt; std::endl ;&lt;br /&gt;
            mod-&amp;gt;Accept(m_obj) ; &lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    return 0 ;&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
input test.sv:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
module top ;&lt;br /&gt;
  parameter p1 = 3 ;&lt;br /&gt;
  parameter p2 = p1 + 3 ;&lt;br /&gt;
  parameter p3 = p2 + 4 ;&lt;br /&gt;
&lt;br /&gt;
  foo #(p2) I1() ;&lt;br /&gt;
  foo #(p3) I2() ;&lt;br /&gt;
endmodule&lt;br /&gt;
&lt;br /&gt;
module foo ;&lt;br /&gt;
   parameter p1 = 1 ;&lt;br /&gt;
   parameter p2 = p1 + 4 ;&lt;br /&gt;
endmodule&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output log:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
-- Analyzing Verilog file 'test.sv' (VERI-1482)&lt;br /&gt;
test.sv(2): INFO: compiling module 'top' (VERI-1018)&lt;br /&gt;
&lt;br /&gt;
-- Processing module top&lt;br /&gt;
-- Processing module top&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :3&lt;br /&gt;
--        Creation initial value :3&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :6&lt;br /&gt;
--        Creation initial value :(p1 + 3)&lt;br /&gt;
--    Param p3&lt;br /&gt;
--        Initial value :10&lt;br /&gt;
--        Creation initial value :(p2 + 4)&lt;br /&gt;
--&amp;gt; Calling StaticEvaluateCreationInitValuesOfParams on top&lt;br /&gt;
-- Processing module top&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :3&lt;br /&gt;
--        Creation initial value :3&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :6&lt;br /&gt;
--        Creation initial value :6&lt;br /&gt;
--    Param p3&lt;br /&gt;
--        Initial value :10&lt;br /&gt;
--        Creation initial value :10&lt;br /&gt;
&lt;br /&gt;
-- Processing module foo&lt;br /&gt;
-- Processing module foo&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :1&lt;br /&gt;
--        Creation initial value :1&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :(p1 + 4)&lt;br /&gt;
--        Creation initial value :(p1 + 4)&lt;br /&gt;
--&amp;gt; Calling StaticEvaluateCreationInitValuesOfParams on foo&lt;br /&gt;
-- Processing module foo&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :1&lt;br /&gt;
--        Creation initial value :1&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :(p1 + 4)&lt;br /&gt;
--        Creation initial value :5&lt;br /&gt;
--&amp;gt; Successfully called ResetStaticEvaluatedCreationInitValuesOfParams on foo&lt;br /&gt;
-- Processing module foo&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :1&lt;br /&gt;
--        Creation initial value :1&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :(p1 + 4)&lt;br /&gt;
--        Creation initial value :(p1 + 4)&lt;br /&gt;
&lt;br /&gt;
-- Processing module foo(p1=6)&lt;br /&gt;
-- Processing module foo(p1=6)&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :6&lt;br /&gt;
--        Creation initial value :1&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :10&lt;br /&gt;
--        Creation initial value :(p1 + 4)&lt;br /&gt;
--&amp;gt; Calling StaticEvaluateCreationInitValuesOfParams on foo(p1=6)&lt;br /&gt;
-- Processing module foo(p1=6)&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :6&lt;br /&gt;
--        Creation initial value :1&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :10&lt;br /&gt;
--        Creation initial value :5&lt;br /&gt;
&lt;br /&gt;
-- Processing module foo(p1=10)&lt;br /&gt;
-- Processing module foo(p1=10)&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :10&lt;br /&gt;
--        Creation initial value :1&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :14&lt;br /&gt;
--        Creation initial value :(p1 + 4)&lt;br /&gt;
--&amp;gt; Calling StaticEvaluateCreationInitValuesOfParams on foo(p1=10)&lt;br /&gt;
-- Processing module foo(p1=10)&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :10&lt;br /&gt;
--        Creation initial value :1&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :14&lt;br /&gt;
--        Creation initial value :5&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mohammad</name></author>	</entry>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=How_to_get_parameters_creation-time_initial_expression/value_after_Static_Elaboration&amp;diff=930</id>
		<title>How to get parameters creation-time initial expression/value after Static Elaboration</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=How_to_get_parameters_creation-time_initial_expression/value_after_Static_Elaboration&amp;diff=930"/>
				<updated>2025-02-19T22:50:24Z</updated>
		
		<summary type="html">&lt;p&gt;Mohammad: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;To ensure the proper functionality of this example, please enable the `VERILOG_PRESERVE_CREATION_INIT_VALUE_OF_PARAMS` compile flag. This flag is necessary because it adds a field to VeriParamId that stores the design-specified initial value.&lt;br /&gt;
&lt;br /&gt;
We cannot use GetInitialValue for this purpose, as its value is overwritten with the evaluated parameter value during Static Elaboration. However, the creation-time initial value added by the flag will remain unaffected by Static Elaboration.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
C++:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
#include &amp;quot;Map.h&amp;quot;            // Make class Map available&lt;br /&gt;
#include &amp;quot;veri_file.h&amp;quot;      // Make verilog reader available&lt;br /&gt;
#include &amp;quot;VeriModule.h&amp;quot;     // Definition of a VeriModule and VeriPrimitive&lt;br /&gt;
#include &amp;quot;VeriExpression.h&amp;quot; // Definition of a VeriExpression&lt;br /&gt;
#include &amp;quot;Array.h&amp;quot;          // Make class Array available&lt;br /&gt;
#include &amp;quot;VeriId.h&amp;quot;         // Definitions of all verilog identifier nodes&lt;br /&gt;
&lt;br /&gt;
#ifdef VERIFIC_NAMESPACE&lt;br /&gt;
using namespace Verific ;&lt;br /&gt;
#endif&lt;br /&gt;
class ExModuleVisit : public VeriVisitor&lt;br /&gt;
{&lt;br /&gt;
public :&lt;br /&gt;
    ExModuleVisit() {}&lt;br /&gt;
    virtual ~ExModuleVisit() {}&lt;br /&gt;
&lt;br /&gt;
    virtual void VERI_VISIT(VeriModule, node) &lt;br /&gt;
    {&lt;br /&gt;
        std::cout &amp;lt;&amp;lt; &amp;quot;-- Processing module &amp;quot; &amp;lt;&amp;lt; node.GetName() &amp;lt;&amp;lt; std::endl ;&lt;br /&gt;
        VeriVisitor::VERI_VISIT_NODE(VeriModule, node) ;&lt;br /&gt;
    }&lt;br /&gt;
    virtual void VERI_VISIT(VeriParamId, node)&lt;br /&gt;
    {&lt;br /&gt;
        std::cout &amp;lt;&amp;lt; &amp;quot;--    Param &amp;quot; &amp;lt;&amp;lt; node.GetName() &amp;lt;&amp;lt; std::endl ;&lt;br /&gt;
        VeriExpression *init_val = node.GetInitialValue() ;&lt;br /&gt;
        if (init_val) {&lt;br /&gt;
            std::cout &amp;lt;&amp;lt; &amp;quot;--        Initial value :&amp;quot; ;&lt;br /&gt;
            init_val-&amp;gt;PrettyPrint(std::cout, 0) ; std::cout &amp;lt;&amp;lt; std::endl ;&lt;br /&gt;
        }&lt;br /&gt;
        VeriExpression *creation_val = node.GetCreationInitialValue() ;&lt;br /&gt;
        if (creation_val) {&lt;br /&gt;
            std::cout &amp;lt;&amp;lt; &amp;quot;--        Creation initial value :&amp;quot; ;&lt;br /&gt;
            creation_val-&amp;gt;PrettyPrint(std::cout, 0) ; std::cout &amp;lt;&amp;lt; std::endl ;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
} ;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char **argv)&lt;br /&gt;
{&lt;br /&gt;
#ifndef VERILOG_PRESERVE_CREATION_INIT_VALUE_OF_PARAMS&lt;br /&gt;
    std::cout &amp;lt;&amp;lt; &amp;quot;Compile flag 'VERILOG_PRESERVE_CREATION_INIT_VALUE_OF_PARAMS' needs to be enabled for this application.\n&amp;quot;; &lt;br /&gt;
    return 1 ;&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
    const char *file_name = 0 ;&lt;br /&gt;
    if (argc&amp;gt;1) {&lt;br /&gt;
        file_name = argv[1] ; // Set the file name as specified by the user&lt;br /&gt;
    } else {&lt;br /&gt;
        file_name = &amp;quot;test.sv&amp;quot; ; // Set default file name&lt;br /&gt;
    }&lt;br /&gt;
   &lt;br /&gt;
    if (!veri_file::Analyze(file_name, veri_file::SYSTEM_VERILOG)) return 1 ;&lt;br /&gt;
    &lt;br /&gt;
    // Return in case of failure.&lt;br /&gt;
    if (!veri_file::ElaborateStatic(&amp;quot;top&amp;quot;, &amp;quot;work&amp;quot;, 0)) {&lt;br /&gt;
        return 4 ;&lt;br /&gt;
    }&lt;br /&gt;
    ExModuleVisit m_obj ;                &lt;br /&gt;
    VeriModule *mod ;&lt;br /&gt;
    MapIter mi ;&lt;br /&gt;
    FOREACH_VERILOG_MODULE(mi, mod) {&lt;br /&gt;
        if (!mod) continue ;&lt;br /&gt;
        std::cout &amp;lt;&amp;lt; &amp;quot;\n-- Processing module &amp;quot; &amp;lt;&amp;lt; mod-&amp;gt;GetName() &amp;lt;&amp;lt; std::endl ;&lt;br /&gt;
        mod-&amp;gt;Accept(m_obj) ;&lt;br /&gt;
        std::cout &amp;lt;&amp;lt; &amp;quot;--&amp;gt; Calling StaticEvaluateCreationInitValuesOfParams on &amp;quot; &amp;lt;&amp;lt; mod-&amp;gt;GetName() &amp;lt;&amp;lt; std::endl ;&lt;br /&gt;
        mod-&amp;gt;StaticEvaluateCreationInitValuesOfParams() ;&lt;br /&gt;
        mod-&amp;gt;Accept(m_obj) ; &lt;br /&gt;
        if (mod-&amp;gt;ResetStaticEvaluatedCreationInitValuesOfParams()) {&lt;br /&gt;
            std::cout &amp;lt;&amp;lt; &amp;quot;--&amp;gt; Successfully called ResetStaticEvaluatedCreationInitValuesOfParams on &amp;quot; &amp;lt;&amp;lt; mod-&amp;gt;GetName() &amp;lt;&amp;lt; std::endl ;&lt;br /&gt;
            mod-&amp;gt;Accept(m_obj) ; &lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    return 0 ;&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
input test.sv:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
module top ;&lt;br /&gt;
  parameter p1 = 3 ;&lt;br /&gt;
  parameter p2 = p1 + 3 ;&lt;br /&gt;
  parameter p3 = p2 + 4 ;&lt;br /&gt;
&lt;br /&gt;
  foo #(p2) I1() ;&lt;br /&gt;
  foo #(p3) I2() ;&lt;br /&gt;
endmodule&lt;br /&gt;
&lt;br /&gt;
module foo ;&lt;br /&gt;
   parameter p1 = 1 ;&lt;br /&gt;
   parameter p2 = p1 + 4 ;&lt;br /&gt;
endmodule&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output log:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
-- Analyzing Verilog file 'ex.sv' (VERI-1482)&lt;br /&gt;
ex.sv(2): INFO: compiling module 'top' (VERI-1018)&lt;br /&gt;
&lt;br /&gt;
-- Processing module top&lt;br /&gt;
-- Processing module top&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :3&lt;br /&gt;
--        Creation initial value :3&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :6&lt;br /&gt;
--        Creation initial value :(p1 + 3)&lt;br /&gt;
--    Param p3&lt;br /&gt;
--        Initial value :10&lt;br /&gt;
--        Creation initial value :(p2 + 4)&lt;br /&gt;
--&amp;gt; Calling StaticEvaluateCreationInitValuesOfParams on top&lt;br /&gt;
-- Processing module top&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :3&lt;br /&gt;
--        Creation initial value :3&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :6&lt;br /&gt;
--        Creation initial value :6&lt;br /&gt;
--    Param p3&lt;br /&gt;
--        Initial value :10&lt;br /&gt;
--        Creation initial value :10&lt;br /&gt;
&lt;br /&gt;
-- Processing module foo&lt;br /&gt;
-- Processing module foo&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :1&lt;br /&gt;
--        Creation initial value :1&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :(p1 + 4)&lt;br /&gt;
--        Creation initial value :(p1 + 4)&lt;br /&gt;
--&amp;gt; Calling StaticEvaluateCreationInitValuesOfParams on foo&lt;br /&gt;
-- Processing module foo&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :1&lt;br /&gt;
--        Creation initial value :1&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :(p1 + 4)&lt;br /&gt;
--        Creation initial value :5&lt;br /&gt;
--&amp;gt; Successfully called ResetStaticEvaluatedCreationInitValuesOfParams on foo&lt;br /&gt;
-- Processing module foo&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :1&lt;br /&gt;
--        Creation initial value :1&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :(p1 + 4)&lt;br /&gt;
--        Creation initial value :(p1 + 4)&lt;br /&gt;
&lt;br /&gt;
-- Processing module foo(p1=6)&lt;br /&gt;
-- Processing module foo(p1=6)&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :6&lt;br /&gt;
--        Creation initial value :1&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :10&lt;br /&gt;
--        Creation initial value :(p1 + 4)&lt;br /&gt;
--&amp;gt; Calling StaticEvaluateCreationInitValuesOfParams on foo(p1=6)&lt;br /&gt;
-- Processing module foo(p1=6)&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :6&lt;br /&gt;
--        Creation initial value :1&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :10&lt;br /&gt;
--        Creation initial value :5&lt;br /&gt;
&lt;br /&gt;
-- Processing module foo(p1=10)&lt;br /&gt;
-- Processing module foo(p1=10)&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :10&lt;br /&gt;
--        Creation initial value :1&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :14&lt;br /&gt;
--        Creation initial value :(p1 + 4)&lt;br /&gt;
--&amp;gt; Calling StaticEvaluateCreationInitValuesOfParams on foo(p1=10)&lt;br /&gt;
-- Processing module foo(p1=10)&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :10&lt;br /&gt;
--        Creation initial value :1&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :14&lt;br /&gt;
--        Creation initial value :5&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mohammad</name></author>	</entry>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=How_to_get_parameters_creation-time_initial_expression/value_after_Static_Elaboration&amp;diff=929</id>
		<title>How to get parameters creation-time initial expression/value after Static Elaboration</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=How_to_get_parameters_creation-time_initial_expression/value_after_Static_Elaboration&amp;diff=929"/>
				<updated>2025-02-19T21:58:00Z</updated>
		
		<summary type="html">&lt;p&gt;Mohammad: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;To ensure the proper functionality of this example, please enable the `VERILOG_PRESERVE_CREATION_INIT_VALUE_OF_PARAMS` compile flag. This flag is necessary because it adds a field to VeriParamId that stores the design-specified initial value.&lt;br /&gt;
&lt;br /&gt;
We cannot use GetInitialValue for this purpose, as its value is overwritten with the evaluated parameter value during Static Elaboration. However, the creation-time initial value added by the flag will remain unaffected by Static Elaboration.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
C++:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
#include &amp;quot;Map.h&amp;quot;            // Make class Map available&lt;br /&gt;
#include &amp;quot;veri_file.h&amp;quot;      // Make verilog reader available&lt;br /&gt;
#include &amp;quot;VeriModule.h&amp;quot;     // Definition of a VeriModule and VeriPrimitive&lt;br /&gt;
#include &amp;quot;VeriExpression.h&amp;quot; // Definition of a VeriExpression&lt;br /&gt;
#include &amp;quot;Array.h&amp;quot;          // Make class Array available&lt;br /&gt;
#include &amp;quot;VeriId.h&amp;quot;         // Definitions of all verilog identifier nodes&lt;br /&gt;
&lt;br /&gt;
#ifdef VERIFIC_NAMESPACE&lt;br /&gt;
using namespace Verific ;&lt;br /&gt;
#endif&lt;br /&gt;
class ExModuleVisit : public VeriVisitor&lt;br /&gt;
{&lt;br /&gt;
public :&lt;br /&gt;
    ExModuleVisit() {}&lt;br /&gt;
    virtual ~ExModuleVisit() {}&lt;br /&gt;
&lt;br /&gt;
    virtual void VERI_VISIT(VeriModule, node) &lt;br /&gt;
    {&lt;br /&gt;
        std::cout &amp;lt;&amp;lt; &amp;quot;-- Processing module &amp;quot; &amp;lt;&amp;lt; node.GetName() &amp;lt;&amp;lt; std::endl ;&lt;br /&gt;
        VeriVisitor::VERI_VISIT_NODE(VeriModule, node) ;&lt;br /&gt;
    }&lt;br /&gt;
    virtual void VERI_VISIT(VeriParamId, node)&lt;br /&gt;
    {&lt;br /&gt;
        std::cout &amp;lt;&amp;lt; &amp;quot;--    Param &amp;quot; &amp;lt;&amp;lt; node.GetName() &amp;lt;&amp;lt; std::endl ;&lt;br /&gt;
        VeriExpression *init_val = node.GetInitialValue() ;&lt;br /&gt;
        if (init_val) {&lt;br /&gt;
            std::cout &amp;lt;&amp;lt; &amp;quot;--        Initial value :&amp;quot; ;&lt;br /&gt;
            init_val-&amp;gt;PrettyPrint(std::cout, 0) ; std::cout &amp;lt;&amp;lt; std::endl ;&lt;br /&gt;
        }&lt;br /&gt;
#ifdef VERILOG_PRESERVE_CREATION_INIT_VALUE_OF_PARAMS&lt;br /&gt;
        // Compile flag &amp;quot;VERILOG_PRESERVE_CREATION_INIT_VALUE_OF_PARAMS&amp;quot; should be enabled to access creation-time initial value&lt;br /&gt;
        VeriExpression *creation_val = node.GetCreationInitialValue() ;&lt;br /&gt;
        if (creation_val) {&lt;br /&gt;
            std::cout &amp;lt;&amp;lt; &amp;quot;--        Creation initial value :&amp;quot; ;&lt;br /&gt;
            creation_val-&amp;gt;PrettyPrint(std::cout, 0) ; std::cout &amp;lt;&amp;lt; std::endl ;&lt;br /&gt;
        }&lt;br /&gt;
#endif&lt;br /&gt;
    }&lt;br /&gt;
} ;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char **argv)&lt;br /&gt;
{&lt;br /&gt;
    const char *file_name = 0 ;&lt;br /&gt;
    if (argc&amp;gt;1) {&lt;br /&gt;
        file_name = argv[1] ; // Set the file name as specified by the user&lt;br /&gt;
    } else {&lt;br /&gt;
        file_name = &amp;quot;test.sv&amp;quot; ; // Set default file name&lt;br /&gt;
    }&lt;br /&gt;
   &lt;br /&gt;
    if (!veri_file::Analyze(file_name, veri_file::SYSTEM_VERILOG)) return 1 ;&lt;br /&gt;
    &lt;br /&gt;
    // Return in case of failure.&lt;br /&gt;
    if (!veri_file::ElaborateStatic(&amp;quot;top&amp;quot;, &amp;quot;work&amp;quot;, 0)) {&lt;br /&gt;
        return 4 ;&lt;br /&gt;
    }&lt;br /&gt;
    ExModuleVisit m_obj ;                &lt;br /&gt;
    VeriModule *mod ;&lt;br /&gt;
    MapIter mi ;&lt;br /&gt;
    FOREACH_VERILOG_MODULE(mi, mod) {&lt;br /&gt;
        if (!mod) continue ;&lt;br /&gt;
        std::cout &amp;lt;&amp;lt; &amp;quot;\n-- Processing module &amp;quot; &amp;lt;&amp;lt; mod-&amp;gt;GetName() &amp;lt;&amp;lt; std::endl ;&lt;br /&gt;
        mod-&amp;gt;Accept(m_obj) ;&lt;br /&gt;
#ifdef VERILOG_PRESERVE_CREATION_INIT_VALUE_OF_PARAMS&lt;br /&gt;
        std::cout &amp;lt;&amp;lt; &amp;quot;--&amp;gt; Calling StaticEvaluateCreationInitValuesOfParams on &amp;quot; &amp;lt;&amp;lt; mod-&amp;gt;GetName() &amp;lt;&amp;lt; std::endl ;&lt;br /&gt;
        mod-&amp;gt;StaticEvaluateCreationInitValuesOfParams() ;&lt;br /&gt;
        mod-&amp;gt;Accept(m_obj) ; &lt;br /&gt;
        if (mod-&amp;gt;ResetStaticEvaluatedCreationInitValuesOfParams()) {&lt;br /&gt;
            std::cout &amp;lt;&amp;lt; &amp;quot;--&amp;gt; Successfully called ResetStaticEvaluatedCreationInitValuesOfParams on &amp;quot; &amp;lt;&amp;lt; mod-&amp;gt;GetName() &amp;lt;&amp;lt; std::endl ;&lt;br /&gt;
            mod-&amp;gt;Accept(m_obj) ; &lt;br /&gt;
        }&lt;br /&gt;
#endif&lt;br /&gt;
    }&lt;br /&gt;
    return 0 ;&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
input test.sv:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
module top ;&lt;br /&gt;
  parameter p1 = 3 ;&lt;br /&gt;
  parameter p2 = p1 + 3 ;&lt;br /&gt;
  parameter p3 = p2 + 4 ;&lt;br /&gt;
&lt;br /&gt;
  foo #(p2) I1() ;&lt;br /&gt;
  foo #(p3) I2() ;&lt;br /&gt;
endmodule&lt;br /&gt;
&lt;br /&gt;
module foo ;&lt;br /&gt;
   parameter p1 = 1 ;&lt;br /&gt;
   parameter p2 = p1 + 4 ;&lt;br /&gt;
endmodule&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output log:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
-- Analyzing Verilog file 'ex.sv' (VERI-1482)&lt;br /&gt;
ex.sv(2): INFO: compiling module 'top' (VERI-1018)&lt;br /&gt;
&lt;br /&gt;
-- Processing module top&lt;br /&gt;
-- Processing module top&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :3&lt;br /&gt;
--        Creation initial value :3&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :6&lt;br /&gt;
--        Creation initial value :(p1 + 3)&lt;br /&gt;
--    Param p3&lt;br /&gt;
--        Initial value :10&lt;br /&gt;
--        Creation initial value :(p2 + 4)&lt;br /&gt;
--&amp;gt; Calling StaticEvaluateCreationInitValuesOfParams on top&lt;br /&gt;
-- Processing module top&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :3&lt;br /&gt;
--        Creation initial value :3&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :6&lt;br /&gt;
--        Creation initial value :6&lt;br /&gt;
--    Param p3&lt;br /&gt;
--        Initial value :10&lt;br /&gt;
--        Creation initial value :10&lt;br /&gt;
&lt;br /&gt;
-- Processing module foo&lt;br /&gt;
-- Processing module foo&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :1&lt;br /&gt;
--        Creation initial value :1&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :(p1 + 4)&lt;br /&gt;
--        Creation initial value :(p1 + 4)&lt;br /&gt;
--&amp;gt; Calling StaticEvaluateCreationInitValuesOfParams on foo&lt;br /&gt;
-- Processing module foo&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :1&lt;br /&gt;
--        Creation initial value :1&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :(p1 + 4)&lt;br /&gt;
--        Creation initial value :5&lt;br /&gt;
--&amp;gt; Successfully called ResetStaticEvaluatedCreationInitValuesOfParams on foo&lt;br /&gt;
-- Processing module foo&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :1&lt;br /&gt;
--        Creation initial value :1&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :(p1 + 4)&lt;br /&gt;
--        Creation initial value :(p1 + 4)&lt;br /&gt;
&lt;br /&gt;
-- Processing module foo(p1=6)&lt;br /&gt;
-- Processing module foo(p1=6)&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :6&lt;br /&gt;
--        Creation initial value :1&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :10&lt;br /&gt;
--        Creation initial value :(p1 + 4)&lt;br /&gt;
--&amp;gt; Calling StaticEvaluateCreationInitValuesOfParams on foo(p1=6)&lt;br /&gt;
-- Processing module foo(p1=6)&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :6&lt;br /&gt;
--        Creation initial value :1&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :10&lt;br /&gt;
--        Creation initial value :5&lt;br /&gt;
&lt;br /&gt;
-- Processing module foo(p1=10)&lt;br /&gt;
-- Processing module foo(p1=10)&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :10&lt;br /&gt;
--        Creation initial value :1&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :14&lt;br /&gt;
--        Creation initial value :(p1 + 4)&lt;br /&gt;
--&amp;gt; Calling StaticEvaluateCreationInitValuesOfParams on foo(p1=10)&lt;br /&gt;
-- Processing module foo(p1=10)&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :10&lt;br /&gt;
--        Creation initial value :1&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :14&lt;br /&gt;
--        Creation initial value :5&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mohammad</name></author>	</entry>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=How_to_get_parameters_creation-time_initial_expression/value_after_Static_Elaboration&amp;diff=928</id>
		<title>How to get parameters creation-time initial expression/value after Static Elaboration</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=How_to_get_parameters_creation-time_initial_expression/value_after_Static_Elaboration&amp;diff=928"/>
				<updated>2025-02-19T21:57:35Z</updated>
		
		<summary type="html">&lt;p&gt;Mohammad: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;To ensure the proper functionality of this example, please enable the `VERILOG_PRESERVE_CREATION_INIT_VALUE_OF_PARAMS` compile flag. This flag is necessary because it adds a field to VeriParamId that stores the design-specified initial value.&lt;br /&gt;
&lt;br /&gt;
We cannot use GetInitialValue for this purpose, as its value is overwritten with the evaluated parameter value during Static Elaboration. However, the creation-time initial value added by the flag will remain unaffected by Static Elaboration.&lt;br /&gt;
&lt;br /&gt;
C++:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
#include &amp;quot;Map.h&amp;quot;            // Make class Map available&lt;br /&gt;
#include &amp;quot;veri_file.h&amp;quot;      // Make verilog reader available&lt;br /&gt;
#include &amp;quot;VeriModule.h&amp;quot;     // Definition of a VeriModule and VeriPrimitive&lt;br /&gt;
#include &amp;quot;VeriExpression.h&amp;quot; // Definition of a VeriExpression&lt;br /&gt;
#include &amp;quot;Array.h&amp;quot;          // Make class Array available&lt;br /&gt;
#include &amp;quot;VeriId.h&amp;quot;         // Definitions of all verilog identifier nodes&lt;br /&gt;
&lt;br /&gt;
#ifdef VERIFIC_NAMESPACE&lt;br /&gt;
using namespace Verific ;&lt;br /&gt;
#endif&lt;br /&gt;
class ExModuleVisit : public VeriVisitor&lt;br /&gt;
{&lt;br /&gt;
public :&lt;br /&gt;
    ExModuleVisit() {}&lt;br /&gt;
    virtual ~ExModuleVisit() {}&lt;br /&gt;
&lt;br /&gt;
    virtual void VERI_VISIT(VeriModule, node) &lt;br /&gt;
    {&lt;br /&gt;
        std::cout &amp;lt;&amp;lt; &amp;quot;-- Processing module &amp;quot; &amp;lt;&amp;lt; node.GetName() &amp;lt;&amp;lt; std::endl ;&lt;br /&gt;
        VeriVisitor::VERI_VISIT_NODE(VeriModule, node) ;&lt;br /&gt;
    }&lt;br /&gt;
    virtual void VERI_VISIT(VeriParamId, node)&lt;br /&gt;
    {&lt;br /&gt;
        std::cout &amp;lt;&amp;lt; &amp;quot;--    Param &amp;quot; &amp;lt;&amp;lt; node.GetName() &amp;lt;&amp;lt; std::endl ;&lt;br /&gt;
        VeriExpression *init_val = node.GetInitialValue() ;&lt;br /&gt;
        if (init_val) {&lt;br /&gt;
            std::cout &amp;lt;&amp;lt; &amp;quot;--        Initial value :&amp;quot; ;&lt;br /&gt;
            init_val-&amp;gt;PrettyPrint(std::cout, 0) ; std::cout &amp;lt;&amp;lt; std::endl ;&lt;br /&gt;
        }&lt;br /&gt;
#ifdef VERILOG_PRESERVE_CREATION_INIT_VALUE_OF_PARAMS&lt;br /&gt;
        // Compile flag &amp;quot;VERILOG_PRESERVE_CREATION_INIT_VALUE_OF_PARAMS&amp;quot; should be enabled to access creation-time initial value&lt;br /&gt;
        VeriExpression *creation_val = node.GetCreationInitialValue() ;&lt;br /&gt;
        if (creation_val) {&lt;br /&gt;
            std::cout &amp;lt;&amp;lt; &amp;quot;--        Creation initial value :&amp;quot; ;&lt;br /&gt;
            creation_val-&amp;gt;PrettyPrint(std::cout, 0) ; std::cout &amp;lt;&amp;lt; std::endl ;&lt;br /&gt;
        }&lt;br /&gt;
#endif&lt;br /&gt;
    }&lt;br /&gt;
} ;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char **argv)&lt;br /&gt;
{&lt;br /&gt;
    const char *file_name = 0 ;&lt;br /&gt;
    if (argc&amp;gt;1) {&lt;br /&gt;
        file_name = argv[1] ; // Set the file name as specified by the user&lt;br /&gt;
    } else {&lt;br /&gt;
        file_name = &amp;quot;test.sv&amp;quot; ; // Set default file name&lt;br /&gt;
    }&lt;br /&gt;
   &lt;br /&gt;
    if (!veri_file::Analyze(file_name, veri_file::SYSTEM_VERILOG)) return 1 ;&lt;br /&gt;
    &lt;br /&gt;
    // Return in case of failure.&lt;br /&gt;
    if (!veri_file::ElaborateStatic(&amp;quot;top&amp;quot;, &amp;quot;work&amp;quot;, 0)) {&lt;br /&gt;
        return 4 ;&lt;br /&gt;
    }&lt;br /&gt;
    ExModuleVisit m_obj ;                &lt;br /&gt;
    VeriModule *mod ;&lt;br /&gt;
    MapIter mi ;&lt;br /&gt;
    FOREACH_VERILOG_MODULE(mi, mod) {&lt;br /&gt;
        if (!mod) continue ;&lt;br /&gt;
        std::cout &amp;lt;&amp;lt; &amp;quot;\n-- Processing module &amp;quot; &amp;lt;&amp;lt; mod-&amp;gt;GetName() &amp;lt;&amp;lt; std::endl ;&lt;br /&gt;
        mod-&amp;gt;Accept(m_obj) ;&lt;br /&gt;
#ifdef VERILOG_PRESERVE_CREATION_INIT_VALUE_OF_PARAMS&lt;br /&gt;
        std::cout &amp;lt;&amp;lt; &amp;quot;--&amp;gt; Calling StaticEvaluateCreationInitValuesOfParams on &amp;quot; &amp;lt;&amp;lt; mod-&amp;gt;GetName() &amp;lt;&amp;lt; std::endl ;&lt;br /&gt;
        mod-&amp;gt;StaticEvaluateCreationInitValuesOfParams() ;&lt;br /&gt;
        mod-&amp;gt;Accept(m_obj) ; &lt;br /&gt;
        if (mod-&amp;gt;ResetStaticEvaluatedCreationInitValuesOfParams()) {&lt;br /&gt;
            std::cout &amp;lt;&amp;lt; &amp;quot;--&amp;gt; Successfully called ResetStaticEvaluatedCreationInitValuesOfParams on &amp;quot; &amp;lt;&amp;lt; mod-&amp;gt;GetName() &amp;lt;&amp;lt; std::endl ;&lt;br /&gt;
            mod-&amp;gt;Accept(m_obj) ; &lt;br /&gt;
        }&lt;br /&gt;
#endif&lt;br /&gt;
    }&lt;br /&gt;
    return 0 ;&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
input test.sv:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
module top ;&lt;br /&gt;
  parameter p1 = 3 ;&lt;br /&gt;
  parameter p2 = p1 + 3 ;&lt;br /&gt;
  parameter p3 = p2 + 4 ;&lt;br /&gt;
&lt;br /&gt;
  foo #(p2) I1() ;&lt;br /&gt;
  foo #(p3) I2() ;&lt;br /&gt;
endmodule&lt;br /&gt;
&lt;br /&gt;
module foo ;&lt;br /&gt;
   parameter p1 = 1 ;&lt;br /&gt;
   parameter p2 = p1 + 4 ;&lt;br /&gt;
endmodule&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output log:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
-- Analyzing Verilog file 'ex.sv' (VERI-1482)&lt;br /&gt;
ex.sv(2): INFO: compiling module 'top' (VERI-1018)&lt;br /&gt;
&lt;br /&gt;
-- Processing module top&lt;br /&gt;
-- Processing module top&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :3&lt;br /&gt;
--        Creation initial value :3&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :6&lt;br /&gt;
--        Creation initial value :(p1 + 3)&lt;br /&gt;
--    Param p3&lt;br /&gt;
--        Initial value :10&lt;br /&gt;
--        Creation initial value :(p2 + 4)&lt;br /&gt;
--&amp;gt; Calling StaticEvaluateCreationInitValuesOfParams on top&lt;br /&gt;
-- Processing module top&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :3&lt;br /&gt;
--        Creation initial value :3&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :6&lt;br /&gt;
--        Creation initial value :6&lt;br /&gt;
--    Param p3&lt;br /&gt;
--        Initial value :10&lt;br /&gt;
--        Creation initial value :10&lt;br /&gt;
&lt;br /&gt;
-- Processing module foo&lt;br /&gt;
-- Processing module foo&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :1&lt;br /&gt;
--        Creation initial value :1&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :(p1 + 4)&lt;br /&gt;
--        Creation initial value :(p1 + 4)&lt;br /&gt;
--&amp;gt; Calling StaticEvaluateCreationInitValuesOfParams on foo&lt;br /&gt;
-- Processing module foo&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :1&lt;br /&gt;
--        Creation initial value :1&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :(p1 + 4)&lt;br /&gt;
--        Creation initial value :5&lt;br /&gt;
--&amp;gt; Successfully called ResetStaticEvaluatedCreationInitValuesOfParams on foo&lt;br /&gt;
-- Processing module foo&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :1&lt;br /&gt;
--        Creation initial value :1&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :(p1 + 4)&lt;br /&gt;
--        Creation initial value :(p1 + 4)&lt;br /&gt;
&lt;br /&gt;
-- Processing module foo(p1=6)&lt;br /&gt;
-- Processing module foo(p1=6)&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :6&lt;br /&gt;
--        Creation initial value :1&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :10&lt;br /&gt;
--        Creation initial value :(p1 + 4)&lt;br /&gt;
--&amp;gt; Calling StaticEvaluateCreationInitValuesOfParams on foo(p1=6)&lt;br /&gt;
-- Processing module foo(p1=6)&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :6&lt;br /&gt;
--        Creation initial value :1&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :10&lt;br /&gt;
--        Creation initial value :5&lt;br /&gt;
&lt;br /&gt;
-- Processing module foo(p1=10)&lt;br /&gt;
-- Processing module foo(p1=10)&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :10&lt;br /&gt;
--        Creation initial value :1&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :14&lt;br /&gt;
--        Creation initial value :(p1 + 4)&lt;br /&gt;
--&amp;gt; Calling StaticEvaluateCreationInitValuesOfParams on foo(p1=10)&lt;br /&gt;
-- Processing module foo(p1=10)&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :10&lt;br /&gt;
--        Creation initial value :1&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :14&lt;br /&gt;
--        Creation initial value :5&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mohammad</name></author>	</entry>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=How_to_get_parameters_creation-time_initial_expression/value_after_Static_Elaboration&amp;diff=927</id>
		<title>How to get parameters creation-time initial expression/value after Static Elaboration</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=How_to_get_parameters_creation-time_initial_expression/value_after_Static_Elaboration&amp;diff=927"/>
				<updated>2025-02-19T20:58:25Z</updated>
		
		<summary type="html">&lt;p&gt;Mohammad: Created page with &amp;quot;C++:  &amp;lt;nowiki&amp;gt; #include &amp;lt;iostream&amp;gt; #include &amp;quot;Map.h&amp;quot;            // Make class Map available #include &amp;quot;veri_file.h&amp;quot;      // Make verilog reader available #include &amp;quot;VeriModule.h&amp;quot;...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;C++:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
#include &amp;quot;Map.h&amp;quot;            // Make class Map available&lt;br /&gt;
#include &amp;quot;veri_file.h&amp;quot;      // Make verilog reader available&lt;br /&gt;
#include &amp;quot;VeriModule.h&amp;quot;     // Definition of a VeriModule and VeriPrimitive&lt;br /&gt;
#include &amp;quot;VeriExpression.h&amp;quot; // Definition of a VeriExpression&lt;br /&gt;
#include &amp;quot;Array.h&amp;quot;          // Make class Array available&lt;br /&gt;
#include &amp;quot;VeriId.h&amp;quot;         // Definitions of all verilog identifier nodes&lt;br /&gt;
&lt;br /&gt;
#ifdef VERIFIC_NAMESPACE&lt;br /&gt;
using namespace Verific ;&lt;br /&gt;
#endif&lt;br /&gt;
class ExModuleVisit : public VeriVisitor&lt;br /&gt;
{&lt;br /&gt;
public :&lt;br /&gt;
    ExModuleVisit() {}&lt;br /&gt;
    virtual ~ExModuleVisit() {}&lt;br /&gt;
&lt;br /&gt;
    virtual void VERI_VISIT(VeriModule, node) &lt;br /&gt;
    {&lt;br /&gt;
        std::cout &amp;lt;&amp;lt; &amp;quot;-- Processing module &amp;quot; &amp;lt;&amp;lt; node.GetName() &amp;lt;&amp;lt; std::endl ;&lt;br /&gt;
        VeriVisitor::VERI_VISIT_NODE(VeriModule, node) ;&lt;br /&gt;
    }&lt;br /&gt;
    virtual void VERI_VISIT(VeriParamId, node)&lt;br /&gt;
    {&lt;br /&gt;
        std::cout &amp;lt;&amp;lt; &amp;quot;--    Param &amp;quot; &amp;lt;&amp;lt; node.GetName() &amp;lt;&amp;lt; std::endl ;&lt;br /&gt;
        VeriExpression *init_val = node.GetInitialValue() ;&lt;br /&gt;
        if (init_val) {&lt;br /&gt;
            std::cout &amp;lt;&amp;lt; &amp;quot;--        Initial value :&amp;quot; ;&lt;br /&gt;
            init_val-&amp;gt;PrettyPrint(std::cout, 0) ; std::cout &amp;lt;&amp;lt; std::endl ;&lt;br /&gt;
        }&lt;br /&gt;
#ifdef VERILOG_PRESERVE_CREATION_INIT_VALUE_OF_PARAMS&lt;br /&gt;
        // Compile flag &amp;quot;VERILOG_PRESERVE_CREATION_INIT_VALUE_OF_PARAMS&amp;quot; should be enabled to access creation-time initial value&lt;br /&gt;
        VeriExpression *creation_val = node.GetCreationInitialValue() ;&lt;br /&gt;
        if (creation_val) {&lt;br /&gt;
            std::cout &amp;lt;&amp;lt; &amp;quot;--        Creation initial value :&amp;quot; ;&lt;br /&gt;
            creation_val-&amp;gt;PrettyPrint(std::cout, 0) ; std::cout &amp;lt;&amp;lt; std::endl ;&lt;br /&gt;
        }&lt;br /&gt;
#endif&lt;br /&gt;
    }&lt;br /&gt;
} ;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char **argv)&lt;br /&gt;
{&lt;br /&gt;
    const char *file_name = 0 ;&lt;br /&gt;
    if (argc&amp;gt;1) {&lt;br /&gt;
        file_name = argv[1] ; // Set the file name as specified by the user&lt;br /&gt;
    } else {&lt;br /&gt;
        file_name = &amp;quot;test.sv&amp;quot; ; // Set default file name&lt;br /&gt;
    }&lt;br /&gt;
   &lt;br /&gt;
    if (!veri_file::Analyze(file_name, veri_file::SYSTEM_VERILOG)) return 1 ;&lt;br /&gt;
    &lt;br /&gt;
    // Return in case of failure.&lt;br /&gt;
    if (!veri_file::ElaborateStatic(&amp;quot;top&amp;quot;, &amp;quot;work&amp;quot;, 0)) {&lt;br /&gt;
        return 4 ;&lt;br /&gt;
    }&lt;br /&gt;
    ExModuleVisit m_obj ;                &lt;br /&gt;
    VeriModule *mod ;&lt;br /&gt;
    MapIter mi ;&lt;br /&gt;
    FOREACH_VERILOG_MODULE(mi, mod) {&lt;br /&gt;
        if (!mod) continue ;&lt;br /&gt;
        std::cout &amp;lt;&amp;lt; &amp;quot;\n-- Processing module &amp;quot; &amp;lt;&amp;lt; mod-&amp;gt;GetName() &amp;lt;&amp;lt; std::endl ;&lt;br /&gt;
        mod-&amp;gt;Accept(m_obj) ;&lt;br /&gt;
#ifdef VERILOG_PRESERVE_CREATION_INIT_VALUE_OF_PARAMS&lt;br /&gt;
        std::cout &amp;lt;&amp;lt; &amp;quot;--&amp;gt; Calling StaticEvaluateCreationInitValuesOfParams on &amp;quot; &amp;lt;&amp;lt; mod-&amp;gt;GetName() &amp;lt;&amp;lt; std::endl ;&lt;br /&gt;
        mod-&amp;gt;StaticEvaluateCreationInitValuesOfParams() ;&lt;br /&gt;
        mod-&amp;gt;Accept(m_obj) ; &lt;br /&gt;
        if (mod-&amp;gt;ResetStaticEvaluatedCreationInitValuesOfParams()) {&lt;br /&gt;
            std::cout &amp;lt;&amp;lt; &amp;quot;--&amp;gt; Successfully called ResetStaticEvaluatedCreationInitValuesOfParams on &amp;quot; &amp;lt;&amp;lt; mod-&amp;gt;GetName() &amp;lt;&amp;lt; std::endl ;&lt;br /&gt;
            mod-&amp;gt;Accept(m_obj) ; &lt;br /&gt;
        }&lt;br /&gt;
#endif&lt;br /&gt;
    }&lt;br /&gt;
    return 0 ;&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
input test.sv:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
module top ;&lt;br /&gt;
  parameter p1 = 3 ;&lt;br /&gt;
  parameter p2 = p1 + 3 ;&lt;br /&gt;
  parameter p3 = p2 + 4 ;&lt;br /&gt;
&lt;br /&gt;
  foo #(p2) I1() ;&lt;br /&gt;
  foo #(p3) I2() ;&lt;br /&gt;
endmodule&lt;br /&gt;
&lt;br /&gt;
module foo ;&lt;br /&gt;
   parameter p1 = 1 ;&lt;br /&gt;
   parameter p2 = p1 + 4 ;&lt;br /&gt;
endmodule&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output log:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
-- Analyzing Verilog file 'ex.sv' (VERI-1482)&lt;br /&gt;
ex.sv(2): INFO: compiling module 'top' (VERI-1018)&lt;br /&gt;
&lt;br /&gt;
-- Processing module top&lt;br /&gt;
-- Processing module top&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :3&lt;br /&gt;
--        Creation initial value :3&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :6&lt;br /&gt;
--        Creation initial value :(p1 + 3)&lt;br /&gt;
--    Param p3&lt;br /&gt;
--        Initial value :10&lt;br /&gt;
--        Creation initial value :(p2 + 4)&lt;br /&gt;
--&amp;gt; Calling StaticEvaluateCreationInitValuesOfParams on top&lt;br /&gt;
-- Processing module top&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :3&lt;br /&gt;
--        Creation initial value :3&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :6&lt;br /&gt;
--        Creation initial value :6&lt;br /&gt;
--    Param p3&lt;br /&gt;
--        Initial value :10&lt;br /&gt;
--        Creation initial value :10&lt;br /&gt;
&lt;br /&gt;
-- Processing module foo&lt;br /&gt;
-- Processing module foo&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :1&lt;br /&gt;
--        Creation initial value :1&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :(p1 + 4)&lt;br /&gt;
--        Creation initial value :(p1 + 4)&lt;br /&gt;
--&amp;gt; Calling StaticEvaluateCreationInitValuesOfParams on foo&lt;br /&gt;
-- Processing module foo&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :1&lt;br /&gt;
--        Creation initial value :1&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :(p1 + 4)&lt;br /&gt;
--        Creation initial value :5&lt;br /&gt;
--&amp;gt; Successfully called ResetStaticEvaluatedCreationInitValuesOfParams on foo&lt;br /&gt;
-- Processing module foo&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :1&lt;br /&gt;
--        Creation initial value :1&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :(p1 + 4)&lt;br /&gt;
--        Creation initial value :(p1 + 4)&lt;br /&gt;
&lt;br /&gt;
-- Processing module foo(p1=6)&lt;br /&gt;
-- Processing module foo(p1=6)&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :6&lt;br /&gt;
--        Creation initial value :1&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :10&lt;br /&gt;
--        Creation initial value :(p1 + 4)&lt;br /&gt;
--&amp;gt; Calling StaticEvaluateCreationInitValuesOfParams on foo(p1=6)&lt;br /&gt;
-- Processing module foo(p1=6)&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :6&lt;br /&gt;
--        Creation initial value :1&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :10&lt;br /&gt;
--        Creation initial value :5&lt;br /&gt;
&lt;br /&gt;
-- Processing module foo(p1=10)&lt;br /&gt;
-- Processing module foo(p1=10)&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :10&lt;br /&gt;
--        Creation initial value :1&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :14&lt;br /&gt;
--        Creation initial value :(p1 + 4)&lt;br /&gt;
--&amp;gt; Calling StaticEvaluateCreationInitValuesOfParams on foo(p1=10)&lt;br /&gt;
-- Processing module foo(p1=10)&lt;br /&gt;
--    Param p1&lt;br /&gt;
--        Initial value :10&lt;br /&gt;
--        Creation initial value :1&lt;br /&gt;
--    Param p2&lt;br /&gt;
--        Initial value :14&lt;br /&gt;
--        Creation initial value :5&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mohammad</name></author>	</entry>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=Main_Page&amp;diff=926</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=Main_Page&amp;diff=926"/>
				<updated>2025-02-19T20:38:57Z</updated>
		
		<summary type="html">&lt;p&gt;Mohammad: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''General'''&lt;br /&gt;
* [[How to get best support from Verific | '''''How to get best support from Verific''''']]&lt;br /&gt;
* [[Source code customization &amp;amp; Stable release services | Source code customization &amp;amp; Stable release services]]&lt;br /&gt;
* [[How to save computer resources | How to save computer resources (memory consumption &amp;amp; runtime)]]&lt;br /&gt;
* [[Original RTL language | How do I know what language a Netlist in the netlist database comes from?]]&lt;br /&gt;
* [[Verific data structures | What are the data structures in Verific?]]&lt;br /&gt;
* [[Remove Verific data structures | How do I remove all Verific data structures in memory?]]&lt;br /&gt;
* [[Does Verific build CDFG? | Does Verific build control and data flow graph (CDFG)?]]&lt;br /&gt;
* [[Does Verific support XMR?| Does Verific support cross module references (XMR)?]]&lt;br /&gt;
* [[Compile-time/run-time flags | Are there options to control Verific software's behavior? Compile-time &amp;amp; run-time flags.]]&lt;br /&gt;
* [[Message handling | How do I downgrade/upgrade messages from Verific? How do I get messages with more details?]]&lt;br /&gt;
* [[Release version | How do I tell the version of a Verific software release? ]]&lt;br /&gt;
* [[Simulation models for Verific primitives | Where do I find simulation models for Verific primitives (VERIFIC_XOR, VERIFIC_DFFRS, ....)? ]]&lt;br /&gt;
* [[Tcl library path| How to correct building (linking) issue &amp;quot;/usr/bin/ld: cannot find -ltcl&amp;quot;]]&lt;br /&gt;
* [[LineFile data from input files | LineFile data from input files]]&lt;br /&gt;
* [[Difference between RTL and gate-level simulations - Flipflop with async set and async reset | Difference between RTL and gate-level simulations - Flipflop with async set and async reset]]&lt;br /&gt;
* [[Preserving user nets - preventing nets from being optimized away | Preserving user nets - preventing nets from being optimized away]]&lt;br /&gt;
* [[Python pretty-printer for gdb | Python pretty-printer for gdb]]&lt;br /&gt;
* [[Yosys-Verific Integration | Yosys-Verific integration]]&lt;br /&gt;
* [[How to enable long paths on Windows? | How to enable long paths on Windows?]]&lt;br /&gt;
&lt;br /&gt;
'''Input: VHDL, Verilog (and SystemVerilog), Liberty, EDIF'''&lt;br /&gt;
* [[How to get all Verilog files being analyzed | Verilog: I'm using -v, -y, .... After Verific is done with the analysis, how do I get a list of all the files being analyzed?]]&lt;br /&gt;
* [[Included files associated with a Verilog source file | Verilog: How do I get the list of included files associated with a Verilog source file?]]&lt;br /&gt;
* [[How to get type/initial value of parameters | Verilog: How to get type/initial value of parameters.]]&lt;br /&gt;
* [[Verilog ports being renamed | Verilog: Port Expressions]]&lt;br /&gt;
* [[Design with System Verilog and Verilog 2001 files | Verilog: For a design consisting of a mixture of Verilog 2001 and SystemVerilog input files, should I parse all the files as SystemVerilog?]]&lt;br /&gt;
* [[How to get module ports from Verilog parsetree | Verilog: From the Verilog parsetree, how can I get the ports of a module?]]&lt;br /&gt;
* [[How to change name of id in Verilog parsetree | Verilog: How do I change the name of an id (VeriidDef) in Verilog parsetree?]]&lt;br /&gt;
* [[How to get library containing nested module | Verilog: How do I get nested modules and get the library that contains the nested module?]]&lt;br /&gt;
* [[How to get linefile information of macro definitions | Verilog: How do I get linefile information of macro definitions?]]&lt;br /&gt;
* [[How to find port dimensions | Verilog: How do I get port dimensions?]]&lt;br /&gt;
* [[Instance - Module binding order | Verilog: What is the order of binding modules to instances?]]&lt;br /&gt;
* [[How Verific elaborator handles blackboxes/unknown boxes | Verilog: How Verific elaborator handles blackboxes/unknown boxes]]&lt;br /&gt;
* [[Constant expression replacement | Verilog: Does Verific replace constant expressions with their respective values?]]&lt;br /&gt;
* [[Modules with '_1' '_2' suffix in their names | Verilog: After static elaboration, there are modules with &amp;quot;_1&amp;quot;, &amp;quot;_2&amp;quot;, ..., suffix in their names. Why?]]&lt;br /&gt;
* [[Defined macros become undefined - MFCU vs SFCU | SystemVerilog: Why does Verific complain about undefined macros for macros defined in a different file (Compilation Unit)?]]&lt;br /&gt;
* [[Notes on analysis | SystemVerilog: Notes on analysis]]&lt;br /&gt;
* [[How to get enums from Verilog parsetree | SystemVerilog: From the parsetree, how can I get the enums declared in a module?]]&lt;br /&gt;
* [[How to identify packages being imported into a module | SystemVerilog: How do I identify packages being imported into a module?]]&lt;br /&gt;
* [[SystemVerilog &amp;quot;std&amp;quot; package | SystemVerilog: Support for SystemVerilog semaphore/process/mailbox constructs.]]&lt;br /&gt;
* [[Top level module with interface ports | SystemVerilog: Support for SystemVerilog top level module with interface ports.]]&lt;br /&gt;
* [[Design with VHDL-1993 and VHDL-2008 files | VHDL: VHDL-1993 and VHDL-2008 each has its own IEEE library set. How do I analyze/elaborate a design with a mixture of files of different VHDL dialects (1993 and 2008)?]]&lt;br /&gt;
* [[Escaped identifiers in RTL files and in Verific data structures | Verilog/VHDL: Escaped identifiers in RTL files and in Verific data structures]]&lt;br /&gt;
* [[Prettyprint to a string | Verilog/VHDL: How to prettyprint a parsetree node to a string.]]&lt;br /&gt;
* [[Static elaboration | Verilog/VHDL: What does 'static elaboration' do?]]&lt;br /&gt;
* [[How to ignore a (not used) parameter/generic in elaboration. | Verilog/VHDL: How to ignore a (not used) parameter/generic in elaboration.]]&lt;br /&gt;
* [[What VeriModule* or VhdlPrimaryUnit* the Netlist comes from? | Verilog/VHDL: For a Netlist in the netlist database, is there a clean way to look back at what VeriModule* or VhdlPrimaryUnit* the Netlist was derived from?]]&lt;br /&gt;
* [[Cross-reference between the original RTL files and the elaborated netlist | Verilog/VHDL: Is there a way to cross-reference between the original RTL design files and the elaboration netlist?]]&lt;br /&gt;
* [[How to ignore parameters/generics in elaboration | Verilog/VHDL: Is there a way to tell the elaborator to ignore certain parameters/generics so that the unit/module is not uniquified?]]&lt;br /&gt;
* [[How to check for errors in analysis/elaboration | Verilog/VHDL: Is there a way to tell if the analysis/elaboration process has errors?]]&lt;br /&gt;
* [[Modules/design units with &amp;quot;_default&amp;quot; suffix in their names | Verilog/VHDL: After static elaboration, there are modules/design units/interfaces with &amp;quot;_default&amp;quot; or &amp;quot;or &amp;quot;_1, _2&amp;quot; suffix in their names. What are they?]]&lt;br /&gt;
* [[How to parse a string | Verilog/VHDL: How to parse a string - Example of adding a module to the parsetree]]&lt;br /&gt;
* [[Support IEEE 1735 encryption standard | Verilog/VHDL: Does Verific support IEEE 1735 encryption standard?]]&lt;br /&gt;
'''Netlist Database'''&lt;br /&gt;
* [[Logic optimization across hierarchy boundaries | Netlist Database: Does Verific perform logic optimization across hierarchy boundaries?]]&lt;br /&gt;
* [[Bit-blasting a multi-port RAM instance | Netlist Database: Bit-blasting a multi-port RAM instance]]&lt;br /&gt;
* [[System attributes | Netlist Database: System attributes]]&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
* [[Output file formats | What language formats does Verific support as output?]]&lt;br /&gt;
&lt;br /&gt;
'''Scripting languages: TCL, Perl, Python'''&lt;br /&gt;
* [[What languages can I use with Verific software? | What programming languages can I use with Verific software?]]&lt;br /&gt;
&lt;br /&gt;
'''Code examples'''&lt;br /&gt;
* [[How to use RegisterCallBackMsg() | Util/C++: How to use RegisterCallBackMsg()]]&lt;br /&gt;
* [[How to use MessageCallBackHandler Class | Util/C++: How to use MessageCallBackHandler Class]]&lt;br /&gt;
* [[How to use RegisterPragmaRefCallBack() | Util/C++: How to use RegisterPragmaRefCallBack()]]&lt;br /&gt;
* [[Write out an encrypted netlist | Database/C++: Write out an encrypted netlist]]&lt;br /&gt;
* [[Extract clock enable | Database/C++: Extract clock enable]]&lt;br /&gt;
* [[Black box, empty box, and unknown box | Database/C++: Black box, empty box, and unknown box]]&lt;br /&gt;
* [[Post processing port resolution of black boxes | Database/C++: Post processing port resolution of black boxes]]&lt;br /&gt;
* [[Finding hierarchical paths of a Netlist | Database/C++: Finding hierarchical paths of a Netlist]]&lt;br /&gt;
* [[Replacing Verific built-in primitives/operators with user implementations | Database/C++: Replacing Verific built-in primitives/operators with user implementations]]&lt;br /&gt;
* [[Hierarchy tree RTL elaboration | Database/Perl: Simple example of hierarchy tree elaboration]]&lt;br /&gt;
* [[Create a Netlist Database from scratch (not from RTL elaboration) | Database/Perl/TCL: Create a Netlist Database from scratch (not from RTL elaboration)]]&lt;br /&gt;
* [[Buffering signals and ungrouping | Database/Verilog: Buffering signals and ungrouping (flattening) in the Netlist Database]]&lt;br /&gt;
* [[Memory elements of a RamNet | Database/Verilog/C++: Memory elements of a RamNet]]&lt;br /&gt;
* [[Process -f file and explore the Netlist Database (C++)| Database/Verilog/C++: Process -f file and explore the Netlist Database]]&lt;br /&gt;
* [[Process -f file and explore the Netlist Database (py)| Database/Verilog/Python: Process -f file and explore the Netlist Database]]&lt;br /&gt;
* [[Fanout cone and grouping | Database/Verilog/Perl: Fanout cone and grouping in the Netlist Database]]&lt;br /&gt;
* [[Type Range example | Database/Verilog/C++: Type Range example  (simple)]]&lt;br /&gt;
* [[Type Range example with multi-dimensional arrays| Database/Verilog/C++/Perl: Type Range example with multi-dimensional arrays]]&lt;br /&gt;
* [[Using TypeRange table to retrieve the originating type-range for an id | Database/Verilog/C++: Using TypeRange table to retrieve the originating type-range for an id]]&lt;br /&gt;
* [[Simple example of visitor pattern | Verilog/C++: Simple examples of visitor pattern]]&lt;br /&gt;
* [[Statically elaborate with different values of parameters | Verilog/C++: Statically elaborate with different values of parameters]]&lt;br /&gt;
* [[Prettyprint all modules in the design hierarchy | Verilog/C++: Prettyprint all modules in the design hierarchy]]&lt;br /&gt;
* [[Getting instances' parameters | Verilog/C++: Getting instances' parameters]]&lt;br /&gt;
* [[Accessing and evaluating module's parameters | Verilog/C++: Accessing and evaluating module's parameters]]&lt;br /&gt;
* [[Visiting Hierarchical References (VeriSelectedName) | Verilog/C++: Visiting Hierarchical References (VeriSelectedName)]]&lt;br /&gt;
* [[Using stream input to ignore input file | Verilog/C++: Using stream input to ignore input file]]&lt;br /&gt;
* [[How to ignore certain modules while analyzing input RTL files | Verilog/C++: How to ignore certain modules while analyzing input RTL files]]&lt;br /&gt;
* [[How to tell if a module has encrypted contents | Verilog/C++: How to tell if a module has encrypted contents]]&lt;br /&gt;
* [[Comment out a line using text based design modification and parsetree modification | Verilog/C++: Comment out a line using text-based design modification and parsetree modification]] &lt;br /&gt;
* [[Verilog/C++: How to use IsUserDeclared() : Example for port associations]]&lt;br /&gt;
* [[How to create new module in Verilog parsetree | Verilog/C++: How to create new module in Verilog parsetree]]&lt;br /&gt;
* [[In Verilog parsetree adding names to unnamed instances | Verilog/C++: In Verilog parsetree adding names to unnamed instances]]&lt;br /&gt;
* [[How to get full hierarchy ID path | Verilog/C++: How to get full hierarchy ID path]]&lt;br /&gt;
* [[How to traverse scope hierarchy | Verilog/C++: How to traverse scope hierarchy]]&lt;br /&gt;
* [[Access attributes in parsetree | Verilog/C++: How to access attributes in parsetree]]&lt;br /&gt;
* [[How to detect multiple-clock-edge condition in Verilog parsetree | Verilog/C++: How to detect multiple-clock-edge condition in Verilog parsetree]]&lt;br /&gt;
* [[How to get driving net of an instance | Verilog/C++: How to get driving net of an instance]]&lt;br /&gt;
* [[Parse select modules only and ignore the rest | Verilog/C++: Parse select modules only and ignore the rest]]&lt;br /&gt;
* [[Create DOT diagram of parse tree | Verilog/C++: Create DOT diagram of a parse tree]]&lt;br /&gt;
* [[How to get parameters creation-time initial expression/value after Static Elaboration | Verilog/C++: How to get parameters creation-time initial expression/value after Static Elaboration]]&lt;br /&gt;
* [[How to get linefile data of macros - Macro callback function | Verilog/C++/Perl/Python: How to get linefile data of macros - Macro callback function]]&lt;br /&gt;
* [[Where in RTL does it get assigned? | Verilog/C++/Perl/Python: Where in RTL does it get assigned?]]&lt;br /&gt;
* [[Access attributes of ports in parsetree | Verilog/Perl: Access attributes of ports in parsetree and from netlist]]&lt;br /&gt;
* [[Evaluate 'for-generate' loop | Verilog/C++: Evaluate 'for-generate' loop]]&lt;br /&gt;
* [[Retrieve package name for user-defined variable types | SystemVerilog/C++/Python: Retrieve package name for user-defined variable types]]&lt;br /&gt;
* [[Pretty-print a module and the packages imported by the module | SystemVerilog/C++: Pretty-print a module and the packages imported by the module]]&lt;br /&gt;
* [[How to get packed dimensions of enum | SystemVerilog/C++: How to get packed dimensions of enum]]&lt;br /&gt;
* [[How to replace a statement that has a label | SystemVerilog/C++: How to replace a statement that has a label]]&lt;br /&gt;
* [[How to insert/add a statement, or a module item, into a sequential block and a generate block | SystemVerilog/C++: How to insert/add a statement, or a module item, into a sequential block and a generate block]]&lt;br /&gt;
* [[Simple examples of VHDL visitor pattern | VHDL/C++: Simple examples of VHDL visitor pattern]]&lt;br /&gt;
* [[Traverse instances in parsetree | VHDL/C++: Traverse instances in parsetree]]&lt;br /&gt;
* [[Parsing from data in memory | Verilog/VHDL/C++: Parsing from data in memory]]&lt;br /&gt;
&lt;br /&gt;
'''INVIO Code examples'''&lt;br /&gt;
* [[Simple port modification | SystemVerilog/Python: Simple port modification]]&lt;/div&gt;</summary>
		<author><name>Mohammad</name></author>	</entry>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=How_to_enable_long_paths_on_Windows%3F&amp;diff=925</id>
		<title>How to enable long paths on Windows?</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=How_to_enable_long_paths_on_Windows%3F&amp;diff=925"/>
				<updated>2024-12-11T05:27:53Z</updated>
		
		<summary type="html">&lt;p&gt;Mohammad: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Historically, operating systems used to have limitations of maximum path length.&lt;br /&gt;
For example, when an absolute path is required, the full path couldn't exceed this size.&lt;br /&gt;
&lt;br /&gt;
Most modern operating systems and file systems have removed this limitation.&lt;br /&gt;
Verific does not have this limitation and is dependent on the host OS. Windows and its applications do not support long paths, by default. So, it may need some setup to enable support for the long paths. &lt;br /&gt;
&lt;br /&gt;
If long paths are not enabled on Windows, we will fail to open/read a file with a long path name which will produce errors.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To enable long path name support, you need to have '''both''' of the following set to be able to read a file with a long path name:&lt;br /&gt;
&lt;br /&gt;
(1) Property '''''LongPathsEnabled''''' should be set to 1 under the following registry entry:&lt;br /&gt;
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\&lt;br /&gt;
&lt;br /&gt;
(2) During compilation/building, longPathAware element should be set to true. The application manifest must also include the longPathAware element. &lt;br /&gt;
Add the following to the manifest file:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;application xmlns=&amp;quot;urn:schemas-microsoft-com:asm.v3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;windowsSettings xmlns:ws2=&amp;quot;http://schemas.microsoft.com/SMI/2016/WindowsSettings&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;ws2:longPathAware&amp;gt;true&amp;lt;/ws2:longPathAware&amp;gt;&lt;br /&gt;
    &amp;lt;/windowsSettings&amp;gt;&lt;br /&gt;
&amp;lt;/application&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more details on enabling long paths on Windows, please refer to these links:&lt;br /&gt;
&lt;br /&gt;
https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry#enable-long-paths-in-windows-10-version-1607-and-later&lt;br /&gt;
&lt;br /&gt;
https://stackoverflow.com/questions/53918205/how-to-enable-long-path-aware-behavior-via-manifest-in-a-c-executable&lt;br /&gt;
&lt;br /&gt;
https://stackoverflow.com/questions/6829691/opening-long-file-names-in-windows-using-fopen-with-c&lt;/div&gt;</summary>
		<author><name>Mohammad</name></author>	</entry>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=How_to_enable_long_paths_on_Windows%3F&amp;diff=924</id>
		<title>How to enable long paths on Windows?</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=How_to_enable_long_paths_on_Windows%3F&amp;diff=924"/>
				<updated>2024-12-11T05:27:16Z</updated>
		
		<summary type="html">&lt;p&gt;Mohammad: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Historically, operating systems used to have limitations of maximum path length.&lt;br /&gt;
For example, when an absolute path is required, the full path couldn't exceed this size.&lt;br /&gt;
&lt;br /&gt;
Most modern operating systems and file systems have removed this limitation.&lt;br /&gt;
Verific does not have this limitation and is dependent on the host OS. Windows and its applications do not support long paths, by default. So, it may need some setup to enable support for the long paths. &lt;br /&gt;
&lt;br /&gt;
If long paths are not enabled on Windows, we will fail to open/read a file with a long path name which will produce errors.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To enable long path name support, you need to have '''both''' of the following set to be able to read a file with a long path name:&lt;br /&gt;
&lt;br /&gt;
(1) Property ''LongPathsEnabled'' should be set to 1 under the following registry entry:&lt;br /&gt;
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\&lt;br /&gt;
&lt;br /&gt;
(2) During compilation/building, longPathAware element should be set to true. The application manifest must also include the longPathAware element. &lt;br /&gt;
Add the following to the manifest file:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;application xmlns=&amp;quot;urn:schemas-microsoft-com:asm.v3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;windowsSettings xmlns:ws2=&amp;quot;http://schemas.microsoft.com/SMI/2016/WindowsSettings&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;ws2:longPathAware&amp;gt;true&amp;lt;/ws2:longPathAware&amp;gt;&lt;br /&gt;
    &amp;lt;/windowsSettings&amp;gt;&lt;br /&gt;
&amp;lt;/application&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more details on enabling long paths on Windows, please refer to these links:&lt;br /&gt;
&lt;br /&gt;
https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry#enable-long-paths-in-windows-10-version-1607-and-later&lt;br /&gt;
&lt;br /&gt;
https://stackoverflow.com/questions/53918205/how-to-enable-long-path-aware-behavior-via-manifest-in-a-c-executable&lt;br /&gt;
&lt;br /&gt;
https://stackoverflow.com/questions/6829691/opening-long-file-names-in-windows-using-fopen-with-c&lt;/div&gt;</summary>
		<author><name>Mohammad</name></author>	</entry>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=How_to_enable_long_paths_on_Windows%3F&amp;diff=923</id>
		<title>How to enable long paths on Windows?</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=How_to_enable_long_paths_on_Windows%3F&amp;diff=923"/>
				<updated>2024-12-09T22:49:44Z</updated>
		
		<summary type="html">&lt;p&gt;Mohammad: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Historically, operating systems used to have limitations of maximum path length.&lt;br /&gt;
For example, when an absolute path is required, the full path couldn't exceed this size.&lt;br /&gt;
&lt;br /&gt;
Most modern operating systems and file systems have removed this limitation.&lt;br /&gt;
Verific has removed this limitation but Windows still needs some setup to enable long paths. &lt;br /&gt;
&lt;br /&gt;
If long paths are not enabled on Windows, we will fail to open/read a file with a long path name which will produce errors.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To enable long path name support, you need to have '''both''' of the following set to be able to read a file with a long path name:&lt;br /&gt;
&lt;br /&gt;
(1) Property LongPathsEnabled should be set to 1 under the following registry entry:&lt;br /&gt;
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\&lt;br /&gt;
&lt;br /&gt;
(2) During compilation/building, longPathAware element should be set to true. The application manifest must also include the longPathAware element. &lt;br /&gt;
Add the following to the manifest file:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;application xmlns=&amp;quot;urn:schemas-microsoft-com:asm.v3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;windowsSettings xmlns:ws2=&amp;quot;http://schemas.microsoft.com/SMI/2016/WindowsSettings&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;ws2:longPathAware&amp;gt;true&amp;lt;/ws2:longPathAware&amp;gt;&lt;br /&gt;
    &amp;lt;/windowsSettings&amp;gt;&lt;br /&gt;
&amp;lt;/application&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more details on enabling long paths on Windows, please refer to these links:&lt;br /&gt;
&lt;br /&gt;
https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry#enable-long-paths-in-windows-10-version-1607-and-later&lt;br /&gt;
&lt;br /&gt;
https://stackoverflow.com/questions/53918205/how-to-enable-long-path-aware-behavior-via-manifest-in-a-c-executable&lt;br /&gt;
&lt;br /&gt;
https://stackoverflow.com/questions/6829691/opening-long-file-names-in-windows-using-fopen-with-c&lt;/div&gt;</summary>
		<author><name>Mohammad</name></author>	</entry>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=How_to_enable_long_paths_on_Windows%3F&amp;diff=922</id>
		<title>How to enable long paths on Windows?</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=How_to_enable_long_paths_on_Windows%3F&amp;diff=922"/>
				<updated>2024-12-09T22:49:10Z</updated>
		
		<summary type="html">&lt;p&gt;Mohammad: Created page with &amp;quot;Historically, operating systems used to have limitations of maximum path length. For example, when an absolute path is required, the full path cannot exceed this size.  Most m...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Historically, operating systems used to have limitations of maximum path length.&lt;br /&gt;
For example, when an absolute path is required, the full path cannot exceed this size.&lt;br /&gt;
&lt;br /&gt;
Most modern operating systems and file systems have removed this limitation.&lt;br /&gt;
Verific has removed this limitation but Windows still needs some setup to enable long paths. &lt;br /&gt;
&lt;br /&gt;
If long paths are not enabled on Windows, we will fail to open/read a file with a long path name which will produce errors.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To enable long path name support, you need to have '''both''' of the following set to be able to read a file with a long path name:&lt;br /&gt;
&lt;br /&gt;
(1) Property LongPathsEnabled should be set to 1 under the following registry entry:&lt;br /&gt;
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\&lt;br /&gt;
&lt;br /&gt;
(2) During compilation/building, longPathAware element should be set to true. The application manifest must also include the longPathAware element. &lt;br /&gt;
Add the following to the manifest file:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;application xmlns=&amp;quot;urn:schemas-microsoft-com:asm.v3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;windowsSettings xmlns:ws2=&amp;quot;http://schemas.microsoft.com/SMI/2016/WindowsSettings&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;ws2:longPathAware&amp;gt;true&amp;lt;/ws2:longPathAware&amp;gt;&lt;br /&gt;
    &amp;lt;/windowsSettings&amp;gt;&lt;br /&gt;
&amp;lt;/application&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more details on enabling long paths on Windows, please refer to these links:&lt;br /&gt;
&lt;br /&gt;
https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry#enable-long-paths-in-windows-10-version-1607-and-later&lt;br /&gt;
&lt;br /&gt;
https://stackoverflow.com/questions/53918205/how-to-enable-long-path-aware-behavior-via-manifest-in-a-c-executable&lt;br /&gt;
&lt;br /&gt;
https://stackoverflow.com/questions/6829691/opening-long-file-names-in-windows-using-fopen-with-c&lt;/div&gt;</summary>
		<author><name>Mohammad</name></author>	</entry>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=Main_Page&amp;diff=921</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=Main_Page&amp;diff=921"/>
				<updated>2024-12-09T21:37:14Z</updated>
		
		<summary type="html">&lt;p&gt;Mohammad: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''General'''&lt;br /&gt;
* [[How to get best support from Verific | '''''How to get best support from Verific''''']]&lt;br /&gt;
* [[Source code customization &amp;amp; Stable release services | Source code customization &amp;amp; Stable release services]]&lt;br /&gt;
* [[How to save computer resources | How to save computer resources (memory consumption &amp;amp; runtime)]]&lt;br /&gt;
* [[Original RTL language | How do I know what language a Netlist in the netlist database comes from?]]&lt;br /&gt;
* [[Verific data structures | What are the data structures in Verific?]]&lt;br /&gt;
* [[Remove Verific data structures | How do I remove all Verific data structures in memory?]]&lt;br /&gt;
* [[Does Verific build CDFG? | Does Verific build control and data flow graph (CDFG)?]]&lt;br /&gt;
* [[Does Verific support XMR?| Does Verific support cross module references (XMR)?]]&lt;br /&gt;
* [[Compile-time/run-time flags | Are there options to control Verific software's behavior? Compile-time &amp;amp; run-time flags.]]&lt;br /&gt;
* [[Message handling | How do I downgrade/upgrade messages from Verific? How do I get messages with more details?]]&lt;br /&gt;
* [[Release version | How do I tell the version of a Verific software release? ]]&lt;br /&gt;
* [[Simulation models for Verific primitives | Where do I find simulation models for Verific primitives (VERIFIC_XOR, VERIFIC_DFFRS, ....)? ]]&lt;br /&gt;
* [[Tcl library path| How to correct building (linking) issue &amp;quot;/usr/bin/ld: cannot find -ltcl&amp;quot;]]&lt;br /&gt;
* [[LineFile data from input files | LineFile data from input files]]&lt;br /&gt;
* [[Difference between RTL and gate-level simulations - Flipflop with async set and async reset | Difference between RTL and gate-level simulations - Flipflop with async set and async reset]]&lt;br /&gt;
* [[Preserving user nets - preventing nets from being optimized away | Preserving user nets - preventing nets from being optimized away]]&lt;br /&gt;
* [[Python pretty-printer for gdb | Python pretty-printer for gdb]]&lt;br /&gt;
* [[Yosys-Verific Integration | Yosys-Verific integration]]&lt;br /&gt;
* [[How to enable long paths on Windows? | How to enable long paths on Windows?]]&lt;br /&gt;
&lt;br /&gt;
'''Input: VHDL, Verilog (and SystemVerilog), Liberty, EDIF'''&lt;br /&gt;
* [[How to get all Verilog files being analyzed | Verilog: I'm using -v, -y, .... After Verific is done with the analysis, how do I get a list of all the files being analyzed?]]&lt;br /&gt;
* [[Included files associated with a Verilog source file | Verilog: How do I get the list of included files associated with a Verilog source file?]]&lt;br /&gt;
* [[How to get type/initial value of parameters | Verilog: How to get type/initial value of parameters.]]&lt;br /&gt;
* [[Verilog ports being renamed | Verilog: Port Expressions]]&lt;br /&gt;
* [[Design with System Verilog and Verilog 2001 files | Verilog: For a design consisting of a mixture of Verilog 2001 and SystemVerilog input files, should I parse all the files as SystemVerilog?]]&lt;br /&gt;
* [[How to get module ports from Verilog parsetree | Verilog: From the Verilog parsetree, how can I get the ports of a module?]]&lt;br /&gt;
* [[How to change name of id in Verilog parsetree | Verilog: How do I change the name of an id (VeriidDef) in Verilog parsetree?]]&lt;br /&gt;
* [[How to get library containing nested module | Verilog: How do I get nested modules and get the library that contains the nested module?]]&lt;br /&gt;
* [[How to get linefile information of macro definitions | Verilog: How do I get linefile information of macro definitions?]]&lt;br /&gt;
* [[How to find port dimensions | Verilog: How do I get port dimensions?]]&lt;br /&gt;
* [[Instance - Module binding order | Verilog: What is the order of binding modules to instances?]]&lt;br /&gt;
* [[How Verific elaborator handles blackboxes/unknown boxes | Verilog: How Verific elaborator handles blackboxes/unknown boxes]]&lt;br /&gt;
* [[Constant expression replacement | Verilog: Does Verific replace constant expressions with their respective values?]]&lt;br /&gt;
* [[Modules with '_1' '_2' suffix in their names | Verilog: After static elaboration, there are modules with &amp;quot;_1&amp;quot;, &amp;quot;_2&amp;quot;, ..., suffix in their names. Why?]]&lt;br /&gt;
* [[Defined macros become undefined - MFCU vs SFCU | SystemVerilog: Why does Verific complain about undefined macros for macros defined in a different file (Compilation Unit)?]]&lt;br /&gt;
* [[Notes on analysis | SystemVerilog: Notes on analysis]]&lt;br /&gt;
* [[How to get enums from Verilog parsetree | SystemVerilog: From the parsetree, how can I get the enums declared in a module?]]&lt;br /&gt;
* [[How to identify packages being imported into a module | SystemVerilog: How do I identify packages being imported into a module?]]&lt;br /&gt;
* [[SystemVerilog &amp;quot;std&amp;quot; package | SystemVerilog: Support for SystemVerilog semaphore/process/mailbox constructs.]]&lt;br /&gt;
* [[Top level module with interface ports | SystemVerilog: Support for SystemVerilog top level module with interface ports.]]&lt;br /&gt;
* [[Design with VHDL-1993 and VHDL-2008 files | VHDL: VHDL-1993 and VHDL-2008 each has its own IEEE library set. How do I analyze/elaborate a design with a mixture of files of different VHDL dialects (1993 and 2008)?]]&lt;br /&gt;
* [[Escaped identifiers in RTL files and in Verific data structures | Verilog/VHDL: Escaped identifiers in RTL files and in Verific data structures]]&lt;br /&gt;
* [[Prettyprint to a string | Verilog/VHDL: How to prettyprint a parsetree node to a string.]]&lt;br /&gt;
* [[Static elaboration | Verilog/VHDL: What does 'static elaboration' do?]]&lt;br /&gt;
* [[How to ignore a (not used) parameter/generic in elaboration. | Verilog/VHDL: How to ignore a (not used) parameter/generic in elaboration.]]&lt;br /&gt;
* [[What VeriModule* or VhdlPrimaryUnit* the Netlist comes from? | Verilog/VHDL: For a Netlist in the netlist database, is there a clean way to look back at what VeriModule* or VhdlPrimaryUnit* the Netlist was derived from?]]&lt;br /&gt;
* [[Cross-reference between the original RTL files and the elaborated netlist | Verilog/VHDL: Is there a way to cross-reference between the original RTL design files and the elaboration netlist?]]&lt;br /&gt;
* [[How to ignore parameters/generics in elaboration | Verilog/VHDL: Is there a way to tell the elaborator to ignore certain parameters/generics so that the unit/module is not uniquified?]]&lt;br /&gt;
* [[How to check for errors in analysis/elaboration | Verilog/VHDL: Is there a way to tell if the analysis/elaboration process has errors?]]&lt;br /&gt;
* [[Modules/design units with &amp;quot;_default&amp;quot; suffix in their names | Verilog/VHDL: After static elaboration, there are modules/design units/interfaces with &amp;quot;_default&amp;quot; or &amp;quot;or &amp;quot;_1, _2&amp;quot; suffix in their names. What are they?]]&lt;br /&gt;
* [[How to parse a string | Verilog/VHDL: How to parse a string - Example of adding a module to the parsetree]]&lt;br /&gt;
* [[Support IEEE 1735 encryption standard | Verilog/VHDL: Does Verific support IEEE 1735 encryption standard?]]&lt;br /&gt;
'''Netlist Database'''&lt;br /&gt;
* [[Logic optimization across hierarchy boundaries | Netlist Database: Does Verific perform logic optimization across hierarchy boundaries?]]&lt;br /&gt;
* [[Bit-blasting a multi-port RAM instance | Netlist Database: Bit-blasting a multi-port RAM instance]]&lt;br /&gt;
* [[System attributes | Netlist Database: System attributes]]&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
* [[Output file formats | What language formats does Verific support as output?]]&lt;br /&gt;
&lt;br /&gt;
'''Scripting languages: TCL, Perl, Python'''&lt;br /&gt;
* [[What languages can I use with Verific software? | What programming languages can I use with Verific software?]]&lt;br /&gt;
&lt;br /&gt;
'''Code examples'''&lt;br /&gt;
* [[How to use RegisterCallBackMsg() | Util/C++: How to use RegisterCallBackMsg()]]&lt;br /&gt;
* [[How to use MessageCallBackHandler Class | Util/C++: How to use MessageCallBackHandler Class]]&lt;br /&gt;
* [[How to use RegisterPragmaRefCallBack() | Util/C++: How to use RegisterPragmaRefCallBack()]]&lt;br /&gt;
* [[Write out an encrypted netlist | Database/C++: Write out an encrypted netlist]]&lt;br /&gt;
* [[Extract clock enable | Database/C++: Extract clock enable]]&lt;br /&gt;
* [[Black box, empty box, and unknown box | Database/C++: Black box, empty box, and unknown box]]&lt;br /&gt;
* [[Post processing port resolution of black boxes | Database/C++: Post processing port resolution of black boxes]]&lt;br /&gt;
* [[Finding hierarchical paths of a Netlist | Database/C++: Finding hierarchical paths of a Netlist]]&lt;br /&gt;
* [[Replacing Verific built-in primitives/operators with user implementations | Database/C++: Replacing Verific built-in primitives/operators with user implementations]]&lt;br /&gt;
* [[Hierarchy tree RTL elaboration | Database/Perl: Simple example of hierarchy tree elaboration]]&lt;br /&gt;
* [[Create a Netlist Database from scratch (not from RTL elaboration) | Database/Perl/TCL: Create a Netlist Database from scratch (not from RTL elaboration)]]&lt;br /&gt;
* [[Buffering signals and ungrouping | Database/Verilog: Buffering signals and ungrouping (flattening) in the Netlist Database]]&lt;br /&gt;
* [[Memory elements of a RamNet | Database/Verilog/C++: Memory elements of a RamNet]]&lt;br /&gt;
* [[Process -f file and explore the Netlist Database (C++)| Database/Verilog/C++: Process -f file and explore the Netlist Database]]&lt;br /&gt;
* [[Process -f file and explore the Netlist Database (py)| Database/Verilog/Python: Process -f file and explore the Netlist Database]]&lt;br /&gt;
* [[Fanout cone and grouping | Database/Verilog/Perl: Fanout cone and grouping in the Netlist Database]]&lt;br /&gt;
* [[Type Range example | Database/Verilog/C++: Type Range example  (simple)]]&lt;br /&gt;
* [[Type Range example with multi-dimensional arrays| Database/Verilog/C++/Perl: Type Range example with multi-dimensional arrays]]&lt;br /&gt;
* [[Using TypeRange table to retrieve the originating type-range for an id | Database/Verilog/C++: Using TypeRange table to retrieve the originating type-range for an id]]&lt;br /&gt;
* [[Simple example of visitor pattern | Verilog/C++: Simple examples of visitor pattern]]&lt;br /&gt;
* [[Statically elaborate with different values of parameters | Verilog/C++: Statically elaborate with different values of parameters]]&lt;br /&gt;
* [[Prettyprint all modules in the design hierarchy | Verilog/C++: Prettyprint all modules in the design hierarchy]]&lt;br /&gt;
* [[Getting instances' parameters | Verilog/C++: Getting instances' parameters]]&lt;br /&gt;
* [[Accessing and evaluating module's parameters | Verilog/C++: Accessing and evaluating module's parameters]]&lt;br /&gt;
* [[Visiting Hierarchical References (VeriSelectedName) | Verilog/C++: Visiting Hierarchical References (VeriSelectedName)]]&lt;br /&gt;
* [[Using stream input to ignore input file | Verilog/C++: Using stream input to ignore input file]]&lt;br /&gt;
* [[How to ignore certain modules while analyzing input RTL files | Verilog/C++: How to ignore certain modules while analyzing input RTL files]]&lt;br /&gt;
* [[How to tell if a module has encrypted contents | Verilog/C++: How to tell if a module has encrypted contents]]&lt;br /&gt;
* [[Comment out a line using text based design modification and parsetree modification | Verilog/C++: Comment out a line using text-based design modification and parsetree modification]] &lt;br /&gt;
* [[Verilog/C++: How to use IsUserDeclared() : Example for port associations]]&lt;br /&gt;
* [[How to create new module in Verilog parsetree | Verilog/C++: How to create new module in Verilog parsetree]]&lt;br /&gt;
* [[In Verilog parsetree adding names to unnamed instances | Verilog/C++: In Verilog parsetree adding names to unnamed instances]]&lt;br /&gt;
* [[How to get full hierarchy ID path | Verilog/C++: How to get full hierarchy ID path]]&lt;br /&gt;
* [[How to traverse scope hierarchy | Verilog/C++: How to traverse scope hierarchy]]&lt;br /&gt;
* [[Access attributes in parsetree | Verilog/C++: How to access attributes in parsetree]]&lt;br /&gt;
* [[How to detect multiple-clock-edge condition in Verilog parsetree | Verilog/C++: How to detect multiple-clock-edge condition in Verilog parsetree]]&lt;br /&gt;
* [[How to get driving net of an instance | Verilog/C++: How to get driving net of an instance]]&lt;br /&gt;
* [[Parse select modules only and ignore the rest | Verilog/C++: Parse select modules only and ignore the rest]]&lt;br /&gt;
* [[Create DOT diagram of parse tree | Verilog/C++: Create DOT diagram of a parse tree]]&lt;br /&gt;
* [[How to get linefile data of macros - Macro callback function | Verilog/C++/Perl/Python: How to get linefile data of macros - Macro callback function]]&lt;br /&gt;
* [[Where in RTL does it get assigned? | Verilog/C++/Perl/Python: Where in RTL does it get assigned?]]&lt;br /&gt;
* [[Access attributes of ports in parsetree | Verilog/Perl: Access attributes of ports in parsetree and from netlist]]&lt;br /&gt;
* [[Evaluate 'for-generate' loop | Verilog/C++: Evaluate 'for-generate' loop]]&lt;br /&gt;
* [[Retrieve package name for user-defined variable types | SystemVerilog/C++/Python: Retrieve package name for user-defined variable types]]&lt;br /&gt;
* [[Pretty-print a module and the packages imported by the module | SystemVerilog/C++: Pretty-print a module and the packages imported by the module]]&lt;br /&gt;
* [[How to get packed dimensions of enum | SystemVerilog/C++: How to get packed dimensions of enum]]&lt;br /&gt;
* [[How to replace a statement that has a label | SystemVerilog/C++: How to replace a statement that has a label]]&lt;br /&gt;
* [[How to insert/add a statement, or a module item, into a sequential block and a generate block | SystemVerilog/C++: How to insert/add a statement, or a module item, into a sequential block and a generate block]]&lt;br /&gt;
* [[Simple examples of VHDL visitor pattern | VHDL/C++: Simple examples of VHDL visitor pattern]]&lt;br /&gt;
* [[Traverse instances in parsetree | VHDL/C++: Traverse instances in parsetree]]&lt;br /&gt;
* [[Parsing from data in memory | Verilog/VHDL/C++: Parsing from data in memory]]&lt;br /&gt;
&lt;br /&gt;
'''INVIO Code examples'''&lt;br /&gt;
* [[Simple port modification | SystemVerilog/Python: Simple port modification]]&lt;/div&gt;</summary>
		<author><name>Mohammad</name></author>	</entry>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=Simple_port_modification&amp;diff=920</id>
		<title>Simple port modification</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=Simple_port_modification&amp;diff=920"/>
				<updated>2024-11-08T23:39:03Z</updated>
		
		<summary type="html">&lt;p&gt;Mohammad: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This example converts module with struct ports into flat ports.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
from invio import *&lt;br /&gt;
&lt;br /&gt;
set_preference(&amp;quot;invio_insert_ports_with_newline&amp;quot;, 1)&lt;br /&gt;
add_sv_file(&amp;quot;test.sv&amp;quot;)&lt;br /&gt;
analyze()&lt;br /&gt;
elaborate(&amp;quot;top&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
# Convert instance of the module with struct ports into flat ports &lt;br /&gt;
mod = get_modules(&amp;quot;child&amp;quot;).first&lt;br /&gt;
for i in get_instances(mod):&lt;br /&gt;
    for p in i.portmaps:&lt;br /&gt;
        pin = p.pin&lt;br /&gt;
        if pin and pin.data_type.is_named_user_type:&lt;br /&gt;
                print(f'... Replacing portmap: {p.full_name}')&lt;br /&gt;
                portmap = ''&lt;br /&gt;
                for m in pin.data_type.members:&lt;br /&gt;
                    portmap = portmap + f'.{pin.base_name}_{m.base_name} ({p.connected.first.base_name}.{m.base_name})' + ', \n'&lt;br /&gt;
                rt = create_raw_text_object(ref=p)&lt;br /&gt;
                replace_orig_text_of_object(rt, portmap[:len(portmap)-3]) # trim off the last ', '&lt;br /&gt;
# You will need to write out the modification and relaod to see the effect of text replacement in the parse tree.&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
# Replace the assignment with raw text&lt;br /&gt;
a =  get_assigns(mod).first&lt;br /&gt;
new_assign = &amp;quot;&amp;quot;&amp;quot;assign out_bus_clk = in_bus_clk;&lt;br /&gt;
    assign out_bus_rst = in_bus_rst;&lt;br /&gt;
    assign out_bus_addr = in_bus_addr;&lt;br /&gt;
    assign out_bus_data = in_bus_data;&lt;br /&gt;
&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
print(f'... Replacing assignment: {a.full_name}')&lt;br /&gt;
replace_orig_text_of_object(a, new_assign)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# flatten the ports&lt;br /&gt;
new_ports = []&lt;br /&gt;
for p in get_ports(mod):&lt;br /&gt;
    p_type = p.data_type&lt;br /&gt;
    if (p_type.is_named_user_type):&lt;br /&gt;
        print(f'... Replacing port: {p.full_name}')&lt;br /&gt;
        # Create new ports for each memeber and add them to the module&lt;br /&gt;
        for m in p_type.members:&lt;br /&gt;
            portname = f&amp;quot;{p.base_name}_{m.base_name}&amp;quot;&lt;br /&gt;
            dims = []&lt;br /&gt;
            for d in m.dimensions:&lt;br /&gt;
                dims.append( (d.left_index, d.right_index) )&lt;br /&gt;
            # Create a port with the same attributes as struct memebers&lt;br /&gt;
            new_port = create_port(portname, p.direction, datatype_name=m.data_type_name, dimensions=dims);&lt;br /&gt;
            new_ports.append(new_port)&lt;br /&gt;
&lt;br /&gt;
        # Delete the old struct port&lt;br /&gt;
        delete_object(p)&lt;br /&gt;
&lt;br /&gt;
# Insert them into top module after removing the old ports&lt;br /&gt;
for p in new_ports:&lt;br /&gt;
    insert_into(p, mod)&lt;br /&gt;
&lt;br /&gt;
# Write out the modifications&lt;br /&gt;
write_modified_file(&amp;quot;test.sv&amp;quot;, &amp;quot;test_mod.sv&amp;quot;)&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;test.sv&amp;quot;&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
typedef struct {&lt;br /&gt;
    logic clk;&lt;br /&gt;
    logic rst;&lt;br /&gt;
    logic [1:0] addr;&lt;br /&gt;
    int data;&lt;br /&gt;
} bus_t;&lt;br /&gt;
&lt;br /&gt;
module child (&lt;br /&gt;
              input bus_t in_bus,&lt;br /&gt;
              output bus_t out_bus&lt;br /&gt;
              );&lt;br /&gt;
&lt;br /&gt;
   assign out_bus = in_bus;&lt;br /&gt;
endmodule // child&lt;br /&gt;
&lt;br /&gt;
module top #(WIDTH = 4)(&lt;br /&gt;
   input bus_t top_in_bus, &lt;br /&gt;
   input [0:WIDTH-1] a,&lt;br /&gt;
   output [0:WIDTH-1] d,&lt;br /&gt;
   output bus_t top_out_bus&lt;br /&gt;
) ;&lt;br /&gt;
&lt;br /&gt;
   child u_child (&lt;br /&gt;
                  .in_bus (top_in_bus),&lt;br /&gt;
                  .out_bus (top_out_bus)&lt;br /&gt;
                  );&lt;br /&gt;
&lt;br /&gt;
endmodule&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Testcase after modification, &amp;quot;test_mod.sv&amp;quot;:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
typedef struct {&lt;br /&gt;
    logic clk;&lt;br /&gt;
    logic rst;&lt;br /&gt;
    logic [1:0] addr;&lt;br /&gt;
    int data;&lt;br /&gt;
} bus_t;&lt;br /&gt;
&lt;br /&gt;
module child (&lt;br /&gt;
input logic in_bus_clk,&lt;br /&gt;
input logic in_bus_rst,&lt;br /&gt;
input logic [1:0] in_bus_addr,&lt;br /&gt;
input int in_bus_data,&lt;br /&gt;
output logic out_bus_clk,&lt;br /&gt;
output logic out_bus_rst,&lt;br /&gt;
output logic [1:0] out_bus_addr,&lt;br /&gt;
output int out_bus_data              &lt;br /&gt;
              );&lt;br /&gt;
&lt;br /&gt;
   assign out_bus_clk = in_bus_clk;&lt;br /&gt;
    assign out_bus_rst = in_bus_rst;&lt;br /&gt;
    assign out_bus_addr = in_bus_addr;&lt;br /&gt;
    assign out_bus_data = in_bus_data;&lt;br /&gt;
&lt;br /&gt;
endmodule // child&lt;br /&gt;
&lt;br /&gt;
module top #(WIDTH = 4)(&lt;br /&gt;
   input bus_t top_in_bus, &lt;br /&gt;
   input [0:WIDTH-1] a,&lt;br /&gt;
   output [0:WIDTH-1] d,&lt;br /&gt;
   output bus_t top_out_bus&lt;br /&gt;
) ;&lt;br /&gt;
&lt;br /&gt;
   child u_child (&lt;br /&gt;
                  .in_bus_clk (top_in_bus.clk), &lt;br /&gt;
.in_bus_rst (top_in_bus.rst), &lt;br /&gt;
.in_bus_addr (top_in_bus.addr), &lt;br /&gt;
.in_bus_data (top_in_bus.data),&lt;br /&gt;
                  .out_bus_clk (top_out_bus.clk), &lt;br /&gt;
.out_bus_rst (top_out_bus.rst), &lt;br /&gt;
.out_bus_addr (top_out_bus.addr), &lt;br /&gt;
.out_bus_data (top_out_bus.data)&lt;br /&gt;
                  );&lt;br /&gt;
&lt;br /&gt;
endmodule&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mohammad</name></author>	</entry>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=Simple_port_modification&amp;diff=911</id>
		<title>Simple port modification</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=Simple_port_modification&amp;diff=911"/>
				<updated>2024-10-11T22:59:26Z</updated>
		
		<summary type="html">&lt;p&gt;Mohammad: Created page with &amp;quot;This example converts module with struct ports into flat ports.   &amp;lt;nowiki&amp;gt; from invio import *  set_preference(&amp;quot;invio_insert_ports_with_newline&amp;quot;, 1) add_sv_file(&amp;quot;test.sv&amp;quot;) ana...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This example converts module with struct ports into flat ports.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
from invio import *&lt;br /&gt;
&lt;br /&gt;
set_preference(&amp;quot;invio_insert_ports_with_newline&amp;quot;, 1)&lt;br /&gt;
add_sv_file(&amp;quot;test.sv&amp;quot;)&lt;br /&gt;
analyze()&lt;br /&gt;
elaborate(&amp;quot;top&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
# Convert top module with struct ports into flat ports &lt;br /&gt;
top_module_obj = get_modules(&amp;quot;top&amp;quot;).first&lt;br /&gt;
for p in get_ports(top_module_obj):&lt;br /&gt;
    #report_attributes(p) # for debugging purposes you can print the attributes and see what is going on&lt;br /&gt;
    p_type = p.data_type&lt;br /&gt;
    # Filter the user type ports&lt;br /&gt;
    if (p_type.is_named_user_type):&lt;br /&gt;
        # Create new ports for each memeber and add them to the module&lt;br /&gt;
        for m in p_type.members:&lt;br /&gt;
            dims = []&lt;br /&gt;
            for d in m.dimensions:&lt;br /&gt;
                dims.append( (d.left_index, d.right_index) )&lt;br /&gt;
            # Create a port with the same attributes as struct memebers&lt;br /&gt;
            new_port = create_port(m.base_name, p.direction, datatype_name=m.data_type_name, dimensions=dims);&lt;br /&gt;
            # Insert them into top module&lt;br /&gt;
            insert_into(new_port, top_module_obj)&lt;br /&gt;
&lt;br /&gt;
        # Delete the old struct port&lt;br /&gt;
        delete_object(p)&lt;br /&gt;
&lt;br /&gt;
# Write out the modifications&lt;br /&gt;
write_modified_file(&amp;quot;test.sv&amp;quot;, &amp;quot;test_mod.sv&amp;quot;)&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;test.sv&amp;quot;&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
typedef struct {&lt;br /&gt;
    logic clk;&lt;br /&gt;
    logic rst;&lt;br /&gt;
    logic [1:0] addr;&lt;br /&gt;
    int data;&lt;br /&gt;
} bus_t;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Convert the struct port into flat ports&lt;br /&gt;
module top #(WIDTH = 4)(&lt;br /&gt;
   input bus_t in_bus, // this one&lt;br /&gt;
   output [0:WIDTH-1] d,&lt;br /&gt;
   input [0:WIDTH-1] a&lt;br /&gt;
) ;&lt;br /&gt;
&lt;br /&gt;
endmodule&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Testcase after modification, &amp;quot;test_mod.sv&amp;quot;:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
typedef struct {&lt;br /&gt;
    logic clk;&lt;br /&gt;
    logic rst;&lt;br /&gt;
    logic [1:0] addr;&lt;br /&gt;
    int data;&lt;br /&gt;
} bus_t;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Convert the struct port into flat ports&lt;br /&gt;
module top #(WIDTH = 4)(&lt;br /&gt;
   output [0:WIDTH-1] d,&lt;br /&gt;
   input [0:WIDTH-1] a,&lt;br /&gt;
input logic clk,&lt;br /&gt;
input logic rst,&lt;br /&gt;
input logic [1:0] addr,&lt;br /&gt;
input int data&lt;br /&gt;
) ;&lt;br /&gt;
&lt;br /&gt;
endmodule&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mohammad</name></author>	</entry>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=Main_Page&amp;diff=910</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=Main_Page&amp;diff=910"/>
				<updated>2024-10-11T22:54:16Z</updated>
		
		<summary type="html">&lt;p&gt;Mohammad: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''General'''&lt;br /&gt;
* [[How to get best support from Verific | '''''How to get best support from Verific''''']]&lt;br /&gt;
* [[Source code customization &amp;amp; Stable release services | Source code customization &amp;amp; Stable release services]]&lt;br /&gt;
* [[How to save computer resources | How to save computer resources (memory consumption &amp;amp; runtime)]]&lt;br /&gt;
* [[Original RTL language | How do I know what language a Netlist in the netlist database comes from?]]&lt;br /&gt;
* [[Verific data structures | What are the data structures in Verific?]]&lt;br /&gt;
* [[Remove Verific data structures | How do I remove all Verific data structures in memory?]]&lt;br /&gt;
* [[Does Verific build CDFG? | Does Verific build control and data flow graph (CDFG)?]]&lt;br /&gt;
* [[Does Verific support XMR?| Does Verific support cross module references (XMR)?]]&lt;br /&gt;
* [[Compile-time/run-time flags | Are there options to control Verific software's behavior? Compile-time &amp;amp; run-time flags.]]&lt;br /&gt;
* [[Message handling | How do I downgrade/upgrade messages from Verific? How do I get messages with more details?]]&lt;br /&gt;
* [[Release version | How do I tell the version of a Verific software release? ]]&lt;br /&gt;
* [[Simulation models for Verific primitives | Where do I find simulation models for Verific primitives (VERIFIC_XOR, VERIFIC_DFFRS, ....)? ]]&lt;br /&gt;
* [[Tcl library path| How to correct building (linking) issue &amp;quot;/usr/bin/ld: cannot find -ltcl&amp;quot;]]&lt;br /&gt;
* [[LineFile data from input files | LineFile data from input files]]&lt;br /&gt;
* [[Difference between RTL and gate-level simulations - Flipflop with async set and async reset | Difference between RTL and gate-level simulations - Flipflop with async set and async reset]]&lt;br /&gt;
* [[Preserving user nets - preventing nets from being optimized away | Preserving user nets - preventing nets from being optimized away]]&lt;br /&gt;
* [[Python pretty-printer for gdb | Python pretty-printer for gdb]]&lt;br /&gt;
* [[Yosys-Verific Integration | Yosys-Verific integration]]&lt;br /&gt;
&lt;br /&gt;
'''Input: VHDL, Verilog (and SystemVerilog), Liberty, EDIF'''&lt;br /&gt;
* [[How to get all Verilog files being analyzed | Verilog: I'm using -v, -y, .... After Verific is done with the analysis, how do I get a list of all the files being analyzed?]]&lt;br /&gt;
* [[Included files associated with a Verilog source file | Verilog: How do I get the list of included files associated with a Verilog source file?]]&lt;br /&gt;
* [[How to get type/initial value of parameters | Verilog: How to get type/initial value of parameters.]]&lt;br /&gt;
* [[Verilog ports being renamed | Verilog: Port Expressions]]&lt;br /&gt;
* [[Design with System Verilog and Verilog 2001 files | Verilog: For a design consisting of a mixture of Verilog 2001 and SystemVerilog input files, should I parse all the files as SystemVerilog?]]&lt;br /&gt;
* [[How to get module ports from Verilog parsetree | Verilog: From the Verilog parsetree, how can I get the ports of a module?]]&lt;br /&gt;
* [[How to change name of id in Verilog parsetree | Verilog: How do I change the name of an id (VeriidDef) in Verilog parsetree?]]&lt;br /&gt;
* [[How to get library containing nested module | Verilog: How do I get nested modules and get the library that contains the nested module?]]&lt;br /&gt;
* [[How to get linefile information of macro definitions | Verilog: How do I get linefile information of macro definitions?]]&lt;br /&gt;
* [[How to find port dimensions | Verilog: How do I get port dimensions?]]&lt;br /&gt;
* [[Instance - Module binding order | Verilog: What is the order of binding modules to instances?]]&lt;br /&gt;
* [[How Verific elaborator handles blackboxes/unknown boxes | Verilog: How Verific elaborator handles blackboxes/unknown boxes]]&lt;br /&gt;
* [[Constant expression replacement | Verilog: Does Verific replace constant expressions with their respective values?]]&lt;br /&gt;
* [[Modules with '_1' '_2' suffix in their names | Verilog: After static elaboration, there are modules with &amp;quot;_1&amp;quot;, &amp;quot;_2&amp;quot;, ..., suffix in their names. Why?]]&lt;br /&gt;
* [[Defined macros become undefined - MFCU vs SFCU | SystemVerilog: Why does Verific complain about undefined macros for macros defined in a different file (Compilation Unit)?]]&lt;br /&gt;
* [[Notes on analysis | SystemVerilog: Notes on analysis]]&lt;br /&gt;
* [[How to get enums from Verilog parsetree | SystemVerilog: From the parsetree, how can I get the enums declared in a module?]]&lt;br /&gt;
* [[How to identify packages being imported into a module | SystemVerilog: How do I identify packages being imported into a module?]]&lt;br /&gt;
* [[SystemVerilog &amp;quot;std&amp;quot; package | SystemVerilog: Support for SystemVerilog semaphore/process/mailbox constructs.]]&lt;br /&gt;
* [[Top level module with interface ports | SystemVerilog: Support for SystemVerilog top level module with interface ports.]]&lt;br /&gt;
* [[Design with VHDL-1993 and VHDL-2008 files | VHDL: VHDL-1993 and VHDL-2008 each has its own IEEE library set. How do I analyze/elaborate a design with a mixture of files of different VHDL dialects (1993 and 2008)?]]&lt;br /&gt;
* [[Escaped identifiers in RTL files and in Verific data structures | Verilog/VHDL: Escaped identifiers in RTL files and in Verific data structures]]&lt;br /&gt;
* [[Prettyprint to a string | Verilog/VHDL: How to prettyprint a parsetree node to a string.]]&lt;br /&gt;
* [[Static elaboration | Verilog/VHDL: What does 'static elaboration' do?]]&lt;br /&gt;
* [[How to ignore a (not used) parameter/generic in elaboration. | Verilog/VHDL: How to ignore a (not used) parameter/generic in elaboration.]]&lt;br /&gt;
* [[What VeriModule* or VhdlPrimaryUnit* the Netlist comes from? | Verilog/VHDL: For a Netlist in the netlist database, is there a clean way to look back at what VeriModule* or VhdlPrimaryUnit* the Netlist was derived from?]]&lt;br /&gt;
* [[Cross-reference between the original RTL files and the elaborated netlist | Verilog/VHDL: Is there a way to cross-reference between the original RTL design files and the elaboration netlist?]]&lt;br /&gt;
* [[How to ignore parameters/generics in elaboration | Verilog/VHDL: Is there a way to tell the elaborator to ignore certain parameters/generics so that the unit/module is not uniquified?]]&lt;br /&gt;
* [[How to check for errors in analysis/elaboration | Verilog/VHDL: Is there a way to tell if the analysis/elaboration process has errors?]]&lt;br /&gt;
* [[Modules/design units with &amp;quot;_default&amp;quot; suffix in their names | Verilog/VHDL: After static elaboration, there are modules/design units/interfaces with &amp;quot;_default&amp;quot; suffix in their names. Why? And what are they?]]&lt;br /&gt;
* [[How to parse a string | Verilog/VHDL: How to parse a string - Example of adding a module to the parsetree]]&lt;br /&gt;
* [[Support IEEE 1735 encryption standard | Verilog/VHDL: Does Verific support IEEE 1735 encryption standard?]]&lt;br /&gt;
'''Netlist Database'''&lt;br /&gt;
* [[Logic optimization across hierarchy boundaries | Netlist Database: Does Verific perform logic optimization across hierarchy boundaries?]]&lt;br /&gt;
* [[Bit-blasting a multi-port RAM instance | Netlist Database: Bit-blasting a multi-port RAM instance]]&lt;br /&gt;
* [[System attributes | Netlist Database: System attributes]]&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
* [[Output file formats | What language formats does Verific support as output?]]&lt;br /&gt;
&lt;br /&gt;
'''Scripting languages: TCL, Perl, Python'''&lt;br /&gt;
* [[What languages can I use with Verific software? | What programming languages can I use with Verific software?]]&lt;br /&gt;
&lt;br /&gt;
'''Code examples'''&lt;br /&gt;
* [[How to use RegisterCallBackMsg() | Util/C++: How to use RegisterCallBackMsg()]]&lt;br /&gt;
* [[How to use MessageCallBackHandler Class | Util/C++: How to use MessageCallBackHandler Class]]&lt;br /&gt;
* [[How to use RegisterPragmaRefCallBack() | Util/C++: How to use RegisterPragmaRefCallBack()]]&lt;br /&gt;
* [[Write out an encrypted netlist | Database/C++: Write out an encrypted netlist]]&lt;br /&gt;
* [[Extract clock enable | Database/C++: Extract clock enable]]&lt;br /&gt;
* [[Black box, empty box, and unknown box | Database/C++: Black box, empty box, and unknown box]]&lt;br /&gt;
* [[Post processing port resolution of black boxes | Database/C++: Post processing port resolution of black boxes]]&lt;br /&gt;
* [[Finding hierarchical paths of a Netlist | Database/C++: Finding hierarchical paths of a Netlist]]&lt;br /&gt;
* [[Replacing Verific built-in primitives/operators with user implementations | Database/C++: Replacing Verific built-in primitives/operators with user implementations]]&lt;br /&gt;
* [[Hierarchy tree RTL elaboration | Database/Perl: Simple example of hierarchy tree elaboration]]&lt;br /&gt;
* [[Create a Netlist Database from scratch (not from RTL elaboration) | Database/Perl/TCL: Create a Netlist Database from scratch (not from RTL elaboration)]]&lt;br /&gt;
* [[Buffering signals and ungrouping | Database/Verilog: Buffering signals and ungrouping (flattening) in the Netlist Database]]&lt;br /&gt;
* [[Memory elements of a RamNet | Database/Verilog/C++: Memory elements of a RamNet]]&lt;br /&gt;
* [[Process -f file and explore the Netlist Database (C++)| Database/Verilog/C++: Process -f file and explore the Netlist Database]]&lt;br /&gt;
* [[Process -f file and explore the Netlist Database (py)| Database/Verilog/Python: Process -f file and explore the Netlist Database]]&lt;br /&gt;
* [[Fanout cone and grouping | Database/Verilog/Perl: Fanout cone and grouping in the Netlist Database]]&lt;br /&gt;
* [[Type Range example | Database/Verilog/C++: Type Range example  (simple)]]&lt;br /&gt;
* [[Type Range example with multi-dimensional arrays| Database/Verilog/C++/Perl: Type Range example with multi-dimensional arrays]]&lt;br /&gt;
* [[Using TypeRange table to retrieve the originating type-range for an id | Database/Verilog/C++: Using TypeRange table to retrieve the originating type-range for an id]]&lt;br /&gt;
* [[Simple example of visitor pattern | Verilog/C++: Simple examples of visitor pattern]]&lt;br /&gt;
* [[Statically elaborate with different values of parameters | Verilog/C++: Statically elaborate with different values of parameters]]&lt;br /&gt;
* [[Prettyprint all modules in the design hierarchy | Verilog/C++: Prettyprint all modules in the design hierarchy]]&lt;br /&gt;
* [[Getting instances' parameters | Verilog/C++: Getting instances' parameters]]&lt;br /&gt;
* [[Accessing and evaluating module's parameters | Verilog/C++: Accessing and evaluating module's parameters]]&lt;br /&gt;
* [[Visiting Hierarchical References (VeriSelectedName) | Verilog/C++: Visiting Hierarchical References (VeriSelectedName)]]&lt;br /&gt;
* [[Using stream input to ignore input file | Verilog/C++: Using stream input to ignore input file]]&lt;br /&gt;
* [[How to ignore certain modules while analyzing input RTL files | Verilog/C++: How to ignore certain modules while analyzing input RTL files]]&lt;br /&gt;
* [[How to tell if a module has encrypted contents | Verilog/C++: How to tell if a module has encrypted contents]]&lt;br /&gt;
* [[Comment out a line using text based design modification and parsetree modification | Verilog/C++: Comment out a line using text-based design modification and parsetree modification]] &lt;br /&gt;
* [[Verilog/C++: How to use IsUserDeclared() : Example for port associations]]&lt;br /&gt;
* [[How to create new module in Verilog parsetree | Verilog/C++: How to create new module in Verilog parsetree]]&lt;br /&gt;
* [[In Verilog parsetree adding names to unnamed instances | Verilog/C++: In Verilog parsetree adding names to unnamed instances]]&lt;br /&gt;
* [[How to get full hierarchy ID path | Verilog/C++: How to get full hierarchy ID path]]&lt;br /&gt;
* [[How to traverse scope hierarchy | Verilog/C++: How to traverse scope hierarchy]]&lt;br /&gt;
* [[Access attributes in parsetree | Verilog/C++: How to access attributes in parsetree]]&lt;br /&gt;
* [[How to detect multiple-clock-edge condition in Verilog parsetree | Verilog/C++: How to detect multiple-clock-edge condition in Verilog parsetree]]&lt;br /&gt;
* [[How to get driving net of an instance | Verilog/C++: How to get driving net of an instance]]&lt;br /&gt;
* [[Parse select modules only and ignore the rest | Verilog/C++: Parse select modules only and ignore the rest]]&lt;br /&gt;
* [[Create DOT diagram of parse tree | Verilog/C++: Create DOT diagram of a parse tree]]&lt;br /&gt;
* [[How to get linefile data of macros - Macro callback function | Verilog/C++/Perl/Python: How to get linefile data of macros - Macro callback function]]&lt;br /&gt;
* [[Where in RTL does it get assigned? | Verilog/C++/Perl/Python: Where in RTL does it get assigned?]]&lt;br /&gt;
* [[Access attributes of ports in parsetree | Verilog/Perl: Access attributes of ports in parsetree and from netlist]]&lt;br /&gt;
* [[Evaluate 'for-generate' loop | Verilog/C++: Evaluate 'for-generate' loop]]&lt;br /&gt;
* [[Retrieve package name for user-defined variable types | SystemVerilog/C++/Python: Retrieve package name for user-defined variable types]]&lt;br /&gt;
* [[Pretty-print a module and the packages imported by the module | SystemVerilog/C++: Pretty-print a module and the packages imported by the module]]&lt;br /&gt;
* [[How to get packed dimensions of enum | SystemVerilog/C++: How to get packed dimensions of enum]]&lt;br /&gt;
* [[How to replace a statement that has a label | SystemVerilog/C++: How to replace a statement that has a label]]&lt;br /&gt;
* [[How to insert/add a statement, or a module item, into a sequential block and a generate block | SystemVerilog/C++: How to insert/add a statement, or a module item, into a sequential block and a generate block]]&lt;br /&gt;
* [[Simple examples of VHDL visitor pattern | VHDL/C++: Simple examples of VHDL visitor pattern]]&lt;br /&gt;
* [[Traverse instances in parsetree | VHDL/C++: Traverse instances in parsetree]]&lt;br /&gt;
* [[Parsing from data in memory | Verilog/VHDL/C++: Parsing from data in memory]]&lt;br /&gt;
&lt;br /&gt;
'''INVIO Code examples'''&lt;br /&gt;
* [[Simple port modification | SystemVerilog/Python: Simple port modification]]&lt;/div&gt;</summary>
		<author><name>Mohammad</name></author>	</entry>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=How_to_insert/add_a_statement,_or_a_module_item,_into_a_sequential_block_and_a_generate_block&amp;diff=908</id>
		<title>How to insert/add a statement, or a module item, into a sequential block and a generate block</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=How_to_insert/add_a_statement,_or_a_module_item,_into_a_sequential_block_and_a_generate_block&amp;diff=908"/>
				<updated>2024-09-06T19:36:06Z</updated>
		
		<summary type="html">&lt;p&gt;Mohammad: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This application shows how to insert a new statement into a sequential block and a generate block. &lt;br /&gt;
It uses the Analyze* APIs that were described in the FAQ page: [https://www.verific.com/faq/index.php?title=How_to_parse_a_string].&lt;br /&gt;
&lt;br /&gt;
C++:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
#include &amp;quot;veri_file.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriModule.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriId.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriModuleItem.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriStatement.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriScope.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriVisitor.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;Netlist.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriWrite.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;Strings.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;Array.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Map.h&amp;quot;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
#include &amp;lt;sstream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#ifdef VERIFIC_NAMESPACE&lt;br /&gt;
using namespace Verific ;&lt;br /&gt;
#endif&lt;br /&gt;
using namespace std ;&lt;br /&gt;
&lt;br /&gt;
class MyVisitor : public VeriVisitor&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
    MyVisitor() : VeriVisitor(), _parent_stack() { }&lt;br /&gt;
    virtual ~MyVisitor() { }&lt;br /&gt;
&lt;br /&gt;
    virtual void VERI_VISIT(VeriSeqBlock, node)&lt;br /&gt;
    {&lt;br /&gt;
        // Don't stop at the first VeriSeqBlock&lt;br /&gt;
        VeriVisitor::VERI_VISIT_NODE(VeriSeqBlock, node) ;&lt;br /&gt;
&lt;br /&gt;
        // Find the block to add the new statement&lt;br /&gt;
        char *pp_str = node.GetPrettyPrintedString() ;&lt;br /&gt;
        if(!Strings::compare(pp_str, &amp;quot;begin\n    test2 &amp;lt;=  ack ;\nend\n&amp;quot;)) {&lt;br /&gt;
            Strings::free(pp_str) ;&lt;br /&gt;
            return ;&lt;br /&gt;
        }&lt;br /&gt;
        //  node.Info(&amp;quot;Got VeriSeqBlock: %s&amp;quot;, pp_str) ;&lt;br /&gt;
        Strings::free(pp_str) ;&lt;br /&gt;
&lt;br /&gt;
        // Insert the statement&lt;br /&gt;
        unsigned st = 0;&lt;br /&gt;
        VeriScope *scope = node.GetScope() ;&lt;br /&gt;
        if (scope) {&lt;br /&gt;
            // Now analyze the string into VeriStatement:&lt;br /&gt;
            linefile_type dummy_lf = LineFile::EncodeLineFile(&amp;quot;read-from-string&amp;quot;, 1) ;&lt;br /&gt;
            VeriStatement *new_node = veri_file::AnalyzeStatement(&amp;quot;A2:cover property (test2 == 1'b1) ;&amp;quot;, veri_file::SYSTEM_VERILOG, dummy_lf /*could be 0, may use node.Linefile()*/, scope) ;&lt;br /&gt;
            if (new_node) { // Something went wrong&lt;br /&gt;
                st = node.AddStatement(new_node, 0 /*add at the end*/, 1 /*resolve*/);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        node.Info(&amp;quot;Statement insertion into SeqBlock: %s&amp;quot;, ((st)?&amp;quot;succeeded&amp;quot;:&amp;quot;FAILED&amp;quot;)) ;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    virtual void VERI_VISIT(VeriGenerateConstruct, node)&lt;br /&gt;
    {&lt;br /&gt;
        // Don't stop at first node&lt;br /&gt;
        VeriVisitor::VERI_VISIT_NODE(VeriGenerateConstruct, node) ;&lt;br /&gt;
&lt;br /&gt;
        // Find the block to add to&lt;br /&gt;
        // For now I assume there is only one so nothing to skip&lt;br /&gt;
        char *pp_str = node.GetPrettyPrintedString() ;&lt;br /&gt;
     //   node.Info(&amp;quot;Got VeriGenerateConstruct: %s&amp;quot;, pp_str) ;&lt;br /&gt;
        Strings::free(pp_str) ;&lt;br /&gt;
&lt;br /&gt;
        // Insert the statement&lt;br /&gt;
        unsigned st = 0 ;&lt;br /&gt;
        VeriScope *scope = node.GetScope() ;&lt;br /&gt;
&lt;br /&gt;
        // node doesn't have a scope get the parent scope.&lt;br /&gt;
        if (!scope) {&lt;br /&gt;
            VeriTreeNode *parent = GetParent() ;&lt;br /&gt;
            VERIFIC_ASSERT(parent) ;&lt;br /&gt;
            scope = parent-&amp;gt;GetScope();&lt;br /&gt;
        }&lt;br /&gt;
        if (scope) {&lt;br /&gt;
            // Now analyze the string into ModuleItem:&lt;br /&gt;
            VeriModuleItem *new_node = veri_file::AnalyzeModuleItem(&amp;quot;A1: cover property(@(posedge clk) test1 == 1'b1) ;&amp;quot;, veri_file::SYSTEM_VERILOG, 0 /*may use node.Linefile()*/, scope) ;&lt;br /&gt;
            if (new_node) {&lt;br /&gt;
                // It is used as a module item - try adding it:&lt;br /&gt;
                st = node.AddModuleItem((VeriModuleItem *) new_node, 0 /*add at the end*/, 1 /*resolve*/) ;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        node.Info(&amp;quot;Statement insertion into GenerateConstruct: %s&amp;quot;, ((st)?&amp;quot;succeeded&amp;quot;:&amp;quot;FAILED&amp;quot;)) ;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    // Maintain a parent pointer in the visitor:&lt;br /&gt;
    virtual void PreAction(VeriTreeNode &amp;amp;node)  { _parent_stack.Insert(&amp;amp;node) ; }&lt;br /&gt;
    virtual void PostAction(VeriTreeNode &amp;amp;node)&lt;br /&gt;
    {&lt;br /&gt;
        VeriTreeNode *n = (VeriTreeNode *)_parent_stack.RemoveLast() ;&lt;br /&gt;
        VERIFIC_ASSERT(n == &amp;amp;node) ;&lt;br /&gt;
    }&lt;br /&gt;
    VeriTreeNode *GetParent() const&lt;br /&gt;
    {&lt;br /&gt;
        VeriTreeNode *n = (VeriTreeNode *)_parent_stack.GetLast() ;&lt;br /&gt;
        VERIFIC_ASSERT(n) ;&lt;br /&gt;
        return n ;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
    Array _parent_stack ;&lt;br /&gt;
} ; // class MyVisitor&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char **argv)&lt;br /&gt;
{&lt;br /&gt;
    Array files(1) ;&lt;br /&gt;
    files.Insert(&amp;quot;test.v&amp;quot;) ;&lt;br /&gt;
    if (!veri_file::AnalyzeMultipleFiles(&amp;amp;files, veri_file::SYSTEM_VERILOG)) return 1 ;&lt;br /&gt;
&lt;br /&gt;
    veri_file::PrettyPrint(&amp;quot;before.v.golden.new&amp;quot;, 0) ;&lt;br /&gt;
&lt;br /&gt;
    MyVisitor mv ;&lt;br /&gt;
&lt;br /&gt;
    MapIter mi ;&lt;br /&gt;
    VeriModule *mod ;&lt;br /&gt;
    FOREACH_VERILOG_MODULE(mi, mod) if (mod) mod-&amp;gt;Accept(mv) ;&lt;br /&gt;
&lt;br /&gt;
    veri_file::PrettyPrint(&amp;quot;after.v.golden.new&amp;quot;, 0) ;&lt;br /&gt;
&lt;br /&gt;
    // Elaborate the design:&lt;br /&gt;
    veri_file::ElaborateAll() ;&lt;br /&gt;
&lt;br /&gt;
    VeriWrite vw ;&lt;br /&gt;
    vw.WriteFile(&amp;quot;test.v.golden.new&amp;quot;, Netlist::PresentDesign()) ;&lt;br /&gt;
&lt;br /&gt;
    // Synthesize assertions in the parse tree:&lt;br /&gt;
    //veri_file::SynthesizeConcurrentAssertions() ;&lt;br /&gt;
    //veri_file::PrettyPrint(&amp;quot;test_assert_synth.v.golden.new&amp;quot;, 0) ;&lt;br /&gt;
&lt;br /&gt;
    return 0 ;&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The application is going to add the statements where the comments sit.&lt;br /&gt;
&lt;br /&gt;
Testcase:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
module top #(parameter HEADER = 1) (input clk, input rst, input ack) ;&lt;br /&gt;
    generate &lt;br /&gt;
     reg test1 ;&lt;br /&gt;
     reg test2 ;&lt;br /&gt;
     if(HEADER) begin: HEADER_ADDR&lt;br /&gt;
        always @(posedge clk or posedge rst) begin&lt;br /&gt;
            if (rst) begin&lt;br /&gt;
                test1 &amp;lt;= 1'b0 ;&lt;br /&gt;
                test2 &amp;lt;= 1'b0 ;&lt;br /&gt;
            end else begin&lt;br /&gt;
                test2 &amp;lt;= ack ;&lt;br /&gt;
//              A2: cover property (test2 == 1'b1) ;&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
     end&lt;br /&gt;
//   A1: cover property(@(posedge clk) test1 == 1'b1) ;&lt;br /&gt;
    endgenerate&lt;br /&gt;
endmodule&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Run:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
[moh@awing0 240906]$ ./test-linux &lt;br /&gt;
-- Analyzing Verilog file 'test.v' (VERI-1482)&lt;br /&gt;
-- Printing all libraries to file 'before.v.golden.new' (VERI-1492)&lt;br /&gt;
test.v(13): INFO: Statement insertion into SeqBlock: succeeded&lt;br /&gt;
test.v(17): INFO: Statement insertion into GenerateConstruct: succeeded&lt;br /&gt;
-- Printing all libraries to file 'after.v.golden.new' (VERI-1492)&lt;br /&gt;
test.v(1): INFO: compiling module 'top' (VERI-1018)&lt;br /&gt;
-- Writing netlist 'top' to Verilog file 'test.v.golden.new' (VDB-1030)&lt;br /&gt;
[moh@awing0 240906]$ cat after.v.golden.new &lt;br /&gt;
&lt;br /&gt;
module top #(parameter HEADER = 1) (&lt;br /&gt;
    input clk, &lt;br /&gt;
    input rst, &lt;br /&gt;
    input ack) ;&lt;br /&gt;
    generate&lt;br /&gt;
        reg test1 ; &lt;br /&gt;
        reg test2 ; &lt;br /&gt;
        if (HEADER) &lt;br /&gt;
            begin : HEADER_ADDR&lt;br /&gt;
                always&lt;br /&gt;
                    @(posedge clk or posedge rst)&lt;br /&gt;
                    begin&lt;br /&gt;
                        if (rst) &lt;br /&gt;
                            begin&lt;br /&gt;
                                test1 &amp;lt;=  1'b0 ;&lt;br /&gt;
                                test2 &amp;lt;=  1'b0 ;&lt;br /&gt;
                            end&lt;br /&gt;
                        else&lt;br /&gt;
                            begin&lt;br /&gt;
                                test2 &amp;lt;=  ack ;&lt;br /&gt;
                                A2 : cover property ((test2 == 1'b1)) ;&lt;br /&gt;
                            end&lt;br /&gt;
                    end&lt;br /&gt;
            end&lt;br /&gt;
        A1 : cover property (@(posedge clk) (test1 == 1'b1)) ;&lt;br /&gt;
    endgenerate&lt;br /&gt;
endmodule&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[moh@awing0 240906]$ &lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mohammad</name></author>	</entry>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=How_to_insert/add_a_statement,_or_a_module_item,_into_a_sequential_block_and_a_generate_block&amp;diff=907</id>
		<title>How to insert/add a statement, or a module item, into a sequential block and a generate block</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=How_to_insert/add_a_statement,_or_a_module_item,_into_a_sequential_block_and_a_generate_block&amp;diff=907"/>
				<updated>2024-09-06T19:19:10Z</updated>
		
		<summary type="html">&lt;p&gt;Mohammad: Created page with &amp;quot;This application shows how to insert a new statement into a sequential block and a generate block.  It mostly uses the Add* APIs that were described in the FAQ page: [https://...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This application shows how to insert a new statement into a sequential block and a generate block. &lt;br /&gt;
It mostly uses the Add* APIs that were described in the FAQ page: [https://www.verific.com/faq/index.php?title=How_to_parse_a_string].&lt;br /&gt;
&lt;br /&gt;
C++:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
#include &amp;quot;veri_file.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriModule.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriId.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriModuleItem.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriStatement.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriScope.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriVisitor.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;Netlist.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriWrite.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;Strings.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;Array.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Map.h&amp;quot;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
#include &amp;lt;sstream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#ifdef VERIFIC_NAMESPACE&lt;br /&gt;
using namespace Verific ;&lt;br /&gt;
#endif&lt;br /&gt;
using namespace std ;&lt;br /&gt;
&lt;br /&gt;
class MyVisitor : public VeriVisitor&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
    MyVisitor() : VeriVisitor(), _parent_stack() { }&lt;br /&gt;
    virtual ~MyVisitor() { }&lt;br /&gt;
&lt;br /&gt;
    virtual void VERI_VISIT(VeriSeqBlock, node)&lt;br /&gt;
    {&lt;br /&gt;
        // Don't stop at the first VeriSeqBlock&lt;br /&gt;
        VeriVisitor::VERI_VISIT_NODE(VeriSeqBlock, node) ;&lt;br /&gt;
&lt;br /&gt;
        // Find the block to add the new statement&lt;br /&gt;
        char *pp_str = node.GetPrettyPrintedString() ;&lt;br /&gt;
        if(!Strings::compare(pp_str, &amp;quot;begin\n    test2 &amp;lt;=  ack ;\nend\n&amp;quot;)) {&lt;br /&gt;
            Strings::free(pp_str) ;&lt;br /&gt;
            return ;&lt;br /&gt;
        }&lt;br /&gt;
        //  node.Info(&amp;quot;Got VeriSeqBlock: %s&amp;quot;, pp_str) ;&lt;br /&gt;
        Strings::free(pp_str) ;&lt;br /&gt;
&lt;br /&gt;
        // Insert the statement&lt;br /&gt;
        unsigned st = 0;&lt;br /&gt;
        VeriScope *scope = node.GetScope() ;&lt;br /&gt;
        if (scope) {&lt;br /&gt;
            // Now analyze the string into VeriStatement:&lt;br /&gt;
            linefile_type dummy_lf = LineFile::EncodeLineFile(&amp;quot;read-from-string&amp;quot;, 1) ;&lt;br /&gt;
            VeriStatement *new_node = veri_file::AnalyzeStatement(&amp;quot;A2:cover property (test2 == 1'b1) ;&amp;quot;, veri_file::SYSTEM_VERILOG, dummy_lf /*could be 0, may use node.Linefile()*/, scope) ;&lt;br /&gt;
            if (new_node) { // Something went wrong&lt;br /&gt;
                st = node.AddStatement(new_node, 0 /*add at the end*/, 1 /*resolve*/);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        node.Info(&amp;quot;Statement insertion into SeqBlock: %s&amp;quot;, ((st)?&amp;quot;succeeded&amp;quot;:&amp;quot;FAILED&amp;quot;)) ;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    virtual void VERI_VISIT(VeriGenerateConstruct, node)&lt;br /&gt;
    {&lt;br /&gt;
        // Don't stop at first node&lt;br /&gt;
        VeriVisitor::VERI_VISIT_NODE(VeriGenerateConstruct, node) ;&lt;br /&gt;
&lt;br /&gt;
        // Find the block to add to&lt;br /&gt;
        // For now I assume there is only one so nothing to skip&lt;br /&gt;
        char *pp_str = node.GetPrettyPrintedString() ;&lt;br /&gt;
     //   node.Info(&amp;quot;Got VeriGenerateConstruct: %s&amp;quot;, pp_str) ;&lt;br /&gt;
        Strings::free(pp_str) ;&lt;br /&gt;
&lt;br /&gt;
        // Insert the statement&lt;br /&gt;
        unsigned st = 0 ;&lt;br /&gt;
        VeriScope *scope = node.GetScope() ;&lt;br /&gt;
&lt;br /&gt;
        // node doesn't have a scope get the parent scope.&lt;br /&gt;
        if (!scope) {&lt;br /&gt;
            VeriTreeNode *parent = GetParent() ;&lt;br /&gt;
            VERIFIC_ASSERT(parent) ;&lt;br /&gt;
            scope = parent-&amp;gt;GetScope();&lt;br /&gt;
        }&lt;br /&gt;
        if (scope) {&lt;br /&gt;
            // Now analyze the string into ModuleItem:&lt;br /&gt;
            VeriModuleItem *new_node = veri_file::AnalyzeModuleItem(&amp;quot;A1: cover property(@(posedge clk) test1 == 1'b1) ;&amp;quot;, veri_file::SYSTEM_VERILOG, 0 /*may use node.Linefile()*/, scope) ;&lt;br /&gt;
            if (new_node) {&lt;br /&gt;
                // It is used as a module item - try adding it:&lt;br /&gt;
                st = node.AddModuleItem((VeriModuleItem *) new_node, 0 /*add at the end*/, 1 /*resolve*/) ;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        node.Info(&amp;quot;Statement insertion into GenerateConstruct: %s&amp;quot;, ((st)?&amp;quot;succeeded&amp;quot;:&amp;quot;FAILED&amp;quot;)) ;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    // Maintain a parent pointer in the visitor:&lt;br /&gt;
    virtual void PreAction(VeriTreeNode &amp;amp;node)  { _parent_stack.Insert(&amp;amp;node) ; }&lt;br /&gt;
    virtual void PostAction(VeriTreeNode &amp;amp;node)&lt;br /&gt;
    {&lt;br /&gt;
        VeriTreeNode *n = (VeriTreeNode *)_parent_stack.RemoveLast() ;&lt;br /&gt;
        VERIFIC_ASSERT(n == &amp;amp;node) ;&lt;br /&gt;
    }&lt;br /&gt;
    VeriTreeNode *GetParent() const&lt;br /&gt;
    {&lt;br /&gt;
        VeriTreeNode *n = (VeriTreeNode *)_parent_stack.GetLast() ;&lt;br /&gt;
        VERIFIC_ASSERT(n) ;&lt;br /&gt;
        return n ;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
    Array _parent_stack ;&lt;br /&gt;
} ; // class MyVisitor&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char **argv)&lt;br /&gt;
{&lt;br /&gt;
    Array files(1) ;&lt;br /&gt;
    files.Insert(&amp;quot;test.v&amp;quot;) ;&lt;br /&gt;
    if (!veri_file::AnalyzeMultipleFiles(&amp;amp;files, veri_file::SYSTEM_VERILOG)) return 1 ;&lt;br /&gt;
&lt;br /&gt;
    veri_file::PrettyPrint(&amp;quot;before.v.golden.new&amp;quot;, 0) ;&lt;br /&gt;
&lt;br /&gt;
    MyVisitor mv ;&lt;br /&gt;
&lt;br /&gt;
    MapIter mi ;&lt;br /&gt;
    VeriModule *mod ;&lt;br /&gt;
    FOREACH_VERILOG_MODULE(mi, mod) if (mod) mod-&amp;gt;Accept(mv) ;&lt;br /&gt;
&lt;br /&gt;
    veri_file::PrettyPrint(&amp;quot;after.v.golden.new&amp;quot;, 0) ;&lt;br /&gt;
&lt;br /&gt;
    // Elaborate the design:&lt;br /&gt;
    veri_file::ElaborateAll() ;&lt;br /&gt;
&lt;br /&gt;
    VeriWrite vw ;&lt;br /&gt;
    vw.WriteFile(&amp;quot;test.v.golden.new&amp;quot;, Netlist::PresentDesign()) ;&lt;br /&gt;
&lt;br /&gt;
    // Synthesize assertions in the parse tree:&lt;br /&gt;
    //veri_file::SynthesizeConcurrentAssertions() ;&lt;br /&gt;
    //veri_file::PrettyPrint(&amp;quot;test_assert_synth.v.golden.new&amp;quot;, 0) ;&lt;br /&gt;
&lt;br /&gt;
    return 0 ;&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The application is going to add the statements where the comments sit.&lt;br /&gt;
&lt;br /&gt;
Testcase:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
module top #(parameter HEADER = 1) (input clk, input rst, input ack) ;&lt;br /&gt;
    generate &lt;br /&gt;
     reg test1 ;&lt;br /&gt;
     reg test2 ;&lt;br /&gt;
     if(HEADER) begin: HEADER_ADDR&lt;br /&gt;
        always @(posedge clk or posedge rst) begin&lt;br /&gt;
            if (rst) begin&lt;br /&gt;
                test1 &amp;lt;= 1'b0 ;&lt;br /&gt;
                test2 &amp;lt;= 1'b0 ;&lt;br /&gt;
            end else begin&lt;br /&gt;
                test2 &amp;lt;= ack ;&lt;br /&gt;
//              A2: cover property (test2 == 1'b1) ;&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
     end&lt;br /&gt;
//   A1: cover property(@(posedge clk) test1 == 1'b1) ;&lt;br /&gt;
    endgenerate&lt;br /&gt;
endmodule&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Run:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
[moh@awing0 240906]$ ./test-linux &lt;br /&gt;
-- Analyzing Verilog file 'test.v' (VERI-1482)&lt;br /&gt;
-- Printing all libraries to file 'before.v.golden.new' (VERI-1492)&lt;br /&gt;
test.v(13): INFO: Statement insertion into SeqBlock: succeeded&lt;br /&gt;
test.v(17): INFO: Statement insertion into GenerateConstruct: succeeded&lt;br /&gt;
-- Printing all libraries to file 'after.v.golden.new' (VERI-1492)&lt;br /&gt;
test.v(1): INFO: compiling module 'top' (VERI-1018)&lt;br /&gt;
-- Writing netlist 'top' to Verilog file 'test.v.golden.new' (VDB-1030)&lt;br /&gt;
[moh@awing0 240906]$ cat after.v.golden.new &lt;br /&gt;
&lt;br /&gt;
module top #(parameter HEADER = 1) (&lt;br /&gt;
    input clk, &lt;br /&gt;
    input rst, &lt;br /&gt;
    input ack) ;&lt;br /&gt;
    generate&lt;br /&gt;
        reg test1 ; &lt;br /&gt;
        reg test2 ; &lt;br /&gt;
        if (HEADER) &lt;br /&gt;
            begin : HEADER_ADDR&lt;br /&gt;
                always&lt;br /&gt;
                    @(posedge clk or posedge rst)&lt;br /&gt;
                    begin&lt;br /&gt;
                        if (rst) &lt;br /&gt;
                            begin&lt;br /&gt;
                                test1 &amp;lt;=  1'b0 ;&lt;br /&gt;
                                test2 &amp;lt;=  1'b0 ;&lt;br /&gt;
                            end&lt;br /&gt;
                        else&lt;br /&gt;
                            begin&lt;br /&gt;
                                test2 &amp;lt;=  ack ;&lt;br /&gt;
                                A2 : cover property ((test2 == 1'b1)) ;&lt;br /&gt;
                            end&lt;br /&gt;
                    end&lt;br /&gt;
            end&lt;br /&gt;
        A1 : cover property (@(posedge clk) (test1 == 1'b1)) ;&lt;br /&gt;
    endgenerate&lt;br /&gt;
endmodule&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[moh@awing0 240906]$ &lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mohammad</name></author>	</entry>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=Main_Page&amp;diff=906</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=Main_Page&amp;diff=906"/>
				<updated>2024-09-06T19:02:01Z</updated>
		
		<summary type="html">&lt;p&gt;Mohammad: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''General'''&lt;br /&gt;
* [[How to get best support from Verific | '''''How to get best support from Verific''''']]&lt;br /&gt;
* [[Source code customization &amp;amp; Stable release services | Source code customization &amp;amp; Stable release services]]&lt;br /&gt;
* [[How to save computer resources | How to save computer resources (memory consumption &amp;amp; runtime)]]&lt;br /&gt;
* [[Original RTL language | How do I know what language a Netlist in the netlist database comes from?]]&lt;br /&gt;
* [[Verific data structures | What are the data structures in Verific?]]&lt;br /&gt;
* [[Remove Verific data structures | How do I remove all Verific data structures in memory?]]&lt;br /&gt;
* [[Does Verific build CDFG? | Does Verific build control and data flow graph (CDFG)?]]&lt;br /&gt;
* [[Does Verific support XMR?| Does Verific support cross module references (XMR)?]]&lt;br /&gt;
* [[Compile-time/run-time flags | Are there options to control Verific software's behavior? Compile-time &amp;amp; run-time flags.]]&lt;br /&gt;
* [[Message handling | How do I downgrade/upgrade messages from Verific? How do I get messages with more details?]]&lt;br /&gt;
* [[Release version | How do I tell the version of a Verific software release? ]]&lt;br /&gt;
* [[Simulation models for Verific primitives | Where do I find simulation models for Verific primitives (VERIFIC_XOR, VERIFIC_DFFRS, ....)? ]]&lt;br /&gt;
* [[Tcl library path| How to correct building (linking) issue &amp;quot;/usr/bin/ld: cannot find -ltcl&amp;quot;]]&lt;br /&gt;
* [[LineFile data from input files | LineFile data from input files]]&lt;br /&gt;
* [[Difference between RTL and gate-level simulations - Flipflop with async set and async reset | Difference between RTL and gate-level simulations - Flipflop with async set and async reset]]&lt;br /&gt;
* [[Preserving user nets - preventing nets from being optimized away | Preserving user nets - preventing nets from being optimized away]]&lt;br /&gt;
* [[Python pretty-printer for gdb | Python pretty-printer for gdb]]&lt;br /&gt;
* [[Yosys-Verific Integration | Yosys-Verific integration]]&lt;br /&gt;
&lt;br /&gt;
'''Input: VHDL, Verilog (and SystemVerilog), Liberty, EDIF'''&lt;br /&gt;
* [[How to get all Verilog files being analyzed | Verilog: I'm using -v, -y, .... After Verific is done with the analysis, how do I get a list of all the files being analyzed?]]&lt;br /&gt;
* [[Included files associated with a Verilog source file | Verilog: How do I get the list of included files associated with a Verilog source file?]]&lt;br /&gt;
* [[How to get type/initial value of parameters | Verilog: How to get type/initial value of parameters.]]&lt;br /&gt;
* [[Verilog ports being renamed | Verilog: Port Expressions]]&lt;br /&gt;
* [[Design with System Verilog and Verilog 2001 files | Verilog: For a design consisting of a mixture of Verilog 2001 and SystemVerilog input files, should I parse all the files as SystemVerilog?]]&lt;br /&gt;
* [[How to get module ports from Verilog parsetree | Verilog: From the Verilog parsetree, how can I get the ports of a module?]]&lt;br /&gt;
* [[How to change name of id in Verilog parsetree | Verilog: How do I change the name of an id (VeriidDef) in Verilog parsetree?]]&lt;br /&gt;
* [[How to get library containing nested module | Verilog: How do I get nested modules and get the library that contains the nested module?]]&lt;br /&gt;
* [[How to get linefile information of macro definitions | Verilog: How do I get linefile information of macro definitions?]]&lt;br /&gt;
* [[How to find port dimensions | Verilog: How do I get port dimensions?]]&lt;br /&gt;
* [[Instance - Module binding order | Verilog: What is the order of binding modules to instances?]]&lt;br /&gt;
* [[How Verific elaborator handles blackboxes/unknown boxes | Verilog: How Verific elaborator handles blackboxes/unknown boxes]]&lt;br /&gt;
* [[Constant expression replacement | Verilog: Does Verific replace constant expressions with their respective values?]]&lt;br /&gt;
* [[Modules with '_1' '_2' suffix in their names | Verilog: After static elaboration, there are modules with &amp;quot;_1&amp;quot;, &amp;quot;_2&amp;quot;, ..., suffix in their names. Why?]]&lt;br /&gt;
* [[Defined macros become undefined - MFCU vs SFCU | SystemVerilog: Why does Verific complain about undefined macros for macros defined in a different file (Compilation Unit)?]]&lt;br /&gt;
* [[Notes on analysis | SystemVerilog: Notes on analysis]]&lt;br /&gt;
* [[How to get enums from Verilog parsetree | SystemVerilog: From the parsetree, how can I get the enums declared in a module?]]&lt;br /&gt;
* [[How to identify packages being imported into a module | SystemVerilog: How do I identify packages being imported into a module?]]&lt;br /&gt;
* [[SystemVerilog &amp;quot;std&amp;quot; package | SystemVerilog: Support for SystemVerilog semaphore/process/mailbox constructs.]]&lt;br /&gt;
* [[Top level module with interface ports | SystemVerilog: Support for SystemVerilog top level module with interface ports.]]&lt;br /&gt;
* [[Design with VHDL-1993 and VHDL-2008 files | VHDL: VHDL-1993 and VHDL-2008 each has its own IEEE library set. How do I analyze/elaborate a design with a mixture of files of different VHDL dialects (1993 and 2008)?]]&lt;br /&gt;
* [[Escaped identifiers in RTL files and in Verific data structures | Verilog/VHDL: Escaped identifiers in RTL files and in Verific data structures]]&lt;br /&gt;
* [[Prettyprint to a string | Verilog/VHDL: How to prettyprint a parsetree node to a string.]]&lt;br /&gt;
* [[Static elaboration | Verilog/VHDL: What does 'static elaboration' do?]]&lt;br /&gt;
* [[How to ignore a (not used) parameter/generic in elaboration. | Verilog/VHDL: How to ignore a (not used) parameter/generic in elaboration.]]&lt;br /&gt;
* [[What VeriModule* or VhdlPrimaryUnit* the Netlist comes from? | Verilog/VHDL: For a Netlist in the netlist database, is there a clean way to look back at what VeriModule* or VhdlPrimaryUnit* the Netlist was derived from?]]&lt;br /&gt;
* [[Cross-reference between the original RTL files and the elaborated netlist | Verilog/VHDL: Is there a way to cross-reference between the original RTL design files and the elaboration netlist?]]&lt;br /&gt;
* [[How to ignore parameters/generics in elaboration | Verilog/VHDL: Is there a way to tell the elaborator to ignore certain parameters/generics so that the unit/module is not uniquified?]]&lt;br /&gt;
* [[How to check for errors in analysis/elaboration | Verilog/VHDL: Is there a way to tell if the analysis/elaboration process has errors?]]&lt;br /&gt;
* [[Modules/design units with &amp;quot;_default&amp;quot; suffix in their names | Verilog/VHDL: After static elaboration, there are modules/design units/interfaces with &amp;quot;_default&amp;quot; suffix in their names. Why? And what are they?]]&lt;br /&gt;
* [[How to parse a string | Verilog/VHDL: How to parse a string - Example of adding a module to the parsetree]]&lt;br /&gt;
* [[Support IEEE 1735 encryption standard | Verilog/VHDL: Does Verific support IEEE 1735 encryption standard?]]&lt;br /&gt;
'''Netlist Database'''&lt;br /&gt;
* [[Logic optimization across hierarchy boundaries | Netlist Database: Does Verific perform logic optimization across hierarchy boundaries?]]&lt;br /&gt;
* [[Bit-blasting a multi-port RAM instance | Netlist Database: Bit-blasting a multi-port RAM instance]]&lt;br /&gt;
* [[System attributes | Netlist Database: System attributes]]&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
* [[Output file formats | What language formats does Verific support as output?]]&lt;br /&gt;
&lt;br /&gt;
'''Scripting languages: TCL, Perl, Python'''&lt;br /&gt;
* [[What languages can I use with Verific software? | What programming languages can I use with Verific software?]]&lt;br /&gt;
&lt;br /&gt;
'''Code examples'''&lt;br /&gt;
* [[How to use RegisterCallBackMsg() | Util/C++: How to use RegisterCallBackMsg()]]&lt;br /&gt;
* [[How to use MessageCallBackHandler Class | Util/C++: How to use MessageCallBackHandler Class]]&lt;br /&gt;
* [[How to use RegisterPragmaRefCallBack() | Util/C++: How to use RegisterPragmaRefCallBack()]]&lt;br /&gt;
* [[Write out an encrypted netlist | Database/C++: Write out an encrypted netlist]]&lt;br /&gt;
* [[Extract clock enable | Database/C++: Extract clock enable]]&lt;br /&gt;
* [[Black box, empty box, and unknown box | Database/C++: Black box, empty box, and unknown box]]&lt;br /&gt;
* [[Post processing port resolution of black boxes | Database/C++: Post processing port resolution of black boxes]]&lt;br /&gt;
* [[Finding hierarchical paths of a Netlist | Database/C++: Finding hierarchical paths of a Netlist]]&lt;br /&gt;
* [[Replacing Verific built-in primitives/operators with user implementations | Database/C++: Replacing Verific built-in primitives/operators with user implementations]]&lt;br /&gt;
* [[Hierarchy tree RTL elaboration | Database/Perl: Simple example of hierarchy tree elaboration]]&lt;br /&gt;
* [[Create a Netlist Database from scratch (not from RTL elaboration) | Database/Perl/TCL: Create a Netlist Database from scratch (not from RTL elaboration)]]&lt;br /&gt;
* [[Buffering signals and ungrouping | Database/Verilog: Buffering signals and ungrouping (flattening) in the Netlist Database]]&lt;br /&gt;
* [[Memory elements of a RamNet | Database/Verilog/C++: Memory elements of a RamNet]]&lt;br /&gt;
* [[Process -f file and explore the Netlist Database (C++)| Database/Verilog/C++: Process -f file and explore the Netlist Database]]&lt;br /&gt;
* [[Process -f file and explore the Netlist Database (py)| Database/Verilog/Python: Process -f file and explore the Netlist Database]]&lt;br /&gt;
* [[Fanout cone and grouping | Database/Verilog/Perl: Fanout cone and grouping in the Netlist Database]]&lt;br /&gt;
* [[Type Range example | Database/Verilog/C++: Type Range example  (simple)]]&lt;br /&gt;
* [[Type Range example with multi-dimensional arrays| Database/Verilog/C++/Perl: Type Range example with multi-dimensional arrays]]&lt;br /&gt;
* [[Using TypeRange table to retrieve the originating type-range for an id | Database/Verilog/C++: Using TypeRange table to retrieve the originating type-range for an id]]&lt;br /&gt;
* [[Simple example of visitor pattern | Verilog/C++: Simple examples of visitor pattern]]&lt;br /&gt;
* [[Statically elaborate with different values of parameters | Verilog/C++: Statically elaborate with different values of parameters]]&lt;br /&gt;
* [[Prettyprint all modules in the design hierarchy | Verilog/C++: Prettyprint all modules in the design hierarchy]]&lt;br /&gt;
* [[Getting instances' parameters | Verilog/C++: Getting instances' parameters]]&lt;br /&gt;
* [[Accessing and evaluating module's parameters | Verilog/C++: Accessing and evaluating module's parameters]]&lt;br /&gt;
* [[Visiting Hierarchical References (VeriSelectedName) | Verilog/C++: Visiting Hierarchical References (VeriSelectedName)]]&lt;br /&gt;
* [[Using stream input to ignore input file | Verilog/C++: Using stream input to ignore input file]]&lt;br /&gt;
* [[How to ignore certain modules while analyzing input RTL files | Verilog/C++: How to ignore certain modules while analyzing input RTL files]]&lt;br /&gt;
* [[How to tell if a module has encrypted contents | Verilog/C++: How to tell if a module has encrypted contents]]&lt;br /&gt;
* [[Comment out a line using text based design modification and parsetree modification | Verilog/C++: Comment out a line using text-based design modification and parsetree modification]] &lt;br /&gt;
* [[Verilog/C++: How to use IsUserDeclared() : Example for port associations]]&lt;br /&gt;
* [[How to create new module in Verilog parsetree | Verilog/C++: How to create new module in Verilog parsetree]]&lt;br /&gt;
* [[In Verilog parsetree adding names to unnamed instances | Verilog/C++: In Verilog parsetree adding names to unnamed instances]]&lt;br /&gt;
* [[How to get full hierarchy ID path | Verilog/C++: How to get full hierarchy ID path]]&lt;br /&gt;
* [[How to traverse scope hierarchy | Verilog/C++: How to traverse scope hierarchy]]&lt;br /&gt;
* [[Access attributes in parsetree | Verilog/C++: How to access attributes in parsetree]]&lt;br /&gt;
* [[How to detect multiple-clock-edge condition in Verilog parsetree | Verilog/C++: How to detect multiple-clock-edge condition in Verilog parsetree]]&lt;br /&gt;
* [[How to get driving net of an instance | Verilog/C++: How to get driving net of an instance]]&lt;br /&gt;
* [[Parse select modules only and ignore the rest | Verilog/C++: Parse select modules only and ignore the rest]]&lt;br /&gt;
* [[Create DOT diagram of parse tree | Verilog/C++: Create DOT diagram of a parse tree]]&lt;br /&gt;
* [[How to get linefile data of macros - Macro callback function | Verilog/C++/Perl/Python: How to get linefile data of macros - Macro callback function]]&lt;br /&gt;
* [[Where in RTL does it get assigned? | Verilog/C++/Perl/Python: Where in RTL does it get assigned?]]&lt;br /&gt;
* [[Access attributes of ports in parsetree | Verilog/Perl: Access attributes of ports in parsetree and from netlist]]&lt;br /&gt;
* [[Evaluate 'for-generate' loop | Verilog/C++: Evaluate 'for-generate' loop]]&lt;br /&gt;
* [[Retrieve package name for user-defined variable types | SystemVerilog/C++/Python: Retrieve package name for user-defined variable types]]&lt;br /&gt;
* [[Pretty-print a module and the packages imported by the module | SystemVerilog/C++: Pretty-print a module and the packages imported by the module]]&lt;br /&gt;
* [[How to get packed dimensions of enum | SystemVerilog/C++: How to get packed dimensions of enum]]&lt;br /&gt;
* [[How to replace a statement that has a label | SystemVerilog/C++: How to replace a statement that has a label]]&lt;br /&gt;
* [[How to insert/add a statement, or a module item, into a sequential block and a generate block | SystemVerilog/C++: How to insert/add a statement, or a module item, into a sequential block and a generate block]]&lt;br /&gt;
* [[Simple examples of VHDL visitor pattern | VHDL/C++: Simple examples of VHDL visitor pattern]]&lt;br /&gt;
* [[Traverse instances in parsetree | VHDL/C++: Traverse instances in parsetree]]&lt;br /&gt;
* [[Parsing from data in memory | Verilog/VHDL/C++: Parsing from data in memory]]&lt;/div&gt;</summary>
		<author><name>Mohammad</name></author>	</entry>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=Main_Page&amp;diff=905</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=Main_Page&amp;diff=905"/>
				<updated>2024-09-06T18:59:53Z</updated>
		
		<summary type="html">&lt;p&gt;Mohammad: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''General'''&lt;br /&gt;
* [[How to get best support from Verific | '''''How to get best support from Verific''''']]&lt;br /&gt;
* [[Source code customization &amp;amp; Stable release services | Source code customization &amp;amp; Stable release services]]&lt;br /&gt;
* [[How to save computer resources | How to save computer resources (memory consumption &amp;amp; runtime)]]&lt;br /&gt;
* [[Original RTL language | How do I know what language a Netlist in the netlist database comes from?]]&lt;br /&gt;
* [[Verific data structures | What are the data structures in Verific?]]&lt;br /&gt;
* [[Remove Verific data structures | How do I remove all Verific data structures in memory?]]&lt;br /&gt;
* [[Does Verific build CDFG? | Does Verific build control and data flow graph (CDFG)?]]&lt;br /&gt;
* [[Does Verific support XMR?| Does Verific support cross module references (XMR)?]]&lt;br /&gt;
* [[Compile-time/run-time flags | Are there options to control Verific software's behavior? Compile-time &amp;amp; run-time flags.]]&lt;br /&gt;
* [[Message handling | How do I downgrade/upgrade messages from Verific? How do I get messages with more details?]]&lt;br /&gt;
* [[Release version | How do I tell the version of a Verific software release? ]]&lt;br /&gt;
* [[Simulation models for Verific primitives | Where do I find simulation models for Verific primitives (VERIFIC_XOR, VERIFIC_DFFRS, ....)? ]]&lt;br /&gt;
* [[Tcl library path| How to correct building (linking) issue &amp;quot;/usr/bin/ld: cannot find -ltcl&amp;quot;]]&lt;br /&gt;
* [[LineFile data from input files | LineFile data from input files]]&lt;br /&gt;
* [[Difference between RTL and gate-level simulations - Flipflop with async set and async reset | Difference between RTL and gate-level simulations - Flipflop with async set and async reset]]&lt;br /&gt;
* [[Preserving user nets - preventing nets from being optimized away | Preserving user nets - preventing nets from being optimized away]]&lt;br /&gt;
* [[Python pretty-printer for gdb | Python pretty-printer for gdb]]&lt;br /&gt;
* [[Yosys-Verific Integration | Yosys-Verific integration]]&lt;br /&gt;
&lt;br /&gt;
'''Input: VHDL, Verilog (and SystemVerilog), Liberty, EDIF'''&lt;br /&gt;
* [[How to get all Verilog files being analyzed | Verilog: I'm using -v, -y, .... After Verific is done with the analysis, how do I get a list of all the files being analyzed?]]&lt;br /&gt;
* [[Included files associated with a Verilog source file | Verilog: How do I get the list of included files associated with a Verilog source file?]]&lt;br /&gt;
* [[How to get type/initial value of parameters | Verilog: How to get type/initial value of parameters.]]&lt;br /&gt;
* [[Verilog ports being renamed | Verilog: Port Expressions]]&lt;br /&gt;
* [[Design with System Verilog and Verilog 2001 files | Verilog: For a design consisting of a mixture of Verilog 2001 and SystemVerilog input files, should I parse all the files as SystemVerilog?]]&lt;br /&gt;
* [[How to get module ports from Verilog parsetree | Verilog: From the Verilog parsetree, how can I get the ports of a module?]]&lt;br /&gt;
* [[How to change name of id in Verilog parsetree | Verilog: How do I change the name of an id (VeriidDef) in Verilog parsetree?]]&lt;br /&gt;
* [[How to get library containing nested module | Verilog: How do I get nested modules and get the library that contains the nested module?]]&lt;br /&gt;
* [[How to get linefile information of macro definitions | Verilog: How do I get linefile information of macro definitions?]]&lt;br /&gt;
* [[How to find port dimensions | Verilog: How do I get port dimensions?]]&lt;br /&gt;
* [[Instance - Module binding order | Verilog: What is the order of binding modules to instances?]]&lt;br /&gt;
* [[How Verific elaborator handles blackboxes/unknown boxes | Verilog: How Verific elaborator handles blackboxes/unknown boxes]]&lt;br /&gt;
* [[Constant expression replacement | Verilog: Does Verific replace constant expressions with their respective values?]]&lt;br /&gt;
* [[Modules with '_1' '_2' suffix in their names | Verilog: After static elaboration, there are modules with &amp;quot;_1&amp;quot;, &amp;quot;_2&amp;quot;, ..., suffix in their names. Why?]]&lt;br /&gt;
* [[Defined macros become undefined - MFCU vs SFCU | SystemVerilog: Why does Verific complain about undefined macros for macros defined in a different file (Compilation Unit)?]]&lt;br /&gt;
* [[Notes on analysis | SystemVerilog: Notes on analysis]]&lt;br /&gt;
* [[How to get enums from Verilog parsetree | SystemVerilog: From the parsetree, how can I get the enums declared in a module?]]&lt;br /&gt;
* [[How to identify packages being imported into a module | SystemVerilog: How do I identify packages being imported into a module?]]&lt;br /&gt;
* [[SystemVerilog &amp;quot;std&amp;quot; package | SystemVerilog: Support for SystemVerilog semaphore/process/mailbox constructs.]]&lt;br /&gt;
* [[Top level module with interface ports | SystemVerilog: Support for SystemVerilog top level module with interface ports.]]&lt;br /&gt;
* [[Design with VHDL-1993 and VHDL-2008 files | VHDL: VHDL-1993 and VHDL-2008 each has its own IEEE library set. How do I analyze/elaborate a design with a mixture of files of different VHDL dialects (1993 and 2008)?]]&lt;br /&gt;
* [[Escaped identifiers in RTL files and in Verific data structures | Verilog/VHDL: Escaped identifiers in RTL files and in Verific data structures]]&lt;br /&gt;
* [[Prettyprint to a string | Verilog/VHDL: How to prettyprint a parsetree node to a string.]]&lt;br /&gt;
* [[Static elaboration | Verilog/VHDL: What does 'static elaboration' do?]]&lt;br /&gt;
* [[How to ignore a (not used) parameter/generic in elaboration. | Verilog/VHDL: How to ignore a (not used) parameter/generic in elaboration.]]&lt;br /&gt;
* [[What VeriModule* or VhdlPrimaryUnit* the Netlist comes from? | Verilog/VHDL: For a Netlist in the netlist database, is there a clean way to look back at what VeriModule* or VhdlPrimaryUnit* the Netlist was derived from?]]&lt;br /&gt;
* [[Cross-reference between the original RTL files and the elaborated netlist | Verilog/VHDL: Is there a way to cross-reference between the original RTL design files and the elaboration netlist?]]&lt;br /&gt;
* [[How to ignore parameters/generics in elaboration | Verilog/VHDL: Is there a way to tell the elaborator to ignore certain parameters/generics so that the unit/module is not uniquified?]]&lt;br /&gt;
* [[How to check for errors in analysis/elaboration | Verilog/VHDL: Is there a way to tell if the analysis/elaboration process has errors?]]&lt;br /&gt;
* [[Modules/design units with &amp;quot;_default&amp;quot; suffix in their names | Verilog/VHDL: After static elaboration, there are modules/design units/interfaces with &amp;quot;_default&amp;quot; suffix in their names. Why? And what are they?]]&lt;br /&gt;
* [[How to parse a string | Verilog/VHDL: How to parse a string - Example of adding a module to the parsetree]]&lt;br /&gt;
* [[Support IEEE 1735 encryption standard | Verilog/VHDL: Does Verific support IEEE 1735 encryption standard?]]&lt;br /&gt;
'''Netlist Database'''&lt;br /&gt;
* [[Logic optimization across hierarchy boundaries | Netlist Database: Does Verific perform logic optimization across hierarchy boundaries?]]&lt;br /&gt;
* [[Bit-blasting a multi-port RAM instance | Netlist Database: Bit-blasting a multi-port RAM instance]]&lt;br /&gt;
* [[System attributes | Netlist Database: System attributes]]&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
* [[Output file formats | What language formats does Verific support as output?]]&lt;br /&gt;
&lt;br /&gt;
'''Scripting languages: TCL, Perl, Python'''&lt;br /&gt;
* [[What languages can I use with Verific software? | What programming languages can I use with Verific software?]]&lt;br /&gt;
&lt;br /&gt;
'''Code examples'''&lt;br /&gt;
* [[How to use RegisterCallBackMsg() | Util/C++: How to use RegisterCallBackMsg()]]&lt;br /&gt;
* [[How to use MessageCallBackHandler Class | Util/C++: How to use MessageCallBackHandler Class]]&lt;br /&gt;
* [[How to use RegisterPragmaRefCallBack() | Util/C++: How to use RegisterPragmaRefCallBack()]]&lt;br /&gt;
* [[Write out an encrypted netlist | Database/C++: Write out an encrypted netlist]]&lt;br /&gt;
* [[Extract clock enable | Database/C++: Extract clock enable]]&lt;br /&gt;
* [[Black box, empty box, and unknown box | Database/C++: Black box, empty box, and unknown box]]&lt;br /&gt;
* [[Post processing port resolution of black boxes | Database/C++: Post processing port resolution of black boxes]]&lt;br /&gt;
* [[Finding hierarchical paths of a Netlist | Database/C++: Finding hierarchical paths of a Netlist]]&lt;br /&gt;
* [[Replacing Verific built-in primitives/operators with user implementations | Database/C++: Replacing Verific built-in primitives/operators with user implementations]]&lt;br /&gt;
* [[Hierarchy tree RTL elaboration | Database/Perl: Simple example of hierarchy tree elaboration]]&lt;br /&gt;
* [[Create a Netlist Database from scratch (not from RTL elaboration) | Database/Perl/TCL: Create a Netlist Database from scratch (not from RTL elaboration)]]&lt;br /&gt;
* [[Buffering signals and ungrouping | Database/Verilog: Buffering signals and ungrouping (flattening) in the Netlist Database]]&lt;br /&gt;
* [[Memory elements of a RamNet | Database/Verilog/C++: Memory elements of a RamNet]]&lt;br /&gt;
* [[Process -f file and explore the Netlist Database (C++)| Database/Verilog/C++: Process -f file and explore the Netlist Database]]&lt;br /&gt;
* [[Process -f file and explore the Netlist Database (py)| Database/Verilog/Python: Process -f file and explore the Netlist Database]]&lt;br /&gt;
* [[Fanout cone and grouping | Database/Verilog/Perl: Fanout cone and grouping in the Netlist Database]]&lt;br /&gt;
* [[Type Range example | Database/Verilog/C++: Type Range example  (simple)]]&lt;br /&gt;
* [[Type Range example with multi-dimensional arrays| Database/Verilog/C++/Perl: Type Range example with multi-dimensional arrays]]&lt;br /&gt;
* [[Using TypeRange table to retrieve the originating type-range for an id | Database/Verilog/C++: Using TypeRange table to retrieve the originating type-range for an id]]&lt;br /&gt;
* [[Simple example of visitor pattern | Verilog/C++: Simple examples of visitor pattern]]&lt;br /&gt;
* [[Statically elaborate with different values of parameters | Verilog/C++: Statically elaborate with different values of parameters]]&lt;br /&gt;
* [[Prettyprint all modules in the design hierarchy | Verilog/C++: Prettyprint all modules in the design hierarchy]]&lt;br /&gt;
* [[Getting instances' parameters | Verilog/C++: Getting instances' parameters]]&lt;br /&gt;
* [[Accessing and evaluating module's parameters | Verilog/C++: Accessing and evaluating module's parameters]]&lt;br /&gt;
* [[Visiting Hierarchical References (VeriSelectedName) | Verilog/C++: Visiting Hierarchical References (VeriSelectedName)]]&lt;br /&gt;
* [[Using stream input to ignore input file | Verilog/C++: Using stream input to ignore input file]]&lt;br /&gt;
* [[How to ignore certain modules while analyzing input RTL files | Verilog/C++: How to ignore certain modules while analyzing input RTL files]]&lt;br /&gt;
* [[How to tell if a module has encrypted contents | Verilog/C++: How to tell if a module has encrypted contents]]&lt;br /&gt;
* [[Comment out a line using text based design modification and parsetree modification | Verilog/C++: Comment out a line using text-based design modification and parsetree modification]] &lt;br /&gt;
* [[Verilog/C++: How to use IsUserDeclared() : Example for port associations]]&lt;br /&gt;
* [[How to create new module in Verilog parsetree | Verilog/C++: How to create new module in Verilog parsetree]]&lt;br /&gt;
* [[In Verilog parsetree adding names to unnamed instances | Verilog/C++: In Verilog parsetree adding names to unnamed instances]]&lt;br /&gt;
* [[How to get full hierarchy ID path | Verilog/C++: How to get full hierarchy ID path]]&lt;br /&gt;
* [[How to traverse scope hierarchy | Verilog/C++: How to traverse scope hierarchy]]&lt;br /&gt;
* [[Access attributes in parsetree | Verilog/C++: How to access attributes in parsetree]]&lt;br /&gt;
* [[How to detect multiple-clock-edge condition in Verilog parsetree | Verilog/C++: How to detect multiple-clock-edge condition in Verilog parsetree]]&lt;br /&gt;
* [[How to get driving net of an instance | Verilog/C++: How to get driving net of an instance]]&lt;br /&gt;
* [[Parse select modules only and ignore the rest | Verilog/C++: Parse select modules only and ignore the rest]]&lt;br /&gt;
* [[Create DOT diagram of parse tree | Verilog/C++: Create DOT diagram of a parse tree]]&lt;br /&gt;
* [[How to get linefile data of macros - Macro callback function | Verilog/C++/Perl/Python: How to get linefile data of macros - Macro callback function]]&lt;br /&gt;
* [[Where in RTL does it get assigned? | Verilog/C++/Perl/Python: Where in RTL does it get assigned?]]&lt;br /&gt;
* [[Access attributes of ports in parsetree | Verilog/Perl: Access attributes of ports in parsetree and from netlist]]&lt;br /&gt;
* [[Evaluate 'for-generate' loop | Verilog/C++: Evaluate 'for-generate' loop]]&lt;br /&gt;
* [[Retrieve package name for user-defined variable types | SystemVerilog/C++/Python: Retrieve package name for user-defined variable types]]&lt;br /&gt;
* [[Pretty-print a module and the packages imported by the module | SystemVerilog/C++: Pretty-print a module and the packages imported by the module]]&lt;br /&gt;
* [[How to get packed dimensions of enum | SystemVerilog/C++: How to get packed dimensions of enum]]&lt;br /&gt;
* [[How to replace a statement that has a label | SystemVerilog/C++: How to replace a statement that has a label]]&lt;br /&gt;
* [[How to insert a statement, module item, into a sequential block or a generate block | SystemVerilog/C++: How to insert a statement, module item, into a sequential block or a generate block]]&lt;br /&gt;
* [[Simple examples of VHDL visitor pattern | VHDL/C++: Simple examples of VHDL visitor pattern]]&lt;br /&gt;
* [[Traverse instances in parsetree | VHDL/C++: Traverse instances in parsetree]]&lt;br /&gt;
* [[Parsing from data in memory | Verilog/VHDL/C++: Parsing from data in memory]]&lt;/div&gt;</summary>
		<author><name>Mohammad</name></author>	</entry>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=How_to_replace_a_statement_that_has_a_label&amp;diff=904</id>
		<title>How to replace a statement that has a label</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=How_to_replace_a_statement_that_has_a_label&amp;diff=904"/>
				<updated>2024-09-06T18:26:43Z</updated>
		
		<summary type="html">&lt;p&gt;Mohammad: Created page with &amp;quot;This application shows how to replace a statement expression and the statement could have a label that we can keep or change with a new label.   For the following testcase it...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This application shows how to replace a statement expression and the statement could have a label that we can keep or change with a new label. &lt;br /&gt;
&lt;br /&gt;
For the following testcase it specifically replaces assert A1 and assert A2 with the following A1 and A3 in the parse tree.&lt;br /&gt;
      A1: assert property(a ##0 b ##0 c |=&amp;gt; o) ;&lt;br /&gt;
      A3: assert property(@(posedge clk) disable iff(rst) a ##0 b ##0 c |=&amp;gt; o) ;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Testcase:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
module top(clk, rst, a, b, c, d, o) ;&lt;br /&gt;
    input clk, rst, a, b, c, d ;&lt;br /&gt;
    output reg o ;&lt;br /&gt;
&lt;br /&gt;
    always @(posedge clk) begin&lt;br /&gt;
        if (rst)&lt;br /&gt;
            o &amp;lt;= 0 ;&lt;br /&gt;
        else begin&lt;br /&gt;
            A1: assert property(a |-&amp;gt; b |-&amp;gt; c |=&amp;gt; o) ;&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    A2: assert property(@(posedge clk) disable iff(rst) a |-&amp;gt; b |-&amp;gt; c |=&amp;gt; o) ;&lt;br /&gt;
endmodule&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
C++:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
#include &amp;quot;veri_file.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriModule.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriId.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriStatement.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriScope.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriVisitor.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;Netlist.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriWrite.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;Strings.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;Array.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Map.h&amp;quot;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
#include &amp;lt;sstream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#ifdef VERIFIC_NAMESPACE&lt;br /&gt;
using namespace Verific ;&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
void find_replace(&lt;br /&gt;
    std::string&amp;amp; s,&lt;br /&gt;
    std::string const&amp;amp; toReplace,&lt;br /&gt;
    std::string const&amp;amp; replaceWith&lt;br /&gt;
) {&lt;br /&gt;
    std::size_t pos = s.find(toReplace);&lt;br /&gt;
    if (pos == std::string::npos) return;&lt;br /&gt;
    s.replace(pos, toReplace.length(), replaceWith);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class MyVisitor : public VeriVisitor&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
    MyVisitor() : VeriVisitor(), _parent_stack() { }&lt;br /&gt;
    virtual ~MyVisitor() { }&lt;br /&gt;
&lt;br /&gt;
    virtual void VERI_VISIT(VeriAssertion, node)&lt;br /&gt;
    {&lt;br /&gt;
        VeriTreeNode *parent = GetParent() ;&lt;br /&gt;
        VERIFIC_ASSERT(parent) ;&lt;br /&gt;
&lt;br /&gt;
        char *pp_str = node.GetPrettyPrintedString() ;&lt;br /&gt;
        node.Info(&amp;quot;Got assertion: %s&amp;quot;, pp_str) ;&lt;br /&gt;
        Strings::free(pp_str) ;&lt;br /&gt;
&lt;br /&gt;
        //pp_str = parent-&amp;gt;GetPrettyPrintedString() ;&lt;br /&gt;
        //node.Info(&amp;quot;Parent: %s&amp;quot;, pp_str) ;&lt;br /&gt;
        //Strings::free(pp_str) ;&lt;br /&gt;
&lt;br /&gt;
        VeriIdDef *label = node.GetOpeningLabel() ;&lt;br /&gt;
        if (!label) return ;&lt;br /&gt;
&lt;br /&gt;
        unsigned st ;&lt;br /&gt;
        if (Strings::compare(label-&amp;gt;Name(), &amp;quot;A1&amp;quot;)) {&lt;br /&gt;
            std::stringstream stream ;&lt;br /&gt;
            node.PrettyPrint(stream, 0) ;&lt;br /&gt;
            std::string s = stream.str();&lt;br /&gt;
            find_replace(s, &amp;quot;|-&amp;gt;&amp;quot;, &amp;quot;##(0)&amp;quot;);&lt;br /&gt;
            find_replace(s, &amp;quot;A1 : &amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
            char *updated_rtl_code = Strings::save(s.c_str()) ;&lt;br /&gt;
            node.Info(&amp;quot;UPDATED assertion: %s&amp;quot;, updated_rtl_code) ;&lt;br /&gt;
            st = ReplaceAssertWith(node, *parent, &amp;quot;A1&amp;quot; /*same label*/, &amp;quot;assert property(a ##0 b ##0 c |=&amp;gt; o) ;&amp;quot;) ;&lt;br /&gt;
        } else {&lt;br /&gt;
            st = ReplaceAssertWith(node, *parent, &amp;quot;A3&amp;quot; /*different label*/, &amp;quot;assert property(@(posedge clk) disable iff(rst) a ##0 b ##0 c |=&amp;gt; o) ;&amp;quot;) ;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        parent-&amp;gt;Info(&amp;quot;Assertion replacement: %s&amp;quot;, ((st)?&amp;quot;succeeded&amp;quot;:&amp;quot;FAILED&amp;quot;)) ;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // Maintain a parent pointer in the visitor:&lt;br /&gt;
    virtual void PreAction(VeriTreeNode &amp;amp;node)  { _parent_stack.Insert(&amp;amp;node) ; }&lt;br /&gt;
    virtual void PostAction(VeriTreeNode &amp;amp;node)&lt;br /&gt;
    {&lt;br /&gt;
        VeriTreeNode *n = (VeriTreeNode *)_parent_stack.RemoveLast() ;&lt;br /&gt;
        VERIFIC_ASSERT(n == &amp;amp;node) ;&lt;br /&gt;
    }&lt;br /&gt;
    VeriTreeNode *GetParent() const&lt;br /&gt;
    {&lt;br /&gt;
        VeriTreeNode *n = (VeriTreeNode *)_parent_stack.GetLast() ;&lt;br /&gt;
        VERIFIC_ASSERT(n) ;&lt;br /&gt;
        return n ;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
protected:&lt;br /&gt;
    unsigned ReplaceAssertWith(VeriAssertion &amp;amp;assert, VeriTreeNode &amp;amp;parent, const char *new_label, const char *new_assert)&lt;br /&gt;
    {&lt;br /&gt;
        if (!new_assert) return 0 ;&lt;br /&gt;
&lt;br /&gt;
        // Check for any opening label:&lt;br /&gt;
        VeriIdDef *label = assert.GetOpeningLabel() ;&lt;br /&gt;
&lt;br /&gt;
        unsigned same_label = (label &amp;amp;&amp;amp; new_label &amp;amp;&amp;amp; Strings::compare(label-&amp;gt;Name(), new_label)) ? 1 : 0 ;&lt;br /&gt;
&lt;br /&gt;
        // Create the string to be parsed with label if the labels are different:&lt;br /&gt;
        char *rtl_code = (new_label &amp;amp;&amp;amp; !same_label) ? Strings::save(new_label, &amp;quot;:&amp;quot;, new_assert) : 0 ;&lt;br /&gt;
&lt;br /&gt;
        // Get the scope of the parent node:&lt;br /&gt;
        VeriScope *parent_scope = parent.GetScope() ;&lt;br /&gt;
        if (!parent_scope) {&lt;br /&gt;
            VeriScope *scope = assert.GetScope() ;&lt;br /&gt;
            if (scope) parent_scope = scope-&amp;gt;Upper() ;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        // Cannot handle a label without a parent scope:&lt;br /&gt;
        if ((label || new_label) &amp;amp;&amp;amp; !parent_scope) return 0 ;&lt;br /&gt;
&lt;br /&gt;
        // Now analyze the string into assertion statement:&lt;br /&gt;
        VeriStatement *new_node = veri_file::AnalyzeStatement(((rtl_code)?rtl_code:new_assert), veri_file::SYSTEM_VERILOG, 0 /*may use assert.Linefile()*/, parent_scope) ;&lt;br /&gt;
        Strings::free(rtl_code) ;&lt;br /&gt;
        if (!new_node) return 0 ; // Something went wrong&lt;br /&gt;
&lt;br /&gt;
        if (label &amp;amp;&amp;amp; parent_scope &amp;amp;&amp;amp; (!new_label || !same_label)) {&lt;br /&gt;
#if 0&lt;br /&gt;
            // Different label or the new one does not have a label:&lt;br /&gt;
            // If you want, you can undeclare and delete the old label;&lt;br /&gt;
            // but it may cause memory corruption if it is referred in the design.&lt;br /&gt;
            // In that case you have to traverse the whole design and reset the refs.&lt;br /&gt;
            // Also, keeping it around will prevent defining the same label again later.&lt;br /&gt;
            parent_scope-&amp;gt;Undeclare(label) ;&lt;br /&gt;
            label-&amp;gt;ClearAllBckPtrs() ;&lt;br /&gt;
            assert.SetOpeningLabel(0) ;&lt;br /&gt;
            delete label ;&lt;br /&gt;
#endif&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        unsigned st = 1 ;&lt;br /&gt;
        // Now, try to replace the assertion statment on the parent:&lt;br /&gt;
        if (!parent.ReplaceChildStmt(&amp;amp;assert, new_node, 1 /*delete old assert*/)) {&lt;br /&gt;
            // Failed to replace, it may be used as a module item - try to replace that here:&lt;br /&gt;
            st = parent.ReplaceChildModuleItem(&amp;amp;assert, new_node, 1 /*delete old assert*/) ;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        if (same_label) {&lt;br /&gt;
            // Same label: re-use the existing label:&lt;br /&gt;
            new_node-&amp;gt;SetOpeningLabel(label) ;&lt;br /&gt;
            label-&amp;gt;SetScope(new_node-&amp;gt;GetScope()) ;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        return st ; // 1 = success, 0 = failure&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
    Array _parent_stack ;&lt;br /&gt;
} ; // class MyVisitor&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char **argv)&lt;br /&gt;
{&lt;br /&gt;
    Array files(1) ;&lt;br /&gt;
    files.Insert(&amp;quot;test.v&amp;quot;) ;&lt;br /&gt;
    if (!veri_file::AnalyzeMultipleFiles(&amp;amp;files, veri_file::SYSTEM_VERILOG)) return 1 ;&lt;br /&gt;
&lt;br /&gt;
    veri_file::PrettyPrint(&amp;quot;test_pp.v.golden.new&amp;quot;, 0) ;&lt;br /&gt;
&lt;br /&gt;
    MyVisitor mv ;&lt;br /&gt;
&lt;br /&gt;
    MapIter mi ;&lt;br /&gt;
    VeriModule *mod ;&lt;br /&gt;
    FOREACH_VERILOG_MODULE(mi, mod) if (mod) mod-&amp;gt;Accept(mv) ;&lt;br /&gt;
&lt;br /&gt;
    veri_file::PrettyPrint(&amp;quot;test_mod_pp.v.golden.new&amp;quot;, 0) ;&lt;br /&gt;
&lt;br /&gt;
    // Elaborate the design:&lt;br /&gt;
    veri_file::ElaborateAll() ;&lt;br /&gt;
&lt;br /&gt;
    VeriWrite vw ;&lt;br /&gt;
    vw.WriteFile(&amp;quot;test.v.golden.new&amp;quot;, Netlist::PresentDesign()) ;&lt;br /&gt;
&lt;br /&gt;
    // Synthesize assertions in the parse tree:&lt;br /&gt;
    //veri_file::SynthesizeConcurrentAssertions() ;&lt;br /&gt;
    //veri_file::PrettyPrint(&amp;quot;test_assert_synth.v.golden.new&amp;quot;, 0) ;&lt;br /&gt;
&lt;br /&gt;
    return 0 ;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Final modified result:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
module top (clk, rst, a, b, c, d, o) ;&lt;br /&gt;
    input clk, rst, a, b, c, d ; &lt;br /&gt;
    output reg o ; &lt;br /&gt;
    always&lt;br /&gt;
        @(posedge clk)&lt;br /&gt;
        begin&lt;br /&gt;
            if (rst) &lt;br /&gt;
                o &amp;lt;=  0 ;&lt;br /&gt;
            else&lt;br /&gt;
                begin&lt;br /&gt;
                    A1 : assert property (a ##(0) b ##(0) c |=&amp;gt; o) ;&lt;br /&gt;
                end&lt;br /&gt;
        end&lt;br /&gt;
    A3 : assert property (@(posedge clk) disable iff ( rst) a ##(0) b ##(0) c |=&amp;gt; o) ;&lt;br /&gt;
endmodule&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mohammad</name></author>	</entry>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=Main_Page&amp;diff=903</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=Main_Page&amp;diff=903"/>
				<updated>2024-09-06T18:04:48Z</updated>
		
		<summary type="html">&lt;p&gt;Mohammad: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''General'''&lt;br /&gt;
* [[How to get best support from Verific | '''''How to get best support from Verific''''']]&lt;br /&gt;
* [[Source code customization &amp;amp; Stable release services | Source code customization &amp;amp; Stable release services]]&lt;br /&gt;
* [[How to save computer resources | How to save computer resources (memory consumption &amp;amp; runtime)]]&lt;br /&gt;
* [[Original RTL language | How do I know what language a Netlist in the netlist database comes from?]]&lt;br /&gt;
* [[Verific data structures | What are the data structures in Verific?]]&lt;br /&gt;
* [[Remove Verific data structures | How do I remove all Verific data structures in memory?]]&lt;br /&gt;
* [[Does Verific build CDFG? | Does Verific build control and data flow graph (CDFG)?]]&lt;br /&gt;
* [[Does Verific support XMR?| Does Verific support cross module references (XMR)?]]&lt;br /&gt;
* [[Compile-time/run-time flags | Are there options to control Verific software's behavior? Compile-time &amp;amp; run-time flags.]]&lt;br /&gt;
* [[Message handling | How do I downgrade/upgrade messages from Verific? How do I get messages with more details?]]&lt;br /&gt;
* [[Release version | How do I tell the version of a Verific software release? ]]&lt;br /&gt;
* [[Simulation models for Verific primitives | Where do I find simulation models for Verific primitives (VERIFIC_XOR, VERIFIC_DFFRS, ....)? ]]&lt;br /&gt;
* [[Tcl library path| How to correct building (linking) issue &amp;quot;/usr/bin/ld: cannot find -ltcl&amp;quot;]]&lt;br /&gt;
* [[LineFile data from input files | LineFile data from input files]]&lt;br /&gt;
* [[Difference between RTL and gate-level simulations - Flipflop with async set and async reset | Difference between RTL and gate-level simulations - Flipflop with async set and async reset]]&lt;br /&gt;
* [[Preserving user nets - preventing nets from being optimized away | Preserving user nets - preventing nets from being optimized away]]&lt;br /&gt;
* [[Python pretty-printer for gdb | Python pretty-printer for gdb]]&lt;br /&gt;
* [[Yosys-Verific Integration | Yosys-Verific integration]]&lt;br /&gt;
&lt;br /&gt;
'''Input: VHDL, Verilog (and SystemVerilog), Liberty, EDIF'''&lt;br /&gt;
* [[How to get all Verilog files being analyzed | Verilog: I'm using -v, -y, .... After Verific is done with the analysis, how do I get a list of all the files being analyzed?]]&lt;br /&gt;
* [[Included files associated with a Verilog source file | Verilog: How do I get the list of included files associated with a Verilog source file?]]&lt;br /&gt;
* [[How to get type/initial value of parameters | Verilog: How to get type/initial value of parameters.]]&lt;br /&gt;
* [[Verilog ports being renamed | Verilog: Port Expressions]]&lt;br /&gt;
* [[Design with System Verilog and Verilog 2001 files | Verilog: For a design consisting of a mixture of Verilog 2001 and SystemVerilog input files, should I parse all the files as SystemVerilog?]]&lt;br /&gt;
* [[How to get module ports from Verilog parsetree | Verilog: From the Verilog parsetree, how can I get the ports of a module?]]&lt;br /&gt;
* [[How to change name of id in Verilog parsetree | Verilog: How do I change the name of an id (VeriidDef) in Verilog parsetree?]]&lt;br /&gt;
* [[How to get library containing nested module | Verilog: How do I get nested modules and get the library that contains the nested module?]]&lt;br /&gt;
* [[How to get linefile information of macro definitions | Verilog: How do I get linefile information of macro definitions?]]&lt;br /&gt;
* [[How to find port dimensions | Verilog: How do I get port dimensions?]]&lt;br /&gt;
* [[Instance - Module binding order | Verilog: What is the order of binding modules to instances?]]&lt;br /&gt;
* [[How Verific elaborator handles blackboxes/unknown boxes | Verilog: How Verific elaborator handles blackboxes/unknown boxes]]&lt;br /&gt;
* [[Constant expression replacement | Verilog: Does Verific replace constant expressions with their respective values?]]&lt;br /&gt;
* [[Modules with '_1' '_2' suffix in their names | Verilog: After static elaboration, there are modules with &amp;quot;_1&amp;quot;, &amp;quot;_2&amp;quot;, ..., suffix in their names. Why?]]&lt;br /&gt;
* [[Defined macros become undefined - MFCU vs SFCU | SystemVerilog: Why does Verific complain about undefined macros for macros defined in a different file (Compilation Unit)?]]&lt;br /&gt;
* [[Notes on analysis | SystemVerilog: Notes on analysis]]&lt;br /&gt;
* [[How to get enums from Verilog parsetree | SystemVerilog: From the parsetree, how can I get the enums declared in a module?]]&lt;br /&gt;
* [[How to identify packages being imported into a module | SystemVerilog: How do I identify packages being imported into a module?]]&lt;br /&gt;
* [[SystemVerilog &amp;quot;std&amp;quot; package | SystemVerilog: Support for SystemVerilog semaphore/process/mailbox constructs.]]&lt;br /&gt;
* [[Top level module with interface ports | SystemVerilog: Support for SystemVerilog top level module with interface ports.]]&lt;br /&gt;
* [[Design with VHDL-1993 and VHDL-2008 files | VHDL: VHDL-1993 and VHDL-2008 each has its own IEEE library set. How do I analyze/elaborate a design with a mixture of files of different VHDL dialects (1993 and 2008)?]]&lt;br /&gt;
* [[Escaped identifiers in RTL files and in Verific data structures | Verilog/VHDL: Escaped identifiers in RTL files and in Verific data structures]]&lt;br /&gt;
* [[Prettyprint to a string | Verilog/VHDL: How to prettyprint a parsetree node to a string.]]&lt;br /&gt;
* [[Static elaboration | Verilog/VHDL: What does 'static elaboration' do?]]&lt;br /&gt;
* [[How to ignore a (not used) parameter/generic in elaboration. | Verilog/VHDL: How to ignore a (not used) parameter/generic in elaboration.]]&lt;br /&gt;
* [[What VeriModule* or VhdlPrimaryUnit* the Netlist comes from? | Verilog/VHDL: For a Netlist in the netlist database, is there a clean way to look back at what VeriModule* or VhdlPrimaryUnit* the Netlist was derived from?]]&lt;br /&gt;
* [[Cross-reference between the original RTL files and the elaborated netlist | Verilog/VHDL: Is there a way to cross-reference between the original RTL design files and the elaboration netlist?]]&lt;br /&gt;
* [[How to ignore parameters/generics in elaboration | Verilog/VHDL: Is there a way to tell the elaborator to ignore certain parameters/generics so that the unit/module is not uniquified?]]&lt;br /&gt;
* [[How to check for errors in analysis/elaboration | Verilog/VHDL: Is there a way to tell if the analysis/elaboration process has errors?]]&lt;br /&gt;
* [[Modules/design units with &amp;quot;_default&amp;quot; suffix in their names | Verilog/VHDL: After static elaboration, there are modules/design units/interfaces with &amp;quot;_default&amp;quot; suffix in their names. Why? And what are they?]]&lt;br /&gt;
* [[How to parse a string | Verilog/VHDL: How to parse a string - Example of adding a module to the parsetree]]&lt;br /&gt;
* [[Support IEEE 1735 encryption standard | Verilog/VHDL: Does Verific support IEEE 1735 encryption standard?]]&lt;br /&gt;
'''Netlist Database'''&lt;br /&gt;
* [[Logic optimization across hierarchy boundaries | Netlist Database: Does Verific perform logic optimization across hierarchy boundaries?]]&lt;br /&gt;
* [[Bit-blasting a multi-port RAM instance | Netlist Database: Bit-blasting a multi-port RAM instance]]&lt;br /&gt;
* [[System attributes | Netlist Database: System attributes]]&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
* [[Output file formats | What language formats does Verific support as output?]]&lt;br /&gt;
&lt;br /&gt;
'''Scripting languages: TCL, Perl, Python'''&lt;br /&gt;
* [[What languages can I use with Verific software? | What programming languages can I use with Verific software?]]&lt;br /&gt;
&lt;br /&gt;
'''Code examples'''&lt;br /&gt;
* [[How to use RegisterCallBackMsg() | Util/C++: How to use RegisterCallBackMsg()]]&lt;br /&gt;
* [[How to use MessageCallBackHandler Class | Util/C++: How to use MessageCallBackHandler Class]]&lt;br /&gt;
* [[How to use RegisterPragmaRefCallBack() | Util/C++: How to use RegisterPragmaRefCallBack()]]&lt;br /&gt;
* [[Write out an encrypted netlist | Database/C++: Write out an encrypted netlist]]&lt;br /&gt;
* [[Extract clock enable | Database/C++: Extract clock enable]]&lt;br /&gt;
* [[Black box, empty box, and unknown box | Database/C++: Black box, empty box, and unknown box]]&lt;br /&gt;
* [[Post processing port resolution of black boxes | Database/C++: Post processing port resolution of black boxes]]&lt;br /&gt;
* [[Finding hierarchical paths of a Netlist | Database/C++: Finding hierarchical paths of a Netlist]]&lt;br /&gt;
* [[Replacing Verific built-in primitives/operators with user implementations | Database/C++: Replacing Verific built-in primitives/operators with user implementations]]&lt;br /&gt;
* [[Hierarchy tree RTL elaboration | Database/Perl: Simple example of hierarchy tree elaboration]]&lt;br /&gt;
* [[Create a Netlist Database from scratch (not from RTL elaboration) | Database/Perl/TCL: Create a Netlist Database from scratch (not from RTL elaboration)]]&lt;br /&gt;
* [[Buffering signals and ungrouping | Database/Verilog: Buffering signals and ungrouping (flattening) in the Netlist Database]]&lt;br /&gt;
* [[Memory elements of a RamNet | Database/Verilog/C++: Memory elements of a RamNet]]&lt;br /&gt;
* [[Process -f file and explore the Netlist Database (C++)| Database/Verilog/C++: Process -f file and explore the Netlist Database]]&lt;br /&gt;
* [[Process -f file and explore the Netlist Database (py)| Database/Verilog/Python: Process -f file and explore the Netlist Database]]&lt;br /&gt;
* [[Fanout cone and grouping | Database/Verilog/Perl: Fanout cone and grouping in the Netlist Database]]&lt;br /&gt;
* [[Type Range example | Database/Verilog/C++: Type Range example  (simple)]]&lt;br /&gt;
* [[Type Range example with multi-dimensional arrays| Database/Verilog/C++/Perl: Type Range example with multi-dimensional arrays]]&lt;br /&gt;
* [[Using TypeRange table to retrieve the originating type-range for an id | Database/Verilog/C++: Using TypeRange table to retrieve the originating type-range for an id]]&lt;br /&gt;
* [[Simple example of visitor pattern | Verilog/C++: Simple examples of visitor pattern]]&lt;br /&gt;
* [[Statically elaborate with different values of parameters | Verilog/C++: Statically elaborate with different values of parameters]]&lt;br /&gt;
* [[Prettyprint all modules in the design hierarchy | Verilog/C++: Prettyprint all modules in the design hierarchy]]&lt;br /&gt;
* [[Getting instances' parameters | Verilog/C++: Getting instances' parameters]]&lt;br /&gt;
* [[Accessing and evaluating module's parameters | Verilog/C++: Accessing and evaluating module's parameters]]&lt;br /&gt;
* [[Visiting Hierarchical References (VeriSelectedName) | Verilog/C++: Visiting Hierarchical References (VeriSelectedName)]]&lt;br /&gt;
* [[Using stream input to ignore input file | Verilog/C++: Using stream input to ignore input file]]&lt;br /&gt;
* [[How to ignore certain modules while analyzing input RTL files | Verilog/C++: How to ignore certain modules while analyzing input RTL files]]&lt;br /&gt;
* [[How to tell if a module has encrypted contents | Verilog/C++: How to tell if a module has encrypted contents]]&lt;br /&gt;
* [[Comment out a line using text based design modification and parsetree modification | Verilog/C++: Comment out a line using text-based design modification and parsetree modification]] &lt;br /&gt;
* [[Verilog/C++: How to use IsUserDeclared() : Example for port associations]]&lt;br /&gt;
* [[How to create new module in Verilog parsetree | Verilog/C++: How to create new module in Verilog parsetree]]&lt;br /&gt;
* [[In Verilog parsetree adding names to unnamed instances | Verilog/C++: In Verilog parsetree adding names to unnamed instances]]&lt;br /&gt;
* [[How to get full hierarchy ID path | Verilog/C++: How to get full hierarchy ID path]]&lt;br /&gt;
* [[How to traverse scope hierarchy | Verilog/C++: How to traverse scope hierarchy]]&lt;br /&gt;
* [[Access attributes in parsetree | Verilog/C++: How to access attributes in parsetree]]&lt;br /&gt;
* [[How to detect multiple-clock-edge condition in Verilog parsetree | Verilog/C++: How to detect multiple-clock-edge condition in Verilog parsetree]]&lt;br /&gt;
* [[How to get driving net of an instance | Verilog/C++: How to get driving net of an instance]]&lt;br /&gt;
* [[Parse select modules only and ignore the rest | Verilog/C++: Parse select modules only and ignore the rest]]&lt;br /&gt;
* [[Create DOT diagram of parse tree | Verilog/C++: Create DOT diagram of a parse tree]]&lt;br /&gt;
* [[How to get linefile data of macros - Macro callback function | Verilog/C++/Perl/Python: How to get linefile data of macros - Macro callback function]]&lt;br /&gt;
* [[Where in RTL does it get assigned? | Verilog/C++/Perl/Python: Where in RTL does it get assigned?]]&lt;br /&gt;
* [[Access attributes of ports in parsetree | Verilog/Perl: Access attributes of ports in parsetree and from netlist]]&lt;br /&gt;
* [[Evaluate 'for-generate' loop | Verilog/C++: Evaluate 'for-generate' loop]]&lt;br /&gt;
* [[Retrieve package name for user-defined variable types | SystemVerilog/C++/Python: Retrieve package name for user-defined variable types]]&lt;br /&gt;
* [[Pretty-print a module and the packages imported by the module | SystemVerilog/C++: Pretty-print a module and the packages imported by the module]]&lt;br /&gt;
* [[How to get packed dimensions of enum | SystemVerilog/C++: How to get packed dimensions of enum]]&lt;br /&gt;
* [[How to replace a statement that has a label | SystemVerilog/C++: How to replace a statement that has a label]]&lt;br /&gt;
* [[Simple examples of VHDL visitor pattern | VHDL/C++: Simple examples of VHDL visitor pattern]]&lt;br /&gt;
* [[Traverse instances in parsetree | VHDL/C++: Traverse instances in parsetree]]&lt;br /&gt;
* [[Parsing from data in memory | Verilog/VHDL/C++: Parsing from data in memory]]&lt;/div&gt;</summary>
		<author><name>Mohammad</name></author>	</entry>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=Pretty-print_a_module_and_the_packages_imported_by_the_module&amp;diff=877</id>
		<title>Pretty-print a module and the packages imported by the module</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=Pretty-print_a_module_and_the_packages_imported_by_the_module&amp;diff=877"/>
				<updated>2023-12-15T05:49:43Z</updated>
		
		<summary type="html">&lt;p&gt;Mohammad: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;C++:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
#include &amp;lt;fstream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;veri_file.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriModule.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriId.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriScope.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;Map.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
using namespace std ;&lt;br /&gt;
&lt;br /&gt;
#ifdef VERIFIC_NAMESPACE&lt;br /&gt;
using namespace Verific ;&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
int main(int argc, const char **argv)&lt;br /&gt;
{&lt;br /&gt;
    const char *file = (argc &amp;gt; 1) ? argv[1] : &amp;quot;test.sv&amp;quot; ;&lt;br /&gt;
&lt;br /&gt;
    // Analyze the files (AnalyzeMultipleFiles API is the recommended one):&lt;br /&gt;
    Array files(1) ;&lt;br /&gt;
    files.InsertLast(file) ;&lt;br /&gt;
    if (!veri_file::AnalyzeMultipleFiles(&amp;amp;files, veri_file::SYSTEM_VERILOG)) return 1 ;&lt;br /&gt;
&lt;br /&gt;
    MapIter mi ;&lt;br /&gt;
    VeriModule *module ;&lt;br /&gt;
    FOREACH_VERILOG_MODULE(mi, module){&lt;br /&gt;
        if (!module) continue ;&lt;br /&gt;
        if (module-&amp;gt;IsPackage()) continue ; // no need to dive into package&lt;br /&gt;
&lt;br /&gt;
        // Get the scope of the module:&lt;br /&gt;
        VeriScope *scope = module-&amp;gt;GetScope() ;&lt;br /&gt;
&lt;br /&gt;
        char *outputfilename = Strings::save(module-&amp;gt;Name(), &amp;quot;_pp_out.v&amp;quot;);&lt;br /&gt;
        std::ofstream f(outputfilename, std::ios::out) ;&lt;br /&gt;
&lt;br /&gt;
        // Get the scope that this module/scope is using:&lt;br /&gt;
        // This also includes the compilation unit in the list, if any/required:&lt;br /&gt;
        Set *using_scopes = (scope) ? scope-&amp;gt;GetUsing() : 0 ;&lt;br /&gt;
&lt;br /&gt;
        // Print all those scopes/modules before printing the module itself:&lt;br /&gt;
        SetIter si ;&lt;br /&gt;
        VeriScope *using_scope ;&lt;br /&gt;
        FOREACH_SET_ITEM(using_scopes, si, &amp;amp;using_scope) {&lt;br /&gt;
            VeriIdDef *mod_id = using_scope-&amp;gt;GetContainingModule() ;&lt;br /&gt;
            VeriModule *mod = (mod_id) ? mod_id-&amp;gt;GetModule() : 0 ;&lt;br /&gt;
            if (!mod) continue ;&lt;br /&gt;
            if (mod-&amp;gt;IsPackage()) {&lt;br /&gt;
                std::cout &amp;lt;&amp;lt; &amp;quot;&amp;gt;&amp;gt;&amp;gt; Module '&amp;quot; &amp;lt;&amp;lt; module-&amp;gt;Name() &amp;lt;&amp;lt; &amp;quot;' uses package '&amp;quot; &amp;lt;&amp;lt; mod-&amp;gt;Name() &amp;lt;&amp;lt; &amp;quot;' &amp;lt;&amp;lt;&amp;lt;\n&amp;quot;;&lt;br /&gt;
            }&lt;br /&gt;
            f &amp;lt;&amp;lt; &amp;quot;// Printing package &amp;quot; &amp;lt;&amp;lt; mod-&amp;gt;Name() &amp;lt;&amp;lt; endl ;&lt;br /&gt;
            mod-&amp;gt;PrettyPrint(f, 0) ;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        // Now  print the module:&lt;br /&gt;
        f &amp;lt;&amp;lt; &amp;quot;// Printing module &amp;quot; &amp;lt;&amp;lt; module-&amp;gt;Name() &amp;lt;&amp;lt; endl ;&lt;br /&gt;
        module-&amp;gt;PrettyPrint(f, 0) ;&lt;br /&gt;
        f.close() ;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    return 0 ;&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Input Verilog:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
package PKG1 ;&lt;br /&gt;
    typedef int my_int ;&lt;br /&gt;
endpackage&lt;br /&gt;
&lt;br /&gt;
typedef byte my_byte ;&lt;br /&gt;
&lt;br /&gt;
module test ;&lt;br /&gt;
    import PKG1::* ;&lt;br /&gt;
    my_int int1 ;&lt;br /&gt;
    my_byte byte1 ;&lt;br /&gt;
endmodule&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Console output:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
-- Analyzing Verilog file 'top.v' (VERI-1482)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Module 'top' uses package 'PKG1' &amp;lt;&amp;lt;&amp;lt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Module 'top' uses package '$unit_top_v' &amp;lt;&amp;lt;&amp;lt;&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pretty-printed output:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
// Printing package PKG1&lt;br /&gt;
&lt;br /&gt;
package PKG1 ;&lt;br /&gt;
    typedef int my_int ;&lt;br /&gt;
endpackage&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Printing package $unit_test_sv&lt;br /&gt;
&lt;br /&gt;
typedef byte my_byte ;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Printing module test&lt;br /&gt;
&lt;br /&gt;
module test ;&lt;br /&gt;
    import PKG1:: * ;&lt;br /&gt;
    my_int int1 ;&lt;br /&gt;
    my_byte byte1 ;&lt;br /&gt;
endmodule&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mohammad</name></author>	</entry>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=Message_handling&amp;diff=876</id>
		<title>Message handling</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=Message_handling&amp;diff=876"/>
				<updated>2023-12-12T19:48:23Z</updated>
		
		<summary type="html">&lt;p&gt;Mohammad: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Q: How do I upgrade/downgrade messages from Verific?'''&lt;br /&gt;
&lt;br /&gt;
Verific message table, with notation as whether the error can be safely downgraded: [http://www.verific.com/docs/index.php?title=Message_Downgrading_Table Verific Message Table]&lt;br /&gt;
&lt;br /&gt;
(Access to Verific On-line Documentation requires login. Contact Verific if you don't know/don't have credentials).&lt;br /&gt;
&lt;br /&gt;
You can set any message to any type below:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
VERIFIC_NONE,         // print no prefix&lt;br /&gt;
VERIFIC_ERROR,        // print ERROR:&lt;br /&gt;
VERIFIC_WARNING,      // print WARNING:&lt;br /&gt;
VERIFIC_IGNORE,       // ignore message (do not print message):&lt;br /&gt;
VERIFIC_INFO,         // print INFO:&lt;br /&gt;
VERIFIC_COMMENT,      // print --&lt;br /&gt;
VERIFIC_PROGRAM_ERROR // print PROGRAM_ERROR&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
For C++, use the following APIs:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
Message::SetMessageType()       - Force a message type by message id&lt;br /&gt;
Message::GetMessageType()       - Get the message type by message id&lt;br /&gt;
Message::ClearMessageType()     - Clear a message type by message id&lt;br /&gt;
Message::SetAllMessageType()    - Force all messages of type 'orig' to behave as type 'type'.&lt;br /&gt;
Message::ClearAllMessageTypes() - Clear all forced message types&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Python, use the following APIs:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
Message.SetMessageType()       - Force a message type by message id&lt;br /&gt;
Message.GetMessageType()       - Get the message type by message id&lt;br /&gt;
Message.ClearMessageType()     - Clear a message type by message id&lt;br /&gt;
Message.SetAllMessageType()    - Force all messages of type 'orig' to behave as type 'type'.&lt;br /&gt;
Message.ClearAllMessageTypes() - Clear all forced message types&lt;br /&gt;
&lt;br /&gt;
* Python interface also accepts 'Message_SetMessageType()' but 'Message.SetMessageType()' is accepted and is more readable. &lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Some Python usage example:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
Orignal messages log:&lt;br /&gt;
-- Analyzing Verilog file '../../src/example_designs/verilog/r4000.v' (VERI-1482)&lt;br /&gt;
../../src/example_designs/verilog/r4000.v(82): INFO: analyzing included file '../../src/example_designs/verilog/cntrl.v' (VERI-1328)&lt;br /&gt;
../../src/example_designs/verilog/r4000.v(82): INFO: back to file '../../src/example_designs/verilog/r4000.v' (VERI-2320)&lt;br /&gt;
../../src/example_designs/verilog/r4000.v(83): INFO: analyzing included file '../../src/example_designs/verilog/alu.v' (VERI-1328)&lt;br /&gt;
../../src/example_designs/verilog/r4000.v(83): INFO: back to file '../../src/example_designs/verilog/r4000.v' (VERI-2320)&lt;br /&gt;
../../src/example_designs/verilog/r4000.v(84): INFO: analyzing included file '../../src/example_designs/verilog/register.v' (VERI-1328)&lt;br /&gt;
../../src/example_designs/verilog/r4000.v(84): INFO: back to file '../../src/example_designs/verilog/r4000.v' (VERI-2320)&lt;br /&gt;
 &lt;br /&gt;
This python line is added before analyzing the file:&lt;br /&gt;
Verific.Message.SetMessageType(&amp;quot;VERI-1328&amp;quot;, Verific.VERIFIC_IGNORE)&lt;br /&gt;
 &lt;br /&gt;
New messages log:&lt;br /&gt;
-- Analyzing Verilog file '../../src/example_designs/verilog/r4000.v' (VERI-1482)&lt;br /&gt;
../../src/example_designs/verilog/r4000.v(82): INFO: back to file '../../src/example_designs/verilog/r4000.v' (VERI-2320)&lt;br /&gt;
../../src/example_designs/verilog/r4000.v(83): INFO: back to file '../../src/example_designs/verilog/r4000.v' (VERI-2320)&lt;br /&gt;
../../src/example_designs/verilog/r4000.v(84): INFO: back to file '../../src/example_designs/verilog/r4000.v' (VERI-2320)&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Tcl, use the following commands:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
setmsgtype&lt;br /&gt;
clearmsgtype&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Some Perl command examples:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
# ignore message VNLR-1015&lt;br /&gt;
Verific::Message::SetMessageType(&amp;quot;VNLR-1015&amp;quot;, $Verific::VERIFIC_IGNORE);&lt;br /&gt;
# ignore all warning messages&lt;br /&gt;
Verific::Message::SetAllMessageType($Verific::VERIFIC_WARNING, $Verific::VERIFIC_IGNORE);&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Note that downgrading an error may have unpredictable/undesirable results.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Q: How do I get messages with more details?'''&lt;br /&gt;
&lt;br /&gt;
For &amp;quot;syntax error&amp;quot; messages, you can get messages with more details by enabling compile flag &amp;quot;VERIFIC_PRODUCE_VERBOSE_SYNTAX_ERROR_MESSAGE&amp;quot; or its runtime equivalent &amp;quot;verific_produce_verbose_syntax_error_message&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
With these flags enabled, for syntax errors, the parsers will print the whole line and point to the exact token where the issue is.&lt;br /&gt;
&lt;br /&gt;
For example, with:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
1. module test (input c, output reg o) ;&lt;br /&gt;
2.     always@(*)&lt;br /&gt;
3.         unique priority case (c)&lt;br /&gt;
4.             1'b0 : o = 1'b1 ;&lt;br /&gt;
5.             1'b1 : o = 1'b0 ;&lt;br /&gt;
6.         endcase&lt;br /&gt;
7. endmodule&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
By default, the Verilog parser outputs:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
-- Analyzing Verilog file 'test.v' (VERI-1482)&lt;br /&gt;
test.v(3): ERROR: syntax error near 'priority' (VERI-1137)&lt;br /&gt;
test.v(3): ERROR: SystemVerilog keyword priority used in incorrect context (VERI-2344)&lt;br /&gt;
test.v(4): ERROR: syntax error near '=' (VERI-1137)&lt;br /&gt;
test.v(5): ERROR: syntax error near '=' (VERI-1137)&lt;br /&gt;
test.v(3): ERROR: 'c' is not a constant (VERI-1188)&lt;br /&gt;
test.v(4): ERROR: 'o' is not a type (VERI-1281)&lt;br /&gt;
test.v(5): ERROR: 'o' is not a type (VERI-1281)&lt;br /&gt;
test.v(7): ERROR: module 'test' ignored due to previous errors (VERI-1072)&lt;br /&gt;
ERROR: analyze: failed (CMD-1014)&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With &amp;quot;verific_produce_verbose_syntax_error_message&amp;quot; enabled, you'll see:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
-- Analyzing Verilog file 'test.v' (VERI-1482)&lt;br /&gt;
test.v(3): INFO:         unique priority case (c) (VERI-2124)&lt;br /&gt;
test.v(3): INFO:                        ^ (VERI-2124)&lt;br /&gt;
test.v(3): ERROR: syntax error near 'priority', expecting 'case' or 'casex' or 'casez' or 'if' (VERI-1137)&lt;br /&gt;
test.v(3): ERROR: SystemVerilog keyword priority used in incorrect context (VERI-2344)&lt;br /&gt;
test.v(4): INFO:             1'b0 : o = 1'b1 ; (VERI-2124)&lt;br /&gt;
test.v(4): INFO:                       ^ (VERI-2124)&lt;br /&gt;
test.v(4): ERROR: syntax error near '=' (VERI-1137)&lt;br /&gt;
test.v(5): INFO:             1'b1 : o = 1'b0 ; (VERI-2124)&lt;br /&gt;
test.v(5): INFO:                       ^ (VERI-2124)&lt;br /&gt;
test.v(5): ERROR: syntax error near '=' (VERI-1137)&lt;br /&gt;
test.v(3): ERROR: 'c' is not a constant (VERI-1188)&lt;br /&gt;
test.v(4): ERROR: 'o' is not a type (VERI-1281)&lt;br /&gt;
test.v(5): ERROR: 'o' is not a type (VERI-1281)&lt;br /&gt;
test.v(7): ERROR: module 'test' ignored due to previous errors (VERI-1072)&lt;br /&gt;
ERROR: analyze: failed (CMD-1014)&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Other useful APIs'''&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
    // Control if messages going to console:&lt;br /&gt;
    SetConsoleOutput(unsigned console_output)&lt;br /&gt;
&lt;br /&gt;
    // Control if messages going to a logfile:&lt;br /&gt;
    OpenLogFile(const char *log_file)&lt;br /&gt;
    CloseLogFile()&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mohammad</name></author>	</entry>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=How_to_get_linefile_data_of_macros_-_Macro_callback_function&amp;diff=875</id>
		<title>How to get linefile data of macros - Macro callback function</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=How_to_get_linefile_data_of_macros_-_Macro_callback_function&amp;diff=875"/>
				<updated>2023-12-11T20:14:08Z</updated>
		
		<summary type="html">&lt;p&gt;Mohammad: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;C++ application:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
#include &amp;lt;sstream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;veri_file.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriTreeNode.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;Map.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
using namespace std ;&lt;br /&gt;
&lt;br /&gt;
#ifdef VERIFIC_NAMESPACE&lt;br /&gt;
using namespace Verific ;&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
class CppMacroCallBackHandler : public MacroCallBackHandler&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
    CppMacroCallBackHandler() { }&lt;br /&gt;
    virtual ~CppMacroCallBackHandler() { }&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
    // Prevent compiler from defining the following&lt;br /&gt;
    CppMacroCallBackHandler(const CppMacroCallBackHandler &amp;amp;) ;            // Purposely leave unimplemented&lt;br /&gt;
    CppMacroCallBackHandler&amp;amp; operator=(const CppMacroCallBackHandler &amp;amp;) ; // Purposely leave unimplemented&lt;br /&gt;
&lt;br /&gt;
public:&lt;br /&gt;
    // This is called when an user defined macro is being defined using `define in active area:&lt;br /&gt;
    virtual void DefineMacro(const char *macro_name, const char *macro_body, const char *macro_args, const linefile_type lf)&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;A macro is being defined:\n&amp;quot; ;&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;\tName: &amp;quot; &amp;lt;&amp;lt; macro_name &amp;lt;&amp;lt; endl ;&lt;br /&gt;
        if (macro_body) cout &amp;lt;&amp;lt; &amp;quot;\tValue: &amp;quot; &amp;lt;&amp;lt; macro_body &amp;lt;&amp;lt; endl ;&lt;br /&gt;
        if (macro_args) cout &amp;lt;&amp;lt; &amp;quot;\tArguments: &amp;quot; &amp;lt;&amp;lt; macro_args &amp;lt;&amp;lt; endl ;&lt;br /&gt;
        if (lf) cout &amp;lt;&amp;lt; &amp;quot;\tLocation: &amp;quot; &amp;lt;&amp;lt; PrintLocation(lf) &amp;lt;&amp;lt; endl ;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // This is called when an user defined macro is being undefined using `undef in active area:&lt;br /&gt;
    virtual void UndefineMacro(const char *macro_name, const linefile_type lf)&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;A macro is being undefined:\n&amp;quot; ;&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;\tName: &amp;quot; &amp;lt;&amp;lt; macro_name &amp;lt;&amp;lt; endl ;&lt;br /&gt;
        if (lf) cout &amp;lt;&amp;lt; &amp;quot;\tLocation: &amp;quot; &amp;lt;&amp;lt; PrintLocation(lf) &amp;lt;&amp;lt; endl ;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // This is called when an user defined macro is being referenced using `MacroName or in `ifdef MacroName in active area:&lt;br /&gt;
    virtual void UserMacroRef(const char *macro_name, const char *macro_actuals, unsigned from_if_cond, unsigned from_active_area, const linefile_type lf)&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;A user macro is being referenced\n&amp;quot; ;&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;\tName: &amp;quot; &amp;lt;&amp;lt; macro_name &amp;lt;&amp;lt; endl ;&lt;br /&gt;
        if (macro_actuals) cout &amp;lt;&amp;lt; &amp;quot;\tActuals: &amp;quot; &amp;lt;&amp;lt; macro_actuals &amp;lt;&amp;lt; endl ;&lt;br /&gt;
        if (from_if_cond) cout &amp;lt;&amp;lt; &amp;quot;\tFrom condition: &amp;quot; &amp;lt;&amp;lt; from_if_cond &amp;lt;&amp;lt; endl ;&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;\tUsed in: &amp;quot; &amp;lt;&amp;lt; ((from_active_area)?&amp;quot;Active&amp;quot;:&amp;quot;Inactive&amp;quot;) &amp;lt;&amp;lt; &amp;quot; area\n&amp;quot; ;&lt;br /&gt;
        if (lf) cout &amp;lt;&amp;lt; &amp;quot;\tLocation: &amp;quot; &amp;lt;&amp;lt; PrintLocation(lf) &amp;lt;&amp;lt; endl ;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // This is called when an pre-defined macros (`ifdef, `ifndef, `else, `elsif, `endif, `undef, `undefineall) are being processed.&lt;br /&gt;
    // This is called from both in active and inactive areas (`undef, `undefineall are skipped). Argument 'from_active_area' is set accordingly:&lt;br /&gt;
    virtual void PredefinedMacroRef(const char *macro_name, unsigned from_active_area, const linefile_type lf)&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;A predefined macro is being referenced\n&amp;quot; ;&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;\tName: &amp;quot; &amp;lt;&amp;lt; macro_name &amp;lt;&amp;lt; endl ;&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;\tUsed in: &amp;quot; &amp;lt;&amp;lt; ((from_active_area)?&amp;quot;Active&amp;quot;:&amp;quot;Inactive&amp;quot;) &amp;lt;&amp;lt; &amp;quot; area\n&amp;quot; ;&lt;br /&gt;
        if (lf) cout &amp;lt;&amp;lt; &amp;quot;\tLocation: &amp;quot; &amp;lt;&amp;lt; PrintLocation(lf) &amp;lt;&amp;lt; endl ;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
    string PrintLocation(const linefile_type lf)&lt;br /&gt;
    {&lt;br /&gt;
        ostringstream result(&amp;quot;&amp;quot;) ;&lt;br /&gt;
&lt;br /&gt;
        if (lf) {&lt;br /&gt;
#ifdef VERIFIC_LINEFILE_INCLUDES_COLUMNS&lt;br /&gt;
            result &amp;lt;&amp;lt; lf-&amp;gt;GetFileName() ;&lt;br /&gt;
            result &amp;lt;&amp;lt; &amp;quot;[&amp;quot; ;&lt;br /&gt;
            result &amp;lt;&amp;lt; lf-&amp;gt;GetLeftLine() ;&lt;br /&gt;
            result &amp;lt;&amp;lt; &amp;quot;:&amp;quot; ;&lt;br /&gt;
            result &amp;lt;&amp;lt; lf-&amp;gt;GetLeftCol() ;&lt;br /&gt;
            result &amp;lt;&amp;lt; &amp;quot;] - &amp;quot; ;&lt;br /&gt;
            result &amp;lt;&amp;lt; lf-&amp;gt;GetFileName() ;&lt;br /&gt;
            result &amp;lt;&amp;lt; &amp;quot;[&amp;quot; ;&lt;br /&gt;
            result &amp;lt;&amp;lt; lf-&amp;gt;GetRightLine() ;&lt;br /&gt;
            result &amp;lt;&amp;lt; &amp;quot;:&amp;quot; ;&lt;br /&gt;
            result &amp;lt;&amp;lt; lf-&amp;gt;GetRightCol() ;&lt;br /&gt;
            result &amp;lt;&amp;lt; &amp;quot;]&amp;quot; ;&lt;br /&gt;
#else&lt;br /&gt;
            result &amp;lt;&amp;lt; LineFile::GetFileName(lf) ;&lt;br /&gt;
            result &amp;lt;&amp;lt; &amp;quot;[&amp;quot; ;&lt;br /&gt;
            result &amp;lt;&amp;lt; LineFile::GetLineNo(lf) ;&lt;br /&gt;
            result &amp;lt;&amp;lt; &amp;quot;]&amp;quot; ;&lt;br /&gt;
#endif&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        return result.str() ;&lt;br /&gt;
    }&lt;br /&gt;
} ; // CppMacroCallBackHandler&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char **argv)&lt;br /&gt;
{&lt;br /&gt;
    CppMacroCallBackHandler mh ;&lt;br /&gt;
    veri_file::RegisterCallBackMacro(&amp;amp;mh) ;&lt;br /&gt;
&lt;br /&gt;
    const char *file = (argc &amp;gt; 1) ? argv[1] : &amp;quot;test.v&amp;quot; ;&lt;br /&gt;
    if (!veri_file::Analyze(file)) return 1 ;&lt;br /&gt;
&lt;br /&gt;
    return 0 ;&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Perl script:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
#!/usr/bin/perl -w&lt;br /&gt;
&lt;br /&gt;
use strict ;&lt;br /&gt;
use warnings ;&lt;br /&gt;
&lt;br /&gt;
use lib &amp;quot;../pm&amp;quot; ;&lt;br /&gt;
use Verific ;&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
    package PerlMacroCallBackHandler ;&lt;br /&gt;
        use base 'Verific::MacroCallBackHandler' ;&lt;br /&gt;
        # This is called when an user defined macro is being defined using `define in active area:&lt;br /&gt;
        sub DefineMacro&lt;br /&gt;
        {&lt;br /&gt;
            my ($class, $name, $body, $args, $lf) = @_ ;&lt;br /&gt;
            print &amp;quot;A macro is being defined:\n&amp;quot; ;&lt;br /&gt;
            print &amp;quot;\tName: $name\n&amp;quot; ;&lt;br /&gt;
            print &amp;quot;\tValue: $body\n&amp;quot; if ($body) ;&lt;br /&gt;
            print &amp;quot;\tArguments: $args\n&amp;quot; if ($args) ;&lt;br /&gt;
            print &amp;quot;\tLocation: &amp;quot; . PrintLocation($lf) . &amp;quot;\n&amp;quot; if ($lf) ;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        # This is called when an user defined macro is being undefined using `undef in active area:&lt;br /&gt;
        sub UndefineMacro&lt;br /&gt;
        {&lt;br /&gt;
            my ($class, $name, $lf) = @_ ;&lt;br /&gt;
            print &amp;quot;A macro is being undefined:\n&amp;quot; ;&lt;br /&gt;
            print &amp;quot;\tName: $name\n&amp;quot; ;&lt;br /&gt;
            print &amp;quot;\tLocation: &amp;quot; . PrintLocation($lf) . &amp;quot;\n&amp;quot; if ($lf) ;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        # This is called when an user defined macro is being referenced using `MacroName or in `ifdef MacroName in active area:&lt;br /&gt;
        # Argument $cond is set when it is used in condition of `ifdef or `endif or `elsif:&lt;br /&gt;
        sub UserMacroRef&lt;br /&gt;
        {&lt;br /&gt;
            my ($class, $name, $actual, $cond, $from_active_area, $lf) = @_ ;&lt;br /&gt;
            print &amp;quot;A user macro is being referenced\n&amp;quot; ;&lt;br /&gt;
            print &amp;quot;\tName: $name\n&amp;quot; ;&lt;br /&gt;
            print &amp;quot;\tActuals: $actual\n&amp;quot; if ($actual) ;&lt;br /&gt;
            print &amp;quot;\tFrom condition: $cond\n&amp;quot; if ($cond) ;&lt;br /&gt;
            print &amp;quot;\tUsed in: &amp;quot; . (($from_active_area)?&amp;quot;Active&amp;quot;:&amp;quot;Inactive&amp;quot;) . &amp;quot; area\n&amp;quot; ;&lt;br /&gt;
            print &amp;quot;\tLocation: &amp;quot; . PrintLocation($lf) . &amp;quot;\n&amp;quot; if ($lf) ;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        # This is called when an pre-defined macros (`ifdef, `ifndef, `else, `elsif, `endif, `undef, `undefineall) are being processed.&lt;br /&gt;
        # This is called from both in active and inactive areas (`undef, `undefineall are skipped). Argument 'from_active_area' is set accordingly:&lt;br /&gt;
        sub PredefinedMacroRef&lt;br /&gt;
        {&lt;br /&gt;
            my ($class, $name, $from_active_area, $lf) = @_ ;&lt;br /&gt;
            print &amp;quot;A predefined macro is being referenced\n&amp;quot; ;&lt;br /&gt;
            print &amp;quot;\tName: $name\n&amp;quot; ;&lt;br /&gt;
            print &amp;quot;\tUsed in: &amp;quot; . (($from_active_area)?&amp;quot;Active&amp;quot;:&amp;quot;Inactive&amp;quot;) . &amp;quot; area\n&amp;quot; ;&lt;br /&gt;
            print &amp;quot;\tLocation: &amp;quot; . PrintLocation($lf) . &amp;quot;\n&amp;quot; if ($lf) ;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        sub PrintLocation&lt;br /&gt;
        {&lt;br /&gt;
            my ($lf) = @_ ;&lt;br /&gt;
            if (!$lf) { return &amp;quot;NULL&amp;quot; ; }&lt;br /&gt;
            return $lf-&amp;gt;GetFileName() . &amp;quot;[&amp;quot; . $lf-&amp;gt;GetLeftLine() . &amp;quot;:&amp;quot; . $lf-&amp;gt;GetLeftCol() . &amp;quot;] - &amp;quot; .&lt;br /&gt;
                   $lf-&amp;gt;GetFileName() . &amp;quot;[&amp;quot; . $lf-&amp;gt;GetRightLine() . &amp;quot;:&amp;quot; . $lf-&amp;gt;GetRightCol() . &amp;quot;]&amp;quot; ;&lt;br /&gt;
        }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sub SetupCallBack&lt;br /&gt;
{&lt;br /&gt;
    my $pmcb = PerlMacroCallBackHandler-&amp;gt;new() ;&lt;br /&gt;
    Verific::veri_file::RegisterCallBackMacro($pmcb) ;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sub ParseFile&lt;br /&gt;
{&lt;br /&gt;
    my ($file) = @_ ;&lt;br /&gt;
    Verific::veri_file::Analyze($file, $Verific::veri_file::SYSTEM_VERILOG) ;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
my $file = &amp;quot;test.v&amp;quot; ;&lt;br /&gt;
if (scalar(@ARGV)) {&lt;br /&gt;
    $file = $ARGV[0] ;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
SetupCallBack() ;&lt;br /&gt;
ParseFile($file) ;&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Python script:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
cat test.py&lt;br /&gt;
#!/usr/bin/python&lt;br /&gt;
&lt;br /&gt;
import sys&lt;br /&gt;
sys.path.append('../py')&lt;br /&gt;
import Verific&lt;br /&gt;
&lt;br /&gt;
class my_macro_cb (Verific.MacroCallBackHandler) :&lt;br /&gt;
    def __init__ (self):&lt;br /&gt;
        Verific.MacroCallBackHandler.__init__ (self)&lt;br /&gt;
&lt;br /&gt;
    def DefineMacro (self, macro_name, macro_body, macro_args, lf) :&lt;br /&gt;
        if (macro_body == None) :&lt;br /&gt;
            macro_body = &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
        if (macro_args) :&lt;br /&gt;
            print(&amp;quot;=====&amp;gt; `define %s(%s) %s&amp;quot; % (macro_name, macro_args, macro_body))&lt;br /&gt;
        else :&lt;br /&gt;
            print(&amp;quot;=====&amp;gt; `define %s %s&amp;quot; % (macro_name, macro_body))&lt;br /&gt;
&lt;br /&gt;
    def UndefineMacro (self, macro_name, lf) :&lt;br /&gt;
        print(&amp;quot;=====&amp;gt; `undefine %s&amp;quot; % macro_name)&lt;br /&gt;
&lt;br /&gt;
    def UserMacroRef (self, macro_name, macro_actuals, from_if_cond, from_active_area, lf) :&lt;br /&gt;
        if (macro_actuals) :&lt;br /&gt;
            print(&amp;quot;=====&amp;gt; `%s(%s)&amp;quot; % (macro_name, macro_actuals))&lt;br /&gt;
        else :&lt;br /&gt;
            print(&amp;quot;=====&amp;gt; `%s&amp;quot; % macro_name)&lt;br /&gt;
&lt;br /&gt;
    def PredefinedMacroRef (self, macro_name, from_active_area, lf) :&lt;br /&gt;
        print(&amp;quot;=====&amp;gt; `%s (predefined macro)&amp;quot; % macro_name)&lt;br /&gt;
&lt;br /&gt;
# END of my_macro_cb&lt;br /&gt;
&lt;br /&gt;
veri_parser = Verific.veri_file()&lt;br /&gt;
&lt;br /&gt;
cb = my_macro_cb()&lt;br /&gt;
veri_parser.RegisterCallBackMacro(cb)&lt;br /&gt;
&lt;br /&gt;
Verific.RuntimeFlags_SetVar(&amp;quot;veri_include_ansi_file_search&amp;quot;, 1)&lt;br /&gt;
Verific.RuntimeFlags_SetVar(&amp;quot;veri_improve_include_dir_processing_runtime_for_network_file_system&amp;quot;, 1)&lt;br /&gt;
&lt;br /&gt;
file_names_ptr = Verific.PythonProcessFFile(&amp;quot;filelist.f&amp;quot;, veri_parser.F_FILE_NONE, veri_parser.SYSTEM_VERILOG)&lt;br /&gt;
if (file_names_ptr) :&lt;br /&gt;
    if (veri_parser.AnalyzeMultipleFiles(file_names_ptr, veri_parser.SYSTEM_VERILOG) == 0) :&lt;br /&gt;
        print(&amp;quot;Failed to analyze files&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
exit (0)&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verilog testcase:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
`define ABC&lt;br /&gt;
&lt;br /&gt;
module test ;&lt;br /&gt;
`ifdef ABC &lt;br /&gt;
    initial $display(&amp;quot;ABC&amp;quot;) ;&lt;br /&gt;
`elsif DEF&lt;br /&gt;
    initial $display(&amp;quot;DEF&amp;quot;) ;&lt;br /&gt;
`else &lt;br /&gt;
    initial $display(&amp;quot;!ABC&amp;quot;) ;&lt;br /&gt;
`endif&lt;br /&gt;
&lt;br /&gt;
`ifdef DEF &lt;br /&gt;
    initial $display(&amp;quot;DEF&amp;quot;) ;&lt;br /&gt;
    `ifdef IGNORED_AREA&lt;br /&gt;
    `endif&lt;br /&gt;
    `ABC&lt;br /&gt;
    `DEF&lt;br /&gt;
`elsif ABC&lt;br /&gt;
    initial $display(&amp;quot;ABC&amp;quot;) ;&lt;br /&gt;
`else &lt;br /&gt;
    initial $display(&amp;quot;!DEF&amp;quot;) ;&lt;br /&gt;
`endif&lt;br /&gt;
endmodule&lt;br /&gt;
&lt;br /&gt;
`undef ABC&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
-- Analyzing Verilog file 'test.v' (VERI-1482)&lt;br /&gt;
A macro is being defined:&lt;br /&gt;
	Name: ABC&lt;br /&gt;
	Location: test.v[1:1] - test.v[2:1]&lt;br /&gt;
A predefined macro is being referenced&lt;br /&gt;
	Name: ifdef&lt;br /&gt;
	Used in: Active area&lt;br /&gt;
	Location: test.v[4:1] - test.v[4:7]&lt;br /&gt;
A user macro is being referenced&lt;br /&gt;
	Name: ABC&lt;br /&gt;
	From condition: 1&lt;br /&gt;
	Used in: Active area&lt;br /&gt;
	Location: test.v[4:8] - test.v[4:11]&lt;br /&gt;
A predefined macro is being referenced&lt;br /&gt;
	Name: elsif&lt;br /&gt;
	Used in: Active area&lt;br /&gt;
	Location: test.v[6:1] - test.v[6:7]&lt;br /&gt;
A user macro is being referenced&lt;br /&gt;
	Name: DEF&lt;br /&gt;
	From condition: 1&lt;br /&gt;
	Used in: Inactive area&lt;br /&gt;
	Location: test.v[6:8] - test.v[6:11]&lt;br /&gt;
A predefined macro is being referenced&lt;br /&gt;
	Name: else&lt;br /&gt;
	Used in: Inactive area&lt;br /&gt;
	Location: test.v[8:1] - test.v[8:6]&lt;br /&gt;
A predefined macro is being referenced&lt;br /&gt;
	Name: endif&lt;br /&gt;
	Used in: Inactive area&lt;br /&gt;
	Location: test.v[10:1] - test.v[10:7]&lt;br /&gt;
A predefined macro is being referenced&lt;br /&gt;
	Name: ifdef&lt;br /&gt;
	Used in: Active area&lt;br /&gt;
	Location: test.v[12:1] - test.v[12:7]&lt;br /&gt;
A user macro is being referenced&lt;br /&gt;
	Name: DEF&lt;br /&gt;
	From condition: 1&lt;br /&gt;
	Used in: Active area&lt;br /&gt;
	Location: test.v[12:8] - test.v[12:11]&lt;br /&gt;
A predefined macro is being referenced&lt;br /&gt;
	Name: ifdef&lt;br /&gt;
	Used in: Inactive area&lt;br /&gt;
	Location: test.v[14:5] - test.v[14:11]&lt;br /&gt;
A user macro is being referenced&lt;br /&gt;
	Name: IGNORED_AREA&lt;br /&gt;
	From condition: 1&lt;br /&gt;
	Used in: Inactive area&lt;br /&gt;
	Location: test.v[14:12] - test.v[14:24]&lt;br /&gt;
A predefined macro is being referenced&lt;br /&gt;
	Name: endif&lt;br /&gt;
	Used in: Inactive area&lt;br /&gt;
	Location: test.v[15:5] - test.v[15:11]&lt;br /&gt;
A user macro is being referenced&lt;br /&gt;
	Name: ABC&lt;br /&gt;
	Used in: Inactive area&lt;br /&gt;
	Location: test.v[16:5] - test.v[16:9]&lt;br /&gt;
A user macro is being referenced&lt;br /&gt;
	Name: DEF&lt;br /&gt;
	Used in: Inactive area&lt;br /&gt;
	Location: test.v[17:5] - test.v[17:9]&lt;br /&gt;
A predefined macro is being referenced&lt;br /&gt;
	Name: elsif&lt;br /&gt;
	Used in: Inactive area&lt;br /&gt;
	Location: test.v[18:1] - test.v[18:7]&lt;br /&gt;
A user macro is being referenced&lt;br /&gt;
	Name: ABC&lt;br /&gt;
	From condition: 1&lt;br /&gt;
	Used in: Active area&lt;br /&gt;
	Location: test.v[18:8] - test.v[18:11]&lt;br /&gt;
A predefined macro is being referenced&lt;br /&gt;
	Name: else&lt;br /&gt;
	Used in: Active area&lt;br /&gt;
	Location: test.v[20:1] - test.v[20:6]&lt;br /&gt;
A predefined macro is being referenced&lt;br /&gt;
	Name: endif&lt;br /&gt;
	Used in: Inactive area&lt;br /&gt;
	Location: test.v[22:1] - test.v[22:7]&lt;br /&gt;
A predefined macro is being referenced&lt;br /&gt;
	Name: undef&lt;br /&gt;
	Used in: Active area&lt;br /&gt;
	Location: test.v[25:1] - test.v[25:7]&lt;br /&gt;
A user macro is being referenced&lt;br /&gt;
	Name: ABC&lt;br /&gt;
	Used in: Active area&lt;br /&gt;
	Location: test.v[25:8] - test.v[25:11]&lt;br /&gt;
A macro is being undefined:&lt;br /&gt;
	Name: ABC&lt;br /&gt;
	Location: test.v[25:8] - test.v[25:11]&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mohammad</name></author>	</entry>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=Message_handling&amp;diff=874</id>
		<title>Message handling</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=Message_handling&amp;diff=874"/>
				<updated>2023-12-07T23:48:00Z</updated>
		
		<summary type="html">&lt;p&gt;Mohammad: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Q: How do I upgrade/downgrade messages from Verific?'''&lt;br /&gt;
&lt;br /&gt;
Verific message table, with notation as whether the error can be safely downgraded: [http://www.verific.com/docs/index.php?title=Message_Downgrading_Table Verific Message Table]&lt;br /&gt;
&lt;br /&gt;
(Access to Verific On-line Documentation requires login. Contact Verific if you don't know/don't have credentials).&lt;br /&gt;
&lt;br /&gt;
You can set any message to any type below:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
VERIFIC_NONE,         // print no prefix&lt;br /&gt;
VERIFIC_ERROR,        // print ERROR:&lt;br /&gt;
VERIFIC_WARNING,      // print WARNING:&lt;br /&gt;
VERIFIC_IGNORE,       // ignore message (do not print message):&lt;br /&gt;
VERIFIC_INFO,         // print INFO:&lt;br /&gt;
VERIFIC_COMMENT,      // print --&lt;br /&gt;
VERIFIC_PROGRAM_ERROR // print PROGRAM_ERROR&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
For C++, use the following APIs:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
Message::SetMessageType()       - Force a message type by message id&lt;br /&gt;
Message::GetMessageType()       - Get the message type by message id&lt;br /&gt;
Message::ClearMessageType()     - Clear a message type by message id&lt;br /&gt;
Message::SetAllMessageType()    - Force all messages of type 'orig' to behave as type 'type'.&lt;br /&gt;
Message::ClearAllMessageTypes() - Clear all forced message types&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Python, use the following APIs:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
Message.SetMessageType()       - Force a message type by message id&lt;br /&gt;
Message.GetMessageType()       - Get the message type by message id&lt;br /&gt;
Message.ClearMessageType()     - Clear a message type by message id&lt;br /&gt;
Message.SetAllMessageType()    - Force all messages of type 'orig' to behave as type 'type'.&lt;br /&gt;
Message.ClearAllMessageTypes() - Clear all forced message types&lt;br /&gt;
&lt;br /&gt;
Now instead of 'Message_SetMessageType()' Python interface accepts 'Message.SetMessageType()' to make the code more readable. &lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Some Python usage example:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
Orignal messages log:&lt;br /&gt;
-- Analyzing Verilog file '../../src/example_designs/verilog/r4000.v' (VERI-1482)&lt;br /&gt;
../../src/example_designs/verilog/r4000.v(82): INFO: analyzing included file '../../src/example_designs/verilog/cntrl.v' (VERI-1328)&lt;br /&gt;
../../src/example_designs/verilog/r4000.v(82): INFO: back to file '../../src/example_designs/verilog/r4000.v' (VERI-2320)&lt;br /&gt;
../../src/example_designs/verilog/r4000.v(83): INFO: analyzing included file '../../src/example_designs/verilog/alu.v' (VERI-1328)&lt;br /&gt;
../../src/example_designs/verilog/r4000.v(83): INFO: back to file '../../src/example_designs/verilog/r4000.v' (VERI-2320)&lt;br /&gt;
../../src/example_designs/verilog/r4000.v(84): INFO: analyzing included file '../../src/example_designs/verilog/register.v' (VERI-1328)&lt;br /&gt;
../../src/example_designs/verilog/r4000.v(84): INFO: back to file '../../src/example_designs/verilog/r4000.v' (VERI-2320)&lt;br /&gt;
&lt;br /&gt;
This python line is added before analyzing the file:&lt;br /&gt;
Verific.Message.SetMessageType(&amp;quot;VERI-1328&amp;quot;, Verific.VERIFIC_IGNORE)&lt;br /&gt;
&lt;br /&gt;
New messages log:&lt;br /&gt;
-- Analyzing Verilog file '../../src/example_designs/verilog/r4000.v' (VERI-1482)&lt;br /&gt;
../../src/example_designs/verilog/r4000.v(82): INFO: back to file '../../src/example_designs/verilog/r4000.v' (VERI-2320)&lt;br /&gt;
../../src/example_designs/verilog/r4000.v(83): INFO: back to file '../../src/example_designs/verilog/r4000.v' (VERI-2320)&lt;br /&gt;
../../src/example_designs/verilog/r4000.v(84): INFO: back to file '../../src/example_designs/verilog/r4000.v' (VERI-2320)&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Tcl, use the following commands:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
setmsgtype&lt;br /&gt;
clearmsgtype&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Some Perl command examples:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
# ignore message VNLR-1015&lt;br /&gt;
Verific::Message::SetMessageType(&amp;quot;VNLR-1015&amp;quot;, $Verific::VERIFIC_IGNORE);&lt;br /&gt;
# ignore all warning messages&lt;br /&gt;
Verific::Message::SetAllMessageType($Verific::VERIFIC_WARNING, $Verific::VERIFIC_IGNORE);&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Note that downgrading an error may have unpredictable/undesirable results.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Q: How do I get messages with more details?'''&lt;br /&gt;
&lt;br /&gt;
For &amp;quot;syntax error&amp;quot; messages, you can get messages with more details by enabling compile flag &amp;quot;VERIFIC_PRODUCE_VERBOSE_SYNTAX_ERROR_MESSAGE&amp;quot; or its runtime equivalent &amp;quot;verific_produce_verbose_syntax_error_message&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
With these flags enabled, for syntax errors, the parsers will print the whole line and point to the exact token where the issue is.&lt;br /&gt;
&lt;br /&gt;
For example, with:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
1. module test (input c, output reg o) ;&lt;br /&gt;
2.     always@(*)&lt;br /&gt;
3.         unique priority case (c)&lt;br /&gt;
4.             1'b0 : o = 1'b1 ;&lt;br /&gt;
5.             1'b1 : o = 1'b0 ;&lt;br /&gt;
6.         endcase&lt;br /&gt;
7. endmodule&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
By default, the Verilog parser outputs:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
-- Analyzing Verilog file 'test.v' (VERI-1482)&lt;br /&gt;
test.v(3): ERROR: syntax error near 'priority' (VERI-1137)&lt;br /&gt;
test.v(3): ERROR: SystemVerilog keyword priority used in incorrect context (VERI-2344)&lt;br /&gt;
test.v(4): ERROR: syntax error near '=' (VERI-1137)&lt;br /&gt;
test.v(5): ERROR: syntax error near '=' (VERI-1137)&lt;br /&gt;
test.v(3): ERROR: 'c' is not a constant (VERI-1188)&lt;br /&gt;
test.v(4): ERROR: 'o' is not a type (VERI-1281)&lt;br /&gt;
test.v(5): ERROR: 'o' is not a type (VERI-1281)&lt;br /&gt;
test.v(7): ERROR: module 'test' ignored due to previous errors (VERI-1072)&lt;br /&gt;
ERROR: analyze: failed (CMD-1014)&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With &amp;quot;verific_produce_verbose_syntax_error_message&amp;quot; enabled, you'll see:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
-- Analyzing Verilog file 'test.v' (VERI-1482)&lt;br /&gt;
test.v(3): INFO:         unique priority case (c) (VERI-2124)&lt;br /&gt;
test.v(3): INFO:                        ^ (VERI-2124)&lt;br /&gt;
test.v(3): ERROR: syntax error near 'priority', expecting 'case' or 'casex' or 'casez' or 'if' (VERI-1137)&lt;br /&gt;
test.v(3): ERROR: SystemVerilog keyword priority used in incorrect context (VERI-2344)&lt;br /&gt;
test.v(4): INFO:             1'b0 : o = 1'b1 ; (VERI-2124)&lt;br /&gt;
test.v(4): INFO:                       ^ (VERI-2124)&lt;br /&gt;
test.v(4): ERROR: syntax error near '=' (VERI-1137)&lt;br /&gt;
test.v(5): INFO:             1'b1 : o = 1'b0 ; (VERI-2124)&lt;br /&gt;
test.v(5): INFO:                       ^ (VERI-2124)&lt;br /&gt;
test.v(5): ERROR: syntax error near '=' (VERI-1137)&lt;br /&gt;
test.v(3): ERROR: 'c' is not a constant (VERI-1188)&lt;br /&gt;
test.v(4): ERROR: 'o' is not a type (VERI-1281)&lt;br /&gt;
test.v(5): ERROR: 'o' is not a type (VERI-1281)&lt;br /&gt;
test.v(7): ERROR: module 'test' ignored due to previous errors (VERI-1072)&lt;br /&gt;
ERROR: analyze: failed (CMD-1014)&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Other useful APIs'''&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
    // Control if messages going to console:&lt;br /&gt;
    SetConsoleOutput(unsigned console_output)&lt;br /&gt;
&lt;br /&gt;
    // Control if messages going to a logfile:&lt;br /&gt;
    OpenLogFile(const char *log_file)&lt;br /&gt;
    CloseLogFile()&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mohammad</name></author>	</entry>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=Message_handling&amp;diff=873</id>
		<title>Message handling</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=Message_handling&amp;diff=873"/>
				<updated>2023-12-07T23:43:05Z</updated>
		
		<summary type="html">&lt;p&gt;Mohammad: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Q: How do I upgrade/downgrade messages from Verific?'''&lt;br /&gt;
&lt;br /&gt;
Verific message table, with notation as whether the error can be safely downgraded: [http://www.verific.com/docs/index.php?title=Message_Downgrading_Table Verific Message Table]&lt;br /&gt;
&lt;br /&gt;
(Access to Verific On-line Documentation requires login. Contact Verific if you don't know/don't have credentials).&lt;br /&gt;
&lt;br /&gt;
You can set any message to any type below:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
VERIFIC_NONE,         // print no prefix&lt;br /&gt;
VERIFIC_ERROR,        // print ERROR:&lt;br /&gt;
VERIFIC_WARNING,      // print WARNING:&lt;br /&gt;
VERIFIC_IGNORE,       // ignore message (do not print message):&lt;br /&gt;
VERIFIC_INFO,         // print INFO:&lt;br /&gt;
VERIFIC_COMMENT,      // print --&lt;br /&gt;
VERIFIC_PROGRAM_ERROR // print PROGRAM_ERROR&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
For C++, use the following APIs:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
Message::SetMessageType()       - Force a message type by message id&lt;br /&gt;
Message::GetMessageType()       - Get the message type by message id&lt;br /&gt;
Message::ClearMessageType()     - Clear a message type by message id&lt;br /&gt;
Message::SetAllMessageType()    - Force all messages of type 'orig' to behave as type 'type'.&lt;br /&gt;
Message::ClearAllMessageTypes() - Clear all forced message types&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Python, use the following APIs:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
Message.SetMessageType()       - Force a message type by message id&lt;br /&gt;
Message.GetMessageType()       - Get the message type by message id&lt;br /&gt;
Message.ClearMessageType()     - Clear a message type by message id&lt;br /&gt;
Message.SetAllMessageType()    - Force all messages of type 'orig' to behave as type 'type'.&lt;br /&gt;
Message.ClearAllMessageTypes() - Clear all forced message types&lt;br /&gt;
&lt;br /&gt;
Now instead of 'Message_SetMessageType()' Python interface accepts 'Message.SetMessageType()' to make the code more readable. &lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Some Python usage example:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
Orignal messages log:&lt;br /&gt;
-- Analyzing Verilog file '../../src/example_designs/verilog/r4000.v' (VERI-1482)&lt;br /&gt;
../../src/example_designs/verilog/r4000.v(82): INFO: analyzing included file '../../src/example_designs/verilog/cntrl.v' (VERI-1328)&lt;br /&gt;
../../src/example_designs/verilog/r4000.v(82): INFO: back to file '../../src/example_designs/verilog/r4000.v' (VERI-2320)&lt;br /&gt;
../../src/example_designs/verilog/r4000.v(83): INFO: analyzing included file '../../src/example_designs/verilog/alu.v' (VERI-1328)&lt;br /&gt;
../../src/example_designs/verilog/r4000.v(83): INFO: back to file '../../src/example_designs/verilog/r4000.v' (VERI-2320)&lt;br /&gt;
../../src/example_designs/verilog/r4000.v(84): INFO: analyzing included file '../../src/example_designs/verilog/register.v' (VERI-1328)&lt;br /&gt;
../../src/example_designs/verilog/r4000.v(84): INFO: back to file '../../src/example_designs/verilog/r4000.v' (VERI-2320)&lt;br /&gt;
&lt;br /&gt;
After this python line is added:&lt;br /&gt;
Verific.Message.SetMessageType(&amp;quot;VERI-1328&amp;quot;, Verific.VERIFIC_IGNORE)&lt;br /&gt;
&lt;br /&gt;
New messages log:&lt;br /&gt;
-- Analyzing Verilog file '../../src/example_designs/verilog/r4000.v' (VERI-1482)&lt;br /&gt;
../../src/example_designs/verilog/r4000.v(82): INFO: back to file '../../src/example_designs/verilog/r4000.v' (VERI-2320)&lt;br /&gt;
../../src/example_designs/verilog/r4000.v(83): INFO: back to file '../../src/example_designs/verilog/r4000.v' (VERI-2320)&lt;br /&gt;
../../src/example_designs/verilog/r4000.v(84): INFO: back to file '../../src/example_designs/verilog/r4000.v' (VERI-2320)&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Tcl, use the following commands:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
setmsgtype&lt;br /&gt;
clearmsgtype&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Some Perl command examples:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
# ignore message VNLR-1015&lt;br /&gt;
Verific::Message::SetMessageType(&amp;quot;VNLR-1015&amp;quot;, $Verific::VERIFIC_IGNORE);&lt;br /&gt;
# ignore all warning messages&lt;br /&gt;
Verific::Message::SetAllMessageType($Verific::VERIFIC_WARNING, $Verific::VERIFIC_IGNORE);&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Note that downgrading an error may have unpredictable/undesirable results.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Q: How do I get messages with more details?'''&lt;br /&gt;
&lt;br /&gt;
For &amp;quot;syntax error&amp;quot; messages, you can get messages with more details by enabling compile flag &amp;quot;VERIFIC_PRODUCE_VERBOSE_SYNTAX_ERROR_MESSAGE&amp;quot; or its runtime equivalent &amp;quot;verific_produce_verbose_syntax_error_message&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
With these flags enabled, for syntax errors, the parsers will print the whole line and point to the exact token where the issue is.&lt;br /&gt;
&lt;br /&gt;
For example, with:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
1. module test (input c, output reg o) ;&lt;br /&gt;
2.     always@(*)&lt;br /&gt;
3.         unique priority case (c)&lt;br /&gt;
4.             1'b0 : o = 1'b1 ;&lt;br /&gt;
5.             1'b1 : o = 1'b0 ;&lt;br /&gt;
6.         endcase&lt;br /&gt;
7. endmodule&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
By default, the Verilog parser outputs:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
-- Analyzing Verilog file 'test.v' (VERI-1482)&lt;br /&gt;
test.v(3): ERROR: syntax error near 'priority' (VERI-1137)&lt;br /&gt;
test.v(3): ERROR: SystemVerilog keyword priority used in incorrect context (VERI-2344)&lt;br /&gt;
test.v(4): ERROR: syntax error near '=' (VERI-1137)&lt;br /&gt;
test.v(5): ERROR: syntax error near '=' (VERI-1137)&lt;br /&gt;
test.v(3): ERROR: 'c' is not a constant (VERI-1188)&lt;br /&gt;
test.v(4): ERROR: 'o' is not a type (VERI-1281)&lt;br /&gt;
test.v(5): ERROR: 'o' is not a type (VERI-1281)&lt;br /&gt;
test.v(7): ERROR: module 'test' ignored due to previous errors (VERI-1072)&lt;br /&gt;
ERROR: analyze: failed (CMD-1014)&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With &amp;quot;verific_produce_verbose_syntax_error_message&amp;quot; enabled, you'll see:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
-- Analyzing Verilog file 'test.v' (VERI-1482)&lt;br /&gt;
test.v(3): INFO:         unique priority case (c) (VERI-2124)&lt;br /&gt;
test.v(3): INFO:                        ^ (VERI-2124)&lt;br /&gt;
test.v(3): ERROR: syntax error near 'priority', expecting 'case' or 'casex' or 'casez' or 'if' (VERI-1137)&lt;br /&gt;
test.v(3): ERROR: SystemVerilog keyword priority used in incorrect context (VERI-2344)&lt;br /&gt;
test.v(4): INFO:             1'b0 : o = 1'b1 ; (VERI-2124)&lt;br /&gt;
test.v(4): INFO:                       ^ (VERI-2124)&lt;br /&gt;
test.v(4): ERROR: syntax error near '=' (VERI-1137)&lt;br /&gt;
test.v(5): INFO:             1'b1 : o = 1'b0 ; (VERI-2124)&lt;br /&gt;
test.v(5): INFO:                       ^ (VERI-2124)&lt;br /&gt;
test.v(5): ERROR: syntax error near '=' (VERI-1137)&lt;br /&gt;
test.v(3): ERROR: 'c' is not a constant (VERI-1188)&lt;br /&gt;
test.v(4): ERROR: 'o' is not a type (VERI-1281)&lt;br /&gt;
test.v(5): ERROR: 'o' is not a type (VERI-1281)&lt;br /&gt;
test.v(7): ERROR: module 'test' ignored due to previous errors (VERI-1072)&lt;br /&gt;
ERROR: analyze: failed (CMD-1014)&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Other useful APIs'''&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
    // Control if messages going to console:&lt;br /&gt;
    SetConsoleOutput(unsigned console_output)&lt;br /&gt;
&lt;br /&gt;
    // Control if messages going to a logfile:&lt;br /&gt;
    OpenLogFile(const char *log_file)&lt;br /&gt;
    CloseLogFile()&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mohammad</name></author>	</entry>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=Message_handling&amp;diff=872</id>
		<title>Message handling</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=Message_handling&amp;diff=872"/>
				<updated>2023-12-07T23:33:11Z</updated>
		
		<summary type="html">&lt;p&gt;Mohammad: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Q: How do I upgrade/downgrade messages from Verific?'''&lt;br /&gt;
&lt;br /&gt;
Verific message table, with notation as whether the error can be safely downgraded: [http://www.verific.com/docs/index.php?title=Message_Downgrading_Table Verific Message Table]&lt;br /&gt;
&lt;br /&gt;
(Access to Verific On-line Documentation requires login. Contact Verific if you don't know/don't have credentials).&lt;br /&gt;
&lt;br /&gt;
You can set any message to any type below:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
VERIFIC_NONE,         // print no prefix&lt;br /&gt;
VERIFIC_ERROR,        // print ERROR:&lt;br /&gt;
VERIFIC_WARNING,      // print WARNING:&lt;br /&gt;
VERIFIC_IGNORE,       // ignore message (do not print message):&lt;br /&gt;
VERIFIC_INFO,         // print INFO:&lt;br /&gt;
VERIFIC_COMMENT,      // print --&lt;br /&gt;
VERIFIC_PROGRAM_ERROR // print PROGRAM_ERROR&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
For C++, use the following APIs:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
Message::SetMessageType()       - Force a message type by message id&lt;br /&gt;
Message::GetMessageType()       - Get the message type by message id&lt;br /&gt;
Message::ClearMessageType()     - Clear a message type by message id&lt;br /&gt;
Message::SetAllMessageType()    - Force all messages of type 'orig' to behave as type 'type'.&lt;br /&gt;
Message::ClearAllMessageTypes() - Clear all forced message types&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Python, use the following APIs:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
Message_SetMessageType()       - Force a message type by message id&lt;br /&gt;
Message_GetMessageType()       - Get the message type by message id&lt;br /&gt;
Message_ClearMessageType()     - Clear a message type by message id&lt;br /&gt;
Message_SetAllMessageType()    - Force all messages of type 'orig' to behave as type 'type'.&lt;br /&gt;
Message_ClearAllMessageTypes() - Clear all forced message types&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Some Python usage example:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
Orignal messages log:&lt;br /&gt;
-- Analyzing Verilog file '../../src/example_designs/verilog/r4000.v' (VERI-1482)&lt;br /&gt;
../../src/example_designs/verilog/r4000.v(82): INFO: analyzing included file '../../src/example_designs/verilog/cntrl.v' (VERI-1328)&lt;br /&gt;
../../src/example_designs/verilog/r4000.v(82): INFO: back to file '../../src/example_designs/verilog/r4000.v' (VERI-2320)&lt;br /&gt;
../../src/example_designs/verilog/r4000.v(83): INFO: analyzing included file '../../src/example_designs/verilog/alu.v' (VERI-1328)&lt;br /&gt;
../../src/example_designs/verilog/r4000.v(83): INFO: back to file '../../src/example_designs/verilog/r4000.v' (VERI-2320)&lt;br /&gt;
../../src/example_designs/verilog/r4000.v(84): INFO: analyzing included file '../../src/example_designs/verilog/register.v' (VERI-1328)&lt;br /&gt;
../../src/example_designs/verilog/r4000.v(84): INFO: back to file '../../src/example_designs/verilog/r4000.v' (VERI-2320)&lt;br /&gt;
&lt;br /&gt;
After this python line is added:&lt;br /&gt;
Verific.Message_SetMessageType(&amp;quot;VERI-1328&amp;quot;, Verific.VERIFIC_IGNORE)&lt;br /&gt;
&lt;br /&gt;
New messages log:&lt;br /&gt;
-- Analyzing Verilog file '../../src/example_designs/verilog/r4000.v' (VERI-1482)&lt;br /&gt;
../../src/example_designs/verilog/r4000.v(82): INFO: back to file '../../src/example_designs/verilog/r4000.v' (VERI-2320)&lt;br /&gt;
../../src/example_designs/verilog/r4000.v(83): INFO: back to file '../../src/example_designs/verilog/r4000.v' (VERI-2320)&lt;br /&gt;
../../src/example_designs/verilog/r4000.v(84): INFO: back to file '../../src/example_designs/verilog/r4000.v' (VERI-2320)&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Tcl, use the following commands:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
setmsgtype&lt;br /&gt;
clearmsgtype&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Some Perl command examples:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
# ignore message VNLR-1015&lt;br /&gt;
Verific::Message::SetMessageType(&amp;quot;VNLR-1015&amp;quot;, $Verific::VERIFIC_IGNORE);&lt;br /&gt;
# ignore all warning messages&lt;br /&gt;
Verific::Message::SetAllMessageType($Verific::VERIFIC_WARNING, $Verific::VERIFIC_IGNORE);&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Note that downgrading an error may have unpredictable/undesirable results.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Q: How do I get messages with more details?'''&lt;br /&gt;
&lt;br /&gt;
For &amp;quot;syntax error&amp;quot; messages, you can get messages with more details by enabling compile flag &amp;quot;VERIFIC_PRODUCE_VERBOSE_SYNTAX_ERROR_MESSAGE&amp;quot; or its runtime equivalent &amp;quot;verific_produce_verbose_syntax_error_message&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
With these flags enabled, for syntax errors, the parsers will print the whole line and point to the exact token where the issue is.&lt;br /&gt;
&lt;br /&gt;
For example, with:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
1. module test (input c, output reg o) ;&lt;br /&gt;
2.     always@(*)&lt;br /&gt;
3.         unique priority case (c)&lt;br /&gt;
4.             1'b0 : o = 1'b1 ;&lt;br /&gt;
5.             1'b1 : o = 1'b0 ;&lt;br /&gt;
6.         endcase&lt;br /&gt;
7. endmodule&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
By default, the Verilog parser outputs:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
-- Analyzing Verilog file 'test.v' (VERI-1482)&lt;br /&gt;
test.v(3): ERROR: syntax error near 'priority' (VERI-1137)&lt;br /&gt;
test.v(3): ERROR: SystemVerilog keyword priority used in incorrect context (VERI-2344)&lt;br /&gt;
test.v(4): ERROR: syntax error near '=' (VERI-1137)&lt;br /&gt;
test.v(5): ERROR: syntax error near '=' (VERI-1137)&lt;br /&gt;
test.v(3): ERROR: 'c' is not a constant (VERI-1188)&lt;br /&gt;
test.v(4): ERROR: 'o' is not a type (VERI-1281)&lt;br /&gt;
test.v(5): ERROR: 'o' is not a type (VERI-1281)&lt;br /&gt;
test.v(7): ERROR: module 'test' ignored due to previous errors (VERI-1072)&lt;br /&gt;
ERROR: analyze: failed (CMD-1014)&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With &amp;quot;verific_produce_verbose_syntax_error_message&amp;quot; enabled, you'll see:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
-- Analyzing Verilog file 'test.v' (VERI-1482)&lt;br /&gt;
test.v(3): INFO:         unique priority case (c) (VERI-2124)&lt;br /&gt;
test.v(3): INFO:                        ^ (VERI-2124)&lt;br /&gt;
test.v(3): ERROR: syntax error near 'priority', expecting 'case' or 'casex' or 'casez' or 'if' (VERI-1137)&lt;br /&gt;
test.v(3): ERROR: SystemVerilog keyword priority used in incorrect context (VERI-2344)&lt;br /&gt;
test.v(4): INFO:             1'b0 : o = 1'b1 ; (VERI-2124)&lt;br /&gt;
test.v(4): INFO:                       ^ (VERI-2124)&lt;br /&gt;
test.v(4): ERROR: syntax error near '=' (VERI-1137)&lt;br /&gt;
test.v(5): INFO:             1'b1 : o = 1'b0 ; (VERI-2124)&lt;br /&gt;
test.v(5): INFO:                       ^ (VERI-2124)&lt;br /&gt;
test.v(5): ERROR: syntax error near '=' (VERI-1137)&lt;br /&gt;
test.v(3): ERROR: 'c' is not a constant (VERI-1188)&lt;br /&gt;
test.v(4): ERROR: 'o' is not a type (VERI-1281)&lt;br /&gt;
test.v(5): ERROR: 'o' is not a type (VERI-1281)&lt;br /&gt;
test.v(7): ERROR: module 'test' ignored due to previous errors (VERI-1072)&lt;br /&gt;
ERROR: analyze: failed (CMD-1014)&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Other useful APIs'''&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
    // Control if messages going to console:&lt;br /&gt;
    SetConsoleOutput(unsigned console_output)&lt;br /&gt;
&lt;br /&gt;
    // Control if messages going to a logfile:&lt;br /&gt;
    OpenLogFile(const char *log_file)&lt;br /&gt;
    CloseLogFile()&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mohammad</name></author>	</entry>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=How_to_use_MessageCallBackHandler_Class&amp;diff=871</id>
		<title>How to use MessageCallBackHandler Class</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=How_to_use_MessageCallBackHandler_Class&amp;diff=871"/>
				<updated>2023-12-05T23:22:10Z</updated>
		
		<summary type="html">&lt;p&gt;Mohammad: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a small example showing how to use MessageCallBackHandler Class:&lt;br /&gt;
&lt;br /&gt;
In C++:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;veri_file.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;Message.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Strings.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#ifdef VERIFIC_NAMESPACE&lt;br /&gt;
using namespace Verific ;&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
class MyMsgCallBack : public MessageCallBackHandler&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
    MyMsgCallBack() : MessageCallBackHandler(), _msg_string(0) { }&lt;br /&gt;
    virtual ~MyMsgCallBack() { Strings::free(_msg_string) ; _msg_string = 0 ; }&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
    MyMsgCallBack(const MyMsgCallBack &amp;amp;) ;&lt;br /&gt;
    MyMsgCallBack&amp;amp; operator=(const MyMsgCallBack &amp;amp;) ;&lt;br /&gt;
&lt;br /&gt;
public:&lt;br /&gt;
    virtual void Msg(msg_type_t msg_type, const char *message_id, linefile_type linefile, const char *msg_str) ;&lt;br /&gt;
&lt;br /&gt;
    char * GetLinefile(linefile_type linefile) const&lt;br /&gt;
    {&lt;br /&gt;
        if (!linefile)&lt;br /&gt;
            return Strings::save(&amp;quot;&amp;quot;); &lt;br /&gt;
        char * lineNo = Strings::itoa(LineFile::GetLineNo(linefile));&lt;br /&gt;
        char * lineFileStr = Strings::save(LineFile::GetFileName(linefile), &amp;quot;(&amp;quot;, lineNo, &amp;quot;): &amp;quot;);&lt;br /&gt;
        Strings::free(lineNo);&lt;br /&gt;
        return lineFileStr; &lt;br /&gt;
    }  &lt;br /&gt;
&lt;br /&gt;
    const char * GetMsgType(msg_type_t msg_type) const&lt;br /&gt;
    {&lt;br /&gt;
        if (msg_type == VERIFIC_INFO)&lt;br /&gt;
            return &amp;quot;INFO: &amp;quot;;&lt;br /&gt;
        else if (msg_type == VERIFIC_WARNING)&lt;br /&gt;
            return &amp;quot;WARNING: &amp;quot;;&lt;br /&gt;
        else if (msg_type == VERIFIC_ERROR)&lt;br /&gt;
            return &amp;quot;ERROR: &amp;quot;;&lt;br /&gt;
        else &lt;br /&gt;
            return &amp;quot;-- &amp;quot;;&lt;br /&gt;
    }  &lt;br /&gt;
&lt;br /&gt;
    const char * GetMessageString() const { return _msg_string ; }&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
    char *_msg_string ;&lt;br /&gt;
} ; // class MyMsgCallBack&lt;br /&gt;
&lt;br /&gt;
void MyMsgCallBack::Msg(msg_type_t msg_type, const char * message_id, linefile_type linefile, const char *msg_str)&lt;br /&gt;
{&lt;br /&gt;
    if (!_msg_string) {&lt;br /&gt;
        char *line_str = GetLinefile(linefile);&lt;br /&gt;
        _msg_string = Strings::save(&amp;quot;\t&amp;quot;, line_str, GetMsgType(msg_type), msg_str, &amp;quot; (&amp;quot;, message_id, &amp;quot;)\n&amp;quot;) ;&lt;br /&gt;
        Strings::free(line_str) ;&lt;br /&gt;
    } else {&lt;br /&gt;
        char *tmp = _msg_string ;&lt;br /&gt;
        char *line_str = GetLinefile(linefile);&lt;br /&gt;
        _msg_string = Strings::save(_msg_string, &amp;quot;\t&amp;quot;, line_str, GetMsgType(msg_type), msg_str, &amp;quot; (&amp;quot;, message_id, &amp;quot;)\n&amp;quot;) ;&lt;br /&gt;
        Strings::free(tmp) ;&lt;br /&gt;
        Strings::free(line_str) ;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
int main(int argc, const char **argv)&lt;br /&gt;
{&lt;br /&gt;
    MyMsgCallBack mmcb ;&lt;br /&gt;
    Message::RegisterCallBackMsg(&amp;amp;mmcb) ;&lt;br /&gt;
&lt;br /&gt;
    const char *in_file = (argc &amp;gt; 1) ? argv[1] : &amp;quot;test.v&amp;quot; ;&lt;br /&gt;
    if (!veri_file::Analyze(in_file)) return 1 ;&lt;br /&gt;
&lt;br /&gt;
    const char *msg_str = mmcb.GetMessageString() ;&lt;br /&gt;
    std::cout &amp;lt;&amp;lt; &amp;quot;\nAccumulated messages: \n&amp;quot; &amp;lt;&amp;lt; msg_str ;&lt;br /&gt;
&lt;br /&gt;
    return 0 ;&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
test.v:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
module test (output [3:0] out) ;&lt;br /&gt;
    assign out = {1} ;&lt;br /&gt;
endmodule&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
[moh@awing0 15065]$ ./test-linux&lt;br /&gt;
-- Analyzing Verilog file 'test.v' (VERI-1482)&lt;br /&gt;
test.v(2): WARNING: concatenation with an unsized literal will be treated as 32 bits (VERI-1320)&lt;br /&gt;
&lt;br /&gt;
Accumulated messages: &lt;br /&gt;
	-- Analyzing Verilog file 'test.v' (VERI-1482)&lt;br /&gt;
	test.v(2): WARNING: concatenation with an unsized literal will be treated as 32 bits (VERI-1320)&lt;br /&gt;
[moh@awing0 15065]$ &lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Python:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
#!/usr/bin/python&lt;br /&gt;
import sys&lt;br /&gt;
sys.path.append('../py')&lt;br /&gt;
import Verific&lt;br /&gt;
&lt;br /&gt;
class MyMessageCallBack(Verific.MessageCallBackHandler,object):&lt;br /&gt;
&lt;br /&gt;
    _msg_string = &amp;quot;\nAccumulated message:\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    def __init__(obj):&lt;br /&gt;
        if not obj:&lt;br /&gt;
            return&lt;br /&gt;
        super(MyMessageCallBack,obj).__init__()&lt;br /&gt;
 &lt;br /&gt;
    def Msg(self, msg_type, message_id, linefile, msg_str):&lt;br /&gt;
        self._msg_string = self._msg_string + &amp;quot;\t&amp;quot; + self.GetLinefile(linefile) + self.GetMsgType(msg_type) + msg_str + &amp;quot; (&amp;quot; + message_id + &amp;quot;)\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    def GetLinefile(self, linefile):&lt;br /&gt;
        if not linefile:&lt;br /&gt;
            return &amp;quot;&amp;quot;&lt;br /&gt;
        return Verific.LineFile_GetFileName(linefile) + &amp;quot;(&amp;quot; + str(Verific.LineFile_GetLineNo(linefile)) + &amp;quot;): &amp;quot;&lt;br /&gt;
&lt;br /&gt;
    def GetMsgType(self, msg_type):&lt;br /&gt;
        if (msg_type==Verific.VERIFIC_INFO):&lt;br /&gt;
            return &amp;quot;INFO: &amp;quot;&lt;br /&gt;
        elif (msg_type==Verific.VERIFIC_WARNING):&lt;br /&gt;
            return &amp;quot;WARNING: &amp;quot;&lt;br /&gt;
        elif (msg_type==Verific.VERIFIC_ERROR):&lt;br /&gt;
            return &amp;quot;ERROR: &amp;quot;&lt;br /&gt;
        return &amp;quot;-- &amp;quot;&lt;br /&gt;
&lt;br /&gt;
    def GetMessageString(self):&lt;br /&gt;
        return self._msg_string&lt;br /&gt;
&lt;br /&gt;
mc = MyMessageCallBack()&lt;br /&gt;
Verific.Message_RegisterCallBackMsg(mc)&lt;br /&gt;
&lt;br /&gt;
if (not Verific.veri_file_Analyze(&amp;quot;test.v&amp;quot;)):&lt;br /&gt;
    print(&amp;quot;Error during analysis. Exiting.&amp;quot;)&lt;br /&gt;
    sys.exit(1)&lt;br /&gt;
&lt;br /&gt;
print mc.GetMessageString()&lt;br /&gt;
&lt;br /&gt;
sys.exit(0)&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
[moh@awing0 15065]$ ./test.py &lt;br /&gt;
-- Analyzing Verilog file 'test.v' (VERI-1482)&lt;br /&gt;
test.v(2): WARNING: concatenation with an unsized literal will be treated as 32 bits (VERI-1320)&lt;br /&gt;
&lt;br /&gt;
Accumulated message:&lt;br /&gt;
	-- Analyzing Verilog file 'test.v' (VERI-1482)&lt;br /&gt;
	test.v(2): WARNING: concatenation with an unsized literal will be treated as 32 bits (VERI-1320)&lt;br /&gt;
&lt;br /&gt;
[moh@awing0 15065]$ &lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Perl:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#!/usr/bin/perl -w&lt;br /&gt;
&lt;br /&gt;
use strict ;&lt;br /&gt;
use warnings ;&lt;br /&gt;
&lt;br /&gt;
use lib &amp;quot;../pm&amp;quot; ;&lt;br /&gt;
require &amp;quot;Verific.pm&amp;quot; ;&lt;br /&gt;
&lt;br /&gt;
use Verific ;&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
    package MyMessageCallBack ;&lt;br /&gt;
        use base 'Verific::MessageCallBackHandler' ;&lt;br /&gt;
&lt;br /&gt;
        my $msg_string = &amp;quot;\nAccumulated message:\n&amp;quot; ;&lt;br /&gt;
&lt;br /&gt;
        sub Msg&lt;br /&gt;
        {&lt;br /&gt;
            my ($class, $msg_type, $message_id, $linefile, $msg_str) = (@_) ;&lt;br /&gt;
            $msg_string .= &amp;quot;\t&amp;quot; . GetLinefile($linefile) . GetMsgType($msg_type) . &amp;quot;$msg_str ($message_id)\n&amp;quot; ;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        sub GetLinefile&lt;br /&gt;
        {&lt;br /&gt;
            my ($linefile) = (@_) ;&lt;br /&gt;
            if (!$linefile) { return &amp;quot;&amp;quot; ; } ;&lt;br /&gt;
            return Verific::LineFile::GetFileName($linefile) . &amp;quot;(&amp;quot; . Verific::LineFile::GetLineNo($linefile) . &amp;quot;): &amp;quot; ;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        sub GetMsgType&lt;br /&gt;
        {&lt;br /&gt;
            my ($msg_type) = (@_) ;&lt;br /&gt;
            if ($msg_type == $Verific::VERIFIC_INFO) {&lt;br /&gt;
                return &amp;quot;INFO: &amp;quot;;&lt;br /&gt;
            }&lt;br /&gt;
            elsif ($msg_type == $Verific::VERIFIC_WARNING) {&lt;br /&gt;
                return &amp;quot;WARNING: &amp;quot;;&lt;br /&gt;
            }&lt;br /&gt;
            elsif ($msg_type == $Verific::VERIFIC_ERROR) {&lt;br /&gt;
                return &amp;quot;ERROR: &amp;quot;;&lt;br /&gt;
            }&lt;br /&gt;
            return &amp;quot;-- &amp;quot;;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        sub GetMessageString&lt;br /&gt;
        {&lt;br /&gt;
            return &amp;quot;$msg_string&amp;quot; ;&lt;br /&gt;
        }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
my $mc = MyMessageCallBack-&amp;gt;new() ;&lt;br /&gt;
Verific::Message::RegisterCallBackMsg($mc) ;&lt;br /&gt;
&lt;br /&gt;
if (!Verific::veri_file::Analyze(&amp;quot;test.v&amp;quot;)) {&lt;br /&gt;
    print &amp;quot;Error during analysis. Exiting.\n&amp;quot; ;&lt;br /&gt;
    exit(1) ;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
print $mc-&amp;gt;GetMessageString() ;&lt;br /&gt;
&lt;br /&gt;
exit(0) ;&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
-- Analyzing Verilog file 'test.v' (VERI-1482)&lt;br /&gt;
test.v(2): WARNING: concatenation with an unsized literal will be treated as 32 bits (VERI-1320)&lt;br /&gt;
&lt;br /&gt;
Accumulated message:&lt;br /&gt;
	-- Analyzing Verilog file 'test.v' (VERI-1482)&lt;br /&gt;
	test.v(2): WARNING: concatenation with an unsized literal will be treated as 32 bits (VERI-1320)&lt;br /&gt;
[moh@awing0 15065]$ &lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mohammad</name></author>	</entry>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=How_to_use_MessageCallBackHandler_Class&amp;diff=870</id>
		<title>How to use MessageCallBackHandler Class</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=How_to_use_MessageCallBackHandler_Class&amp;diff=870"/>
				<updated>2023-12-05T20:41:00Z</updated>
		
		<summary type="html">&lt;p&gt;Mohammad: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a small example showing how to use MessageCallBackHandler Class:&lt;br /&gt;
&lt;br /&gt;
In C++:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;veri_file.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;Message.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Strings.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#ifdef VERIFIC_NAMESPACE&lt;br /&gt;
using namespace Verific ;&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
class MyMsgCallBack : public MessageCallBackHandler&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
    MyMsgCallBack() : MessageCallBackHandler(), _msg_string(0) { }&lt;br /&gt;
    virtual ~MyMsgCallBack() { Strings::free(_msg_string) ; _msg_string = 0 ; }&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
    MyMsgCallBack(const MyMsgCallBack &amp;amp;) ;&lt;br /&gt;
    MyMsgCallBack&amp;amp; operator=(const MyMsgCallBack &amp;amp;) ;&lt;br /&gt;
&lt;br /&gt;
public:&lt;br /&gt;
    virtual void Msg(msg_type_t msg_type, const char *message_id, linefile_type linefile, const char *msg_str) ;&lt;br /&gt;
&lt;br /&gt;
    const char * GetMessageString() const { return _msg_string ; }&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
    char *_msg_string ;&lt;br /&gt;
} ; // class MyMsgCallBack&lt;br /&gt;
&lt;br /&gt;
void MyMsgCallBack::Msg(msg_type_t /*msg_type*/, const char * /*message_id*/, linefile_type /*linefile*/, const char *msg_str)&lt;br /&gt;
{&lt;br /&gt;
    if (!_msg_string) {&lt;br /&gt;
        _msg_string = Strings::save(msg_str) ;&lt;br /&gt;
    } else {&lt;br /&gt;
        char *tmp = _msg_string ;&lt;br /&gt;
        _msg_string = Strings::save(_msg_string, &amp;quot;\n&amp;quot;, msg_str) ;&lt;br /&gt;
        Strings::free(tmp) ;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
int main(int argc, const char **argv)&lt;br /&gt;
{&lt;br /&gt;
    MyMsgCallBack mmcb ;&lt;br /&gt;
    Message::RegisterCallBackMsg(&amp;amp;mmcb) ;&lt;br /&gt;
&lt;br /&gt;
    const char *in_file = (argc &amp;gt; 1) ? argv[1] : &amp;quot;test.v&amp;quot; ;&lt;br /&gt;
    if (!veri_file::Analyze(in_file)) return 1 ;&lt;br /&gt;
&lt;br /&gt;
    const char *msg_str = mmcb.GetMessageString() ;&lt;br /&gt;
    std::cout &amp;lt;&amp;lt; &amp;quot;\nAccumulated messages: \n&amp;quot; &amp;lt;&amp;lt; msg_str &amp;lt;&amp;lt; std::endl ;&lt;br /&gt;
&lt;br /&gt;
    return 0 ;&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
test.v:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
module test (output [3:0] out) ;&lt;br /&gt;
    assign out = {1} ;&lt;br /&gt;
endmodule&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
[moh@awing0 15065]$ ./test-linux&lt;br /&gt;
-- Analyzing Verilog file 'test.v' (VERI-1482)&lt;br /&gt;
test.v(2): WARNING: concatenation with an unsized literal will be treated as 32 bits (VERI-1320)&lt;br /&gt;
&lt;br /&gt;
Accumulated messages: &lt;br /&gt;
Analyzing Verilog file 'test.v'&lt;br /&gt;
concatenation with an unsized literal will be treated as 32 bits&lt;br /&gt;
[moh@awing0 15065]$ &lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Python:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
#!/usr/bin/python&lt;br /&gt;
import sys&lt;br /&gt;
sys.path.append('../py')&lt;br /&gt;
import Verific&lt;br /&gt;
&lt;br /&gt;
class MyMessageCallBack(Verific.MessageCallBackHandler,object):&lt;br /&gt;
&lt;br /&gt;
    _msg_string = &amp;quot;\nAccumulated message:\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    def __init__(obj):&lt;br /&gt;
        if not obj:&lt;br /&gt;
            return&lt;br /&gt;
        super(MyMessageCallBack,obj).__init__()&lt;br /&gt;
 &lt;br /&gt;
    def Msg(self, msg_type, message_id, linefile, msg_str):&lt;br /&gt;
        self._msg_string = self._msg_string + &amp;quot;\t&amp;quot; + self.GetLinefile(linefile) + self.GetMsgType(msg_type) + msg_str + &amp;quot; (&amp;quot; + message_id + &amp;quot;)\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    def GetLinefile(self, linefile):&lt;br /&gt;
        if not linefile:&lt;br /&gt;
            return &amp;quot;&amp;quot;&lt;br /&gt;
        return Verific.LineFile_GetFileName(linefile) + &amp;quot;(&amp;quot; + str(Verific.LineFile_GetLineNo(linefile)) + &amp;quot;): &amp;quot;&lt;br /&gt;
&lt;br /&gt;
    def GetMsgType(self, msg_type):&lt;br /&gt;
        if (msg_type==Verific.VERIFIC_INFO):&lt;br /&gt;
            return &amp;quot;INFO: &amp;quot;&lt;br /&gt;
        elif (msg_type==Verific.VERIFIC_WARNING):&lt;br /&gt;
            return &amp;quot;WARNING: &amp;quot;&lt;br /&gt;
        elif (msg_type==Verific.VERIFIC_ERROR):&lt;br /&gt;
            return &amp;quot;ERROR: &amp;quot;&lt;br /&gt;
        return &amp;quot;-- &amp;quot;&lt;br /&gt;
&lt;br /&gt;
    def GetMessageString(self):&lt;br /&gt;
        return self._msg_string&lt;br /&gt;
&lt;br /&gt;
mc = MyMessageCallBack()&lt;br /&gt;
Verific.Message_RegisterCallBackMsg(mc)&lt;br /&gt;
&lt;br /&gt;
if (not Verific.veri_file_Analyze(&amp;quot;test.v&amp;quot;)):&lt;br /&gt;
    print(&amp;quot;Error during analysis. Exiting.&amp;quot;)&lt;br /&gt;
    sys.exit(1)&lt;br /&gt;
&lt;br /&gt;
print mc.GetMessageString()&lt;br /&gt;
&lt;br /&gt;
sys.exit(0)&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
[moh@awing0 15065]$ ./test.py &lt;br /&gt;
-- Analyzing Verilog file 'test.v' (VERI-1482)&lt;br /&gt;
test.v(2): WARNING: concatenation with an unsized literal will be treated as 32 bits (VERI-1320)&lt;br /&gt;
&lt;br /&gt;
Accumulated message:&lt;br /&gt;
	-- Analyzing Verilog file 'test.v' (VERI-1482)&lt;br /&gt;
	test.v(2): WARNING: concatenation with an unsized literal will be treated as 32 bits (VERI-1320)&lt;br /&gt;
&lt;br /&gt;
[moh@awing0 15065]$ &lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Perl:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#!/usr/bin/perl -w&lt;br /&gt;
&lt;br /&gt;
use strict ;&lt;br /&gt;
use warnings ;&lt;br /&gt;
&lt;br /&gt;
use lib &amp;quot;../pm&amp;quot; ;&lt;br /&gt;
require &amp;quot;Verific.pm&amp;quot; ;&lt;br /&gt;
&lt;br /&gt;
use Verific ;&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
    package MyMessageCallBack ;&lt;br /&gt;
        use base 'Verific::MessageCallBackHandler' ;&lt;br /&gt;
&lt;br /&gt;
        my $msg_string = &amp;quot;\nAccumulated message:\n&amp;quot; ;&lt;br /&gt;
&lt;br /&gt;
        sub Msg&lt;br /&gt;
        {&lt;br /&gt;
            my ($class, $msg_type, $message_id, $linefile, $msg_str) = (@_) ;&lt;br /&gt;
            $msg_string .= &amp;quot;\t&amp;quot; . GetLinefile($linefile) . GetMsgType($msg_type) . &amp;quot;$msg_str ($message_id)\n&amp;quot; ;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        sub GetLinefile&lt;br /&gt;
        {&lt;br /&gt;
            my ($linefile) = (@_) ;&lt;br /&gt;
            if (!$linefile) { return &amp;quot;&amp;quot; ; } ;&lt;br /&gt;
            return Verific::LineFile::GetFileName($linefile) . &amp;quot;(&amp;quot; . Verific::LineFile::GetLineNo($linefile) . &amp;quot;): &amp;quot; ;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        sub GetMsgType&lt;br /&gt;
        {&lt;br /&gt;
            my ($msg_type) = (@_) ;&lt;br /&gt;
            if ($msg_type == $Verific::VERIFIC_INFO) {&lt;br /&gt;
                return &amp;quot;INFO: &amp;quot;;&lt;br /&gt;
            }&lt;br /&gt;
            elsif ($msg_type == $Verific::VERIFIC_WARNING) {&lt;br /&gt;
                return &amp;quot;WARNING: &amp;quot;;&lt;br /&gt;
            }&lt;br /&gt;
            elsif ($msg_type == $Verific::VERIFIC_ERROR) {&lt;br /&gt;
                return &amp;quot;ERROR: &amp;quot;;&lt;br /&gt;
            }&lt;br /&gt;
            return &amp;quot;-- &amp;quot;;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        sub GetMessageString&lt;br /&gt;
        {&lt;br /&gt;
            return &amp;quot;$msg_string&amp;quot; ;&lt;br /&gt;
        }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
my $mc = MyMessageCallBack-&amp;gt;new() ;&lt;br /&gt;
Verific::Message::RegisterCallBackMsg($mc) ;&lt;br /&gt;
&lt;br /&gt;
if (!Verific::veri_file::Analyze(&amp;quot;test.v&amp;quot;)) {&lt;br /&gt;
    print &amp;quot;Error during analysis. Exiting.\n&amp;quot; ;&lt;br /&gt;
    exit(1) ;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
print $mc-&amp;gt;GetMessageString() ;&lt;br /&gt;
&lt;br /&gt;
exit(0) ;&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
-- Analyzing Verilog file 'test.v' (VERI-1482)&lt;br /&gt;
test.v(2): WARNING: concatenation with an unsized literal will be treated as 32 bits (VERI-1320)&lt;br /&gt;
&lt;br /&gt;
Accumulated message:&lt;br /&gt;
	-- Analyzing Verilog file 'test.v' (VERI-1482)&lt;br /&gt;
	test.v(2): WARNING: concatenation with an unsized literal will be treated as 32 bits (VERI-1320)&lt;br /&gt;
[moh@awing0 15065]$ &lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mohammad</name></author>	</entry>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=How_to_use_MessageCallBackHandler_Class&amp;diff=869</id>
		<title>How to use MessageCallBackHandler Class</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=How_to_use_MessageCallBackHandler_Class&amp;diff=869"/>
				<updated>2023-12-05T20:35:35Z</updated>
		
		<summary type="html">&lt;p&gt;Mohammad: Created page with &amp;quot;This is a small example showing how to use MessageCallBackHandler Class:  In C++:  &amp;lt;nowiki&amp;gt; #include &amp;lt;iostream&amp;gt;  #include &amp;quot;veri_file.h&amp;quot;  #include &amp;quot;Message.h&amp;quot; #include &amp;quot;Strings...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a small example showing how to use MessageCallBackHandler Class:&lt;br /&gt;
&lt;br /&gt;
In C++:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;veri_file.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;Message.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Strings.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#ifdef VERIFIC_NAMESPACE&lt;br /&gt;
using namespace Verific ;&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
class MyMsgCallBack : public MessageCallBackHandler&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
    MyMsgCallBack() : MessageCallBackHandler(), _msg_string(0) { }&lt;br /&gt;
    virtual ~MyMsgCallBack() { Strings::free(_msg_string) ; _msg_string = 0 ; }&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
    MyMsgCallBack(const MyMsgCallBack &amp;amp;) ;&lt;br /&gt;
    MyMsgCallBack&amp;amp; operator=(const MyMsgCallBack &amp;amp;) ;&lt;br /&gt;
&lt;br /&gt;
public:&lt;br /&gt;
    virtual void Msg(msg_type_t msg_type, const char *message_id, linefile_type linefile, const char *msg_str) ;&lt;br /&gt;
&lt;br /&gt;
    const char * GetMessageString() const { return _msg_string ; }&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
    char *_msg_string ;&lt;br /&gt;
} ; // class MyMsgCallBack&lt;br /&gt;
&lt;br /&gt;
void MyMsgCallBack::Msg(msg_type_t /*msg_type*/, const char * /*message_id*/, linefile_type /*linefile*/, const char *msg_str)&lt;br /&gt;
{&lt;br /&gt;
    if (!_msg_string) {&lt;br /&gt;
        _msg_string = Strings::save(msg_str) ;&lt;br /&gt;
    } else {&lt;br /&gt;
        char *tmp = _msg_string ;&lt;br /&gt;
        _msg_string = Strings::save(_msg_string, &amp;quot;\n&amp;quot;, msg_str) ;&lt;br /&gt;
        Strings::free(tmp) ;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
int main(int argc, const char **argv)&lt;br /&gt;
{&lt;br /&gt;
    MyMsgCallBack mmcb ;&lt;br /&gt;
    Message::RegisterCallBackMsg(&amp;amp;mmcb) ;&lt;br /&gt;
&lt;br /&gt;
    const char *in_file = (argc &amp;gt; 1) ? argv[1] : &amp;quot;test.v&amp;quot; ;&lt;br /&gt;
    if (!veri_file::Analyze(in_file)) return 1 ;&lt;br /&gt;
&lt;br /&gt;
    const char *msg_str = mmcb.GetMessageString() ;&lt;br /&gt;
    std::cout &amp;lt;&amp;lt; &amp;quot;Accumulated messages: &amp;quot; &amp;lt;&amp;lt; msg_str &amp;lt;&amp;lt; std::endl ;&lt;br /&gt;
&lt;br /&gt;
    return 0 ;&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
test.v:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
module test (output [3:0] out) ;&lt;br /&gt;
    assign out = {1} ;&lt;br /&gt;
endmodule&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
[moh@awing0 15065]$ ./test-linux&lt;br /&gt;
-- Analyzing Verilog file 'test.v' (VERI-1482)&lt;br /&gt;
test.v(2): WARNING: concatenation with an unsized literal will be treated as 32 bits (VERI-1320)&lt;br /&gt;
Accumulated messages: Analyzing Verilog file 'test.v'&lt;br /&gt;
concatenation with an unsized literal will be treated as 32 bits&lt;br /&gt;
[moh@awing0 15065]$ &lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Python:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
#!/usr/bin/python&lt;br /&gt;
import sys&lt;br /&gt;
sys.path.append('../py')&lt;br /&gt;
import Verific&lt;br /&gt;
&lt;br /&gt;
class MyMessageCallBack(Verific.MessageCallBackHandler,object):&lt;br /&gt;
&lt;br /&gt;
    _msg_string = &amp;quot;\nAccumulated message:\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    def __init__(obj):&lt;br /&gt;
        if not obj:&lt;br /&gt;
            return&lt;br /&gt;
        super(MyMessageCallBack,obj).__init__()&lt;br /&gt;
 &lt;br /&gt;
    def Msg(self, msg_type, message_id, linefile, msg_str):&lt;br /&gt;
        self._msg_string = self._msg_string + &amp;quot;\t&amp;quot; + self.GetLinefile(linefile) + self.GetMsgType(msg_type) + msg_str + &amp;quot; (&amp;quot; + message_id + &amp;quot;)\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    def GetLinefile(self, linefile):&lt;br /&gt;
        if not linefile:&lt;br /&gt;
            return &amp;quot;&amp;quot;&lt;br /&gt;
        return Verific.LineFile_GetFileName(linefile) + &amp;quot;(&amp;quot; + str(Verific.LineFile_GetLineNo(linefile)) + &amp;quot;): &amp;quot;&lt;br /&gt;
&lt;br /&gt;
    def GetMsgType(self, msg_type):&lt;br /&gt;
        if (msg_type==Verific.VERIFIC_INFO):&lt;br /&gt;
            return &amp;quot;INFO: &amp;quot;&lt;br /&gt;
        elif (msg_type==Verific.VERIFIC_WARNING):&lt;br /&gt;
            return &amp;quot;WARNING: &amp;quot;&lt;br /&gt;
        elif (msg_type==Verific.VERIFIC_ERROR):&lt;br /&gt;
            return &amp;quot;ERROR: &amp;quot;&lt;br /&gt;
        return &amp;quot;-- &amp;quot;&lt;br /&gt;
&lt;br /&gt;
    def GetMessageString(self):&lt;br /&gt;
        return self._msg_string&lt;br /&gt;
&lt;br /&gt;
mc = MyMessageCallBack()&lt;br /&gt;
Verific.Message_RegisterCallBackMsg(mc)&lt;br /&gt;
&lt;br /&gt;
if (not Verific.veri_file_Analyze(&amp;quot;test.v&amp;quot;)):&lt;br /&gt;
    print(&amp;quot;Error during analysis. Exiting.&amp;quot;)&lt;br /&gt;
    sys.exit(1)&lt;br /&gt;
&lt;br /&gt;
print mc.GetMessageString()&lt;br /&gt;
&lt;br /&gt;
sys.exit(0)&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
[moh@awing0 15065]$ ./test.py &lt;br /&gt;
-- Analyzing Verilog file 'test.v' (VERI-1482)&lt;br /&gt;
test.v(2): WARNING: concatenation with an unsized literal will be treated as 32 bits (VERI-1320)&lt;br /&gt;
&lt;br /&gt;
Accumulated message:&lt;br /&gt;
	-- Analyzing Verilog file 'test.v' (VERI-1482)&lt;br /&gt;
	test.v(2): WARNING: concatenation with an unsized literal will be treated as 32 bits (VERI-1320)&lt;br /&gt;
&lt;br /&gt;
[moh@awing0 15065]$ &lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Perl:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#!/usr/bin/perl -w&lt;br /&gt;
&lt;br /&gt;
use strict ;&lt;br /&gt;
use warnings ;&lt;br /&gt;
&lt;br /&gt;
use lib &amp;quot;../pm&amp;quot; ;&lt;br /&gt;
require &amp;quot;Verific.pm&amp;quot; ;&lt;br /&gt;
&lt;br /&gt;
use Verific ;&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
    package MyMessageCallBack ;&lt;br /&gt;
        use base 'Verific::MessageCallBackHandler' ;&lt;br /&gt;
&lt;br /&gt;
        my $msg_string = &amp;quot;\nAccumulated message:\n&amp;quot; ;&lt;br /&gt;
&lt;br /&gt;
        sub Msg&lt;br /&gt;
        {&lt;br /&gt;
            my ($class, $msg_type, $message_id, $linefile, $msg_str) = (@_) ;&lt;br /&gt;
            $msg_string .= &amp;quot;\t&amp;quot; . GetLinefile($linefile) . GetMsgType($msg_type) . &amp;quot;$msg_str ($message_id)\n&amp;quot; ;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        sub GetLinefile&lt;br /&gt;
        {&lt;br /&gt;
            my ($linefile) = (@_) ;&lt;br /&gt;
            if (!$linefile) { return &amp;quot;&amp;quot; ; } ;&lt;br /&gt;
            return Verific::LineFile::GetFileName($linefile) . &amp;quot;(&amp;quot; . Verific::LineFile::GetLineNo($linefile) . &amp;quot;): &amp;quot; ;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        sub GetMsgType&lt;br /&gt;
        {&lt;br /&gt;
            my ($msg_type) = (@_) ;&lt;br /&gt;
            if ($msg_type == $Verific::VERIFIC_INFO) {&lt;br /&gt;
                return &amp;quot;INFO: &amp;quot;;&lt;br /&gt;
            }&lt;br /&gt;
            elsif ($msg_type == $Verific::VERIFIC_WARNING) {&lt;br /&gt;
                return &amp;quot;WARNING: &amp;quot;;&lt;br /&gt;
            }&lt;br /&gt;
            elsif ($msg_type == $Verific::VERIFIC_ERROR) {&lt;br /&gt;
                return &amp;quot;ERROR: &amp;quot;;&lt;br /&gt;
            }&lt;br /&gt;
            return &amp;quot;-- &amp;quot;;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        sub GetMessageString&lt;br /&gt;
        {&lt;br /&gt;
            return &amp;quot;$msg_string&amp;quot; ;&lt;br /&gt;
        }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
my $mc = MyMessageCallBack-&amp;gt;new() ;&lt;br /&gt;
Verific::Message::RegisterCallBackMsg($mc) ;&lt;br /&gt;
&lt;br /&gt;
if (!Verific::veri_file::Analyze(&amp;quot;test.v&amp;quot;)) {&lt;br /&gt;
    print &amp;quot;Error during analysis. Exiting.\n&amp;quot; ;&lt;br /&gt;
    exit(1) ;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
print $mc-&amp;gt;GetMessageString() ;&lt;br /&gt;
&lt;br /&gt;
exit(0) ;&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
-- Analyzing Verilog file 'test.v' (VERI-1482)&lt;br /&gt;
test.v(2): WARNING: concatenation with an unsized literal will be treated as 32 bits (VERI-1320)&lt;br /&gt;
&lt;br /&gt;
Accumulated message:&lt;br /&gt;
	-- Analyzing Verilog file 'test.v' (VERI-1482)&lt;br /&gt;
	test.v(2): WARNING: concatenation with an unsized literal will be treated as 32 bits (VERI-1320)&lt;br /&gt;
[moh@awing0 15065]$ &lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mohammad</name></author>	</entry>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=Main_Page&amp;diff=868</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=Main_Page&amp;diff=868"/>
				<updated>2023-12-05T20:34:16Z</updated>
		
		<summary type="html">&lt;p&gt;Mohammad: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''General'''&lt;br /&gt;
* [[How to get best support from Verific | '''''How to get best support from Verific''''']]&lt;br /&gt;
* [[Source code customization &amp;amp; Stable release services | Source code customization &amp;amp; Stable release services]]&lt;br /&gt;
* [[How to save computer resources | How to save computer resources (memory consumption &amp;amp; runtime)]]&lt;br /&gt;
* [[Original RTL language | How do I know what language a Netlist in the netlist database comes from?]]&lt;br /&gt;
* [[Verific data structures | What are the data structures in Verific?]]&lt;br /&gt;
* [[Remove Verific data structures | How do I remove all Verific data structures in memory?]]&lt;br /&gt;
* [[Does Verific build CDFG? | Does Verific build control and data flow graph (CDFG)?]]&lt;br /&gt;
* [[Does Verific support XMR?| Does Verific support cross module references (XMR)?]]&lt;br /&gt;
* [[Compile-time/run-time flags | Are there options to control Verific software's behavior? Compile-time &amp;amp; run-time flags.]]&lt;br /&gt;
* [[Message handling | How do I downgrade/upgrade messages from Verific? How do I get messages with more details?]]&lt;br /&gt;
* [[Release version | How do I tell the version of a Verific software release? ]]&lt;br /&gt;
* [[Simulation models for Verific primitives | Where do I find simulation models for Verific primitives (VERIFIC_XOR, VERIFIC_DFFRS, ....)? ]]&lt;br /&gt;
* [[Tcl library path| How to correct building (linking) issue &amp;quot;/usr/bin/ld: cannot find -ltcl&amp;quot;]]&lt;br /&gt;
* [[LineFile data from input files | LineFile data from input files]]&lt;br /&gt;
* [[Difference between RTL and gate-level simulations - Flipflop with async set and async reset | Difference between RTL and gate-level simulations - Flipflop with async set and async reset]]&lt;br /&gt;
* [[Preserving user nets - preventing nets from being optimized away | Preserving user nets - preventing nets from being optimized away]]&lt;br /&gt;
* [[Python pretty-printer for gdb | Python pretty-printer for gdb]]&lt;br /&gt;
&lt;br /&gt;
'''Input: VHDL, Verilog (and SystemVerilog), Liberty, EDIF'''&lt;br /&gt;
* [[How to get all Verilog files being analyzed | Verilog: I'm using -v, -y, .... After Verific is done with the analysis, how do I get a list of all the files being analyzed?]]&lt;br /&gt;
* [[Included files associated with a Verilog source file | Verilog: How do I get the list of included files associated with a Verilog source file?]]&lt;br /&gt;
* [[How to get type/initial value of parameters | Verilog: How to get type/initial value of parameters.]]&lt;br /&gt;
* [[Verilog ports being renamed | Verilog: Port Expressions]]&lt;br /&gt;
* [[Design with System Verilog and Verilog 2001 files | Verilog: For a design consisting of a mixture of Verilog 2001 and SystemVerilog input files, should I parse all the files as SystemVerilog?]]&lt;br /&gt;
* [[How to get module ports from Verilog parsetree | Verilog: From the Verilog parsetree, how can I get the ports of a module?]]&lt;br /&gt;
* [[How to change name of id in Verilog parsetree | Verilog: How do I change the name of an id (VeriidDef) in Verilog parsetree?]]&lt;br /&gt;
* [[How to get library containing nested module | Verilog: How do I get nested modules and get the library that contains the nested module?]]&lt;br /&gt;
* [[How to get linefile information of macro definitions | Verilog: How do I get linefile information of macro definitions?]]&lt;br /&gt;
* [[How to find port dimensions | Verilog: How do I get port dimensions?]]&lt;br /&gt;
* [[Instance - Module binding order | Verilog: What is the order of binding modules to instances?]]&lt;br /&gt;
* [[How Verific elaborator handles blackboxes/unknown boxes | Verilog: How Verific elaborator handles blackboxes/unknown boxes]]&lt;br /&gt;
* [[Constant expression replacement | Verilog: Does Verific replace constant expressions with their respective values?]]&lt;br /&gt;
* [[Modules with '_1' '_2' suffix in their names | Verilog: After static elaboration, there are modules with &amp;quot;_1&amp;quot;, &amp;quot;_2&amp;quot;, ..., suffix in their names. Why?]]&lt;br /&gt;
* [[Defined macros become undefined - MFCU vs SFCU | SystemVerilog: Why does Verific complain about undefined macros for macros defined in a different file (Compilation Unit)?]]&lt;br /&gt;
* [[Notes on analysis | SystemVerilog: Notes on analysis]]&lt;br /&gt;
* [[How to get enums from Verilog parsetree | SystemVerilog: From the parsetree, how can I get the enums declared in a module?]]&lt;br /&gt;
* [[How to identify packages being imported into a module | SystemVerilog: How do I identify packages being imported into a module?]]&lt;br /&gt;
* [[SystemVerilog &amp;quot;std&amp;quot; package | SystemVerilog: Support for SystemVerilog semaphore/process/mailbox constructs.]]&lt;br /&gt;
* [[Top level module with interface ports | SystemVerilog: Support for SystemVerilog top level module with interface ports.]]&lt;br /&gt;
* [[Design with VHDL-1993 and VHDL-2008 files | VHDL: VHDL-1993 and VHDL-2008 each has its own IEEE library set. How do I analyze/elaborate a design with a mixture of files of different VHDL dialects (1993 and 2008)?]]&lt;br /&gt;
* [[Escaped identifiers in RTL files and in Verific data structures | Verilog/VHDL: Escaped identifiers in RTL files and in Verific data structures]]&lt;br /&gt;
* [[Prettyprint to a string | Verilog/VHDL: How to prettyprint a parsetree node to a string.]]&lt;br /&gt;
* [[Static elaboration | Verilog/VHDL: What does 'static elaboration' do?]]&lt;br /&gt;
* [[How to ignore a (not used) parameter/generic in elaboration. | Verilog/VHDL: How to ignore a (not used) parameter/generic in elaboration.]]&lt;br /&gt;
* [[What VeriModule* or VhdlPrimaryUnit* the Netlist comes from? | Verilog/VHDL: For a Netlist in the netlist database, is there a clean way to look back at what VeriModule* or VhdlPrimaryUnit* the Netlist was derived from?]]&lt;br /&gt;
* [[Cross-reference between the original RTL files and the elaborated netlist | Verilog/VHDL: Is there a way to cross-reference between the original RTL design files and the elaboration netlist?]]&lt;br /&gt;
* [[How to ignore parameters/generics in elaboration | Verilog/VHDL: Is there a way to tell the elaborator to ignore certain parameters/generics so that the unit/module is not uniquified?]]&lt;br /&gt;
* [[How to check for errors in analysis/elaboration | Verilog/VHDL: Is there a way to tell if the analysis/elaboration process has errors?]]&lt;br /&gt;
* [[Modules/design units with &amp;quot;_default&amp;quot; suffix in their names | Verilog/VHDL: After static elaboration, there are modules/design units/interfaces with &amp;quot;_default&amp;quot; suffix in their names. Why? And what are they?]]&lt;br /&gt;
* [[How to parse a string | Verilog/VHDL: How to parse a string - Example of adding a module to the parsetree]]&lt;br /&gt;
* [[Support IEEE 1735 encryption standard | Verilog/VHDL: Does Verific support IEEE 1735 encryption standard?]]&lt;br /&gt;
'''Netlist Database'''&lt;br /&gt;
* [[Logic optimization across hierarchy boundaries | Netlist Database: Does Verific perform logic optimization across hierarchy boundaries?]]&lt;br /&gt;
* [[Bit-blasting a multi-port RAM instance | Netlist Database: Bit-blasting a multi-port RAM instance]]&lt;br /&gt;
* [[System attributes | Netlist Database: System attributes]]&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
* [[Output file formats | What language formats does Verific support as output?]]&lt;br /&gt;
&lt;br /&gt;
'''Scripting languages: TCL, Perl, Python'''&lt;br /&gt;
* [[What languages can I use with Verific software? | What programming languages can I use with Verific software?]]&lt;br /&gt;
&lt;br /&gt;
'''Code examples'''&lt;br /&gt;
* [[How to use RegisterCallBackMsg() | Util/C++: How to use RegisterCallBackMsg()]]&lt;br /&gt;
* [[How to use MessageCallBackHandler Class | Util/C++: How to use MessageCallBackHandler Class]]&lt;br /&gt;
* [[How to use RegisterPragmaRefCallBack() | Util/C++: How to use RegisterPragmaRefCallBack()]]&lt;br /&gt;
* [[Write out an encrypted netlist | Database/C++: Write out an encrypted netlist]]&lt;br /&gt;
* [[Extract clock enable | Database/C++: Extract clock enable]]&lt;br /&gt;
* [[Black box, empty box, and unknown box | Database/C++: Black box, empty box, and unknown box]]&lt;br /&gt;
* [[Finding hierarchical paths of a Netlist | Database/C++: Finding hierarchical paths of a Netlist]]&lt;br /&gt;
* [[Replacing Verific built-in primitives/operators with user implementations | Database/C++: Replacing Verific built-in primitives/operators with user implementations]]&lt;br /&gt;
* [[Hierarchy tree RTL elaboration | Database/Perl: Simple example of hierarchy tree elaboration]]&lt;br /&gt;
* [[Create a Netlist Database from scratch (not from RTL elaboration) | Database/Perl/TCL: Create a Netlist Database from scratch (not from RTL elaboration)]]&lt;br /&gt;
* [[Buffering signals and ungrouping | Database/Verilog: Buffering signals and ungrouping (flattening) in the Netlist Database]]&lt;br /&gt;
* [[Memory elements of a RamNet | Database/Verilog/C++: Memory elements of a RamNet]]&lt;br /&gt;
* [[Process -f file and explore the Netlist Database (C++)| Database/Verilog/C++: Process -f file and explore the Netlist Database]]&lt;br /&gt;
* [[Process -f file and explore the Netlist Database (py)| Database/Verilog/Python: Process -f file and explore the Netlist Database]]&lt;br /&gt;
* [[Fanout cone and grouping | Database/Verilog/Perl: Fanout cone and grouping in the Netlist Database]]&lt;br /&gt;
* [[Simple example of visitor pattern | Verilog/C++: Simple examples of visitor pattern]]&lt;br /&gt;
* [[Statically elaborate with different values of parameters | Verilog/C++: Statically elaborate with different values of parameters]]&lt;br /&gt;
* [[Prettyprint all modules in the design hierarchy | Verilog/C++: Prettyprint all modules in the design hierarchy]]&lt;br /&gt;
* [[Getting instances' parameters | Verilog/C++: Getting instances' parameters]]&lt;br /&gt;
* [[Accessing and evaluating module's parameters | Verilog/C++: Accessing and evaluating module's parameters]]&lt;br /&gt;
* [[Visiting Hierarchical References (VeriSelectedName) | Verilog/C++: Visiting Hierarchical References (VeriSelectedName)]]&lt;br /&gt;
* [[Type Range example | Verilog/C++: Type Range example  (simple)]]&lt;br /&gt;
* [[Using stream input to ignore input file | Verilog/C++: Using stream input to ignore input file]]&lt;br /&gt;
* [[How to ignore certain modules while analyzing input RTL files | Verilog/C++: How to ignore certain modules while analyzing input RTL files]]&lt;br /&gt;
* [[How to tell if a module has encrypted contents | Verilog/C++: How to tell if a module has encrypted contents]]&lt;br /&gt;
* [[Comment out a line using text based design modification and parsetree modification | Verilog/C++: Comment out a line using text-based design modification and parsetree modification]] &lt;br /&gt;
* [[Verilog/C++: How to use IsUserDeclared() : Example for port associations]]&lt;br /&gt;
* [[How to create new module in Verilog parsetree | Verilog/C++: How to create new module in Verilog parsetree]]&lt;br /&gt;
* [[In Verilog parsetree adding names to unnamed instances | Verilog/C++: In Verilog parsetree adding names to unnamed instances]]&lt;br /&gt;
* [[How to get full hierarchy ID path | Verilog/C++: How to get full hierarchy ID path]]&lt;br /&gt;
* [[How to traverse scope hierarchy | Verilog/C++: How to traverse scope hierarchy]]&lt;br /&gt;
* [[Access attributes in parsetree | Verilog/C++: How to access attributes in parsetree]]&lt;br /&gt;
* [[How to detect multiple-clock-edge condition in Verilog parsetree | Verilog/C++: How to detect multiple-clock-edge condition in Verilog parsetree]]&lt;br /&gt;
* [[How to get driving net of an instance | Verilog/C++: How to get driving net of an instance]]&lt;br /&gt;
* [[Parse select modules only and ignore the rest | Verilog/C++: Parse select modules only and ignore the rest]]&lt;br /&gt;
* [[Type Range example with multi-dimensional arrays| Verilog/C++/Perl: Type Range example with multi-dimensional arrays]]&lt;br /&gt;
* [[How to get linefile data of macros - Macro callback function | Verilog/C++/Perl/Python: How to get linefile data of macros - Macro callback function]]&lt;br /&gt;
* [[Where in RTL does it get assigned? | Verilog/C++/Perl/Python: Where in RTL does it get assigned?]]&lt;br /&gt;
* [[Access attributes of ports in parsetree | Verilog/Perl: Access attributes of ports in parsetree and from netlist]]&lt;br /&gt;
* [[Evaluate 'for-generate' loop | Verilog/C++: Evaluate 'for-generate' loop]]&lt;br /&gt;
* [[Retrieve package name for user-defined variable types | SystemVerilog/C++/Python: Retrieve package name for user-defined variable types]]&lt;br /&gt;
* [[Pretty-print a module and the packages imported by the module | SystemVerilog/C++: Pretty-print a module and the packages imported by the module]]&lt;br /&gt;
* [[How to get packed dimensions of enum | SystemVerilog/C++: How to get packed dimensions of enum]]&lt;br /&gt;
* [[Simple examples of VHDL visitor pattern | VHDL/C++: Simple examples of VHDL visitor pattern]]&lt;br /&gt;
* [[Traverse instances in parsetree | VHDL/C++: Traverse instances in parsetree]]&lt;br /&gt;
* [[Parsing from data in memory | Verilog/VHDL/C++: Parsing from data in memory]]&lt;/div&gt;</summary>
		<author><name>Mohammad</name></author>	</entry>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=How_to_get_type/initial_value_of_parameters&amp;diff=866</id>
		<title>How to get type/initial value of parameters</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=How_to_get_type/initial_value_of_parameters&amp;diff=866"/>
				<updated>2023-11-04T00:37:10Z</updated>
		
		<summary type="html">&lt;p&gt;Mohammad: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Q: How do I get type and initial value of parameters?'''&lt;br /&gt;
&lt;br /&gt;
Example C++ code:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
#include &amp;quot;veri_file.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriId.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriExpression.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Netlist.h&amp;quot;&lt;br /&gt;
#include &amp;quot;VeriModule.h&amp;quot;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using namespace Verific ;&lt;br /&gt;
&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
    const char *file_name = &amp;quot;test.v&amp;quot;;&lt;br /&gt;
    if (!veri_file::Analyze(file_name, veri_file::SYSTEM_VERILOG)) {&lt;br /&gt;
        std::cout &amp;lt;&amp;lt; &amp;quot;unable to analyze file &amp;quot; &amp;lt;&amp;lt; file_name &amp;lt;&amp;lt; &amp;quot; and mode SYSTEM_VERILOG\n&amp;quot;;&lt;br /&gt;
        return 1 ; &lt;br /&gt;
    }   &lt;br /&gt;
    const char *top_module_name = &amp;quot;top&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
    VeriModule *top = veri_file::GetModule(top_module_name);&lt;br /&gt;
    if (!top) {&lt;br /&gt;
        std::cout &amp;lt;&amp;lt;&amp;quot;module &amp;quot; &amp;lt;&amp;lt; top_module_name &amp;lt;&amp;lt; &amp;quot; not found\n&amp;quot;; &lt;br /&gt;
        return 1;&lt;br /&gt;
    }   &lt;br /&gt;
&lt;br /&gt;
    Array *param_array = top-&amp;gt;GetParameters() ;&lt;br /&gt;
    if (!param_array) {&lt;br /&gt;
        std::cout &amp;lt;&amp;lt; &amp;quot;*** no parameters found ***\n&amp;quot;; &lt;br /&gt;
        return 1;&lt;br /&gt;
    }   &lt;br /&gt;
&lt;br /&gt;
    unsigned i ; &lt;br /&gt;
    VeriIdDef *param_id ;&lt;br /&gt;
    FOREACH_ARRAY_ITEM(param_array, i, param_id) {&lt;br /&gt;
        if (!param_id) continue;&lt;br /&gt;
    &lt;br /&gt;
        std::cout &amp;lt;&amp;lt; &amp;quot;*** param name: &amp;quot; &amp;lt;&amp;lt; param_id-&amp;gt;Name() &amp;lt;&amp;lt; &amp;quot; ***\n&amp;quot;;  &lt;br /&gt;
        VeriDataType *type = param_id-&amp;gt;GetDataType();&lt;br /&gt;
        if (type) {&lt;br /&gt;
            std::cout &amp;lt;&amp;lt; &amp;quot;*** type: &amp;quot; &amp;lt;&amp;lt; type-&amp;gt;GetPrettyPrintedString() &amp;lt;&amp;lt;  &amp;quot;***\n&amp;quot;;&lt;br /&gt;
        } else {&lt;br /&gt;
            std::cout &amp;lt;&amp;lt; &amp;quot;*** type not declared ***\n&amp;quot;;&lt;br /&gt;
        }   &lt;br /&gt;
&lt;br /&gt;
        VeriExpression *init_value = param_id-&amp;gt;GetInitialValue();&lt;br /&gt;
    &lt;br /&gt;
        if (init_value) {&lt;br /&gt;
            std::cout &amp;lt;&amp;lt; &amp;quot;*** initial value: &amp;quot; &amp;lt;&amp;lt; init_value-&amp;gt;GetPrettyPrintedString() &amp;lt;&amp;lt;  &amp;quot; ***\n&amp;quot;;&lt;br /&gt;
        }   &lt;br /&gt;
    }   &lt;br /&gt;
    return 0 ; &lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example Perl code:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
  #!/usr/bin/perl&lt;br /&gt;
  &lt;br /&gt;
  push(@INC,&amp;quot;../../../perlmain/install&amp;quot;);&lt;br /&gt;
  require &amp;quot;Verific.pm&amp;quot;;&lt;br /&gt;
  &lt;br /&gt;
  my $filename = &amp;quot;test.v&amp;quot;;&lt;br /&gt;
  my $mode = 4; # SystemVerilog - Verilog 2K:  my $mode = 1;&lt;br /&gt;
  if (!Verific::veri_file::Analyze($filename, $mode)) { die &amp;quot;unable to analyze file $filename and mode $mode\n&amp;quot;; }&lt;br /&gt;
  &lt;br /&gt;
  $top_module_name = &amp;quot;top&amp;quot;;&lt;br /&gt;
  &lt;br /&gt;
  # $top is VeriModule * &lt;br /&gt;
  my $top = Verific::veri_file::GetModule($top_module_name);&lt;br /&gt;
  if (!defined($top)) { die &amp;quot;module $top_mod not found\n&amp;quot;; } &lt;br /&gt;
  &lt;br /&gt;
  my $param_array = $top-&amp;gt;GetParameters();&lt;br /&gt;
  if (!defined($param_array)) { print &amp;quot;*** no parameters found ***\n&amp;quot;; exit; }&lt;br /&gt;
  &lt;br /&gt;
  # now let's get an Array iterator instead of using the FOREACH_ARRAY_ITEM macro&lt;br /&gt;
  my $param_array_iter = $param_array-&amp;gt;Iterator(&amp;quot;VeriIdDef&amp;quot;); &lt;br /&gt;
  &lt;br /&gt;
  for (my $param_id = $param_array_iter-&amp;gt;First(); &lt;br /&gt;
        $param_array_iter &amp;lt; $param_array_iter-&amp;gt;Size(); &lt;br /&gt;
        $param_id = $param_array_iter-&amp;gt;Next()) {&lt;br /&gt;
  &lt;br /&gt;
        # null check param_id..&lt;br /&gt;
        if (!defined($param_id)) { next; }&lt;br /&gt;
       &lt;br /&gt;
        # print param name&lt;br /&gt;
        printf &amp;quot;* param name: %s ***\n&amp;quot;, $param_id-&amp;gt;Name();&lt;br /&gt;
  &lt;br /&gt;
        # print param type&lt;br /&gt;
        # $type, if specified, is VeriDataType *&lt;br /&gt;
        my $type = $param_id-&amp;gt;GetDataType();&lt;br /&gt;
        if (defined($type)) {&lt;br /&gt;
            my $to_string = &amp;quot;&amp;quot;;&lt;br /&gt;
            $type-&amp;gt;PrettyPrint(\$to_string, 0);&lt;br /&gt;
            print &amp;quot;*** type: $to_string ***\n&amp;quot;; &lt;br /&gt;
        } else {&lt;br /&gt;
            print &amp;quot;*** type not declared ***\n&amp;quot;; &lt;br /&gt;
        }&lt;br /&gt;
  &lt;br /&gt;
        # $init_value is VeriExpression * &lt;br /&gt;
        my $init_value = $param_id-&amp;gt;GetInitialValue();&lt;br /&gt;
  &lt;br /&gt;
        if (defined($init_value)) {&lt;br /&gt;
           my $to_string = &amp;quot;&amp;quot;;&lt;br /&gt;
           $init_value-&amp;gt;PrettyPrint(\$to_string, 0);&lt;br /&gt;
           print &amp;quot;*** initial value: $to_string ***\n&amp;quot;; &lt;br /&gt;
        }&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  exit;&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, this RTL code:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
module top (a0, a1, b0, b1, c0, c1);&lt;br /&gt;
    parameter int DUMMY0 = 8;&lt;br /&gt;
    parameter logic DUMMY1 = 16; &lt;br /&gt;
    parameter WIDTH = 4;&lt;br /&gt;
    input [WIDTH-1 : 0] a0, b0, a1, b1; &lt;br /&gt;
    output [WIDTH-1 : 0] c0, c1; &lt;br /&gt;
    &lt;br /&gt;
endmodule&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Will have the following output:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
-- Analyzing Verilog file 'test.v' (VERI-1482)&lt;br /&gt;
*** param name: DUMMY0 ***&lt;br /&gt;
*** type: int ***&lt;br /&gt;
*** initial value: 8 ***&lt;br /&gt;
*** param name: DUMMY1 ***&lt;br /&gt;
*** type: logic ***&lt;br /&gt;
*** initial value: 16 ***&lt;br /&gt;
*** param name: WIDTH ***&lt;br /&gt;
*** type not declared ***&lt;br /&gt;
*** initial value: 4 ***&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mohammad</name></author>	</entry>

	</feed>