SV
https://www.chipverify.com/systemverilog/systemverilog-enumeration
SystemVerilog includes a set of specialized methods to enable iterating over the values of enumerated types.
first(), function enum first();, Returns the value of the first member of the enumeration
last(), function enum last();, Returns the value of the last member of the enumeration
next(), function enum next (int unsigned N = 1);
Returns the Nth next enumeration value starting from the current value of the given variable
prev(), function enum prev (int unsigned N = 1);
Returns the Nth previous enumeration value starting from the current value of the given variable
num(), function int num();
Returns the number of elements in the given enumeration
name(), function string name();
Returns the string representation of the given enumeration value
method
typedef enum { ... } enum_t ;
enum_t e_var ;
val = e_var.name () ;
// num = enum_t::num () ; // error with VCS