# Related to associative array

**URL:** <https://verificationacademy.com/forums/t/related-to-associative-array/34689>\
**Category:** UVM\
**Tags:** UVM, accessing-the-associative-array-elements\
**Created:** [July 17, 2018, 7:39am UTC](https://verificationacademy.com/forums/t/related-to-associative-array/34689 "2018-07-17T07:39:17Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![shipratripathi](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/e47c2d/32.png) [@shipratripathi](https://verificationacademy.com/forums/u/shipratripathi)\
**Post date:** [July 17, 2018, 8:24am UTC](https://verificationacademy.com/forums/t/related-to-associative-array/34689/5 "2018-07-17T08:24:52Z")

</div>

_In reply to [chr\_sue](https://verificationacademy.com/forums/t/related-to-associative-array/34689/4):_  
hi  
here is the code

```verilog
class axi_storage extends uvm_component;
  `uvm_component_utils(axi_storage)
 bit[31:0]mem[int];
  
  function new(string name, uvm_component parent);
    super.new(name,parent);
  endfunction	

endclass :axi_storage

```

driver class:-

```verilog
class axi_driver extends uvm_driver#(axi_transaction);
 axi_storage strg;
  bit[31:0] dwdataQ1 [31:0];
  int ADDR_Q[$]; int RADDR_Q[$];
if(!uvm_config_db#(axi_storage)::get(this,"*","axi_storage",strg))
		`uvm_fatal("NO_AGNT_CFG",{"storage must be set for:",get_full_name(),".strg"})

if(cfg.master_slave_select == AXI_MASTER) 
 	begin 
		for(int j=0;j<=tx.wlen;j++)
					begin
						
						@(posedge vif.aclk);
						addr=ADDR_Q.pop_back;
						strg.mem[addr]=dwdataQ1[j];
if(cfg.master_slave_select == AXI_SLAVE)
		begin 
		for(int i=0;i<=tx.rlen;i++)
		begin						
													@(posedge vif.aclk);
													$display("\tQueue_1 size in read data is %0d",RADDR_Q.size());
													addrr=RADDR_Q.pop_back();
													if(strg.mem.exists(addrr)) 
													$display("memory",mem);
													vif.rdata<=strg.mem[addrr];

```

---

_[View the full topic](https://verificationacademy.com/forums/t/related-to-associative-array/34689)._
