<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://www.verific.com/faq/index.php?action=history&amp;feed=atom&amp;title=Hierarchy_tree_RTL_elaboration</id>
		<title>Hierarchy tree RTL elaboration - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://www.verific.com/faq/index.php?action=history&amp;feed=atom&amp;title=Hierarchy_tree_RTL_elaboration"/>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=Hierarchy_tree_RTL_elaboration&amp;action=history"/>
		<updated>2026-05-02T12:46:13Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.26.3</generator>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=Hierarchy_tree_RTL_elaboration&amp;diff=615&amp;oldid=prev</id>
		<title>Hoa: Created page with &quot;Reference: [https://www.verific.com/faq/index.php?title=Does_Verific_support_XMR%3F Does Verific support XMR?]  Synthesizing designs with cross-module referencing needs Hierar...&quot;</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=Hierarchy_tree_RTL_elaboration&amp;diff=615&amp;oldid=prev"/>
				<updated>2021-02-25T22:11:49Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;Reference: [https://www.verific.com/faq/index.php?title=Does_Verific_support_XMR%3F Does Verific support XMR?]  Synthesizing designs with cross-module referencing needs Hierar...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Reference: [https://www.verific.com/faq/index.php?title=Does_Verific_support_XMR%3F Does Verific support XMR?]&lt;br /&gt;
&lt;br /&gt;
Synthesizing designs with cross-module referencing needs Hierarchy Tree feature. Below is a simple example.&lt;br /&gt;
&lt;br /&gt;
Perl script:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
#!/usr/bin/perl&lt;br /&gt;
&lt;br /&gt;
use strict ;&lt;br /&gt;
use warnings ;&lt;br /&gt;
push (@INC,&amp;quot;../pm&amp;quot;);&lt;br /&gt;
require &amp;quot;Verific.pm&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
# Runtime flags to support cross-module referencing&lt;br /&gt;
Verific::RuntimeFlags::SetVar(&amp;quot;db_preserve_user_nets&amp;quot;, 1);&lt;br /&gt;
Verific::RuntimeFlags::SetVar(&amp;quot;db_allow_external_nets&amp;quot;, 1);&lt;br /&gt;
&lt;br /&gt;
# hier_tree::Elaborate() expects two arrays as input&lt;br /&gt;
my $topmodules = new Verific::Array();&lt;br /&gt;
my $topunits = new Verific::Array();&lt;br /&gt;
&lt;br /&gt;
# If design has Verilog source files&lt;br /&gt;
my $verilogfiles = new Verific::Array();&lt;br /&gt;
$verilogfiles-&amp;gt;InsertLast(Verific::char_to_void(&amp;quot;test.v&amp;quot;));&lt;br /&gt;
Verific::veri_file::AnalyzeMultipleFiles($verilogfiles);&lt;br /&gt;
$topmodules = Verific::veri_file::GetTopModules(&amp;quot;work&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
# If design has VHDL source files&lt;br /&gt;
Verific::vhdl_file::SetDefaultLibraryPath(&amp;quot;../vdbs&amp;quot;);&lt;br /&gt;
Verific::vhdl_file::Analyze(&amp;quot;test.vhd&amp;quot;);&lt;br /&gt;
$topunits = Verific::vhdl_file::GetTopDesignUnits(&amp;quot;work&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
# $netlists, returned by hier_tree::Elaborate() is an Array of Netlists&lt;br /&gt;
my $netlists = Verific::hier_tree::Elaborate($topmodules, $topunits);&lt;br /&gt;
my $netlist_array_iter = new Verific::NetlistArrayIter($netlists);&lt;br /&gt;
my $first = 1;&lt;br /&gt;
for (my $netlist = $netlist_array_iter-&amp;gt;First();&lt;br /&gt;
     $netlist_array_iter-&amp;gt;GetIndex() &amp;lt; $netlist_array_iter-&amp;gt;Size();&lt;br /&gt;
     $netlist = $netlist_array_iter-&amp;gt;Next()) {&lt;br /&gt;
    if (!defined($netlist)) {&lt;br /&gt;
        next;&lt;br /&gt;
    }&lt;br /&gt;
    if ($first == 1) {&lt;br /&gt;
        print (&amp;quot;Returned by hier_tree::Elaborate(): &amp;quot;, $netlist-&amp;gt;Owner()-&amp;gt;Name(), &amp;quot;\n&amp;quot;);&lt;br /&gt;
        $first = 0;&lt;br /&gt;
    } else {&lt;br /&gt;
        print (&amp;quot;                                    &amp;quot;, $netlist-&amp;gt;Owner()-&amp;gt;Name(), &amp;quot;\n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
my $libset = Verific::Libset::Global();&lt;br /&gt;
if (!defined($libset)) {&lt;br /&gt;
    print &amp;quot;ERROR: can't find global libset\n&amp;quot;;&lt;br /&gt;
    exit;&lt;br /&gt;
}&lt;br /&gt;
my $lib = $libset-&amp;gt;GetLibrary(&amp;quot;work&amp;quot;);&lt;br /&gt;
if (!defined($lib)) {&lt;br /&gt;
    print &amp;quot;ERROR: can't find library 'work'\n&amp;quot;;&lt;br /&gt;
    exit;&lt;br /&gt;
}&lt;br /&gt;
my $cell = $lib-&amp;gt;GetCell(&amp;quot;top&amp;quot;);&lt;br /&gt;
if (!defined($cell)) {&lt;br /&gt;
    print &amp;quot;ERROR: can't find cell 'top'\n&amp;quot;;&lt;br /&gt;
    exit;&lt;br /&gt;
}&lt;br /&gt;
my $topnetlist = $cell-&amp;gt;GetFirstNetlist();&lt;br /&gt;
if (!defined($cell)) {&lt;br /&gt;
    print &amp;quot;ERROR: can't find netlist of cell 'top'\n&amp;quot;;&lt;br /&gt;
    exit;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# Write out netlist for module &amp;quot;top&amp;quot;&lt;br /&gt;
my $veriWriter = Verific::VeriWrite-&amp;gt;new();&lt;br /&gt;
$veriWriter-&amp;gt;WriteFile(sprintf(&amp;quot;%s\_netlist.v&amp;quot;, $topnetlist-&amp;gt;Owner-&amp;gt;Name()), $topnetlist) ;&lt;br /&gt;
&lt;br /&gt;
exit;&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verilog RTL file:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
module top (input [3:0] in, output [3:0] o1, o2, output [4:0]o3, o4, input [4:0] in2) ; // top-level module&lt;br /&gt;
&lt;br /&gt;
    \child(arch) I(o1, o2, in);&lt;br /&gt;
    child #(4) I2(o3, o4, in2);&lt;br /&gt;
&lt;br /&gt;
    test #(3) I3() ;&lt;br /&gt;
    test #(2) I4() ;&lt;br /&gt;
    foo I5() ;&lt;br /&gt;
    sub1 xi1();&lt;br /&gt;
    sub2 xi2();&lt;br /&gt;
endmodule&lt;br /&gt;
&lt;br /&gt;
module test ;&lt;br /&gt;
parameter p = 10 ;&lt;br /&gt;
wire [3:0] o1, o2 ;&lt;br /&gt;
wire [4:0] o3, o4 ;&lt;br /&gt;
reg [3:0] in ;&lt;br /&gt;
reg [4:0] in2 ;&lt;br /&gt;
&lt;br /&gt;
    child #(3) I(o1, o2, in);&lt;br /&gt;
    child #(4) I2(o3, o4, in2);&lt;br /&gt;
endmodule&lt;br /&gt;
&lt;br /&gt;
module xor_gate (CompIn1, CompIn2, CompOut); // Instantiated in 'comp' entity in  Vhdl file test.vhd&lt;br /&gt;
     parameter p = 10 ;&lt;br /&gt;
     input [3:0]CompIn1;&lt;br /&gt;
     input [3:0]CompIn2;&lt;br /&gt;
     output CompOut;&lt;br /&gt;
endmodule&lt;br /&gt;
&lt;br /&gt;
// modules with &amp;quot;circular XMR&amp;quot;&lt;br /&gt;
module sub2(out);&lt;br /&gt;
    output out;&lt;br /&gt;
    assign top.xi1.out = 0;&lt;br /&gt;
endmodule&lt;br /&gt;
&lt;br /&gt;
module sub1(out);&lt;br /&gt;
    output out;&lt;br /&gt;
    assign top.xi2.out = 0;&lt;br /&gt;
endmodule&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VHDL RTL file:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
entity comp is -- top-level unit&lt;br /&gt;
&lt;br /&gt;
   port(X, Y: in BIT_VECTOR(3 DOWNTO 0);&lt;br /&gt;
        Sum, Carry: out BIT);&lt;br /&gt;
&lt;br /&gt;
end;&lt;br /&gt;
&lt;br /&gt;
architecture Structure of comp is&lt;br /&gt;
&lt;br /&gt;
    component xor_gate is&lt;br /&gt;
        generic (p : integer) ;&lt;br /&gt;
        port (CompIn1, CompIn2: in BIT_VECTOR(3 DOWNTO 0);&lt;br /&gt;
              CompOut : out BIT);&lt;br /&gt;
    end component;&lt;br /&gt;
&lt;br /&gt;
-- xor_gate is a Verilog module with port names not as CompIn1, CompIn2 and CompOut.&lt;br /&gt;
&lt;br /&gt;
    --for L1: xor_gate use entity WORK.xor_gate&lt;br /&gt;
            --port map (CompIn1, CompIn2, OPEN);&lt;br /&gt;
&lt;br /&gt;
begin&lt;br /&gt;
&lt;br /&gt;
   L1: xor_gate generic map (4)&lt;br /&gt;
       --port map (X, Y, Sum);&lt;br /&gt;
       port map (CompIn1 =&amp;gt; X, CompIn2 =&amp;gt; Y, CompOut =&amp;gt; Sum);&lt;br /&gt;
&lt;br /&gt;
end;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
entity child is -- instantiated in test module in Verilog design&lt;br /&gt;
   generic (p : integer := 3);&lt;br /&gt;
   port (S1, S2: out bit_vector (p downto 0);&lt;br /&gt;
         I1 : in bit_vector (p downto 0));&lt;br /&gt;
end ;&lt;br /&gt;
&lt;br /&gt;
architecture arch of child is&lt;br /&gt;
begin&lt;br /&gt;
    S1 &amp;lt;= I1 ;&lt;br /&gt;
    S2 &amp;lt;= not I1 ;&lt;br /&gt;
end ;&lt;br /&gt;
&lt;br /&gt;
architecture arch1 of child is&lt;br /&gt;
begin&lt;br /&gt;
    S1 &amp;lt;= I1 ;&lt;br /&gt;
    S2 &amp;lt;= not I1 ;&lt;br /&gt;
end ;&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Hoa</name></author>	</entry>

	</feed>