Hi all!
I wrote some code for uvm_item and uvm_sequence. It generates 5 random items using "constraint", but then I need to create the last item with defined values of item_incode variables (for example in_code = 21'b111101001100001100010 and in_data = 16'b0000000000000101). Could you please advise how am I supposed to do that?
class item_incode extends uvm_sequence_item;
`uvm_object_utils(item_incode)
rand bit [20 : 0] in_code;
rand bit signed [15 : 0] in_data;
.....
constraint c_incode {
0 <= in_code [20 -: 3]; 3 >= in_code [20 -: 3];
0 <= in_code [17 -: 6]; 64 > in_code [17 -: 6];
0 <= in_code [11 -: 6]; 64 > in_code [11 -: 6];
0 <= in_code [5 -: 6]; 64 > in_code [5 -:6];
}
constraint c_indata {in_data inside {[-32767:32767]};}
endclass
class seq0 extends uvm_sequence # (item_incode);
`uvm_object_utils (seq0)
.......
virtual task body();
repeat (5) begin
incode.code_or_dat = 0;
item_incode incode = item_incode::type_id::create("incode");
start_item (incode);
assert(incode.randomize());
`uvm_info("SEQ", $sformatf("Generate new item: %s", incode.convert2str()), UVM_HIGH)
finish_item(incode);
end
endtask
endclass