I saw in some Specman e code example the use of := (colon-equal sign), e.g.:
var regs_type := rf_manager.get_exact_subtype_of_instance(graphics_regs);
When and why should we use := ? Thank you for your help.
I saw in some Specman e code example the use of := (colon-equal sign), e.g.:
var regs_type := rf_manager.get_exact_subtype_of_instance(graphics_regs);
When and why should we use := ? Thank you for your help.
The
:=
means declare a variable of the type the expression on the right returns and assign it to that value. Basically, in your example, the functionget_exact_subtype_of_instance(...)
returns a value of typerf_struct
. Theregs_type
variable will be declared to that type.This code is equivalent to (but shorter than):
This syntax is particularly helpful when casting: