From Genesis2
Jump to: navigation, search

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.

sub get_module_name
Returns the uniquified module name. This task is especially important since whenever we declare a new module we don't really know whether or not it is going to be uniquified, and how many uniquifations of this module already happened. This enables us to leave the dirty work for Genesis.
//; my $module_name = $self->get_module_name();
module `$module_name` (input logic Clk, ... );

// parameterized module code comes here