AXI muckbucket
axi_env.svh
Go to the documentation of this file.
1 //
3 // Copyright (C) 2017, Matt Dew @ Dew Technologies, LLC
4 //
5 // This program is free software (logic verification): you can redistribute it
6 // and/or modify it under the terms of the GNU Lesser General Public License (LGPL)
7 // as published by the Free Software Foundation, either version 3 of the License,
8 // or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
12 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13 // for more details.
14 //
15 // License: LGPL, v3, as defined and found on www.gnu.org,
16 // http://www.gnu.org/licenses/lgpl.html
17 //
18 //
19 // Author's intent: If you use this AXI verification code and find or fix bugs
20 // or make improvements, then share those fixes or improvements.
21 // If you use this in a bigger project, I don't care about,
22 // or want, any changes or code outside this block.
23 // Example: If you use this in an SoC simulation/testbench
24 // I don't want, or care about, your SoC or other blocks.
25 // I just care about the enhancements to these AXI files.
26 // That's why I have choosen the LGPL instead of the GPL.
28 
32 class axi_env : public uvm_env { public:
34 
35 
36  axi_agent_config m_agent_config;
39 
42 
44 
45  new (string name="axi_env", uvm_component parent=null);
46 
47  void build_phase (uvm_phase phase);
48  void connect_phase (uvm_phase phase);
49 
50 };
51 
55  axi_env::new (string name="axi_env", uvm_component parent=null) {
56  super.new(name, parent);
57 }
58 
60  void axi_env::build_phase (uvm_phase phase) {
61  super.build_phase(phase);
62 
63 
64  m_axidriver_agent = axi_agent::type_id::create("m_axidriver_agent", this);
65 
66  if (uvm_config_db <axi_agent_config> ::get(this, "", "m_axidriver_agent.m_config", m_axidriver_agent.m_config)) {
67  uvm_info(this.get_type_name,
68  "Found m_axidriver_agent.m_config in config db.",
69  UVM_INFO)
70  } else {
71  uvm_info(this.get_type_name,
72  "Unable to fetch m_axidriver_agent.m_config from config db. Using defaults",
73  UVM_INFO)
74 
75  m_axidriver_agent.m_config = axi_agent_config::type_id::create("m_axidriver_agent.m_config", this);
76 
77 
78  assert(m_axidriver_agent.m_config.randomize());
79 
80  m_axidriver_agent.m_config.m_active = UVM_ACTIVE;
82  }
83 
84 
85 
86 
87 
88  m_axiresponder_agent = axi_agent::type_id::create("m_axiresponder_agent", this);
89 
90 
91  if (uvm_config_db <axi_agent_config> ::get(this, "", "m_axiresponder_agent.m_config", m_axiresponder_agent.m_config)) {
92  uvm_info(this.get_type_name,
93  "Found m_axiresponder_agent.m_config in config db.",
94  UVM_INFO)
95  } else {
96  uvm_info(this.get_type_name,
97  "Unable to fetch m_axiresponder_agent.m_config from config db. Using defaults",
98  UVM_INFO)
99 
100  m_axiresponder_agent.m_config = axi_agent_config::type_id::create("m_axiresponder_agent.m_config", this);
101 
102 
103  assert(m_axiresponder_agent.m_config.randomize());
104 
105  m_axiresponder_agent.m_config.m_active = UVM_ACTIVE;
107  }
108 
109  m_memory = memory::type_id::create("m_memory", this);
110  uvm_config_db <memory> ::set(null, "*", "m_memory", m_memory);
113 
114 }
118  void axi_env::connect_phase (uvm_phase phase) {
119  super.connect_phase(phase);
120 
123 
124 }
Normal sequencer with an extra analysis fifo and export.
Extremely simple memory model with just write() and read() methods.
Definition: memory.svh:32
axi_sequencer m_driver_seqr
Definition: axi_env.svh:37
axi_agent_config m_config
Definition: axi_agent.svh:44
memory m_memory
Definition: axi_agent.svh:52
memory m_memory
Definition: axi_env.svh:43
Encapsulates driver, monitor, coverage collector, a local memory.
Definition: axi_agent.svh:39
void build_phase(uvm_phase phase)
Creates the two AXI agents and the memory.
Definition: axi_env.svh:60
axi_agent m_axidriver_agent
Definition: axi_env.svh:40
driver_type_t drv_type
axi_agent m_axiresponder_agent
Definition: axi_env.svh:41
new(string name="axi_env", uvm_component parent=null)
Constructor.
Definition: axi_env.svh:55
uvm_component_utils(axi_env) axi_agent_config m_agent_config
void connect_phase(uvm_phase phase)
Sets sequencer pointers/handles.
Definition: axi_env.svh:118
Configuration object for an axi_agent.
Creates two active AXI agents, one master and one slave/responder, plus a memory. ...
Definition: axi_env.svh:32
axi_sequencer m_seqr
Definition: axi_agent.svh:50
axi_sequencer m_responder_seqr
Definition: axi_env.svh:38