Revision as of 22:46, 8 November 2011 by Shacham (→Older (still supported) Genesis2 Instantiation Methods)
Older (still supported) Genesis2 Instantiation Methods
- sub unique_inst
- The main function call for generating (and later instantiating) a new module. Note that this call on its own would not print anything to the output module. Rather, it will return a pointer to the instance module ($unique_inst in the code bellow). Use the $unique_inst->instantiate() and other methods as described above to query this new module and then decide what to print to the generated module code.
//; my $newObj= $self->unique_inst(base_module_name, inst_name, prm1 => val1, prm2 => val2, ...);
Example: Before (SystemVerilog)
Example: After (Genesis2)
//; my $my_adder = $self->unique_inst('Adder', 'MyAdder', w=>8, n=>4); `$my_adder->instantiate()` (.in1(a), .in2(b), .out(c));
- sub clone_inst
- An API method for replicating a module based on an existing instance (i.e., get a handle, or object, which is another instance/copy of an existing one).
//; my $clonedObj = $self->clone_inst($src_inst, 'new_inst_name');
Note that <src_inst> can either be a path (e.g., top.subinst.subsubinst) or it can be just an instance object (like the ones returned by unique_inst or clone_inst)