AXI muckbucket
axi_sequential_writes_seq.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 
33 class axi_sequential_writes_seq : public axi_seq { public:
34 
36 
37  new (string name="axi_sequential_writes_seq");
38  task body();
39 
40 };
41 
42 
47  axi_sequential_writes_seq::new (string name="axi_sequential_writes_seq") {
48  super.new(name);
49 }
50 
51 
60 
61  bit <ADDR_WIDTH-1:0> addr_lo;
62  bit <ADDR_WIDTH-1:0> addr_hi;
63  bit <ID_WIDTH-1:0> xid;
64 
65  axi_seq_item write_item;
66 
67  if (!uvm_config_db <memory> ::get(null, "", "m_memory", m_memory)) {
68  uvm_fatal(this.get_type_name,
69  "Unable to fetch m_memory from config db.")
70  }
71 
72  // Clear memory
73  // AXI write
74  // direct readback of memory
75  // check that addresses before Axi start address are still 0
76  // chck expected data
77  // check that addresses after axi start_addres+length are still 0
78 
79  for (int xfer_cnt=0;xfer_cnt <xfers_to_send;xfer_cnt++) {
80 
81  // clear memory
82  if (clearmemory==1) {
83  for (int i=0;i <window_size;i++) {
84  m_memory.write(i, 0x0);
85  }
86  }
87 
88  write_item = axi_seq_item::type_id::create("write_item");
89 
90 
91  // Not sure why I have to define and set these and
92  // then use them in the randomize with {} but
93  // Riviera Pro works better like this.
94  addr_lo = xfer_cnt*window_size;
95  addr_hi = addr_lo+0x100;
96  xid = xfer_cnt[ID_WIDTH-1:0];
97  start_item(write_item);
98 
99  uvm_info(this.get_type_name(),
100  $sformatf("item %0d id:0x%0x addr_lo: 0x%0x addr_hi: 0x%0x",
101  xfer_cnt, xid, addr_lo,addr_hi),
102  UVM_HIGH)
103 
104 
105  assert( write_item.randomize() with {
106  cmd == e_WRITE;
107  burst_size <= local::max_burst_size;
108  id == local::xid;
109  addr >= local::addr_lo;
110  addr < local::addr_hi;
111  })
112  // If valid specified, then pass it to seq item.
113  if (valid.size() > 0) {
114  write_item.valid = new[valid.size()](valid);
115  }
116 
117  uvm_info("DATA",
118  $sformatf("\n\n\nItem %0d: %s",
119  xfer_cnt, write_item.convert2string()),
120  UVM_INFO)
121  finish_item(write_item);
122 
123  get_response(write_item);
124 
125  if (!m_memory.seq_item_check(.item (write_item),
126  .lower_addr (xfer_cnt*window_size),
127  .upper_addr ((xfer_cnt+1)*window_size))) {
128  uvm_info("MISCOMPARE","Miscompare error", UVM_INFO)
129  }
130 
131 
132  } //for
133 
134 
135 }
136 
string convert2string()
Convert item&#39;s variable into one printable string.
int xfers_to_send
Definition: axi_seq.svh:40
task body()
Does all the work.
uvm_object_utils(axi_sequential_writes_seq) new(string name
localparam ID_WIDTH
Definition: axi_uvm_pkg.sv:40
bit seq_item_check(ref axi_seq_item item, input bit< ADDR_WIDTH-1:0 > lower_addr, input bit< ADDR_WIDTH-1:0 > upper_addr)
Compares an axi_seq_item&#39;s data and burst_type against expected matching memory contents.
Definition: memory.svh:85
virtual void write(input bit< ADDR_WIDTH-1:0 > addr, input bit< 7:0 > data)
Writes into memory.
Definition: memory.svh:58
const int window_size
Definition: axi_seq.svh:39
Writes to memory over AXI, backdoor memory readback and verify.
rand bit valid[]
memory m_memory
Definition: axi_seq.svh:48
bit valid[]
Definition: axi_seq.svh:42
new(string name="axi_seq")
Constructor.
Definition: axi_seq.svh:62
Writes to memory over AXI, backdoor readback, then AXI readback.
Definition: axi_seq.svh:33
contains all data and functions related to axi and usage
localparam ADDR_WIDTH
Definition: axi_uvm_pkg.sv:39