Randomizing a sequence item in Hierarchical Sequences

I have create a Sequence Item which has few variables with rand keyword. I have sequence 1 which randomizes that sequence item and it works as expected.
I create seq 2 which tried to randomize sequence 1 including the sequence item in the sequence 1 using inline constraints.

Now what is not working is : When i try to override sequence item in sequence 1 from sequence 2 i get randonmization failure.

// ===========================================================================
class cM1Seq extends cM3BaseSeq;

uvm_object_utils_begin(cM1Seq) uvm_object_utils_end

logic [31:0] Command;
extern function new(string name = “cM1Seq”);
extern task body();
extern function void pre_randomize();

endclass : cM1Seq

// ---------------------------------------------------------------------------
// new()
// ---------------------------------------------------------------------------
function cM1Seq::new(string name = “cM1Seq”);
super.new(name);

endfunction : new


// body()
// ---------------------------------------------------------------------------
task cM1Seq::body();
bit [31:0] wrData[$];
M3CmdTrn M3CmdTrn0;
M3CmdTrn0 = M3CmdTrn::type_id::create(“M3CmdTrn0”);
if (!M3CmdTrn0.randomize() with {MCmdOpcode == CMD_OPCODE_LOAD; }) begin
$error(“randmization failed”);
end
endtask : body

sequence 2:
// ===========================================================================
class cM2Seq extends cM3BaseSeq;

uvm_object_utils_begin(cM2Seq) uvm_object_utils_end

logic [31:0] Command;
extern function new(string name = “cM2Seq”);
extern task body();
extern function void pre_randomize();

endclass : cM2Seq

// ---------------------------------------------------------------------------
// new()
// ---------------------------------------------------------------------------
function cM2Seq::new(string name = “cM2Seq”);
super.new(name);

endfunction : new


// body()
// ---------------------------------------------------------------------------
task cM2Seq::body();
bit [31:0] wrData[$];
cM1Seq M1Seq;
uvm_create(M1Seq) M1Seq.randomize() with { M3CmdTrn0.MauCmdAddr == 15'h1020;}; uvm_send(M1Seq)

endtask : body

Here the inline constraints from the cM2Seq is never taken effect only the cM1Seq randomization is taking effect which is in the sequence item.

In reply to prashanthiyer90:

You should clean up your code first.
For example look here:

task cM2Seq::body();

you are mixing here the names.

BTW please format your code as SystemVerilog.

In reply to chr_sue:

Hi chr_sue,

I have fixed the typos. Can you let me know what you meant code in system verilog?

In reply to prashanthiyer90:

You should format your code as SV.
On top of entry box you see a few symbols. Select the SV code you have written and go with your mouse over the most right symbol. You’ll see a drop-down menu and select ‘SystemVerilog Code’.