I have below code in my virtual sequencer, except the data array inline constraint(shown below as commented at present in READ transaction), everything works well, if I take off the data constraint in the READ transaction below, it works well.
class my_sequence;
axi_base_seq axi_wseq;
axi_base_seq axi_rseq;
axi_master_sequencer axi_seqr;
axi_seqr = uvm_test_top.env_h.axi_agent.seqr;
`uvm_do_on_with(axi_wseq, axi_seqr,
{
s_kind == axi_type_pkg::WRITE;
s_id inside {[axi_seqr.cfg_h.id_lo:axi_seqr.cfg_h.id_hi]};
s_addr == 'haaaaaaa;
s_length inside {[1:15]};
s_size inside {[1:4]};
s_wait_for_rsp == 1;
})
`uvm_do_on_with(axi_rseq, axi_seqr,
{
s_kind == axi_type_pkg::READ;
s_id == axi_wseq.req.id;
s_addr == axi_wseq.req.addr;
s_length == axi_wseq.req.length;
s_size == axi_wseq.req.size;
s_burst == axi_wseq.req.burst;
s_wait_for_rsp == axi_wseq.req.wait_for_rsp;
//##foreach(axi_wseq.req.data[k]) s_data[k] == axi_wseq.req.data[k]; //I need this for score boarding purpose, so this is my question??? please share the answer for this line.
})
This is the base sequence I am using,
class axi_base_seq extends uvm_sequence #(axi_seq_item);
string tID;
rand axi_type_pkg::eAxiKind s_kind;
rand bit [8:0] s_id;
rand bit [31:0] s_addr;
rand bit [255:0] s_data[];
rand bit [4:0] s_length;
rand bit [2:0] s_size;
rand bit [3:0] s_qos;
rand bit [5:0] s_user;
rand eAxiBurstKind s_burst;
rand bit s_wait_for_rsp;
task body();
req = axi_seq_item::type_id::create("req");
`uvm_info(tID,$sformatf("sequence RUNNING id=%x addr=0x%0x length=%d", s_id, s_addr, s_length),UVM_DEBUG)
`uvm_do_with(req, {
req.addr == s_addr;
req.length == s_length;
req.size == s_size;
req.burst == s_burst;
req.id == s_id;
req.kind == s_kind;
req.addr == s_addr;
req.wait_for_rsp == s_wait_for_rsp;
foreach(s_data[i]) req.data[i] == s_data[i];
})
`uvm_info(tID,$sformatf("sequence COMPLETE id=%x", s_id), UVM_DEBUG)
endtask : body
This is my sequence item and its constraint,
class axi_seq_item_base extends uvm_sequence_item;
rand eAxiKind kind;
rand bit [8:0] id;
rand bit [32:0] addr;
rand bit [255:0] data [];
rand bit [4:0] length;
rand bit [2:0] size;
rand bit [3:0] qos;
rand bit [5:0] user;
rand eAxiBurstKind burst;
rand eAxiRspKind resp;
rand bit wait_for_rsp;
constraint c_data_array {
data.size() == length+1;
}
constraint c_max_length { length < 16; }
constraint c_align { addr % 2**size == 0; }
constraint c_burst { burst inside {axi_type_pkg::FIXED, axi_type_pkg::INCR,axi_type_pkg::WRAP};}
constraint wrap_lenght {if (burst == axi_type_pkg::WRAP) length inside {1,3,7,15};}
constraint c_dj_bytes {if (burst == axi_type_pkg::WRAP) {2**size *(length+1) == 64};}
constraint c_dj_alow {if (burst == axi_type_pkg::WRAP) {addr[4:0] == 0};}
constraint c_dj_user {if (burst == axi_type_pkg::WRAP) {addr[11:6] == user[5:0]};}
//constraint c_dj_bit5 {if (burst == axi_type_pkg::WRAP) {addr[5] == !addr[5]};}
Why my randomization fails when I try to keep the inline constraint for the data array?
I start my_sequence from my top_test class with null sequencer, as I use sequencer as shown above for the axi item, which using uvm_do_on_with.
This is the error message —>> This constraint was not processed due to: array index out of bounds The array involved is: rand bit [255:0] s_data; (from the base sequence shown above)
As I shown above , if I remove this array constraint line, ultimately both arrays from axi_wseq and axi_rseq have the same length(that is because axi_rseq length is also assigned with axi_wseq and randomization go well) but different data.
Thank you and best regards.