AXI muckbucket
axi_uvm_pkg.sv
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 
34 #include "uvm_macros.svh"
35 
36 
37 
38 
42 
43 
44 
52 typedef enum {e_AXI3=0, e_AXI4=1} axi_protocol_version_t;
53 
57 typedef enum {e_WRITE = 0,
58  e_READ = 1,
70  } cmd_t;
71 
77 typedef enum {e_DRIVER,
79  } driver_type_t;
80 
81 
82 #include "axi_seq_item.svh"
83 #include "memory.svh"
84 
85 
86 
94  automatic void aw_from_class(
95  ref axi_seq_item t,
96  output axi_seq_item_aw_vector_s v) {
97 
99 
100  s.awid = t.id;
101 
103  .burst_size(t.burst_size));
104 
105  s.awlen = axi_pkg::calculate_axlen(.addr (t.addr),
106  .burst_size (t.burst_size),
107  .burst_length (t.len));
108 
109  s.awsize = t.burst_size;
110  s.awburst = t.burst_type;
111  s.awlock = t.lock;
112  s.awcache = t.cache;
113  s.awprot = t.prot;
114  s.awqos = t.qos;
115 
116  v = s;
117 }
118 
125  automatic void aw_to_class(
126  ref axi_seq_item t,
127  input axi_seq_item_aw_vector_s v) {
129  s = v;
130 
131 // \todo: should we detect if t==null and do something?
132  // t = new();
133 
134  t.id = s.awid;
135  t.addr = s.awaddr;
136  t.len = (s.awlen+1)*(2**s.awsize);
137  t.axlen = s.awlen;
138  t.burst_size = s.awsize;
139  t.burst_type = s.awburst;
140  t.lock = s.awlock;
141  t.cache = s.awcache;
142  t.prot = s.awprot;
143  t.qos = s.awqos;
144 
145 }
146 
147 
154  automatic void b_from_class(
155  input [ID_WIDTH-1:0] bid,
156  input [2] bresp,
157  output axi_seq_item_b_vector_s v) {
158 
160 
161  s.bid = bid;
162  s.bresp = bresp;
163 
164  v = s;
165 }
166 
172  automatic void b_to_class(
173  ref axi_seq_item t,
174  input axi_seq_item_b_vector_s v) {
175 
177 
178  s = v;
179 
180  t.bid = s.bid;
181  t.bresp = s.bresp;
182 
183 }
184 
193  automatic void ar_from_class(
194  ref axi_seq_item t,
195  output axi_seq_item_ar_vector_s v) {
196 
198 
199  s.arid = t.id;
200 
202  .burst_size(t.burst_size));
203 
204  s.arlen = axi_pkg::calculate_axlen(.addr (t.addr),
205  .burst_size (t.burst_size),
206  .burst_length (t.len));
207 
208  s.arsize = t.burst_size;
209  s.arburst = t.burst_type;
210  s.arlock = t.lock;
211  s.arcache = t.cache;
212  s.arprot = t.prot;
213  s.arqos = t.qos;
214 
215  uvm_info("axi_seq_item::ar_from_class",
216  $sformatf("addr:0x%0x number_bytes: %0d, araddr:0x%0x",
217  t.addr,2**t.burst_size, s.araddr),
218  UVM_HIGH)
219 
220  v = s;
221 }
222 
229  automatic void ar_to_class(
230  ref axi_seq_item t,
231  input axi_seq_item_ar_vector_s v) {
233  s = v;
234 
235  // \todo: should we detect if t==null and do something?
236  // t = new();
237 
238  t.id = s.arid;
239  t.addr = s.araddr;
240  t.len = (s.arlen+1)*(2**s.arsize);
241  t.axlen = s.arlen;
242  t.burst_size = s.arsize;
243  t.burst_type = s.arburst;
244  t.lock = s.arlock;
245  t.cache = s.arcache;
246  t.prot = s.arprot;
247  t.qos = s.arqos;
248 
249 }
250 
251 
252 
253 
254 #include "axi_agent_config.svh"
255 
256 #include "axi_sequencer.svh"
257 #include "axi_seq.svh"
258 #include "axi_responder_seq.svh"
263 
264 #include "axi_driver.svh"
265 #include "axi_responder.svh"
266 #include "axi_monitor.svh"
267 #include "axi_scoreboard.svh"
268 #include "axi_coveragecollector.svh"
269 
270 #include "axi_agent.svh"
271 
272 #include "axi_env_config.svh"
273 #include "axi_env.svh"
274 
275 
276 #include "axi_base_test.svh"
281 
282 
automatic void b_from_class(input[ID_WIDTH-1:0] bid, input[2] bresp, output axi_seq_item_b_vector_s v)
take values from write response channel and stuff into a axi_seq_item_b_vector_s
Definition: axi_uvm_pkg.sv:154
logic< 2:0 > awprot
Definition: axi_pkg.sv:123
bit< C_AXI_LEN_WIDTH-1:0 > calculate_axlen(input bit< C_AXI_ADDR_WIDTH-1:0 > addr, input bit< 2:0 > burst_size, input shortint burst_length)
calculate awlen or arlen
Definition: axi_pkg.sv:320
localparam LEN_WIDTH
Definition: axi_uvm_pkg.sv:41
automatic void ar_from_class(ref axi_seq_item t, output axi_seq_item_ar_vector_s v)
take values from an axi_seq_item and stuff into a axi_seq_item_ar_vector_s
Definition: axi_uvm_pkg.sv:193
logic< 1:0 > arburst
Definition: axi_pkg.sv:185
logic< C_AXI_ID_WIDTH-1:0 > bid
Definition: axi_pkg.sv:163
logic< C_AXI_ID_WIDTH-1:0 > awid
Definition: axi_pkg.sv:114
logic< 2:0 > arsize
Definition: axi_pkg.sv:184
logic< 3:0 > awqos
Definition: axi_pkg.sv:124
logic< 0:0 > awlock
Definition: axi_pkg.sv:121
This packed struct is used to send write address channel information between the DUT and TB...
Definition: axi_pkg.sv:113
logic< 1:0 > bresp
Definition: axi_pkg.sv:164
parameter AXI_ID_WIDTH
Definition: params_pkg.sv:44
logic< 2:0 > awsize
Definition: axi_pkg.sv:119
automatic void aw_to_class(ref axi_seq_item t, input axi_seq_item_aw_vector_s v)
Pull values out of a axi_seq_item_aw_vector_s and stuffs them into an axi_seq_item.
Definition: axi_uvm_pkg.sv:125
logic< 2:0 > arprot
Definition: axi_pkg.sv:188
bit< C_AXI_ADDR_WIDTH-1:0 > calculate_burst_aligned_address(input bit< C_AXI_ADDR_WIDTH-1:0 > address, input bit< 2:0 > burst_size)
calculate burst_size aligned address
Definition: axi_pkg.sv:230
localparam ID_WIDTH
Definition: axi_uvm_pkg.sv:40
logic< 3:0 > arcache
Definition: axi_pkg.sv:187
logic< 3:0 > arqos
Definition: axi_pkg.sv:189
parameter AXI_LEN_WIDTH
Definition: params_pkg.sv:47
logic< C_AXI_ID_WIDTH-1:0 > arid
Definition: axi_pkg.sv:179
logic< 3:0 > awcache
Definition: axi_pkg.sv:122
automatic void b_to_class(ref axi_seq_item t, input axi_seq_item_b_vector_s v)
return values from a axi_seq_item_b_vector_s and return an axi_seq_item
Definition: axi_uvm_pkg.sv:172
driver_type_t
Config variable that tells axi_driver whether it is a master driver or slave driver(responder) ...
Definition: axi_uvm_pkg.sv:77
logic< C_AXI_ADDR_WIDTH-1:0 > araddr
Definition: axi_pkg.sv:180
automatic void ar_to_class(ref axi_seq_item t, input axi_seq_item_ar_vector_s v)
Pull values out of a axi_seq_item_ar_vector_s and stuffs them into an axi_seq_item.
Definition: axi_uvm_pkg.sv:229
parameter AXI_ADDR_WIDTH
Definition: params_pkg.sv:45
logic< C_AXI_ADDR_WIDTH-1:0 > awaddr
Definition: axi_pkg.sv:115
logic< C_AXI_LEN_WIDTH-1:0 > awlen
Definition: axi_pkg.sv:118
logic< C_AXI_LEN_WIDTH-1:0 > arlen
Definition: axi_pkg.sv:183
automatic void aw_from_class(ref axi_seq_item t, output axi_seq_item_aw_vector_s v)
Pull values out of axi_seq_item and stuff into a axi_seq_item_aw_vector_s.
Definition: axi_uvm_pkg.sv:94
logic< 0:0 > arlock
Definition: axi_pkg.sv:186
This packed struct is used to send write response channel information between the DUT and TB...
Definition: axi_pkg.sv:162
logic< 1:0 > awburst
Definition: axi_pkg.sv:120
cmd_t
Command type - what is the purpose of this packet?
Definition: axi_uvm_pkg.sv:57
contains all data and functions related to axi and usage
This packed struct is used to send read address channel information between the DUT and TB...
Definition: axi_pkg.sv:178
axi_protocol_version_t
Version 3 or Version 4.
Definition: axi_uvm_pkg.sv:52
localparam ADDR_WIDTH
Definition: axi_uvm_pkg.sv:39