From Genesis2

Jump to: navigation, search

List of old (still supported) methods for parameter definitions

Back To Main Genesis2 Parameterization Methods Guide.

sub define_param
API method for defining a new parameter (just like defining a parameter in verilog). Note that using the define_param, parameters can only be defined inside the module to which they belong (i.e., $some_inst->define_param(prm_name => prm_val) will cause a genesis generation error). However, parameters can also be defined at instantiation using the unique_inst method as shown below. Definition at instantiation time overwrites definitions done within the module (just like in verilog). As a middle ground, parameter definitions that are not bounded by instantiation can be set using the input XML configuration file. More details can be found here.
In this example, the parameter is registered with name prm_name and receive the value prm_val. The value is also returned to the Perl variable $val.
//; my $val = $self->define_param(prm_name => $prm_val);
sub param_range
API method for specifying an allowed range for a parameter. Two mutually exclusive options are allowed: either specify the range as a list or specify a minimum and/or a maximum. When specifying min/max, it is also possible to specify a step (i.e., the parameter value must be in the specified range and must be an integer number of steps from either min or max).
//; $self->param_range('prm_name', list=>['on', 'off']);
//; $self->param_range('prm_name', list=>[1,2,4,6,8,10]);
//; $self->param_range('prm_name', min=>12);
//; $self->param_range('prm_name', min=>12, step=>2);
//; $self->param_range('prm_name', max=>18);
//; $self->param_range('prm_name', min=>12, max=>18);
//; $self->param_range('prm_name', max=>18, step=>2);
//; $self->param_range('prm_name', min=>8, max=>18, step=>2);
sub force_param
API method for defining an IMMUTABLE parameter. This is pretty much the equivalent of the localparam keyword in Verilog. It defines a parameter which means other modules (up or down the hierarchy) can query its value using the get_param method (see next definition). However, this parameter definition is immutable---it cannot be altered, neither at module instantiation nor through the XML configuration file.
//; my $val = $self->force_param(prm_name => $prm_val);

sub doc_param
API method for adding a documentation comment to a parameter.
//; $self->doc_param('prm_name', 'documentation of prm_name');
Personal tools