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

Subversion Repositories uart2bus_testbench

[/] [uart2bus_testbench/] [trunk/] [tb/] [uvm_src/] [reg/] [sequences/] [uvm_reg_hw_reset_seq.svh] - Blame information for rev 16

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 16 HanySalah
//
2
// -------------------------------------------------------------
3
//    Copyright 2004-2008 Synopsys, Inc.
4
//    Copyright 2010 Mentor Graphics Corporation
5
//    All Rights Reserved Worldwide
6
//
7
//    Licensed under the Apache License, Version 2.0 (the
8
//    "License"); you may not use this file except in
9
//    compliance with the License.  You may obtain a copy of
10
//    the License at
11
//
12
//        http://www.apache.org/licenses/LICENSE-2.0
13
//
14
//    Unless required by applicable law or agreed to in
15
//    writing, software distributed under the License is
16
//    distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
17
//    CONDITIONS OF ANY KIND, either express or implied.  See
18
//    the License for the specific language governing
19
//    permissions and limitations under the License.
20
// -------------------------------------------------------------
21
//
22
 
23
//
24
// class: uvm_reg_hw_reset_seq
25
// Test the hard reset values of registers
26
//
27
// The test sequence performs the following steps
28
//
29
// 1. resets the DUT and the
30
// block abstraction class associated with this sequence.
31
//
32
// 2. reads all of the registers in the block,
33
// via all of the available address maps,
34
// comparing the value read with the expected reset value.
35
//
36
// If bit-type resource named
37
// "NO_REG_TESTS" or "NO_REG_HW_RESET_TEST"
38
// in the "REG::" namespace
39
// matches the full name of the block or register,
40
// the block or register is not tested.
41
//
42
//| uvm_resource_db#(bit)::set({"REG::",regmodel.blk.get_full_name(),".*"},
43
//|                            "NO_REG_TESTS", 1, this);
44
//
45
// This is usually the first test executed on any DUT.
46
//
47
 
48
class uvm_reg_hw_reset_seq extends uvm_reg_sequence #(uvm_sequence #(uvm_reg_item));
49
 
50
   `uvm_object_utils(uvm_reg_hw_reset_seq)
51
 
52
   function new(string name="uvm_reg_hw_reset_seq");
53
     super.new(name);
54
   endfunction
55
 
56
 
57
   // Variable: model
58
   //
59
   // The block to be tested. Declared in the base class.
60
   //
61
   //| uvm_reg_block model;
62
 
63
 
64
   // Variable: body
65
   //
66
   // Executes the Hardware Reset sequence.
67
   // Do not call directly. Use seq.start() instead.
68
 
69
   virtual task body();
70
 
71
      if (model == null) begin
72
         `uvm_error("uvm_reg_hw_reset_seq", "Not block or system specified to run sequence on");
73
         return;
74
      end
75
      uvm_report_info("STARTING_SEQ",{"\n\nStarting ",get_name()," sequence...\n"},UVM_LOW);
76
 
77
      this.reset_blk(model);
78
      model.reset();
79
 
80
      do_block(model);
81
   endtask: body
82
 
83
// Task: do_block
84
   //
85
   // Test all of the registers in a given ~block~
86
   //
87
   protected virtual task do_block(uvm_reg_block blk);
88
      uvm_reg_map maps[$];
89
      uvm_reg_map sub_maps[$];
90
 
91
      if (uvm_resource_db#(bit)::get_by_name({"REG::",blk.get_full_name()},
92
                                             "NO_REG_TESTS", 0) != null ||
93
          uvm_resource_db#(bit)::get_by_name({"REG::",blk.get_full_name()},
94
                                             "NO_REG_HW_RESET_TEST", 0) != null ) begin
95
            return;
96
 
97
      end
98
 
99
 
100
      blk.get_maps(maps);
101
      // Iterate over all maps defined for the RegModel block
102
 
103
      foreach (maps[d]) begin
104
        uvm_reg regs[$];
105
        maps[d].get_submaps(sub_maps);
106
        if(sub_maps.size() !=0) begin
107
          continue;
108
        end
109
 
110
        // Iterate over all registers in the map, checking accesses
111
        // Note: if map were in inner loop, could test simulataneous
112
        // access to same reg via different bus interfaces
113
 
114
        regs.delete();
115
        maps[d].get_registers(regs);
116
 
117
        foreach (regs[i]) begin
118
 
119
          uvm_status_e status;
120
 
121
          // Registers with certain attributes are not to be tested
122
          if (uvm_resource_db#(bit)::get_by_name({"REG::",regs[i].get_full_name()},
123
                                                 "NO_REG_TESTS", 0) != null ||
124
              uvm_resource_db#(bit)::get_by_name({"REG::",regs[i].get_full_name()},
125
                                                 "NO_REG_HW_RESET_TEST", 0) != null )
126
              continue;
127
 
128
          `uvm_info(get_type_name(),
129
                    $sformatf("Verifying reset value of register %s in map \"%s\"...",
130
                    regs[i].get_full_name(), maps[d].get_full_name()), UVM_LOW);
131
 
132
          regs[i].mirror(status, UVM_CHECK, UVM_FRONTDOOR, maps[d], this);
133
 
134
          if (status != UVM_IS_OK) begin
135
             `uvm_error(get_type_name(),
136
                    $sformatf("Status was %s when reading reset value of register \"%s\" through map \"%s\".",
137
                    status.name(), regs[i].get_full_name(), maps[d].get_full_name()));
138
          end
139
        end
140
      end
141
 
142
      begin
143
         uvm_reg_block blks[$];
144
 
145
         blk.get_blocks(blks);
146
         foreach (blks[i]) begin
147
            do_block(blks[i]);
148
         end
149
      end
150
 
151
   endtask:do_block
152
 
153
 
154
   //
155
   // task: reset_blk
156
   // Reset the DUT that corresponds to the specified block abstraction class.
157
   //
158
   // Currently empty.
159
   // Will rollback the environment's phase to the ~reset~
160
   // phase once the new phasing is available.
161
   //
162
   // In the meantime, the DUT should be reset before executing this
163
   // test sequence or this method should be implemented
164
   // in an extension to reset the DUT.
165
   //
166
   virtual task reset_blk(uvm_reg_block blk);
167
   endtask
168
 
169
endclass: uvm_reg_hw_reset_seq
170
 
171
 

powered by: WebSVN 2.1.0

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