# Override parameters in SV package

**URL:** <https://verificationacademy.com/forums/t/override-parameters-in-sv-package/33682>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog\
**Created:** [November 6, 2017, 4:56pm UTC](https://verificationacademy.com/forums/t/override-parameters-in-sv-package/33682 "2017-11-06T16:56:14Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![Lincyyyy](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/l/59ef9b/32.png) [@Lincyyyy](https://verificationacademy.com/forums/u/Lincyyyy)\
**Post date:** [August 10, 2023, 9:38am UTC](https://verificationacademy.com/forums/t/override-parameters-in-sv-package/33682/10 "2023-08-10T09:38:05Z")

</div>

_In reply to [dave\_59](https://verificationacademy.com/forums/t/override-parameters-in-sv-package/33682/10):_

Hi Dave, please find the problem (hopefully better explained)

I have a class cg\_wrap which has parameters A1-A4 as defined below which are used in the covergroup cg\_wrap\_1. The task sample() for the covergroup cg\_wrap\_1 is called in the coverage\_collector class.

My intention is to override the parameters A1 and A2 such that when the task sample() is called, the coverpoints should check the signal with parameter value A1=11, A2=12 and not A1=10 and A1=20.

```verilog
package my_pkg;

import uvm_pkg::*;

`include "uvm_macros.svh"

class cg_wrap #(
  parameter A1 = 10,
  parameter A2 = 20,
   parameter A3 = 30,
   parameter A4 = 40
) extends uvm_sequence_item;

  `uvm_object_param_utils(cg_wrap))
 
  function new(string name="cg_wrap");
    super.new(name);       
      endfunction
 
  covergroup cg_wrap_1 with function sample();
    cp_xyz : coverpoint xyz {
            bins min = {0};
            bins min_p1 = {1};
            bins max_m1 = { A1 - 1};
            bins max = { A1 };
            }
         
    cp_abc : coverpoint abc {
            bins min = {0};
            bins min_p1 = {1};
            bins max_m1 = { A2 - 1};
            bins max = { A2 };
            }
     endgroup

      function new(string name="cg_wrap_1");
         super.new();
         cg_wrap_1 = new();          
         cg_wrap_1.set_inst_name($sformatf("%s", name)); 
      endfunction

      function void sample();
         cg_wrap_1.sample();
      endfunction

endclass

class coverage_collector extends uvm_subscriber#(uvm_sequence_item);

   `uvm_component_utils(coverage_collector)
  uvm_analysis_port #(uvm_sequence_item) to_receiver;
  cg_wrap pkt_cov;
 
   function new(string name, uvm_component parent);
      super.new(name,parent);
      to_receiver = new ("to_receiver", this);  
      pkt_cov = cg_wrap::type_id::create("cg_wrap");
   endfunction : new
  
   task run_phase (uvm_phase phase);
      `uvm_info("UVC","run_phase: Executing. coverage_collector run_phase<<<",UVM_LOW) 
    endtask : run_phase
  
  task sample_and_transmit();
         pkt_cov.sample();
         to_receiver.write(pkt_cov); 
      endtask

  function void write(uvm_sequence_item t);
   //placeholder 
  endfunction

endclass : coverage_collector

endpackage : my_pkg

```

---

_[View the full topic](https://verificationacademy.com/forums/t/override-parameters-in-sv-package/33682)._
