Thanks for your reply.
Naven now i understood why uvm_config_db used.
I have changed my code. Now i am able to pass the parameters directly.
Modified code is:
class alu_5_packets extends alu_base_seq;
`uvm_object_utils(alu_5_packets)
bit [7:0] cin=8’d1;
randc bit [7:0] cmd;
constraint cmd_typ { cmd inside {1,2,19,35,67,131};}
function new (string name = “alu_5_packets”);
super.new(name);
endfunction: new
virtual task body(); uvm_info(get_type_name(), "Executing alu 5 packet sequence", UVM_LOW) uvm_create(req)
assert(req.randomize());
for(int i =0; i<10; i++) begin
req.cmd = i8;
req.cin = (4-i2);
`uvm_send(req)
end
endtask: body
endclass: alu_5_packets
Please let me know if any thing wrong…
And i didnt understand why the below piece of code didnt work.
virtual task body(); uvm_info(get_type_name(), "Executing alu 5 packet sequence", UVM_LOW) for(int i =0; i<10; i++) begin uvm_do_with(req,{req.cmd==i8;req.cin==(4-i2);})
end
endtask: body
In uvm_do_with, whether we can pass the integer values like above code?
Because the above is not working.
But if i pass the values like…
`uvm_do_with(req,{req.cmd==8;req.cin==4;})
It is capturing the values 8 and 4.
Is there any way to do like below code?
for(int i =0; i<10; i++) begin
`uvm_do_with(req,{req.cmd==i8;req.cin==(4-i2);})
end
Can you explain what you are expecting to see and what you are actually seeing? I see several potential issues which may or may not be correct based upon what you are attempting to accomplish.
I am expecting for cmd = 0,8,16,24,…,72 and cin first two clock cycles 4 and 2, afterwards any thing it ll be okay.
But I am seeing all zeros if i use `uvm_do_with(req,{req.cmd==i8;req.cin==(4-i2);}).
You don’t post the base class of req. This is the sequence item being generated and passed to your driver. We would need to see the class code to make sure that you have all the randomization configured correctly.
Any randc constraints apply to that class and not the generated class. You would need to randomize alu_5_packets to account for the cmd_typ constraint.
Do not wrap any randomize() calls within an assert statement. This will cause problems.
Don’t use the `uvm_do_* macros.
Refer to the UVM Cookbook section on sequences to see how to generate sequence items correctly.
You haven’t posted the code for alu_packet. This is the uvm_sequence_item that you are creating. Also, how do you know that what you are creating has 0’s for values? Do you print out the values somewhere?