1 |
11 |
vladimirar |
// You can insert code here by setting file_header_inc in file common.tpl
|
2 |
|
|
|
3 |
|
|
//=============================================================================
|
4 |
|
|
// Project : generated_tb
|
5 |
|
|
//
|
6 |
|
|
// File Name: data_input_seq_item.sv
|
7 |
|
|
//
|
8 |
|
|
//
|
9 |
|
|
// Version: 1.0
|
10 |
|
|
//
|
11 |
|
|
// Code created by Easier UVM Code Generator version 2016-04-18-EP on Sat Apr 27 13:59:59 2019
|
12 |
|
|
//=============================================================================
|
13 |
|
|
// Description: Sequence item for data_input_sequencer
|
14 |
|
|
//=============================================================================
|
15 |
|
|
|
16 |
|
|
`ifndef DATA_INPUT_SEQ_ITEM_SV
|
17 |
|
|
`define DATA_INPUT_SEQ_ITEM_SV
|
18 |
|
|
|
19 |
|
|
// You can insert code here by setting trans_inc_before_class in file data_input.tpl
|
20 |
|
|
|
21 |
|
|
class input_tx extends uvm_sequence_item;
|
22 |
|
|
|
23 |
|
|
`uvm_object_utils(input_tx)
|
24 |
|
|
|
25 |
|
|
// To include variables in copy, compare, print, record, pack, unpack, and compare2string, define them using trans_var in file data_input.tpl
|
26 |
|
|
// To exclude variables from compare, pack, and unpack methods, define them using trans_meta in file data_input.tpl
|
27 |
|
|
|
28 |
|
|
// Transaction variables
|
29 |
|
|
rand logic [15:0] data;
|
30 |
|
|
constraint c_data { 0 <= data; data < 128; }
|
31 |
|
|
|
32 |
|
|
|
33 |
|
|
extern function new(string name = "");
|
34 |
|
|
|
35 |
|
|
// You can remove do_copy/compare/print/record and convert2string method by setting trans_generate_methods_inside_class = no in file data_input.tpl
|
36 |
|
|
extern function void do_copy(uvm_object rhs);
|
37 |
|
|
extern function bit do_compare(uvm_object rhs, uvm_comparer comparer);
|
38 |
|
|
extern function void do_print(uvm_printer printer);
|
39 |
|
|
extern function void do_record(uvm_recorder recorder);
|
40 |
|
|
extern function void do_pack(uvm_packer packer);
|
41 |
|
|
extern function void do_unpack(uvm_packer packer);
|
42 |
|
|
extern function string convert2string();
|
43 |
|
|
|
44 |
|
|
// You can insert code here by setting trans_inc_inside_class in file data_input.tpl
|
45 |
|
|
|
46 |
|
|
endclass : input_tx
|
47 |
|
|
|
48 |
|
|
|
49 |
|
|
function input_tx::new(string name = "");
|
50 |
|
|
super.new(name);
|
51 |
|
|
endfunction : new
|
52 |
|
|
|
53 |
|
|
|
54 |
|
|
// You can remove do_copy/compare/print/record and convert2string method by setting trans_generate_methods_after_class = no in file data_input.tpl
|
55 |
|
|
|
56 |
|
|
function void input_tx::do_copy(uvm_object rhs);
|
57 |
|
|
input_tx rhs_;
|
58 |
|
|
if (!$cast(rhs_, rhs))
|
59 |
|
|
`uvm_fatal(get_type_name(), "Cast of rhs object failed")
|
60 |
|
|
super.do_copy(rhs);
|
61 |
|
|
data = rhs_.data;
|
62 |
|
|
endfunction : do_copy
|
63 |
|
|
|
64 |
|
|
|
65 |
|
|
function bit input_tx::do_compare(uvm_object rhs, uvm_comparer comparer);
|
66 |
|
|
bit result;
|
67 |
|
|
input_tx rhs_;
|
68 |
|
|
if (!$cast(rhs_, rhs))
|
69 |
|
|
`uvm_fatal(get_type_name(), "Cast of rhs object failed")
|
70 |
|
|
result = super.do_compare(rhs, comparer);
|
71 |
|
|
result &= comparer.compare_field("data", data, rhs_.data, $bits(data));
|
72 |
|
|
return result;
|
73 |
|
|
endfunction : do_compare
|
74 |
|
|
|
75 |
|
|
|
76 |
|
|
function void input_tx::do_print(uvm_printer printer);
|
77 |
|
|
if (printer.knobs.sprint == 0)
|
78 |
|
|
`uvm_info(get_type_name(), convert2string(), UVM_MEDIUM)
|
79 |
|
|
else
|
80 |
|
|
printer.m_string = convert2string();
|
81 |
|
|
endfunction : do_print
|
82 |
|
|
|
83 |
|
|
|
84 |
|
|
function void input_tx::do_record(uvm_recorder recorder);
|
85 |
|
|
super.do_record(recorder);
|
86 |
|
|
// Use the record macros to record the item fields:
|
87 |
|
|
`uvm_record_field("data", data)
|
88 |
|
|
endfunction : do_record
|
89 |
|
|
|
90 |
|
|
|
91 |
|
|
function void input_tx::do_pack(uvm_packer packer);
|
92 |
|
|
super.do_pack(packer);
|
93 |
|
|
`uvm_pack_int(data)
|
94 |
|
|
endfunction : do_pack
|
95 |
|
|
|
96 |
|
|
|
97 |
|
|
function void input_tx::do_unpack(uvm_packer packer);
|
98 |
|
|
super.do_unpack(packer);
|
99 |
|
|
`uvm_unpack_int(data)
|
100 |
|
|
endfunction : do_unpack
|
101 |
|
|
|
102 |
|
|
|
103 |
|
|
function string input_tx::convert2string();
|
104 |
|
|
string s;
|
105 |
|
|
$sformat(s, "%s\n", super.convert2string());
|
106 |
|
|
$sformat(s, {"%s\n",
|
107 |
|
|
"data = 'h%0h 'd%0d\n"},
|
108 |
|
|
get_full_name(), data, data);
|
109 |
|
|
return s;
|
110 |
|
|
endfunction : convert2string
|
111 |
|
|
|
112 |
|
|
|
113 |
|
|
// You can insert code here by setting trans_inc_after_class in file data_input.tpl
|
114 |
|
|
|
115 |
|
|
`endif // DATA_INPUT_SEQ_ITEM_SV
|
116 |
|
|
|