Hi,
I have a base uvm_sequence_item-extended class called “instruction_packet”. I declare it like this:
class instruction_packet extends uvm_sequence_item;
rand bit[31:0] data;
rand bit[7:0] address;
...
function new(string name = "instruction_packet");
super.new(name);
endfunction: new
...
endclass
I want to create a few new classes like “J64_instruction_packet” and “U64_instruction_packet” that extends this class and inherits its properties like this:
class J64_instruction_packet extends instruction_packet;
rand bit[11:0] J_var;
...
function new(string name = "J64_instruction_packet");
super.new(name);
endfunction: new
...
endclass
However, I cannot use this new class in my sequence:
class seq extends uvm_sequence#(J64_instruction_packet);
because it is not a ‘uvm_sequence_item’
Error is: "Dynamic cast failed. Casting of source class ‘uvm_pkg.uvm_sequence_item’ to destination class type ‘simprisc_uvm_includes.J64_instruction_packet’ failed due to type mismatch. Please ensure matching types for dynamic cast.
Is there a better approach?
Thank you!!