OpenCores
URL https://opencores.org/ocsvn/avalon-wishbone-bridge/avalon-wishbone-bridge/trunk

Subversion Repositories avalon-wishbone-bridge

[/] [avalon-wishbone-bridge/] [trunk/] [UVM/] [test.svh] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 sumanta.ch
//------------------------------------------------------------
2
//   Copyright 2010 Mentor Graphics Corporation
3
//   All Rights Reserved Worldwide
4
//
5
//   Licensed under the Apache License, Version 2.0 (the
6
//   "License"); you may not use this file except in
7
//   compliance with the License.  You may obtain a copy of
8
//   the License at
9
//
10
//       http://www.apache.org/licenses/LICENSE-2.0
11
//
12
//   Unless required by applicable law or agreed to in
13
//   writing, software distributed under the License is
14
//   distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
15
//   CONDITIONS OF ANY KIND, either express or implied.  See
16
//   the License for the specific language governing
17
//   permissions and limitations under the License.
18
//------------------------------------------------------------
19
//
20
// Class Description:
21
//
22
//
23
class test extends uvm_test;
24
 
25
// UVM Factory Registration Macro
26
//
27
`uvm_component_utils(test)
28
 
29
//------------------------------------------
30
// Data Members
31
//------------------------------------------
32
 
33
//------------------------------------------
34
// Component Members
35
//------------------------------------------
36
// The environment class
37
env m_env;
38
// Configuration objects
39
env_config m_env_cfg;
40
 
41
//------------------------------------------
42
// Methods
43
//------------------------------------------
44
extern function void configure_wb_agent(wb_slave_agent_config cfg);
45
// Standard UVM Methods:
46
extern function new(string name = "test", uvm_component parent = null);
47
extern function void build_phase(uvm_phase phase);
48
extern task  main_phase(uvm_phase phase);
49
 
50
endclass: test
51
 
52
function test::new(string name = "test", uvm_component parent = null);
53
  super.new(name, parent);
54
endfunction
55
 
56
// Build the env, create the env configuration
57
// including any sub configurations and assigning virtural interfaces
58
function void test::build_phase(uvm_phase phase);
59
  // env configuration
60
  m_env_cfg = env_config::type_id::create("m_env_cfg");
61
 
62
  // WB configuration
63
  configure_wb_agent(m_env_cfg.slave_agent_cfg);
64
 
65
  if (!uvm_config_db #(virtual wb_if#(32,64,2))::get(this, "", "WB_vif", m_env_cfg.slave_agent_cfg.WB))
66
    `uvm_error("build_phase", "uvm_config_db #(virtual wb_if)::get(...) failed");
67
 
68
  m_env = env::type_id::create("m_env", this);
69
 
70
  uvm_config_db #(uvm_object)::set(this, "m_env*", "env_config", m_env_cfg);
71
  uvm_config_db #(uvm_object)::set(this, "m_env*", "wb_slave_agent_config", m_env_cfg.slave_agent_cfg);
72
endfunction: build_phase
73
 
74
 
75
//
76
// Convenience function to configure the wb agent
77
//
78
// This can be overloaded by extensions to this base class
79
function void test::configure_wb_agent(wb_slave_agent_config cfg);
80
  cfg.active = UVM_ACTIVE;
81
  cfg.start_address[0] = 32'h0;
82
  cfg.range[0] = 32'h18;
83
endfunction: configure_wb_agent
84
 
85
task test::main_phase(uvm_phase phase);
86
  wb_slave_sequence#(6) slave_seq = wb_slave_sequence#(6)::type_id::create("wb_slave_sequence");
87
  av_sequence#(6) seq1=new();
88
 
89
  phase.raise_objection(this);
90
  fork
91
    seq1.start(m_env.av_agent_h.av_sequencer_h);
92
    slave_seq.start(m_env.slave_agent.m_sequencer);
93
    #10000;
94
  //join_any
95
  join
96
  phase.drop_objection(this);
97
endtask

powered by: WebSVN 2.1.0

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