Fail to cast of enum

In reply to Ep1c F4iL:

You cannot assign an enum variable with an integer without an explicit cast. $urandom_range returns an integer, and the result of randomize is a true or false bit indicating if the constraints could be met.
You probably want

const opcode_t opcode = LOAD;
vif.opcode = opcode.next($urandom_range(16));

A simpler solution would be

opcode_t opcode;
...
void'(randomize(opcode));
vif.opcode <= opcode;