44 lines
1.5 KiB
Systemverilog
44 lines
1.5 KiB
Systemverilog
// ----------------------------------------------------------------------
|
|
class axi_transaction extends uvm_sequence_item;
|
|
// Declare AXI transaction fields
|
|
rand axi_transaction_type_t txn_type; // Transaction type (read/write)
|
|
rand bit [`ADDR_WIDTH-1:0] addr; // Address
|
|
rand bit [`DATA_WIDTH-1:0] data; // Data
|
|
rand bit [`DATA_WIDTH_DIV_8-1:0] strb; // Byte enable
|
|
|
|
`uvm_object_utils_begin(axi_transaction)
|
|
`uvm_field_enum(axi_transaction_type_t, txn_type, UVM_DEFAULT)
|
|
`uvm_field_int(addr, UVM_DEFAULT)
|
|
`uvm_field_int(data, UVM_DEFAULT)
|
|
`uvm_field_int(strb, UVM_DEFAULT)
|
|
`uvm_object_utils_end
|
|
|
|
// Constructor
|
|
function new(string name = "axi_transaction");
|
|
super.new(name);
|
|
endfunction
|
|
|
|
// Copy method for cloning
|
|
virtual function uvm_object clone();
|
|
axi_transaction copy;
|
|
copy = axi_transaction::type_id::create(get_name());
|
|
copy.txn_type = this.txn_type;
|
|
copy.addr = this.addr;
|
|
copy.data = this.data;
|
|
copy.strb = this.strb;
|
|
return copy;
|
|
endfunction
|
|
|
|
// Comparison method for checking equality
|
|
virtual function bit compare(uvm_object rhs);
|
|
axi_transaction other;
|
|
if (!$cast(other, rhs)) return 0; // Ensure type match
|
|
return (this.txn_type == other.txn_type) &&
|
|
(this.addr == other.addr) &&
|
|
(this.data == other.data) &&
|
|
(this.strb == other.strb);
|
|
endfunction
|
|
|
|
endclass : axi_transaction
|
|
|