AXI muckbucket
axi_agent.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 
39 class axi_agent : public uvm_agent { public:
41 
42  uvm_analysis_port <axi_seq_item> ap;
43 
49 
54  new (string name="axi_agent", uvm_component parent=null);
55  void build_phase (uvm_phase phase);
56  void connect_phase (uvm_phase phase);
57 
58 };
59 
63  axi_agent::new (string name="axi_agent", uvm_component parent=null) {
64  super.new(name, parent);
65 }
66 
72  void axi_agent::build_phase(uvm_phase phase) {
73  super.build_phase(phase);
74 
75  if (m_config == null) {
76  if (!uvm_config_db <axi_agent_config> ::get(this, "", "m_config", m_config)) {
77  uvm_info(this.get_type_name, "Unable to fetch axi_agent_config from config db. Using defaults", UVM_INFO)
78  }
79  // Create config object.
80  m_config = axi_agent_config::type_id::create("m_config", this);
81 
82  }
83 
84  ap = new("ap", this);
85 
86  if (m_config.m_active == UVM_ACTIVE) {
87  if (m_config.drv_type == e_DRIVER) {
88  m_driver = axi_driver::type_id::create("m_driver", this);
91  } else {
92  m_responder = axi_responder::type_id::create("m_responder", this);
95  }
96  }
97  m_seqr = axi_sequencer::type_id::create("m_seqr", this);
98 
99 
100  m_monitor = axi_monitor::type_id::create("m_monitor", this);
102  if (m_config.has_scoreboard == 0b1) {
103  m_scoreboard = axi_scoreboard::type_id::create("m_scoreboard", this);
104  }
105  if (m_config.has_coverage == 0b1) {
106  m_coveragecollector = axi_coveragecollector::type_id::create("m_coveragecollector", this);
107  }
108  // \todo: every agent has memory?
110 }
111 
112  void axi_agent::connect_phase (uvm_phase phase) {
113  super.connect_phase(phase);
114 
115  if (m_config.m_active == UVM_ACTIVE) {
116  if (m_config.drv_type == e_DRIVER) {
117  m_driver.seq_item_port.connect(m_seqr.seq_item_export);
118  } else {
119  m_responder.seq_item_port.connect(m_seqr.seq_item_export);
120  m_monitor.driver_activity_ap.connect(m_seqr.request_export);
121 
122  }
123  }
124 
125  if (m_config.has_scoreboard == 0b1) {
126  m_monitor.ap.connect(m_scoreboard.analysis_export);
127  }
128 
129  if (m_config.has_coverage == 0b1) {
130  m_monitor.ap.connect(m_coveragecollector.analysis_export);
131  }
132 
133  m_monitor.ap.connect(ap);
134 
135 }
Logic to act as an AXI slave (responder) for all 5 channels.
Normal sequencer with an extra analysis fifo and export.
Logic to act as an AXI master for all 5 channels.
Definition: axi_driver.svh:31
Extremely simple memory model with just write() and read() methods.
Definition: memory.svh:32
memory m_memory
Definition: axi_driver.svh:36
uvm_analysis_port< axi_seq_item > driver_activity_ap
Definition: axi_monitor.svh:45
axi_agent_config m_config
Definition: axi_agent.svh:44
axi_coveragecollector m_coveragecollector
Definition: axi_agent.svh:51
memory m_memory
Definition: axi_monitor.svh:49
uvm_component_utils(axi_agent) uvm_analysis_port< axi_seq_item > ap
memory m_memory
Definition: axi_agent.svh:52
monitors all 5 channels for activity
Definition: axi_monitor.svh:41
axi_scoreboard m_scoreboard
Definition: axi_agent.svh:48
new(string name="axi_agent", uvm_component parent=null)
Constructor.
Definition: axi_agent.svh:63
void build_phase(uvm_phase phase)
Create sub-components as configured.
Definition: axi_agent.svh:72
axi_responder m_responder
Definition: axi_agent.svh:46
Encapsulates driver, monitor, coverage collector, a local memory.
Definition: axi_agent.svh:39
driver_type_t drv_type
axi_agent_config m_config
Definition: axi_driver.svh:35
axi_agent_config m_config
axi_agent_config m_config
Definition: axi_monitor.svh:48
axi_driver m_driver
Definition: axi_agent.svh:45
Configuration object for an axi_agent.
axi_monitor m_monitor
Definition: axi_agent.svh:47
void connect_phase(uvm_phase phase)
Definition: axi_agent.svh:112
axi_sequencer m_seqr
Definition: axi_agent.svh:50