Instruction sequence generator for verifying a processor

In reply to dave_59:

///scenario.sv///////
`include "../tb/verilog/inst_class.sv"
class instruction_scenario extends inst_class;
rand int unsigned scenario_kind;
rand int unsigned length=50;
rand inst_class items[]; 
rand int unsigned repeated;


function int unsigned define_scenario (string name,
                                       int unsigned max_len);
$info("secenario is %s",name);
this.length=max_len;                                       
endfunction
 
endclass

///////dep_scenario.sv//////////
`include "../tb/verilog/common_scenario.sv"
class dep_scenario extends common_instruction_scenario;
  
int SCN_MORE_DEP;
int base_addr, addr_range;
constraint more_dep_scn_valid {
  //check below line 15/10/12
   if (scenario_kind == SCN_MORE_DEP) {
     
      repeated == 0;         length == 10;
      foreach (items[i]) {
         items[i].rd inside {[base_addr : base_addr+addr_range]};
         items[i].rs1 inside {[base_addr : base_addr+addr_range]};
         items[i].rs2 inside {[base_addr : base_addr+addr_range]};
      }
   }
}

//constraint depcheck 
//{
// items[23].kind ==BA ;
//}


function new;
  super.new();
    this.base_addr = 0;
   this.addr_range = 4;
  
   this.SCN_MORE_DEP = define_scenario ("SCN_MORE_DEP", 40);
endfunction


function void pre_randomize ();
   super.pre_randomize();
   this.base_addr = 0;
   this.addr_range = 4;
endfunction


endclass

class arith_only_scn extends common_instruction_scenario;
   int SCN_ARITH_ONLY;
   constraint arith_only_scn_valid {
      if (scenario_kind == SCN_ARITH_ONLY) {
         repeated == 0;
         length inside {[5:10]};
         foreach (items[i]) {
            foreach (items[i]) {
               items[i].opcode_type == ALU;
            }
         }
      }
   }
   function new ();
      super.new();
      this.SCN_ARITH_ONLY = define_scenario ("SCN_ARITH_ONLY", 30);
   endfunction
endclass

//////////////////////////////////

So what i understand is instead of randomizing the instruction objects i shall randomize the arith_only_scn and dep_scenario classes.Will these constraints written in the form of items[i].any_property=any_value will be passed to the objects pointed by the handles stored in the dynamic array of instructions?