Reactive agent for memory storage

Hi,

I have designed an reactive slave as memory storage component. It simple stores data at specified addr with write and read commands. Since I am running the sequence in forever loop. How do I end the simulation?

class mem_sequence extends uvm_sequence #(mem_seq_item);

   `uvm_object_utils(mem_sequence)

   mem_sequencer p_sequencer;

   function new(string name="mem_sequence");
      super.new(name);
   endfunction

   task pre_body();
      $cast(p_sequencer,m_sequencer);
   endtask

   task body();
      mem_seq_item m_item;
      mem_seq_item m_req;
      forever begin
        
         p_sequencer.m_req_fifo.get(m_req);
         
         if(m_req.write == 1)begin
           `uvm_do_with(m_item, {m_item.ack ==1; m_item.read==0;});
         end
         if(m_req.read == 1)begin
           `uvm_do_with(m_item, {m_item.ack ==1; m_item.data_in == m_req.data_in; m_item.write==0; m_item.read==1;});
         end
      end
   endtask


endclass

In reply to ak_verifsj:

Objections is how the UVM ends the test. All threads get killed when there are no more objections to the run_phase. See EndOfTest | Verification Academy

In reply to dave_59:

Assume that your sequence is started in main phase, the test can query the scoreboard in the environment to know when all the responses to the stimulus have come out of the DUT and drop the objection for the phase in order to move to the next phase. When this occurs, your sequence is killed automatically as Dave pointed out.

In reply to dnguyen82us:

How do you query the scoreboard to know when all the responses to the stimulus has come out?
Not sure how to do this? like some event?

In reply to n347:

Example:

virtual task main_phase(…);
starting_phase.raise_objection();
wait (env.scoreboard.act_number_of_responses == config.number_of_reads);
starting_phase.drop_objection();
endtask : main_phase

PS: there are several sources to get the number of reads from (scoreboard or configuration), scoreboard is basically the sink of all stimulus and response transactions

In reply to ak_verifsj:

How is this a memory storage? i see it as a reactive slave sending responses (ack) to the DUT.

How were you able to end the test?

In reply to n347:

In your sequencer, you have a handle to a memory model.

[i]In reply to ak_verifsj:

you should execute all the sequences that have forever loop in its body method inside fork… join_none.


class axi_rand_burst_transfer extends axi_base test;
    ...
    ...
    task run_phase(uvm_phase phase);
  
        ...
        ...
        phase.raise_objection(this);
        fork
            slave_seq.start(axi_slave_sequencer);    //run the slave_seq that has forever  
        join_none                                    //loopinside fork_none

        //execute other sequences normally
        axi_rand_burst_seq.start(axi_master_seqr);
        phase.drop_objection(this);
        ...
        ...
    endtask

endclass

In reply to voraravi:

I’m not sure if this is a good solution. Your env should have seoerate agents for slave and master. This is the common approach for master/slave systems.

In reply to chr_sue:

You only need to implement one agent for each interface. The agent instantiates appropriate components based on a configuration knob that specifies it’s in master or slave mode.

In reply to UVM_SV_101:

Can you share the full code of re-active agent

In reply to tejasakulu:

Please find the example here:
https://verificationacademy.com/cookbook/code-examples#Slave_Agent_Examples