Hi,
I am using the ‘randc’ variable to generate a cyclic pattern of addresses. The issue is that some values are coming repeatedly and some others are not coming at all.
My code is as below:
class a_seq_item extends uvm_sequence_item;
randc bit [7:0] PADDR;
rand bit [1:0] mem_select; ///00-mem0 ,01 -mem1,10-mem2,11-mem3
constraint PADDR_mem {if(mem_select==2'b00) {PADDR inside {8'h00 , 8'h04 ,8'h08 , 8'h0c,8'h10 ,8'h14 , 8'h18}};
else if (mem_select==2'b01) {PADDR inside {8'h1c , 8'h20 ,8'h24 , 8'h28,8'h2c ,8'h30 , 8'h34}};
else if (mem_select==2'b10){PADDR inside {8'h38 , 8'h3c ,8'h40 , 8'h44,8'h48 ,8'h4c , 8'h50}};
else if (mem_select==2'b11){PADDR inside {8'h54 , 8'h58 ,8'h5c , 8'h60,8'h64 ,8'h68 , 8'h6c} };}
`uvm_object_utils_begin(a_seq_item)
`uvm_field_int(PADDR, UVM_ALL_ON)
`uvm_field_int(mem_select, UVM_ALL_ON)
`uvm_object_utils_end
function new (string name = "a_seq_item");
super.new(name);
endfunction : new
endclass : apb_seq_item
class a_sequence_mem0 extends uvm_sequence #(a_seq_item);
`uvm_object_utils(a_sequence_mem0)
a_seq_item a_item;
function new(string name="a_sequence_mem0");
super.new(name);
endfunction
task body();
repeat(6)
begin
`uvm_do_with(a_item,{a_item.mem_select == 2'b00;})
end
endtask : body
endclass : a_sequence_mem0
The output in a single run is as follows.
PADDR = 10
PADDR = 0c
PADDR = 18
PADDR = 10
PADDR = 04
PADDR = 18
PADDR = 0c
PADDR = 00
PADDR = 0c
PADDR = 0c
PADDR = 04
PADDR = 18
Any help is appreciated.