Difference between revisions of "OldAuxiliaryMethods"

From Genesis2
Jump to: navigation, search
(Created page with "== Older style (still supported) Auxiliary Methods == Back To Main Genesis2 Auxiliary Methods Guide")
 
(Older style (still supported) Auxiliary Methods)
Line 2: Line 2:
  
 
[[Genesis2#Auxiliary_Methods|Back To Main Genesis2 Auxiliary Methods Guide]]
 
[[Genesis2#Auxiliary_Methods|Back To Main Genesis2 Auxiliary Methods Guide]]
 +
 +
; sub get_instance_name: Returns the name of the current instance
 +
<pre>//; my $someObj_inst_name = $someObj->get_instance_name();</pre>
 +
 +
''Example: Before (SystemVerilog)''
 +
<pre>
 +
Adder#(.w(8),.n(4)) MyAdder(.in1(a),.in2(b),.out(c));
 +
</pre>
 +
 +
''After (Genesis2)''
 +
<pre>
 +
//; my $my_adder = generate('Adder', 'MyAdder', w=>8, n=>4);
 +
`$my_adder->get_module_name()` `$my_adder->get_instance_name()`
 +
    (.in1(a), .in2(b), .out(c));
 +
</pre>
 +
 +
Also see ''sub instantiate,'' [[Genesis2#Auxiliary_Methods|here]].

Revision as of 22:51, 8 November 2011

Older style (still supported) Auxiliary Methods

Back To Main Genesis2 Auxiliary Methods Guide

sub get_instance_name
Returns the name of the current instance
//; my $someObj_inst_name = $someObj->get_instance_name();

Example: Before (SystemVerilog)

Adder#(.w(8),.n(4)) MyAdder(.in1(a),.in2(b),.out(c));

After (Genesis2)

//; my $my_adder = generate('Adder', 'MyAdder', w=>8, n=>4);
`$my_adder->get_module_name()` `$my_adder->get_instance_name()`
     (.in1(a), .in2(b), .out(c));

Also see sub instantiate, here.