OpenCores
URL https://opencores.org/ocsvn/lpffir/lpffir/trunk

Subversion Repositories lpffir

[/] [lpffir/] [trunk/] [uvm/] [rca_uvm/] [generated_tb/] [tb/] [rca/] [sv/] [rca_trans.sv] - Blame information for rev 5

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 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: rca_seq_item.sv
7
//
8
//
9
// Version:   1.0
10
//
11
// Code created by Easier UVM Code Generator version 2016-04-18-EP on Tue Mar 19 21:50:30 2019
12
//=============================================================================
13
// Description: Sequence item for rca_sequencer
14
//=============================================================================
15
 
16
`ifndef RCA_SEQ_ITEM_SV
17
`define RCA_SEQ_ITEM_SV
18
 
19
// You can insert code here by setting trans_inc_before_class in file rca.tpl
20
 
21
class trans extends uvm_sequence_item;
22
 
23
  `uvm_object_utils(trans)
24
 
25
  // To include variables in copy, compare, print, record, pack, unpack, and compare2string, define them using trans_var in file rca.tpl
26
  // To exclude variables from compare, pack, and unpack methods, define them using trans_meta in file rca.tpl
27
 
28
  // Transaction variables
29
  rand logic [15:0] input1;
30
  rand logic [15:0] input2;
31
  rand logic carryinput;
32
  logic carryoutput;
33
  logic [15:0] sum;
34
  constraint c_addr_a { 0 <= input1; input1 < 5; }
35
  constraint c_addr_b { 0 <= input2; input2 < 5; }
36
 
37
 
38
  extern function new(string name = "");
39
 
40
  // You can remove do_copy/compare/print/record and convert2string method by setting trans_generate_methods_inside_class = no in file rca.tpl
41
  extern function void do_copy(uvm_object rhs);
42
  extern function bit  do_compare(uvm_object rhs, uvm_comparer comparer);
43
  extern function void do_print(uvm_printer printer);
44
  extern function void do_record(uvm_recorder recorder);
45
  extern function void do_pack(uvm_packer packer);
46
  extern function void do_unpack(uvm_packer packer);
47
  extern function string convert2string();
48
 
49
  // You can insert code here by setting trans_inc_inside_class in file rca.tpl
50
 
51
endclass : trans
52
 
53
 
54
function trans::new(string name = "");
55
  super.new(name);
56
endfunction : new
57
 
58
 
59
// You can remove do_copy/compare/print/record and convert2string method by setting trans_generate_methods_after_class = no in file rca.tpl
60
 
61
function void trans::do_copy(uvm_object rhs);
62
  trans rhs_;
63
  if (!$cast(rhs_, rhs))
64
    `uvm_fatal(get_type_name(), "Cast of rhs object failed")
65
  super.do_copy(rhs);
66
  input1      = rhs_.input1;
67
  input2      = rhs_.input2;
68
  carryinput  = rhs_.carryinput;
69
  carryoutput = rhs_.carryoutput;
70
  sum         = rhs_.sum;
71
endfunction : do_copy
72
 
73
 
74
function bit trans::do_compare(uvm_object rhs, uvm_comparer comparer);
75
  bit result;
76
  trans rhs_;
77
  if (!$cast(rhs_, rhs))
78
    `uvm_fatal(get_type_name(), "Cast of rhs object failed")
79
  result = super.do_compare(rhs, comparer);
80
  result &= comparer.compare_field("input1", input1,           rhs_.input1,      $bits(input1));
81
  result &= comparer.compare_field("input2", input2,           rhs_.input2,      $bits(input2));
82
  result &= comparer.compare_field("carryinput", carryinput,   rhs_.carryinput,  $bits(carryinput));
83
  result &= comparer.compare_field("carryoutput", carryoutput, rhs_.carryoutput, $bits(carryoutput));
84
  result &= comparer.compare_field("sum", sum,                 rhs_.sum,         $bits(sum));
85
  return result;
86
endfunction : do_compare
87
 
88
 
89
function void trans::do_print(uvm_printer printer);
90
  if (printer.knobs.sprint == 0)
91
    `uvm_info(get_type_name(), convert2string(), UVM_MEDIUM)
92
  else
93
    printer.m_string = convert2string();
94
endfunction : do_print
95
 
96
 
97
function void trans::do_record(uvm_recorder recorder);
98
  super.do_record(recorder);
99
  // Use the record macros to record the item fields:
100
  `uvm_record_field("input1",      input1)
101
  `uvm_record_field("input2",      input2)
102
  `uvm_record_field("carryinput",  carryinput)
103
  `uvm_record_field("carryoutput", carryoutput)
104
  `uvm_record_field("sum",         sum)
105
endfunction : do_record
106
 
107
 
108
function void trans::do_pack(uvm_packer packer);
109
  super.do_pack(packer);
110
  `uvm_pack_int(input1)
111
  `uvm_pack_int(input2)
112
  `uvm_pack_int(carryinput)
113
  `uvm_pack_int(carryoutput)
114
  `uvm_pack_int(sum)
115
endfunction : do_pack
116
 
117
 
118
function void trans::do_unpack(uvm_packer packer);
119
  super.do_unpack(packer);
120
  `uvm_unpack_int(input1)
121
  `uvm_unpack_int(input2)
122
  `uvm_unpack_int(carryinput)
123
  `uvm_unpack_int(carryoutput)
124
  `uvm_unpack_int(sum)
125
endfunction : do_unpack
126
 
127
 
128
function string trans::convert2string();
129
  string s;
130
  $sformat(s, "%s\n", super.convert2string());
131
  $sformat(s, {"%s\n",
132
    "input1      = 'h%0h  'd%0d\n",
133
    "input2      = 'h%0h  'd%0d\n",
134
    "carryinput  = 'h%0h  'd%0d\n",
135
    "carryoutput = 'h%0h  'd%0d\n",
136
    "sum         = 'h%0h  'd%0d\n"},
137
    get_full_name(), input1, input1, input2, input2, carryinput, carryinput, carryoutput, carryoutput, sum, sum);
138
  return s;
139
endfunction : convert2string
140
 
141
 
142
// You can insert code here by setting trans_inc_after_class in file rca.tpl
143
 
144
`endif // RCA_SEQ_ITEM_SV
145
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.