How to use enum type in for loop in systemverilog?

Dear All,

I’m trying to implement the enum type in for loop in systemverilog.

enum index { 0xa3, 0x07, 0x18};

for(i=0xa3 ; i<0x18; i++) {
printf(“data is %x”, i);
}

As I know enum is not array. iy’s constant. so it need a stack variable.
this is quite different way from C.

How to use enum type in for loop by systemverilog?
Can I use enum type directly into for loop?

In reply to UVM_LOVE:

Perhaps you are looking for enum_var.first, next() and last() methods.

Cheers
Srini