Search code examples
monitoragentuvm

UVM: connecting sequencer+monitor with a scoreboard


I would like to connect a scoreboard with sequencer+monitor of an agent. Connecting the monitor is straightforward by using an analysis imp (uvm_analysis_imp) since the monitor holds an analysis port.

However, I am not sure how to connect sequencer and scoreboard since the sequencer holds a uvm_seq_item_pull_imp and it is not possible to simply connect it to an analysis imp. My idea was to check the port that is used by uvm_driver instead, that is uvm_seq_item_pull_port.

Unfortunately, it does not seem to be common to connect sequencer and scoreboard, but for my purposes it would be necessary. Is it only possible to use the uvm_seq_item_pull_port for the sequencer-scoreboard connection or is there an easier way?


Solution

  • Doing this kind of connection between an active component (sequencer or driver) is generally frowned upon, due to reusability aspects (I'm contractually obliged to say that :D). It might make sense at SoC level though.

    What you could do is create your own sequencer class (you probably have one already) that contains an analysis port. You'd have to extend send_request(...) to also write the item on that analysis port. You could then connect this analysis port to the scoreboard as you would for a usual monitor:

    class some_sequencer extends uvm_sequencer #(some_item);
      uvm_analysis_port #(some_item) aport;
    
      function void send_request(uvm_sequence_base sequence_ptr, uvm_sequence_item t, bit rerandomize = 0);
        some_item item;
        if (!$cast(item, t))
          `uvm_fatal("CASTERR", "Can't cast")
        super.send_request(sequence_ptr, t, rerandomize);
        aport.write(item);
      endfunction
    endclass
    

    You can find a working example on EDAPlayground (note: I took some shortcuts from the accepted UVM coding guidelines).