Question: Develop the uvm Seq item code which includes all the below Topics UVM Field Macros, Radix, UVM Flags, Inbuilt methods of Seq item dont use

Develop the uvm Seq item code which includes all the below Topics
UVM Field Macros,
Radix,
UVM Flags,
Inbuilt methods of Seq item
dont use chat gpt.sample code i am providing
class sq_item extends uvm_object;
rand bit [7:0] data_array[10]; // Changed field name and size
rand bit [5:0] dynamic_array[]; // Changed field name and size
string model; // Changed field name
int data_queue[$]; // Changed field name
typedef enum {red, orange, yellow, green, blue, indigo, violet} color_set; // Enum definition
randc color_set color_list[4]; // Array of random cyclic enum values
`uvm_object_utils_begin(sq_item)
// Registering fields with all operations enabled and appropriate radix
`uvm_field_sarray_int(data_array, UVM_ALL_ON + UVM_HEX)
`uvm_field_array_int(dynamic_array, UVM_ALL_ON + UVM_BIN)
`uvm_field_string(model, UVM_ALL_ON | UVM_STRING)
`uvm_field_sarray_enum(color_set, color_list, UVM_ALL_ON)
`uvm_field_queue_int(data_queue, UVM_ALL_ON + UVM_DEC)
`uvm_object_utils_end
function new(string name ="sq_item");
super.new(name);
endfunction
endclass`include "uvm_macros.svh"
import uvm_pkg::*;
`include "sq_item.sv"// Updated file name
module sq_item_tb; // Renamed module
sq_item h1, h2; // Changed handle names
initial begin
// Creating memory for two handles using create
h1= sq_item::type_id::create("h1"); // Updated handle name
h2= sq_item::type_id::create("h2"); // Updated handle name
// Creating memory for array and string
h1.dynamic_array = new[15]; // Updated size and field name
h1.model = "Tesla,Chevrolet,Ford,Hyundai"; // Updated field value
h2.dynamic_array = new[15]; // Updated size and field name
h2.model ="BMW,Audi,Mercedes,Lexus"; // Updated field value
// Initialize data_queue with specific values
h1.data_queue ='{100,200,300,400,500}; // Updated queue initialization and field name
// Adding some values to the queue using push_front and push_back
h1.data_queue.push_front(50);
h1.data_queue.push_back(25);
// Randomizing both handles
assert(h1.randomize());
assert(h2.randomize());
// Print the content of both handles
h1.print();
h2.print();
// Compare the two handles and log the result
if (h1.compare(h2))
`uvm_info("","h1 and h2 are matching", UVM_HIGH)
else
`uvm_info("","h1 and h2 are not matching", UVM_HIGH)
// Copy the content of h2 into h1
h1.copy(h2);
// Compare the handles again after copying
if (h1.compare(h2))
`uvm_info("","h1 and h2 are matching after copy", UVM_HIGH)
else
`uvm_info("","h1 and h2 are not matching after copy", UVM_HIGH)
// Print the content of both handles after copying
h1.print();
h2.print();
end
endmodule

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!