I am facing some issues trying to create some sequences, the constrains I added are not taken in consideration when the item is randomize. Do you have any idea why?
class normal_mode_seq extends default_seq;
`uvm_object_utils(normal_mode_seq )
constraint mode_c{
item.mode == NORMAL_OP;
}
function new(string name = "");
super.new(name); // Item is created in the new function of default_seq
endfunction : new
virtual task body();
`uvm_info(get_type_name(),$sformatf("Sequence randomize with %s", item.mode.name()), UVM_NONE)
start_item(item);
if ( !item.randomize())
`uvm_error(get_type_name(), "Failed to randomize transaction")
finish_item(item);
`uvm_info(get_type_name(),$sformatf("Sequence randomize with %s", item.mode.name()), UVM_NONE)
endtask : body
endclass : normal_mode_seq
Hi there,
I am facing some issues trying to create some sequences, the constrains I added are not taken in consideration when the item is randomize. Do you have any idea why?
class normal_mode_seq extends default_seq;
`uvm_object_utils(normal_mode_seq )
constraint mode_c{
item.mode == NORMAL_OP;
}
function new(string name = "");
super.new(name); // Item is created in the new function of default_seq
endfunction : new
virtual task body();
`uvm_info(get_type_name(),$sformatf("Sequence randomize with %s", item.mode.name()), UVM_NONE)
start_item(item);
if ( !item.randomize())
`uvm_error(get_type_name(), "Failed to randomize transaction")
finish_item(item);
`uvm_info(get_type_name(),$sformatf("Sequence randomize with %s", item.mode.name()), UVM_NONE)
endtask : body
endclass : normal_mode_seq
This is the code of the base sequence
class default_seq extends uvm_sequence #(default_seq_item);
`uvm_object_utils(default_seq )
rand default_seq_item item;
function new(string name = "");
super.new(name);
item = default_seq ::type_id::create("item");
endfunction : new
task body();
`uvm_info(get_type_name(), "Default sequence starting", UVM_HIGH)
start_item(item);
if ( !item.randomize() )
`uvm_error(get_type_name(), "Failed to randomize transaction")
finish_item(item);
`uvm_info(get_type_name(), "Default sequence completed", UVM_HIGH)
endtask : body
endclass : default_seq